Commit 2b9b9675 authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Issue repaints when offsetFromRenderer changes for any squashed layer.

This is necessary because the coordinate system of the squashing layer may change
w.r.t. a squashed layer, even if the squashed layer's layout position did not change.
For example, a new layer may be added to a squashing layer that expands its bouds to the top
or left.

BUG=383779

Review URL: https://codereview.chromium.org/331693004

git-svn-id: svn://svn.chromium.org/blink/trunk@176087 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 11b7087b
......@@ -124,6 +124,7 @@ CASE 4, overlap1 gets removed:
(drawsContent 1)
(repaint rects
(rect 0.00 0.00 100.00 100.00)
(rect 0.00 0.00 100.00 100.00)
)
)
)
......
(GraphicsLayer
(bounds 800.00 600.00)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(contentsOpaque 1)
(drawsContent 1)
(children 1
(GraphicsLayer
(children 2
(GraphicsLayer
(position 8.00 8.00)
(bounds 500.00 500.00)
)
(GraphicsLayer
(position 55.00 55.00)
(bounds 500.00 500.00)
(drawsContent 1)
(repaint rects
(rect 55.00 55.00 500.00 500.00)
(rect 0.00 0.00 500.00 500.00)
(rect 0.00 0.00 50.00 50.00)
)
)
)
)
)
)
)
)
<!doctype html>
<script src="../../resources/run-after-display.js"></script>
<!-- The second two divs form a combined squashing layer. display:none'ing the first of them will resize the squashing layer. -->
<div style="width: 500px; height: 500px; -webkit-transform: translateZ(0)"></div>
<div style="position: absolute; top: 55px; left: 55px; width: 500px; height: 500px; background-color: lightblue"></div>
<div id="to-be-removed" style="position: absolute; top: 0px; left: 0px; width: 50px; height: 50px; background-color: lightgray"></div>
<pre id="output" style="display: none"></pre>
<script>
// This test checks that resizing a squashing layer such that the offset of content squashed into it relative to the squashing
// container causes a repaint of its bounds within the updated squashing layer geometry.
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
if (window.internals)
internals.settings.setLayerSquashingEnabled(true);
runAfterDisplay(function() {
if (window.internals)
window.internals.startTrackingRepaints(document);
document.querySelector("#to-be-removed").style.display = 'none';
var output = document.querySelector("#output");
if (window.internals) {
output.textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
window.internals.stopTrackingRepaints(document);
}
output.style.display = 'block';
if (window.testRunner)
testRunner.notifyDone();
});
</script>
\ No newline at end of file
......@@ -577,7 +577,13 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
for (size_t i = 0; i < layers.size(); ++i) {
LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].renderLayer->computeOffsetFromTransformedAncestor();
LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInOwningLayerSpace;
layers[i].offsetFromRenderer = -flooredIntSize(offsetFromSquashLayerOrigin);
// It is ok to repaint here, because all of the geometry needed to correctly repaint is computed by this point.
IntSize newOffsetFromRenderer = -flooredIntSize(offsetFromSquashLayerOrigin);
if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != newOffsetFromRenderer)
layers[i].renderLayer->repainter().repaintIncludingNonCompositingDescendants();
layers[i].offsetFromRenderer = newOffsetFromRenderer;
layers[i].offsetFromRendererSet = true;
layers[i].renderLayer->setSubpixelAccumulation(offsetFromSquashLayerOrigin.fraction());
ASSERT(layers[i].renderLayer->subpixelAccumulation() ==
......@@ -586,7 +592,6 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
// FIXME: find a better design to avoid this redundant value - most likely it will make
// sense to move the paint task info into RenderLayer's m_compositingProperties.
layers[i].renderLayer->setOffsetFromSquashingLayerOrigin(layers[i].offsetFromRenderer);
}
for (size_t i = 0; i < layers.size(); ++i)
......
......@@ -48,12 +48,16 @@ struct GraphicsLayerPaintInfo {
// Offset describing where this squashed RenderLayer paints into the shared GraphicsLayer backing.
IntSize offsetFromRenderer;
bool offsetFromRendererSet;
LayoutSize subpixelAccumulation;
GraphicsLayerPaintingPhase paintingPhase;
bool isBackgroundLayer;
GraphicsLayerPaintInfo() : renderLayer(0), offsetFromRendererSet(false), isBackgroundLayer(false) { }
bool isEquivalentForSquashing(const GraphicsLayerPaintInfo& other)
{
// FIXME: offsetFromRenderer and compositedBounds should not be checked here, because
......
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