Closed
Bug 1285407
Opened 8 years ago
Closed 8 years ago
Animations which can be run on the compositor don't start when "!important" style is removed while it's in effect
Categories
(Core :: DOM: Animation, defect, P3)
Core
DOM: Animation
Tracking
()
RESOLVED
FIXED
mozilla50
Tracking | Status | |
---|---|---|
firefox50 | --- | fixed |
People
(Reporter: hiro, Assigned: hiro)
Details
Attachments
(6 files)
639 bytes,
text/html
|
Details | |
595 bytes,
text/html
|
Details | |
58 bytes,
text/x-review-board-request
|
birtles
:
review+
|
Details |
58 bytes,
text/x-review-board-request
|
birtles
:
review+
|
Details |
58 bytes,
text/x-review-board-request
|
birtles
:
review+
|
Details |
58 bytes,
text/x-review-board-request
|
birtles
:
review+
|
Details |
A transform animation in attaching test case does not initially run on the compositor because the target element has "transform: translateX(0px) !important" style. But after removing the important style, the transform animation still stays original position. A reason I can think of is that we don't call UpdateCascadeResults in such case. But what I don't quite understand is non-compositor animations, say margin-left, *do* start its animation.
Assignee | ||
Comment 1•8 years ago
|
||
This test case works as expected.
Assignee | ||
Comment 2•8 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #0) > Created attachment 8769001 [details] > A test case > > A transform animation in attaching test case does not initially run on the > compositor because the target element has "transform: translateX(0px) > !important" style. But after removing the important style, the transform > animation still stays original position. > > A reason I can think of is that we don't call UpdateCascadeResults in such > case. But what I don't quite understand is non-compositor animations, say > margin-left, *do* start its animation. Oh-oh, I did not realized that the flag is not useful for main-threaded animations. And this issue only happens for web-animations because we call UpdateCascadeResults. http://hg.mozilla.org/mozilla-central/file/23dc78b7b57e/layout/style/nsAnimationManager.cpp#l443 *AND* now I realized a cumbersome problem that we use an old nsStyleContext in EffectCompositor::MaybeUpdateCascadeResults. http://hg.mozilla.org/mozilla-central/file/23dc78b7b57e/dom/animation/EffectCompositor.cpp#l473 In EffectCompositor::MaybeUpdateCascadeResults we get nsStyleContext by calling nsIFrame::StyleContext(), but when it's called from nsStyleSet::GetContext, the nsStyleContext obtained by nsIFrame::StyleContext() is the previous one. We need to pass the new nsStyleContext generated in nsStyleSet::GetContext. I am not sure this cumbersome problem is related to the nested GetContext calls.
Assignee | ||
Comment 3•8 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #2) > (In reply to Hiroyuki Ikezoe (:hiro) from comment #0) > > Created attachment 8769001 [details] > > A test case > > > > A transform animation in attaching test case does not initially run on the > > compositor because the target element has "transform: translateX(0px) > > !important" style. But after removing the important style, the transform > > animation still stays original position. > > > > A reason I can think of is that we don't call UpdateCascadeResults in such > > case. But what I don't quite understand is non-compositor animations, say > > margin-left, *do* start its animation. > > Oh-oh, I did not realized that the flag is not useful for main-threaded > animations. And this issue only happens for web-animations because we call > UpdateCascadeResults. because we call UpdateCascadeResults in case of CSS animations.
Updated•8 years ago
|
Priority: -- → P3
Assignee | ||
Comment 4•8 years ago
|
||
While resolving style context, the primary frame of the target element has previous style context so if we don't pass the newly created nsStyleContext, UpdateCascadeResults uses the previous style to get overridden properties, it will result unexpected cascading results. Review commit: https://reviewboard.mozilla.org/r/63374/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/63374/
Attachment #8769515 -
Flags: review?(bbirtles)
Attachment #8769516 -
Flags: review?(bbirtles)
Attachment #8769517 -
Flags: review?(bbirtles)
Attachment #8769518 -
Flags: review?(bbirtles)
Assignee | ||
Comment 5•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/63376/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/63376/
Assignee | ||
Comment 6•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/63378/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/63378/
Assignee | ||
Comment 7•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/63380/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/63380/
Comment 8•8 years ago
|
||
Comment on attachment 8769515 [details] Bug 1285407 - Part 1: Pass a newly created nsStyleContext to GetAnimationRule and MaybeUpdateAnimationRule. https://reviewboard.mozilla.org/r/63374/#review60232 ::: dom/animation/EffectCompositor.h:122 (Diff revision 1) > // Updates the animation rule stored on the EffectSet for the > // specified (pseudo-)element for cascade level |aLevel|. > // If the animation rule is not marked as needing an update, > // no work is done. > void MaybeUpdateAnimationRule(dom::Element* aElement, > CSSPseudoElementType aPseudoType, > - CascadeLevel aCascadeLevel); > + CascadeLevel aCascadeLevel, > + nsStyleContext *aStyleContext); We should document what style context is used for and if it can be nullptr or not. ::: dom/animation/EffectCompositor.h:131 (Diff revision 1) > nsIStyleRule* GetAnimationRule(dom::Element* aElement, > CSSPseudoElementType aPseudoType, > - CascadeLevel aCascadeLevel); > + CascadeLevel aCascadeLevel, > + nsStyleContext* aStyleContext); It might be worth adding a comment saying why we need to pass in a style context here since it seems a bit odd to require one. Also, we should indicate if it can be nullptr or not. ::: dom/animation/EffectCompositor.h:163 (Diff revision 1) > + // NOTE: If aStyleContext is not specified, we try to use nsStyleContext > + // of the primary frame of the specified (pseudo-)element. > // > // This method does NOT detect if other styles that apply above the > // animation level of the cascade have changed. I think we don't need NOTE: here since it looks like a warning. Instead, how about: // aStyleContext may be nullptr in which case we will use the nsStyleContext // of the primary frame of the specified (pseudo-)element.
Attachment #8769515 -
Flags: review?(bbirtles) → review+
Comment 9•8 years ago
|
||
Comment on attachment 8769516 [details] Bug 1285407 - Part 2: We need to call MarkCascadeNeedsUpdate() when the style context is changed. https://reviewboard.mozilla.org/r/63376/#review60234
Attachment #8769516 -
Flags: review?(bbirtles) → review+
Comment 10•8 years ago
|
||
Comment on attachment 8769517 [details] Bug 1285407 - Part 3: Remove UpdateCascadeResults call because it's called against the same nsStyleContext from MaybeUpdateAnimationRule. https://reviewboard.mozilla.org/r/63378/#review60236
Attachment #8769517 -
Flags: review?(bbirtles) → review+
Comment 11•8 years ago
|
||
Comment on attachment 8769518 [details] Bug 1285407 - Part 4: Drop EffectCompositor::MaybeUpdateCascadeResults(Element*, CSSPseudoElementType) because it's essentially the same as another one. https://reviewboard.mozilla.org/r/63380/#review60238
Attachment #8769518 -
Flags: review?(bbirtles) → review+
Assignee | ||
Comment 12•8 years ago
|
||
Comment on attachment 8769515 [details] Bug 1285407 - Part 1: Pass a newly created nsStyleContext to GetAnimationRule and MaybeUpdateAnimationRule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63374/diff/1-2/
Assignee | ||
Comment 13•8 years ago
|
||
Comment on attachment 8769516 [details] Bug 1285407 - Part 2: We need to call MarkCascadeNeedsUpdate() when the style context is changed. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63376/diff/1-2/
Assignee | ||
Comment 14•8 years ago
|
||
Comment on attachment 8769517 [details] Bug 1285407 - Part 3: Remove UpdateCascadeResults call because it's called against the same nsStyleContext from MaybeUpdateAnimationRule. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63378/diff/1-2/
Assignee | ||
Comment 15•8 years ago
|
||
Comment on attachment 8769518 [details] Bug 1285407 - Part 4: Drop EffectCompositor::MaybeUpdateCascadeResults(Element*, CSSPseudoElementType) because it's essentially the same as another one. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/63380/diff/1-2/
Comment 16•8 years ago
|
||
Pushed by hiikezoe@mozilla-japan.org: https://hg.mozilla.org/integration/autoland/rev/4a3508cf3c41 Part 1: Pass a newly created nsStyleContext to GetAnimationRule and MaybeUpdateAnimationRule. r=birtles https://hg.mozilla.org/integration/autoland/rev/538877b1d33a Part 2: We need to call MarkCascadeNeedsUpdate() when the style context is changed. r=birtles https://hg.mozilla.org/integration/autoland/rev/d4964fe5465e Part 3: Remove UpdateCascadeResults call because it's called against the same nsStyleContext from MaybeUpdateAnimationRule. r=birtles https://hg.mozilla.org/integration/autoland/rev/cd0d40f88145 Part 4: Drop EffectCompositor::MaybeUpdateCascadeResults(Element*, CSSPseudoElementType) because it's essentially the same as another one. r=birtles
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → hiikezoe
Status: NEW → ASSIGNED
Comment 17•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4a3508cf3c41 https://hg.mozilla.org/mozilla-central/rev/538877b1d33a https://hg.mozilla.org/mozilla-central/rev/d4964fe5465e https://hg.mozilla.org/mozilla-central/rev/cd0d40f88145
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in
before you can comment on or make changes to this bug.
Description
•