OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <style type="text/css"> | |
4 #test1 div { | |
5 height: 100px; | |
6 width: 100px; | |
7 } | |
8 #test1 .parent { | |
9 background-image: url(resources/animated.gif) | |
10 } | |
11 #test1 .child { | |
12 background-color: green; | |
13 } | |
14 | |
15 #test2 .parent { | |
16 position: relative; | |
17 height: 100px; | |
18 width: 100px; | |
19 background-image: url(resources/animated.gif); | |
20 background-repeat: no-repeat; | |
21 background-position: center; | |
22 } | |
23 | |
24 #test2 .child { | |
25 background-color: green; | |
26 position: relative; | |
27 left: 25px; | |
28 top: 25px; | |
29 height: 50px; | |
30 width: 50px; | |
31 } | |
32 #test3 img { | |
33 background-image: url(resources/animated.gif) | |
34 } | |
35 #test4 .parent { | |
36 position: relative; | |
37 height: 100px; | |
38 width: 100px; | |
39 background-color: red; | |
40 background-repeat: no-repeat; | |
41 background-position: center; | |
42 background-image: url(resources/animated.gif) | |
43 } | |
44 </style> | |
45 <script> | |
46 // Test that obscured animated gif does not trigger repaints. | |
47 if (window.testRunner) { | |
48 testRunner.waitUntilDone(); | |
49 testRunner.dumpAsText(); | |
50 } | |
51 | |
52 if (window.internals) { | |
53 internals.settings.setUseDefaultImageInterpolationQuality(true); | |
54 internals.runtimeFlags.paintUnderInvalidationCheckingEnabled = true; | |
55 } | |
56 | |
57 function finish() { | |
58 var layerTree = window.internals.layerTreeAsText(document, internals.LAY
ER_TREE_INCLUDES_PAINT_INVALIDATIONS); | |
59 var invalidations = JSON.parse(layerTree).objectPaintInvalidations; | |
60 // Passes if there is no invalidations other than imgForAdvanceImageAnim
ation, | |
61 // or only invalidations because of background obscuration change. | |
62 // This is because before the delayed image decoder finishes decoding th
e image, | |
63 // we first assume the image is not opaque. If the image is found actual
ly opaque | |
64 // after decoding, the background obscuration status of covered elements
will | |
65 // change and cause paint invalidation. | |
66 var invalidatedObjects = {}; | |
67 if (invalidations) { | |
68 for (var i = 0; i < invalidations.length; ++i) { | |
69 var object = invalidations[i].object; | |
70 if (object.indexOf('imgForAdvanceImageAnimation') != -1) | |
71 continue; | |
72 if ((object.indexOf('target3') != -1 || object.indexOf('target4'
) != -1) && invalidations[i].reason == 'background obscuration change') | |
73 continue; | |
74 invalidatedObjects[object] = true; | |
75 } | |
76 } | |
77 | |
78 if (Object.keys(invalidatedObjects).length) | |
79 output.textContent = 'FAIL: Unexpected paint invalidations: ' + JSON
.stringify(invalidatedObjects) + '\n' + layerTree; | |
80 else | |
81 output.textContent = 'PASS'; | |
82 testRunner.notifyDone(); | |
83 } | |
84 | |
85 function start() { | |
86 if (!window.testRunner || !window.internals) | |
87 return; | |
88 | |
89 // Ensure the deferred decoder has decoded resources/apple.jpg. | |
90 testRunner.capturePixelsAsyncThen(function() { | |
91 internals.startTrackingRepaints(document); | |
92 internals.advanceImageAnimation(imgForAdvanceImageAnimation); | |
93 testRunner.layoutAndPaintAsyncThen(function() { | |
94 internals.advanceImageAnimation(imgForAdvanceImageAnimation); | |
95 testRunner.layoutAndPaintAsyncThen(function() { | |
96 internals.advanceImageAnimation(imgForAdvanceImageAnimation)
; | |
97 testRunner.layoutAndPaintAsyncThen(finish); | |
98 }); | |
99 }); | |
100 }); | |
101 } | |
102 | |
103 </script> | |
104 </head> | |
105 <body onload="start()"> | |
106 <div id="test1"> | |
107 <div id="target1" class="parent"> | |
108 <div class="child"> | |
109 </div> | |
110 </div> | |
111 </div> | |
112 <div id="test2"> | |
113 <div id="target2" class="parent"> | |
114 <div class="child"> | |
115 </div> | |
116 </div> | |
117 </div> | |
118 <div id="test3"> | |
119 <img id="target3" src="resources/apple.jpg"> | |
120 </div> | |
121 <div id="test4"> | |
122 <div id="target4" class="parent"> | |
123 <a> | |
124 <div></div> | |
125 <div> | |
126 <img src="resources/apple.jpg"> | |
127 </div> | |
128 </a> | |
129 </div> | |
130 </div> | |
131 <img id="imgForAdvanceImageAnimation" src="resources/animated.gif"> | |
132 <pre id="output"></pre> | |
133 </body> | |
134 </html> | |
OLD | NEW |