mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 1045994 - Add a chrome-only property to AnimationPlayer to indicate if an animation is running on the compositor; r=dbaron, r=bz
This commit is contained in:
parent
d82cede239
commit
85736e031c
@ -50,6 +50,7 @@ public:
|
|||||||
AnimationTimeline* Timeline() const { return mTimeline; }
|
AnimationTimeline* Timeline() const { return mTimeline; }
|
||||||
double StartTime() const;
|
double StartTime() const;
|
||||||
double CurrentTime() const;
|
double CurrentTime() const;
|
||||||
|
bool IsRunningOnCompositor() const { return mIsRunningOnCompositor; }
|
||||||
|
|
||||||
void SetSource(Animation* aSource);
|
void SetSource(Animation* aSource);
|
||||||
void Tick();
|
void Tick();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
|
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
|
||||||
|
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
|
||||||
|
|
||||||
EXPORTS.mozilla.dom += [
|
EXPORTS.mozilla.dom += [
|
||||||
'Animation.h',
|
'Animation.h',
|
||||||
|
1
dom/animation/test/chrome.ini
Normal file
1
dom/animation/test/chrome.ini
Normal file
@ -0,0 +1 @@
|
|||||||
|
[chrome/test_running_on_compositor.html]
|
68
dom/animation/test/chrome/test_running_on_compositor.html
Normal file
68
dom/animation/test/chrome/test_running_on_compositor.html
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>Bug 1045994 - Add a chrome-only property to inspect if an animation is
|
||||||
|
running on the compositor or not</title>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css"
|
||||||
|
href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||||
|
<style>
|
||||||
|
@keyframes anim {
|
||||||
|
to { transform: translate(100px) }
|
||||||
|
}
|
||||||
|
.target {
|
||||||
|
// Element needs geometry to be eligible for layerization
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1045994"
|
||||||
|
target="_blank">Mozilla Bug 1045994</a>
|
||||||
|
<div class="target"></div>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** Test for bug 1045994 - Add a chrome-only property to inspect if an
|
||||||
|
animation is running on the compositor or not **/
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
var div = document.querySelector('div.target');
|
||||||
|
|
||||||
|
const OMTAPrefKey = 'layers.offmainthreadcomposition.async-animations';
|
||||||
|
var omtaEnabled = SpecialPowers.DOMWindowUtils.layerManagerRemote &&
|
||||||
|
SpecialPowers.getBoolPref(OMTAPrefKey);
|
||||||
|
|
||||||
|
// FIXME: When we implement Element.animate, use that here instead of CSS
|
||||||
|
// so that we remove any dependency on the CSS mapping.
|
||||||
|
div.style.animation = 'anim 100s';
|
||||||
|
window.getComputedStyle(div).animationName;
|
||||||
|
var player = div.getAnimationPlayers()[0];
|
||||||
|
|
||||||
|
// Wait so that animation can be set up.
|
||||||
|
// FIXME: When we implement the AnimationPlayer.ready promise we should wait
|
||||||
|
// on that here.
|
||||||
|
window.requestAnimationFrame(function() {
|
||||||
|
is(player.isRunningOnCompositor, omtaEnabled,
|
||||||
|
'AnimationPlayer reports that it is running on the compositor'
|
||||||
|
+ ' during playback');
|
||||||
|
|
||||||
|
div.style.animationPlayState = 'paused';
|
||||||
|
window.getComputedStyle(div).animationPlayState;
|
||||||
|
|
||||||
|
// FIXME: Likewise, we should wait on AnimationPlayer.ready here too.
|
||||||
|
window.requestAnimationFrame(function() {
|
||||||
|
is(player.isRunningOnCompositor, false,
|
||||||
|
'AnimationPlayer reports that it is NOT running on the compositor'
|
||||||
|
+ ' when paused');
|
||||||
|
SimpleTest.finish();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
@ -18,3 +18,8 @@ interface AnimationPlayer {
|
|||||||
[Pure] readonly attribute double startTime;
|
[Pure] readonly attribute double startTime;
|
||||||
readonly attribute double currentTime;
|
readonly attribute double currentTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Non-standard extensions
|
||||||
|
partial interface AnimationPlayer {
|
||||||
|
[ChromeOnly] readonly attribute boolean isRunningOnCompositor;
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user