mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1274944 - Part 4: Implement mutation observer for setting spacing. r=birtles
MozReview-Commit-ID: LmCO9QyQbBU --HG-- extra : rebase_source : f078d871b6c5fab565a3ab03fdbf4ac3452704e6
This commit is contained in:
parent
7d2125257c
commit
c15da6fa38
@ -168,6 +168,10 @@ KeyframeEffect::SetSpacing(JSContext* aCx,
|
||||
KeyframeUtils::ApplyDistributeSpacing(mKeyframes);
|
||||
}
|
||||
|
||||
if (mAnimation && mAnimation->IsRelevant()) {
|
||||
nsNodeUtils::AnimationChanged(mAnimation);
|
||||
}
|
||||
|
||||
if (mTarget) {
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
|
@ -1896,6 +1896,73 @@ addAsyncAnimTest("set_effect_with_previous_animation",
|
||||
yield await_frame();
|
||||
});
|
||||
|
||||
addAsyncAnimTest("set_spacing",
|
||||
{ observe: div, subtree: true }, function*() {
|
||||
var anim = div.animate([ { marginLeft: "0px" },
|
||||
{ marginLeft: "-20px" },
|
||||
{ marginLeft: "100px" },
|
||||
{ marginLeft: "50px" } ],
|
||||
{ duration: 100 * MS_PER_SEC });
|
||||
yield await_frame();
|
||||
assert_records([{ added: [anim], changed: [], removed: [] }],
|
||||
"records after animation is added");
|
||||
|
||||
anim.effect.spacing = "paced(margin-left)";
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [anim], removed: [] }],
|
||||
"records after animation is changed");
|
||||
|
||||
anim.cancel();
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [], removed: [anim] }],
|
||||
"records after animation end");
|
||||
});
|
||||
|
||||
addAsyncAnimTest("set_spacing_on_a_non-animatable_property",
|
||||
{ observe: div, subtree: true }, function*() {
|
||||
var anim = div.animate([ { marginLeft: "0px" },
|
||||
{ marginLeft: "-20px" },
|
||||
{ marginLeft: "100px" },
|
||||
{ marginLeft: "50px" } ],
|
||||
{ duration: 100 * MS_PER_SEC,
|
||||
spacing: "paced(margin-left)" });
|
||||
yield await_frame();
|
||||
assert_records([{ added: [anim], changed: [], removed: [] }],
|
||||
"records after animation is added");
|
||||
|
||||
anim.effect.spacing = "paced(animation-duration)";
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [anim], removed: [] }],
|
||||
"records after setting a non-animatable paced property");
|
||||
|
||||
anim.cancel();
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [], removed: [anim] }],
|
||||
"records after animation end");
|
||||
});
|
||||
|
||||
addAsyncAnimTest("set_the_same_spacing",
|
||||
{ observe: div, subtree: true }, function*() {
|
||||
var anim = div.animate([ { marginLeft: "0px" },
|
||||
{ marginLeft: "-20px" },
|
||||
{ marginLeft: "100px" },
|
||||
{ marginLeft: "50px" } ],
|
||||
{ duration: 100 * MS_PER_SEC,
|
||||
spacing: "paced(margin-left)" });
|
||||
yield await_frame();
|
||||
assert_records([{ added: [anim], changed: [], removed: [] }],
|
||||
"records after animation is added");
|
||||
|
||||
anim.effect.spacing = "paced(margin-left)";
|
||||
yield await_frame();
|
||||
assert_records([], "no record after setting the same spacing");
|
||||
|
||||
anim.cancel();
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [], removed: [anim] }],
|
||||
"records after animation end");
|
||||
});
|
||||
|
||||
// Run the tests.
|
||||
SimpleTest.requestLongerTimeout(2);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
Loading…
Reference in New Issue
Block a user