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
This commit is contained in:
Hiroyuki Ikezoe 2017-05-31 09:24:57 +09:00
Родитель 5179c72ee9
Коммит feb670f840
3 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -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<DeclarationBlock> decl = olddecl->EnsureMutable();
RefPtr<DeclarationBlock> 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()) {

Просмотреть файл

@ -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]

Просмотреть файл

@ -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