Closed Bug 1355349 Opened 8 years ago Closed 7 years ago

stylo: Additive SMIL animations

Categories

(Core :: CSS Parsing and Computation, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: birtles, Assigned: birtles)

References

(Blocks 1 open bug)

Details

Attachments

(10 files, 4 obsolete files)

(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-review-board-request
hiro
: review+
Details
(deleted), text/x-github-pull-request
Details
No description provided.
Attached patch WIP patch for defining zero values (obsolete) (deleted) — Splinter Review
The idea here is we'll expose an FFI where we pass in a RawServoComputedValue and you'll get back a computed value for the same property with a suitable zero value, or None. Then we'll use this to implement the Stylo equivalent of GetZeroValueForUnit (but without the unit). Just dropping this patch here for a while since it's not very useful until we implement additive animation (bug 1329878).
Blocks: stylo-smil
Depends on: 1353202
Assignee: nobody → bbirtles
Status: NEW → ASSIGNED
Priority: P3 → P1
Depends on: 1367960
Attachment #8856822 - Attachment is obsolete: true
I didn't quite get this to review before going away but I'm putting the patches up now in case anyone else wants to build on top of these while I'm away. This should mostly work I think (I've tested locally with a simple by-animation and it seems to do the right thing). I'm still waiting to see what try brings back however. For my own notes when I get back: * I need to go over the first base styles patch. I'm not entirely confident it's right. * There are probably (hopefully) some test expectations that need to be updated. * Other than that, it's probably mostly a matter of seeing what tests fail to pass that should pass (e.g. see the XXX comment in the "Use Servo's initial values to fill in missing SMIL animation endpoints" about whether we need to do some kind of 0 value fixup).
Attachment #8871620 - Attachment is obsolete: true
Comment on attachment 8873734 [details] Bug 1355349 - Move calculation of pseudo type in nsComputedDOMStyle::DoGetStyleContextNoFlush; https://reviewboard.mozilla.org/r/145134/#review149092
Attachment #8873734 - Flags: review?(hikezoe) → review+
The "Get unanimated style in nsComputedDOMStyle::DoGetStyleContextNoFlush for Servo too" patch is probably wrong. Running the tests in dom/smil/tests I hit this failed assertion: 11182 INFO TEST-PASS | dom/smil/test/test_smilXHR.xhtml | animation of attribute shouldn't be taking effect GECKO(11964) | [Parent 11964] WARNING: stylo: No docshell yet, assuming Gecko style system: file c:/moz/src2/dom/base/nsDocument.cpp, line 13174 GECKO(11964) | Assertion failure: IsStyledByServo(), at c:\moz\src2\obj-stylo-debug-opt\dist\include\mozilla/dom/Element.h:466 GECKO(11964) | #01: mozilla::ServoStyleSet::ResolveStyleLazily (c:\moz\src2\layout\style\servostyleset.cpp:1128) GECKO(11964) | #02: mozilla::ServoStyleSet::ResolveTransientServoStyle (c:\moz\src2\layout\style\servostyleset.cpp:548) GECKO(11964) | #03: mozilla::ServoStyleSet::ResolveTransientStyle (c:\moz\src2\layout\style\servostyleset.cpp:532) GECKO(11964) | #04: nsComputedDOMStyle::DoGetStyleContextNoFlush (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:671) GECKO(11964) | #05: nsComputedDOMStyle::GetStyleContext (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:425) GECKO(11964) | #06: nsComputedDOMStyle::UpdateCurrentStyleSources (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:897) GECKO(11964) | #07: nsComputedDOMStyle::GetPropertyCSSValue (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:1000) GECKO(11964) | #08: nsComputedDOMStyle::GetPropertyValue (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:380) GECKO(11964) | #09: mozilla::dom::CSSStyleDeclarationBinding::getPropertyValue (c:\moz\src2\obj-stylo-debug-opt\dom\bindings\cssstyledeclarationbinding.cpp:165) GECKO(11964) | #10: mozilla::dom::GenericBindingMethod (c:\moz\src2\dom\bindings\bindingutils.cpp:2954) GECKO(11964) | #11: js::CallJSNative (c:\moz\src2\js\src\jscntxtinlines.h:293) GECKO(11964) | #12: js::InternalCallOrConstruct (c:\moz\src2\js\src\vm\interpreter.cpp:470) GECKO(11964) | #13: Interpret (c:\moz\src2\js\src\vm\interpreter.cpp:3028)
Attachment #8871617 - Flags: review?(hikezoe) → review+
Comment on attachment 8871617 [details] Bug 1355349 - Add get_zero_value to Animatable trait; https://reviewboard.mozilla.org/r/143100/#review149102 ::: servo/components/style/properties/helpers/animated_properties.mako.rs:1445 (Diff revision 2) > FontWeight::Weight900 > }) > } > > #[inline] > + fn get_zero_value(&self) -> Option<Self> { Some(FontWeight::Weight400) } We should either change this to zero (except there is no zero value :( ) or we should make add_weighted add a difference from 400.
Comment on attachment 8873735 [details] Bug 1355349 - Don't introduce calc() when interpolating between length and percentages if either side is zero; https://reviewboard.mozilla.org/r/145136/#review149104
Attachment #8873735 - Flags: review?(hikezoe) → review+
(In reply to Brian Birtles (:birtles) from comment #23) > GECKO(11964) | Assertion failure: IsStyledByServo(), at > c:\moz\src2\obj-stylo-debug-opt\dist\include\mozilla/dom/Element.h:466 > GECKO(11964) | #01: mozilla::ServoStyleSet::ResolveStyleLazily > (c:\moz\src2\layout\style\servostyleset.cpp:1128) This is bizarre. Even in my local copy ResolveStyleLazily doesn't call IsStyledByServo as far as I can tell. Something to investigate on Monday.
Comment on attachment 8871618 [details] Bug 1355349 - Use Servo's zero values to fill in missing SMIL animation endpoints; https://reviewboard.mozilla.org/r/143102/#review149106 ::: dom/smil/nsSMILCSSValueType.cpp:110 (Diff revision 2) > - if (!aValue1 || !aValue2) { > - NS_WARNING("stylo: Missing values are not yet supported (bug 1355349)"); > - return false; > + aZeroValueStorage.mServo = > + Servo_AnimationValues_GetZeroValue(aValue2->mServo).Consume(); > + aValue1 = &aZeroValueStorage; This looks funny but I don't have other ways. Honestely I am really looking forward to the day we drop the wrapper, AnimationValue.
Attachment #8871618 - Flags: review?(hikezoe) → review+
Comment on attachment 8871619 [details] Bug 1355349 - Add FFI for calling Servo's add and accumulate methods on animation values; https://reviewboard.mozilla.org/r/143104/#review149108
Attachment #8871619 - Flags: review?(hikezoe) → review+
(In reply to Hiroyuki Ikezoe (:hiro) from comment #28) > Comment on attachment 8871618 [details] > Bug 1355349 - Use Servo's zero values to fill in missing SMIL animation > endpoints; > > https://reviewboard.mozilla.org/r/143102/#review149106 > > ::: dom/smil/nsSMILCSSValueType.cpp:110 > (Diff revision 2) > > - if (!aValue1 || !aValue2) { > > - NS_WARNING("stylo: Missing values are not yet supported (bug 1355349)"); > > - return false; > > + aZeroValueStorage.mServo = > > + Servo_AnimationValues_GetZeroValue(aValue2->mServo).Consume(); > > + aValue1 = &aZeroValueStorage; > > This looks funny but I don't have other ways. Honestely I am really looking > forward to the day we drop the wrapper, AnimationValue. Yeah, I thought of a few other ways but they all introduced extra copying. It's weird because in the Gecko codepath we can use statically initialized objects but in Servo we can't.
Comment on attachment 8873736 [details] Bug 1355349 - Treat properties that can't be animated by the Servo backend as unanimatable; https://reviewboard.mozilla.org/r/145138/#review149110
Attachment #8873736 - Flags: review?(hikezoe) → review+
Comment on attachment 8873737 [details] Bug 1355349 - Drop 'virtual' annotation from overridden methods in nsSMILCSSValueType.h; https://reviewboard.mozilla.org/r/145140/#review149112
Attachment #8873737 - Flags: review?(hikezoe) → review+
Comment on attachment 8873738 [details] Bug 1355349 - Reformat a ternary operator to match coding style; https://reviewboard.mozilla.org/r/145142/#review149114
Attachment #8873738 - Flags: review?(hikezoe) → review+
Comment on attachment 8871621 [details] Bug 1355349 - Call Servo's add and accumulate methods for SMIL animations; https://reviewboard.mozilla.org/r/143108/#review149120
Attachment #8871621 - Flags: review?(hikezoe) → review+
Attachment #8873739 - Flags: review?(hikezoe) → review+
Comment on attachment 8871616 [details] Bug 1355349 - Get unanimated style in nsComputedDOMStyle::DoGetStyleContextNoFlush for Servo too; https://reviewboard.mozilla.org/r/143098/#review149124 I think this basically works, but sometimes returns stale base style I guess. I don't actually remember when SMIL calls this code, if it's called in PreTraversal(), there might be some cases that we have stale styles. Maybe, a subsequent tick right after we set inline style? Even if there is a case we have stale styles, I am OK with fixing the case when we move SMIL on the web animation architecture.
Attachment #8871616 - Flags: review?(hikezoe) → review+
(In reply to Brian Birtles (:birtles) from comment #23) > The "Get unanimated style in nsComputedDOMStyle::DoGetStyleContextNoFlush > for Servo too" patch is probably wrong. > > Running the tests in dom/smil/tests I hit this failed assertion: > > 11182 INFO TEST-PASS | dom/smil/test/test_smilXHR.xhtml | animation of > attribute shouldn't be taking effect > GECKO(11964) | [Parent 11964] WARNING: stylo: No docshell yet, assuming > Gecko style system: file c:/moz/src2/dom/base/nsDocument.cpp, line 13174 > GECKO(11964) | Assertion failure: IsStyledByServo(), at > c:\moz\src2\obj-stylo-debug-opt\dist\include\mozilla/dom/Element.h:466 > GECKO(11964) | #01: mozilla::ServoStyleSet::ResolveStyleLazily > (c:\moz\src2\layout\style\servostyleset.cpp:1128) > GECKO(11964) | #02: mozilla::ServoStyleSet::ResolveTransientServoStyle > (c:\moz\src2\layout\style\servostyleset.cpp:548) > GECKO(11964) | #03: mozilla::ServoStyleSet::ResolveTransientStyle > (c:\moz\src2\layout\style\servostyleset.cpp:532) > GECKO(11964) | #04: nsComputedDOMStyle::DoGetStyleContextNoFlush > (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:671) > GECKO(11964) | #05: nsComputedDOMStyle::GetStyleContext > (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:425) > GECKO(11964) | #06: nsComputedDOMStyle::UpdateCurrentStyleSources > (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:897) > GECKO(11964) | #07: nsComputedDOMStyle::GetPropertyCSSValue > (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:1000) > GECKO(11964) | #08: nsComputedDOMStyle::GetPropertyValue > (c:\moz\src2\layout\style\nscomputeddomstyle.cpp:380) > GECKO(11964) | #09: > mozilla::dom::CSSStyleDeclarationBinding::getPropertyValue > (c:\moz\src2\obj-stylo-debug-opt\dom\bindings\cssstyledeclarationbinding.cpp: > 165) > GECKO(11964) | #10: mozilla::dom::GenericBindingMethod > (c:\moz\src2\dom\bindings\bindingutils.cpp:2954) > GECKO(11964) | #11: js::CallJSNative > (c:\moz\src2\js\src\jscntxtinlines.h:293) > GECKO(11964) | #12: js::InternalCallOrConstruct > (c:\moz\src2\js\src\vm\interpreter.cpp:470) > GECKO(11964) | #13: Interpret (c:\moz\src2\js\src\vm\interpreter.cpp:3028) It looks like this might not be related to this patch series after all. This is happening in test_smilXHR.html where we first do: var xhr = new XMLHttpRequest(); xhr.open("GET", "smilXHR_helper.svg", false); xhr.send(); var xdoc = xhr.responseXML Then we pull out a circle element from the document: var circ = xdoc.getElementById("circ") Then at the end we check the computed style of the circle: is(SMILUtil.getComputedStyleSimple(circ, "opacity"), "1", "animation of CSS property shouldn't be taking effect"); The trouble is, in nsComputedDOMStyle::DoGetStyleContextNoFlush we have the following check: if (ServoStyleSet* servoSet = styleSet->GetAsServo()) { StyleRuleInclusion rules = aStyleType == eDefaultOnly ? StyleRuleInclusion::DefaultOnly : StyleRuleInclusion::All; return servoSet->ResolveTransientStyle(aElement, aPseudo, type, rules); } For whatever reason, styleSet->GetAsServo() returns a ServoStyleSet here (I haven't dug into exactly how we look up the styleSet there) so we go ahead and call ResolveTransientStyle. From there we have the following call stack: ServoStyleSet::ResolveTransientStyle ServoStyleSet::ResolveTransientServoStyle ServoStyleSet::ResolveStyleLazily EffectCompositor::PreTraverse In EffectCompositor::PreTraverse we have: bool flushThrottledRestyles = elementToRestyle && elementToRestyle->HasDirtyDescendantsForServo(); |elementToRestyle| here is the <circle> element but HasDirtyDescendantsForServo contains the assertion: MOZ_ASSERT(IsStyledByServo()); which calls: nsINode::IsStyledByServo() const { return OwnerDoc()->IsStyledByServo(); } and the OwnerDoc() here is the XHR doc, which is not styled by servo so the assertion fails. So there's some kind of mismatch between consulting the element's owner doc to see if we're using Servo, and whatever we end up doing to get the style set for the element in DoGetStyleContextNoFlush. I'm currently building without the patches in this bug to confirm that the assertion still fails without them. If it does, I'll file a separate bug for this issue.
(In reply to Brian Birtles (:birtles) from comment #37) > I'm currently building without the patches in this bug to confirm that the > assertion still fails without them. If it does, I'll file a separate bug for > this issue. Confirmed this test fails on a fresh checkout of m-c and filed bug 1370123 for fixing it.
Attachment #8871617 - Attachment is obsolete: true
Attachment #8873735 - Attachment is obsolete: true
Attached file Servo PR #17162 (deleted) —
Pushed by bbirtles@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/38ae6e3d3a11 Move calculation of pseudo type in nsComputedDOMStyle::DoGetStyleContextNoFlush; r=hiro https://hg.mozilla.org/integration/autoland/rev/862c08dd715b Get unanimated style in nsComputedDOMStyle::DoGetStyleContextNoFlush for Servo too; r=hiro https://hg.mozilla.org/integration/autoland/rev/47db7107c874 Use Servo's zero values to fill in missing SMIL animation endpoints; r=hiro https://hg.mozilla.org/integration/autoland/rev/ef01cc3b84b8 Add FFI for calling Servo's add and accumulate methods on animation values; r=hiro https://hg.mozilla.org/integration/autoland/rev/992504b822d2 Treat properties that can't be animated by the Servo backend as unanimatable; r=hiro https://hg.mozilla.org/integration/autoland/rev/297d24c38ab3 Drop 'virtual' annotation from overridden methods in nsSMILCSSValueType.h; r=hiro https://hg.mozilla.org/integration/autoland/rev/c0ef218a7f9e Reformat a ternary operator to match coding style; r=hiro https://hg.mozilla.org/integration/autoland/rev/2f7ad629f8b0 Call Servo's add and accumulate methods for SMIL animations; r=hiro https://hg.mozilla.org/integration/autoland/rev/a3c3e847db4a Update stylo test expectations; r=hiro
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: