forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
animated-gif-background-offscreen.html
39 lines (33 loc) · 1.17 KB
/
animated-gif-background-offscreen.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!doctype HTML>
<body>
<div style="height: 2000px; width: 2000px;">
<div id="targetImage" style="width: 50px; height: 50px"></div>
<img id="testTarget" style="visibility: hidden">
</div>
<script src="resources/text-based-repaint.js"></script>
<script>
window.testIsAsync = true;
// Disable under-invalidation checking because the "under-invalidation" of
// offscreen gif animation is intentional.
if (window.internals)
internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = false;
function repaintTest() {
if (window.internals)
internals.advanceImageAnimation(testTarget);
requestAnimationFrame(function() {
finishRepaintTest();
});
}
function targetImageOnload() {
// Scroll targetImage offscreen.
window.scrollTo(0, 1000);
runRepaintTest();
}
window.onload = function() {
targetImage.style.background = "url(../../fast/backgrounds/resources/red-green-animated.gif)";
// Use a parallel image element as a hack to detect whether the image has loaded, and therefore
// we'll get a frame.
testTarget.onload = targetImageOnload;
testTarget.src = "../../fast/backgrounds/resources/red-green-animated.gif";
}
</script>