Commit 64135db5 authored by leviw@chromium.org's avatar leviw@chromium.org

Fix repainting of composited RenderViews

Blink r175423 fixed non-composited nested RenderView repainting
for repaint-after-layout, but in the process broke repainting of
composited nested RenderViews for all code paths. The fix is to
correctly issue repaints to the backing store of composited
RenderViews regardless of whether they're nested.

BUG=381022
R=esprehn@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175718 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1ae7e004
(GraphicsLayer
(bounds 300.00 516.00)
(children 1
(GraphicsLayer
(bounds 300.00 516.00)
(contentsOpaque 1)
(drawsContent 1)
(children 1
(GraphicsLayer
(position 8.00 8.00)
(bounds 284.00 500.00)
(drawsContent 1)
)
)
)
)
)
<!DOCTYPE html>
<html style='overflow:hidden'>
<body style='overflow:hidden'>
<iframe src="resources/composited-iframe-scroll-repaint-iframe.html">
<!DOCTYPE html>
<html style="background-color:#eeeeee; overflow:hidden">
<script src="text-based-repaint.js"></script>
<script>
function repaintTest() {
document.documentElement.scrollTop = 20;
}
</script>
<body onload="runRepaintTest()" style="transform: translateZ(0);">
<div style="height:500px">
...@@ -460,32 +460,31 @@ void RenderView::invalidateTreeAfterLayout(const RenderLayerModelObject& paintIn ...@@ -460,32 +460,31 @@ void RenderView::invalidateTreeAfterLayout(const RenderLayerModelObject& paintIn
RenderBlock::invalidateTreeAfterLayout(paintInvalidationContainer); RenderBlock::invalidateTreeAfterLayout(paintInvalidationContainer);
} }
void RenderView::repaintViewRectangle(const LayoutRect& ur) const void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const
{ {
ASSERT(!ur.isEmpty()); ASSERT(!repaintRect.isEmpty());
if (document().printing() || !m_frameView) if (document().printing() || !m_frameView)
return; return;
// We always just invalidate the root view, since we could be an iframe that is clipped out // We always just invalidate the root view, since we could be an iframe that is clipped out
// or even invisible. // or even invisible.
Element* elt = document().ownerElement(); Element* owner = document().ownerElement();
if (!elt) { if (layer()->compositingState() == PaintsIntoOwnBacking) {
if (hasLayer() && layer()->compositingState() == PaintsIntoOwnBacking) layer()->repainter().setBackingNeedsRepaintInRect(repaintRect);
layer()->repainter().setBackingNeedsRepaintInRect(ur); } else if (!owner) {
else m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(repaintRect));
m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(ur)); } else if (RenderBox* obj = owner->renderBox()) {
} else if (RenderBox* obj = elt->renderBox()) { LayoutRect viewRectangle = viewRect();
LayoutRect vr = viewRect(); LayoutRect rectToRepaint = intersection(repaintRect, viewRectangle);
LayoutRect r = intersection(ur, vr);
// Subtract out the contentsX and contentsY offsets to get our coords within the viewing // Subtract out the contentsX and contentsY offsets to get our coords within the viewing
// rectangle. // rectangle.
r.moveBy(-vr.location()); rectToRepaint.moveBy(-viewRectangle.location());
// FIXME: Hardcoded offsets here are not good. // FIXME: Hardcoded offsets here are not good.
r.moveBy(obj->contentBoxRect().location()); rectToRepaint.moveBy(obj->contentBoxRect().location());
obj->repaintRectangle(r); obj->repaintRectangle(rectToRepaint);
} }
} }
......
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