Chromium Code Reviews| Index: Source/core/rendering/RenderBox.cpp |
| diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
| index 6888e7414ac5bfae5e8e208e300fa0d4aed80015..96e748845c4494b1d04def40fe6948bdac382366 100644 |
| --- a/Source/core/rendering/RenderBox.cpp |
| +++ b/Source/core/rendering/RenderBox.cpp |
| @@ -142,12 +142,7 @@ void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl |
| { |
| RenderStyle* oldStyle = style(); |
| if (oldStyle) { |
| - // The background of the root element or the body element could propagate up to |
| - // the canvas. Just dirty the entire canvas when our style changes substantially. |
| - if ((diff.needsRepaint() || diff.needsLayout()) && node() |
| - && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { |
| - view()->paintInvalidationForWholeRenderer(); |
| - |
| + if ((diff.needsRepaint() || diff.needsLayout()) && backgroundCanBleedToCanvas()) { |
| if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFixedBackground()) |
| view()->compositor()->setNeedsUpdateFixedBackground(); |
| } |
| @@ -163,10 +158,6 @@ void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl |
| if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlowPosition()) |
| removeFloatingOrPositionedChildFromBlockLists(); |
| } |
| - // FIXME: This branch runs when !oldStyle, which means that layout was never called |
| - // so what's the point in invalidating the whole view that we never painted? |
| - } else if (isBody()) { |
| - view()->paintInvalidationForWholeRenderer(); |
| } |
| RenderBoxModelObject::styleWillChange(diff, newStyle); |
| @@ -1961,6 +1952,13 @@ LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM |
| if (style()->visibility() != VISIBLE && enclosingLayer()->subtreeIsInvisible()) |
| return LayoutRect(); |
| + // If we have a background that could bleed into the canvas, just return |
| + // the viewport's rectangle. This works as only body and the document |
| + // element's renderer can bleed into the viewport so we are guaranteed |
| + // to be in the RenderView's coordinate space. |
| + if (style()->hasBackground() && backgroundCanBleedToCanvas()) |
| + return view()->viewRect(); |
|
dsinclair
2014/07/21 19:32:28
Should we add an ASSERT here just to be safe that
Julien - ping for review
2014/07/21 20:33:33
I don't think that would give us much as that's th
|
| + |
| LayoutRect r = visualOverflowRect(); |
| mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, false /*fixed*/, paintInvalidationState); |
| return r; |