Bug 1294651 - Don't apply iterationComposite value if the preference for Web Animations API is not enabled. r=boris

MozReview-Commit-ID: 5ckKyDSBv3S

--HG--
extra : rebase_source : 5bf069db17cecac17035bd2c9c925abc4c4e5f2c
This commit is contained in:
Hiroyuki Ikezoe 2016-09-21 19:17:18 +09:00
parent d96f0b8741
commit 7de848f9c8
5 changed files with 57 additions and 1 deletions

View File

@ -130,6 +130,12 @@ void
KeyframeEffect::SetIterationComposite(
const IterationCompositeOperation& aIterationComposite)
{
// Ignore iterationComposite if the Web Animations API is not enabled,
// then the default value 'Replace' will be used.
if (!AnimationUtils::IsCoreAPIEnabled()) {
return;
}
if (mEffectOptions.mIterationComposite == aIterationComposite) {
return;
}

View File

@ -510,7 +510,11 @@ KeyframeEffectParamsFromUnion(const OptionsType& aOptions,
result.mPacedProperty,
aInvalidPacedProperty,
aRv);
result.mIterationComposite = options.mIterationComposite;
// Ignore iterationComposite if the Web Animations API is not enabled,
// then the default value 'Replace' will be used.
if (AnimationUtils::IsCoreAPIEnabled()) {
result.mIterationComposite = options.mIterationComposite;
}
}
return result;
}

View File

@ -39,6 +39,7 @@ support-files =
mozilla/file_cubic_bezier_limits.html
mozilla/file_deferred_start.html
mozilla/file_disabled_properties.html
mozilla/file_disable_animations_api_core.html
mozilla/file_document-timeline-origin-time-range.html
mozilla/file_hide_and_show.html
mozilla/file_partial_keyframes.html
@ -92,6 +93,7 @@ skip-if = buildapp == 'mulet'
[mozilla/test_cubic_bezier_limits.html]
[mozilla/test_deferred_start.html]
skip-if = (toolkit == 'gonk' && debug)
[mozilla/test_disable_animations_api_core.html]
[mozilla/test_disabled_properties.html]
[mozilla/test_document-timeline-origin-time-range.html]
[mozilla/test_hide_and_show.html]

View File

@ -0,0 +1,30 @@
<!doctype html>
<meta charset=utf-8>
<script src="../testcommon.js"></script>
<body>
<script>
'use strict';
test(function(t) {
var div = addDiv(t);
var anim =
div.animate({ marginLeft: ['0px', '10px'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
// NOTE: We can't check iterationComposite value itself though API since
// Animation.effect is also behind the the Web Animations API. So we just
// check that style value is not affected by iterationComposite.
anim.currentTime = 200 * MS_PER_SEC;
assert_equals(getComputedStyle(div).marginLeft, '0px',
'Animated style should not be accumulated when the Web Animations API is ' +
'not enabled even if accumulate is specified in the constructor');
}, 'iterationComposite should not affect at all if the Web Animations API ' +
'is not enabled');
done();
</script>
</body>

View File

@ -0,0 +1,14 @@
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
'use strict';
setup({explicit_done: true});
SpecialPowers.pushPrefEnv(
{ "set": [["dom.animations-api.core.enabled", false]]},
function() {
window.open("file_disable_animations_api_core.html");
});
</script>