Commit 3bb8abd4 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Fix compositing/overflow/do-not-repaint-if-scrolling-composited-layers.html

The test was broken because of changed layer tree dump format.
Updated according to the current format and composited scrolling
behavior.

Bug: 639427
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Icc051f653baca28de6e4c4094525bd4efd4eb2de
Reviewed-on: https://chromium-review.googlesource.com/726974Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510104}
parent c3815b3c
...@@ -939,6 +939,7 @@ Bug(none) paint/invalidation/svg/use-clipped-hit.svg [ Failure ] ...@@ -939,6 +939,7 @@ Bug(none) paint/invalidation/svg/use-clipped-hit.svg [ Failure ]
Bug(none) paint/invalidation/svg/zoom-coords-viewattr-01-b.svg [ Failure ] Bug(none) paint/invalidation/svg/zoom-coords-viewattr-01-b.svg [ Failure ]
# Extra raster invalidations. # Extra raster invalidations.
Bug(none) compositing/overflow/do-not-repaint-if-scrolling-composited-layers.html [ Failure ]
Bug(none) paint/invalidation/compositing/clipping-should-not-repaint-composited-descendants.html [ Failure ] Bug(none) paint/invalidation/compositing/clipping-should-not-repaint-composited-descendants.html [ Failure ]
Bug(none) paint/invalidation/compositing/fixed-scroll-in-empty-root-layer.html [ Failure ] Bug(none) paint/invalidation/compositing/fixed-scroll-in-empty-root-layer.html [ Failure ]
Bug(none) paint/invalidation/compositing/resize-repaint.html [ Failure ] Bug(none) paint/invalidation/compositing/resize-repaint.html [ Failure ]
......
Overflow scroll:
PASS did not repaint when unexpected
Overflow scroll with selection:
PASS did not repaint when unexpected
Marquee:
PASS did not repaint when unexpected
Overflow scroll with inline child:
PASS did not repaint when unexpected
Overflow hidden:
PASS repainted when expected PASS repainted when expected
FAIL did not repaint when expected
PASS repainted when expected
PASS did not repaint as expected
FAIL did not repaint when expected
...@@ -8,145 +8,98 @@ ...@@ -8,145 +8,98 @@
if (window.internals) if (window.internals)
window.internals.settings.setPreferCompositingToLCDTextEnabled(false); window.internals.settings.setPreferCompositingToLCDTextEnabled(false);
function hasScrollbarRepaint(layerTree) function hasRepaint(layerTree) {
{ var layers = JSON.parse(layerTree).layers;
return hasScrollbarRepaintHelper(JSON.parse(layerTree)); for (var i = 0; i < layers.length; ++i) {
} var layer = layers[i];
// Exclude repaint in the vertical scrollbar layer which always happens on scroll.
function hasScrollbarRepaintHelper(jsonLayerTree) { if (layer.name == "Vertical Scrollbar Layer")
var repaintRects = jsonLayerTree["repaintRects"]; continue;
if (repaintRects) { if (layer.paintInvalidations)
for (var i = 0; i < repaintRects.length; ++i) {
var width = repaintRects[i][2];
var height = repaintRects[i][3];
if (width != 15 || height != 285)
return true; return true;
} }
}
var children = jsonLayerTree["children"];
if (children) {
for (var i = 0; i < children.length; i++) {
if (hasScrollbarRepaintHelper(children[i]))
return true;
}
}
return false; return false;
} }
function testRepaint() { function testScrollRepaint(description, expectsRepaint, scroller) {
var result = ""; var result = description + ":\n";
for (var testIteration = 0; testIteration < 3; ++testIteration) {
// In all but the marquee case, we should opt into composited scrolling
// and should not repaint.
var expected_results = [false, true, false];
var container = document.getElementById("container");
var marquee = document.getElementById("marquee");
var span = document.getElementById("span");
var toScroll = container;
if (testIteration == 0) {
var selection = getSelection();
var range = document.createRange();
range.selectNode(document.getElementById("selection-start"));
selection.addRange(range);
range = document.createRange();
range.selectNode(document.getElementById("selection-end"));
selection.addRange(range);
} else if (testIteration == 1) {
marquee.style.display = "block";
toScroll = marquee;
} else {
span.style.display = "inline";
}
document.body.offsetTop; document.body.offsetTop;
if (window.internals) if (window.internals)
window.internals.startTrackingRepaints(document); window.internals.startTrackingRepaints(document);
toScroll.scrollTop = 100; scroller.scrollTop = 100;
if (window.internals) { if (window.internals) {
if (hasScrollbarRepaint(window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS)) == expected_results[testIteration]) var layer_tree = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS);
result += "PASS repainted when expected\n"; var repainted = hasRepaint(layer_tree);
var repaintedMessage = repainted ? "repainted" : "did not repaint";
var expectedMessage = expectsRepaint ? " when expected" : " when unexpected";
if (repainted == expectsRepaint)
result += "PASS " + repaintedMessage + expectedMessage + "\n";
else else
result += "FAIL did not repaint when expected\n"; result += "FAIL " + repaintedMessage + expectedMessage + "\n" + layer_tree + "\n";
window.internals.stopTrackingRepaints(document); window.internals.stopTrackingRepaints(document);
} }
// Do all cleanup here (so as not to affect repaint rects). // Do all cleanup here (so as not to affect repaint rects).
toScroll.scrollTop = 0; scroller.scrollTop = 0;
span.style.display = "none";
marquee.style.display = "none";
getSelection().removeAllRanges();
}
return result; return result;
} }
function testNoRepaint() { function testNoRepaint() {
var result = ""; return testScrollRepaint("Overflow scroll", false, container);
var container = document.getElementById("container"); }
document.body.offsetTop; function testWithSelection() {
var selection = getSelection();
if (window.internals) var range = document.createRange();
window.internals.startTrackingRepaints(document); range.selectNode(document.getElementById("selection-start"));
selection.addRange(range);
container.scrollTop = 100; range = document.createRange();
range.selectNode(document.getElementById("selection-end"));
selection.addRange(range);
if (window.internals) { var result = testScrollRepaint("Overflow scroll with selection", false, container);
if (!hasScrollbarRepaint(window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS)))
result += "PASS did not repaint as expected\n"; getSelection().removeAllRanges();
else return result;
result += "FAIL repainted when unexpected\n";
window.internals.stopTrackingRepaints(document);
} }
container.scrollTop = 0; function testMarquee() {
container.style.display = "none";
marquee.style.display = "block";
var result = testScrollRepaint("Marquee", false, marquee);
marquee.style.display = "none";
container.style.display = "block";
return result;
}
function testWithInlineChild() {
span.style.display = "inline";
var result = testScrollRepaint("Overflow scroll with inline child", false, container);
span.style.display = "none";
return result; return result;
} }
function testOverflowHidden() { function testOverflowHidden() {
var result = "";
var container = document.getElementById("container");
container.style.overflow = "hidden"; container.style.overflow = "hidden";
document.body.offsetTop; var result = testScrollRepaint("Overflow hidden", true, container);
container.style.overflow = "scroll";
if (window.internals)
window.internals.startTrackingRepaints(document);
container.scrollTop = 100;
if (window.internals) {
if (hasScrollbarRepaint(window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_PAINT_INVALIDATIONS)))
result += "PASS repainted when expected\n";
else
result += "FAIL did not repaint when expected\n";
window.internals.stopTrackingRepaints(document);
}
container.scrollTop = 0;
return result; return result;
} }
function doTests() { function doTests() {
var marquee = document.getElementById("marquee");
marquee.stop(); marquee.stop();
var result = testRepaint(); var result = testNoRepaint();
result += testNoRepaint(); result += testWithSelection();
result += testMarquee();
result += testWithInlineChild();
result += testOverflowHidden(); result += testOverflowHidden();
var pre = document.createElement('pre'); if (window.testRunner)
document.body.appendChild(pre); testRunner.setCustomTextOutput(result);
pre.innerHTML = result;
if (!window.internals)
document.getElementById("description").style.display = "block";
} }
window.onload = doTests; window.onload = doTests;
...@@ -195,6 +148,7 @@ ...@@ -195,6 +148,7 @@
height: 60px; height: 60px;
backface-visibility: hidden; backface-visibility: hidden;
position: relative; position: relative;
display: none;
} }
</style> </style>
</head> </head>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment