Closed Bug 1324966 Opened 7 years ago Closed 6 years ago

Need a method to get nsStyleContext* without computing the style for a given property which is animating

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: hiro, Unassigned)

Details

The methods is necessary to get the base style for the target element of animations.

It will be similar to nsStyleContext::ResolveStyleWithoutAnimation() but without nsStyleContext* argument. Also it requires to skip FileRules()[1] for animations and transitions level in nsStyleSet::ResolveStyleFor() because FileRules() for those level ends up calling KeyframeEffectReadOnly::ComposeStyle().

[1] https://hg.mozilla.org/mozilla-central/file/7083c0d30e75/layout/style/nsStyleSet.cpp#l1366
(In reply to Hiroyuki Ikezoe (:hiro) from comment #0)
> The methods is necessary to get the base style for the target element of
> animations.
> 
> It will be similar to nsStyleContext::ResolveStyleWithoutAnimation() but
> without nsStyleContext* argument. Also it requires to skip FileRules()[1]
> for animations and transitions level in nsStyleSet::ResolveStyleFor()
> because FileRules() for those level ends up calling
> KeyframeEffectReadOnly::ComposeStyle().

We might need just another variant of nsComputedDOMStyle::GetStyleContextForElement() that replaces 
 ResolvePseudoElementStyle[1] and ResolveStyleFor[2] with ResolveStyleWithoutAnimation()

[1] https://hg.mozilla.org/mozilla-central/file/f179934df0c1/layout/style/nsComputedDOMStyle.cpp#l495
[2] https://hg.mozilla.org/mozilla-central/file/f179934df0c1/layout/style/nsComputedDOMStyle.cpp#l498
After some thought, the method we need should skip only an nsCSSPropertyID that passed to the method, not skipping all of animation properties.
Fortunately, we have already passed an nsCSSPropertyIDSet, which contains property set to be skipped, to KeyframeEffectReadOnly::ComposeStyle()[1], so we can just add the target nsCSSPropertyID in the set.  I am really surprised that Brian suggested to use nsCSSPropertyIDSet, he is the wizard of animation!

[1] https://hg.mozilla.org/mozilla-central/file/5ea0c495d3b2/dom/animation/KeyframeEffectReadOnly.h#l292

Though we still need to pass the nsCSSPropertyID to EffectCompositor::ComposeAnimationRule() somethow.
Blocks: 1244897
Thanks for filing this :hiro- is there someone who could work on this bug in the coming weeks?
Honestly, this is a tough work, I am hoping I can take time to fix in this Q1, but I am less sure. That's being said, I came up with some ideas to reduce that failure (bug 1244897) frequency.   I will post a comment there soon.
Summary: Need a method to get nsStyleContext* without filling rules for animations/transitions level → Need a method to get nsStyleContext* without computing the style for a given property which is animating
No longer blocks: 1244897
Priority: -- → P3
I will mark this invalid once we drop gecko style system in bug 1395112.
Closing we already dropped the old style system.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.