Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint.html

Issue 2242483002: Fix fast/repaint/obscured-background-no-repaint.html (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../resources/run-after-layout-and-paint.js"></script>
4 <style type="text/css"> 3 <style type="text/css">
5 #test1 div { 4 #test1 div {
6 height: 100px; 5 height: 100px;
7 width: 100px; 6 width: 100px;
8 } 7 }
9 #test1 .parent { 8 #test1 .parent {
10 background-image: url(resources/animated.gif) 9 background-image: url(resources/animated.gif)
11 } 10 }
12 #test1 .child { 11 #test1 .child {
13 background-color: green; 12 background-color: green;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 50 }
52 51
53 if (window.internals) { 52 if (window.internals) {
54 internals.settings.setUseDefaultImageInterpolationQuality(true); 53 internals.settings.setUseDefaultImageInterpolationQuality(true);
55 internals.runtimeFlags.slimmingPaintUnderInvalidationCheckingEnabled = t rue; 54 internals.runtimeFlags.slimmingPaintUnderInvalidationCheckingEnabled = t rue;
56 } 55 }
57 56
58 function finish() { 57 function finish() {
59 var layerTree = window.internals.layerTreeAsText(document, internals.LAY ER_TREE_INCLUDES_PAINT_INVALIDATIONS); 58 var layerTree = window.internals.layerTreeAsText(document, internals.LAY ER_TREE_INCLUDES_PAINT_INVALIDATIONS);
60 var invalidations = JSON.parse(layerTree).objectPaintInvalidations; 59 var invalidations = JSON.parse(layerTree).objectPaintInvalidations;
61 // Passes if there is no invalidations, 60 // Passes if there is no invalidations other than imgForAdvanceImageAnim ation,
62 // or only invalidations because of background obscuration change. 61 // or only invalidations because of background obscuration change.
63 // This is because before the delayed image decoder finishes decodin g the image, 62 // This is because before the delayed image decoder finishes decoding th e image,
64 // we first assume the image is not opaque. If the image is found ac tually opaque 63 // we first assume the image is not opaque. If the image is found actual ly opaque
65 // after decoding, the background obscuration status of covered elem ents will 64 // after decoding, the background obscuration status of covered elements will
66 // change and cause paint invalidation. 65 // change and cause paint invalidation.
67 var invalidatedObjects = {}; 66 var invalidatedObjects = {};
68 for (var i = 0; i < invalidations.length; ++i) { 67 if (invalidations) {
69 var object = invalidations[i].object; 68 for (var i = 0; i < invalidations.length; ++i) {
70 // Paint invalidation of target3 and target4 depends on opaqueness o f the foreground image (apple.jpg). 69 var object = invalidations[i].object;
71 // Because of delayed image decoding, we may get actual opaqueness o f the image after the test is started. 70 if (object.indexOf('imgForAdvanceImageAnimation') != -1)
72 // Omit paint invalidations so far if we see 'background obscuration change' for these targets. 71 continue;
73 if ((object.indexOf('target3') != -1 || object.indexOf('target4') != -1) && invalidations[i].reason == 'background obscuration change') 72 if ((object.indexOf('target3') != -1 || object.indexOf('target4' ) != -1) && invalidations[i].reason == 'background obscuration change')
74 delete invalidatedObjects[object]; 73 continue;
75 else
76 invalidatedObjects[object] = true; 74 invalidatedObjects[object] = true;
75 }
77 } 76 }
78 77
79 if (Object.keys(invalidatedObjects).length) 78 if (Object.keys(invalidatedObjects).length)
80 output.textContent = 'FAIL: Unexpected paint invalidations: ' + JSON .stringify(invalidatedObjects) + '\n' + layerTree; 79 output.textContent = 'FAIL: Unexpected paint invalidations: ' + JSON .stringify(invalidatedObjects) + '\n' + layerTree;
81 else 80 else
82 output.textContent = 'PASS'; 81 output.textContent = 'PASS';
83 testRunner.notifyDone(); 82 testRunner.notifyDone();
84 } 83 }
85 84
86 function start() { 85 function start() {
87 if (!window.testRunner || !window.internals) 86 if (!window.testRunner || !window.internals)
88 return; 87 return;
89 88
90 runAfterLayoutAndPaint(function() { 89 // Ensure the deferred decoder has decoded resources/apple.jpg.
90 testRunner.capturePixelsAsyncThen(function() {
91 internals.startTrackingRepaints(document); 91 internals.startTrackingRepaints(document);
92 // Wait a while to let the animated gif advance frames. 92 internals.advanceImageAnimation(imgForAdvanceImageAnimation);
93 setTimeout(finish, 300); 93 testRunner.layoutAndPaintAsyncThen(function() {
94 internals.advanceImageAnimation(imgForAdvanceImageAnimation);
95 testRunner.layoutAndPaintAsyncThen(function() {
96 internals.advanceImageAnimation(imgForAdvanceImageAnimation) ;
97 testRunner.layoutAndPaintAsyncThen(finish);
98 });
99 });
94 }); 100 });
95 } 101 }
96 102
97 </script> 103 </script>
98 </head> 104 </head>
99 <body onload="start()"> 105 <body onload="start()">
100 <div id="test1"> 106 <div id="test1">
101 <div id="target1" class="parent"> 107 <div id="target1" class="parent">
102 <div class="child"> 108 <div class="child">
103 </div> 109 </div>
(...skipping 11 matching lines...) Expand all
115 <div id="test4"> 121 <div id="test4">
116 <div id="target4" class="parent"> 122 <div id="target4" class="parent">
117 <a> 123 <a>
118 <div></div> 124 <div></div>
119 <div> 125 <div>
120 <img src="resources/apple.jpg"> 126 <img src="resources/apple.jpg">
121 </div> 127 </div>
122 </a> 128 </a>
123 </div> 129 </div>
124 </div> 130 </div>
131 <img id="imgForAdvanceImageAnimation" src="resources/animated.gif">
125 <pre id="output"></pre> 132 <pre id="output"></pre>
126 </body> 133 </body>
127 </html> 134 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698