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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint.html
diff --git a/third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint.html b/third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint.html
index c3157a55f2c8d1fd016db8c00019bbc171110295..d3728103ff1fcabf5e1d74f14f883cdd7d05b0c2 100644
--- a/third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint.html
+++ b/third_party/WebKit/LayoutTests/fast/repaint/obscured-background-no-repaint.html
@@ -1,7 +1,6 @@
<html>
<head>
<script src="../../resources/run-after-layout-and-paint.js"></script>
-<script src="resources/text-based-repaint.js"></script>
<style type="text/css">
#test1 div {
height: 100px;
@@ -46,42 +45,75 @@
</style>
<script>
// Test that obscured animated gif does not trigger repaints.
- if (window.testRunner)
+ if (window.testRunner) {
testRunner.waitUntilDone();
- window.testIsAsync = true;
- function repaintTest()
- {
- runAfterLayoutAndPaint(finishRepaintTest);
+ testRunner.dumpAsText();
+ }
+
+ if (window.internals) {
+ internals.settings.setUseDefaultImageInterpolationQuality(true);
+ internals.runtimeFlags.slimmingPaintUnderInvalidationCheckingEnabled = true;
+ }
+
+ function finish() {
+ var layerTree = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS);
+ var invalidations = JSON.parse(layerTree).objectPaintInvalidations;
+ // Passes if there is no invalidations,
+ // or only invalidations because of background obscuration change.
+ // This is because before the delayed image decoder finishes decoding the image,
+ // we first assume the image is not opaque. If the image is found actually opaque
+ // after decoding, the background obscuration status of covered elements will
+ // change and cause paint invalidation.
+ var invalidatedObjects = {};
+ for (var i = 0; i < invalidations.length; ++i) {
+ var object = invalidations[i].object;
+ // Paint invalidation of target3 and target4 depends on opaqueness of the foreground image (apple.jpg).
+ // Because of delayed image decoding, we may get actual opaqueness of the image after the test is started.
+ // Omit paint invalidations so far if we see 'background obscuration change' for these targets.
+ if ((object.indexOf('target3') != -1 || object.indexOf('target4') != -1) && invalidations[i].reason == 'background obscuration change')
+ delete invalidatedObjects[object];
+ else
+ invalidatedObjects[object] = true;
+ }
+
+ if (Object.keys(invalidatedObjects).length)
+ output.textContent = 'FAIL: Unexpected paint invalidations: ' + JSON.stringify(invalidatedObjects) + '\n' + layerTree;
+ else
+ output.textContent = 'PASS';
+ testRunner.notifyDone();
}
function start() {
if (!window.testRunner || !window.internals)
return;
- var img = new Image();
- img.onload = runRepaintTest;
- img.src = "resources/animated.gif";
+ runAfterLayoutAndPaint(function() {
+ internals.startTrackingRepaints(document);
+ // Wait a while to let the animated gif advance frames.
+ setTimeout(finish, 300);
+ });
}
+
</script>
</head>
<body onload="start()">
<div id="test1">
- <div class="parent">
+ <div id="target1" class="parent">
<div class="child">
</div>
</div>
</div>
<div id="test2">
- <div class="parent">
+ <div id="target2" class="parent">
<div class="child">
</div>
</div>
</div>
<div id="test3">
- <img src="resources/apple.jpg">
+ <img id="target3" src="resources/apple.jpg">
</div>
<div id="test4">
- <div class="parent">
+ <div id="target4" class="parent">
<a>
<div></div>
<div>
@@ -90,5 +122,6 @@
</a>
</div>
</div>
+<pre id="output"></pre>
</body>
</html>
« 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