Closed
Bug 555627
Opened 15 years ago
Closed 14 years ago
CSS Transition Cannot Be Applied to :before/:after insertions
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
RESOLVED
FIXED
mozilla2.0b2
People
(Reporter: blair.mitchelmore, Assigned: bzbarsky)
References
(Blocks 1 open bug, )
Details
Attachments
(3 files, 1 obsolete file)
489 bytes,
text/html
|
Details | |
20.00 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
3.97 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a4pre) Gecko/20100327 Minefield/3.7a4pre
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a4pre) Gecko/20100327 Minefield/3.7a4pre
content inserted with :after/:before CSS declarations will transition according to its parent element provided you don't override that style in the css for the inserted content, but you cannot apply individual transitions to the :before/:after blocks themselves.
See the linked demo for a visual example.
Reproducible: Always
Steps to Reproduce:
1. Apply a transition to a :before/:after declaration
2. Activate the transition
Actual Results:
The style switches immediately.
Expected Results:
The style should transition according to the -moz-transition-* values set.
Assignee | ||
Comment 1•15 years ago
|
||
Assignee | ||
Comment 2•15 years ago
|
||
This is happening because we're not consistent about the aElement we pass to GetElementTransitions. From nsTransitionManager::StyleContextChanged we pass in the element we synthesize for the :before or :after. From WalkTransitionRule we're passing in the real element the pseudo is a pseudo-element for.
Assignee | ||
Updated•15 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 3•15 years ago
|
||
That patch fixes the problem, but I haven't sorted through writing a test for this. David, is there a short painless way to hook into the existing tests here, or do I need to do more work than that?
Attachment #435775 -
Flags: review?(dbaron)
Comment on attachment 435775 [details] [diff] [review]
Fix
Could you:
* document in nsTransitionManager.h that StyleContextChanged expects aElement to be the generated before/after element for style contexts with :before and :after pseudos.
Could you also add an assertion in GetElementTransitions that it is never passed an element whose tag is mozgeneratedcontenttbefore/mozgeneratedcontentafter?
As for tests, it's relatively straightforward to write a "stupid" test in a standalone manner by either (a) using a large transition-delay and checking that nothing has changed immediately after triggering the change or (b) as test_transitions_per_property does, using a transition-delay of -1/4 of the duration, and checking that you get the correct interpolation right after triggering the change (I'd suggest not using -1/2 because it tests less, though I haven't converted ..._per_property away from it)
r=dbaron with that
Attachment #435775 -
Flags: review?(dbaron) → review+
Blocks: css-transitions
Assignee | ||
Comment 5•14 years ago
|
||
> document in nsTransitionManager.h that StyleContextChanged expects
Done.
> Could you also add an assertion in GetElementTransitions that it is never
> passed an element whose tag is
> mozgeneratedcontenttbefore/mozgeneratedcontentafter?
I don't think I can; there's nothing that prevents web pages from having elements with those localnames.
I wrote a test for this in test_transitions.html, but it looks like the patch no longer works for some reason (which is too bad; had I done the test earlier, whatever broke it would have made the tree red!). I'm working on bisecting now to find out when it stopped working.
Assignee | ||
Comment 6•14 years ago
|
||
Oh, and my test is not working even in older builds, because computed style on ::before/::after doesn't see the transitioning values (because it always resolves instead of using the frame). I need to adjust it. But even the testcase in this bug is broken in current builds with this patch: it keeps showing the red color.
Assignee | ||
Comment 7•14 years ago
|
||
And the reason for that is that RestyleForAnimation is called on the parent element for ::before and ::after, and we now only do "self" restyles in RestyleForAnimation.
Assignee | ||
Comment 8•14 years ago
|
||
But shouldn't computed style work? Does nsTransitionManager::WalkTransitionRule need to check IsProcessingRestyles() before deciding to not walk the rule?
Assignee | ||
Comment 10•14 years ago
|
||
Attachment #435775 -
Attachment is obsolete: true
Attachment #453112 -
Flags: review?(dbaron)
Comment on attachment 453112 [details] [diff] [review]
Fix that works on trunk, with test
r=dbaron
And I agree with the change suggested in comment 8 (as I think we discussed on IRC).
Attachment #453112 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 12•14 years ago
|
||
Assignee | ||
Comment 13•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3b2
You need to log in
before you can comment on or make changes to this bug.
Description
•