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

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

Issue 2229643002: Don't invalidate paint on background image change if it's obscured (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@BackgroundObscured
Patch Set: Rebase 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../resources/run-after-layout-and-paint.js"></script> 3 <script src="../../resources/run-after-layout-and-paint.js"></script>
4 <script src="resources/text-based-repaint.js"></script>
5 <style type="text/css"> 4 <style type="text/css">
6 #test1 div { 5 #test1 div {
7 height: 100px; 6 height: 100px;
8 width: 100px; 7 width: 100px;
9 } 8 }
10 #test1 .parent { 9 #test1 .parent {
11 background-image: url(resources/animated.gif) 10 background-image: url(resources/animated.gif)
12 } 11 }
13 #test1 .child { 12 #test1 .child {
14 background-color: green; 13 background-color: green;
(...skipping 24 matching lines...) Expand all
39 height: 100px; 38 height: 100px;
40 width: 100px; 39 width: 100px;
41 background-color: red; 40 background-color: red;
42 background-repeat: no-repeat; 41 background-repeat: no-repeat;
43 background-position: center; 42 background-position: center;
44 background-image: url(resources/animated.gif) 43 background-image: url(resources/animated.gif)
45 } 44 }
46 </style> 45 </style>
47 <script> 46 <script>
48 // Test that obscured animated gif does not trigger repaints. 47 // Test that obscured animated gif does not trigger repaints.
49 if (window.testRunner) 48 if (window.testRunner) {
50 testRunner.waitUntilDone(); 49 testRunner.waitUntilDone();
51 window.testIsAsync = true; 50 testRunner.dumpAsText();
52 function repaintTest() 51 }
53 { 52
54 runAfterLayoutAndPaint(finishRepaintTest); 53 if (window.internals) {
54 internals.settings.setUseDefaultImageInterpolationQuality(true);
55 internals.runtimeFlags.slimmingPaintUnderInvalidationCheckingEnabled = t rue;
56 }
57
58 function finish() {
59 var layerTree = window.internals.layerTreeAsText(document, internals.LAY ER_TREE_INCLUDES_PAINT_INVALIDATIONS);
60 var invalidations = JSON.parse(layerTree).objectPaintInvalidations;
61 // Passes if there is no invalidations,
62 // or only invalidations because of background obscuration change.
63 // This is because before the delayed image decoder finishes decodin g the image,
64 // we first assume the image is not opaque. If the image is found ac tually opaque
65 // after decoding, the background obscuration status of covered elem ents will
66 // change and cause paint invalidation.
67 var invalidatedObjects = {};
68 for (var i = 0; i < invalidations.length; ++i) {
69 var object = invalidations[i].object;
70 // Paint invalidation of target3 and target4 depends on opaqueness o f the foreground image (apple.jpg).
71 // Because of delayed image decoding, we may get actual opaqueness o f the image after the test is started.
72 // Omit paint invalidations so far if we see 'background obscuration change' for these targets.
73 if ((object.indexOf('target3') != -1 || object.indexOf('target4') != -1) && invalidations[i].reason == 'background obscuration change')
74 delete invalidatedObjects[object];
75 else
76 invalidatedObjects[object] = true;
77 }
78
79 if (Object.keys(invalidatedObjects).length)
80 output.textContent = 'FAIL: Unexpected paint invalidations: ' + JSON .stringify(invalidatedObjects) + '\n' + layerTree;
81 else
82 output.textContent = 'PASS';
83 testRunner.notifyDone();
55 } 84 }
56 85
57 function start() { 86 function start() {
58 if (!window.testRunner || !window.internals) 87 if (!window.testRunner || !window.internals)
59 return; 88 return;
60 89
61 var img = new Image(); 90 runAfterLayoutAndPaint(function() {
62 img.onload = runRepaintTest; 91 internals.startTrackingRepaints(document);
63 img.src = "resources/animated.gif"; 92 // Wait a while to let the animated gif advance frames.
93 setTimeout(finish, 300);
94 });
64 } 95 }
96
65 </script> 97 </script>
66 </head> 98 </head>
67 <body onload="start()"> 99 <body onload="start()">
68 <div id="test1"> 100 <div id="test1">
69 <div class="parent"> 101 <div id="target1" class="parent">
70 <div class="child"> 102 <div class="child">
71 </div> 103 </div>
72 </div> 104 </div>
73 </div> 105 </div>
74 <div id="test2"> 106 <div id="test2">
75 <div class="parent"> 107 <div id="target2" class="parent">
76 <div class="child"> 108 <div class="child">
77 </div> 109 </div>
78 </div> 110 </div>
79 </div> 111 </div>
80 <div id="test3"> 112 <div id="test3">
81 <img src="resources/apple.jpg"> 113 <img id="target3" src="resources/apple.jpg">
82 </div> 114 </div>
83 <div id="test4"> 115 <div id="test4">
84 <div class="parent"> 116 <div id="target4" class="parent">
85 <a> 117 <a>
86 <div></div> 118 <div></div>
87 <div> 119 <div>
88 <img src="resources/apple.jpg"> 120 <img src="resources/apple.jpg">
89 </div> 121 </div>
90 </a> 122 </a>
91 </div> 123 </div>
92 </div> 124 </div>
125 <pre id="output"></pre>
93 </body> 126 </body>
94 </html> 127 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698