From feb670f84055c1e6762278f838ad89f9511e6c98 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Wed, 31 May 2017 09:24:57 +0900 Subject: [PATCH] Bug 1361938 - Do not reuse DeclarationBlock when modifying inline style. r=heycam In stylo, the DeclarationBlock is stored in element's RuleNode directly, so when we call setProperty(), the new property value replaces the old value immediately. This causes a problem for CSS transition. CSS transition needs before-change style. From the spec; before-change style as the computed values of all properties on the element as of the previous style change event, except with any styles derived from declarative animations such as CSS Transitions, CSS Animations, and SMIL Animations updated to the current time To get correct before-change style, when we call getProperty(), we need to preserve rule nodes tree as the rules as of the *previous style change event*. And we need to cascade the preserved rule nodes with updated animation rules during animation-only restyle, and then we can use the result of the cascading as before-change style before cascading inline style changes in normal restyle. MozReview-Commit-ID: 9bkHz3Vvqg2 --HG-- extra : rebase_source : b6343bba67bd697a53d04d0e7ab2dbdc01c5d3f0 --- layout/style/nsDOMCSSDeclaration.cpp | 12 +++++++++++- layout/style/test/mochitest.ini | 1 - layout/style/test/stylo-failures.md | 2 -- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index e130b9cc95c0..d8033db773b6 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -317,7 +317,17 @@ nsDOMCSSDeclaration::ModifyDeclaration(GeckoFunc aGeckoFunc, // between when we mutate the declaration and when we set the new // rule (see stack in bug 209575). mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true); - RefPtr decl = olddecl->EnsureMutable(); + RefPtr decl; + if (olddecl->IsServo() && !olddecl->IsDirty()) { + // In stylo, the old DeclarationBlock is stored in element's rule node tree + // directly, to avoid new values replacing the DeclarationBlock in the tree + // directly, we need to copy the old one here if we haven't yet copied. + // As a result the new value does not replace rule node tree until traversal + // happens. + decl = olddecl->Clone(); + } else { + decl = olddecl->EnsureMutable(); + } bool changed; if (decl->IsGecko()) { diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 2e79905fac2f..009c6da265e0 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -60,7 +60,6 @@ support-files = file_animations_effect_timing_iterations.html [test_animations_iterationstart.html] support-files = file_animations_iterationstart.html [test_animations_omta.html] -skip-if = (stylo && !e10s) # mochitest expectations are different with non-e10s, bug 1361938 [test_animations_omta_start.html] skip-if = (stylo && !e10s) # mochitest expectations are different with non-e10s, bug 1362292 [test_animations_pausing.html] diff --git a/layout/style/test/stylo-failures.md b/layout/style/test/stylo-failures.md index 8f5520652596..c316e58c984a 100644 --- a/layout/style/test/stylo-failures.md +++ b/layout/style/test/stylo-failures.md @@ -36,8 +36,6 @@ to mochitest command. * test_media_queries_dynamic.html `restyle`: bug 1357461 [4] * test_media_queries_dynamic_xbl.html: xbl support bug 1290276 [2] * Animation support: - * OMTA - * test_animations_omta.html: bug 1361938, bug 1340005 [*] * SMIL Animation * test_restyles_in_smil_animation.html [2] * console support bug 1352669