Remove 2 calls to paintInvalidationForWholeRenderer

These calls were needed as we can make the body or the
document element's background bleed into the canvas (ie
replacing the FrameView's background). However the logic
was working around the fact that
clippedOverflowRectForPaintInvalidation didn't account for
the previous cases.

The whole logic works as the 2 renderers where this happens
share the same coordinate space as the viewport. The tests
are all invalidating as much, we just got rid of some stray
invalidations.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@178605 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 325e42fe
......@@ -1256,6 +1256,10 @@ crbug.com/30536 [ Win ] http/tests/encoding/meta-switch-mid-parse-with-title.htm
crbug.com/30536 [ Win ] http/tests/htmlimports/csp-import-block-but-domain-nested.html [ Timeout Pass ]
crbug.com/30536 [ Win ] http/tests/ssl/referer-301.html [ Timeout Pass ]
Bug(jchaffraix) fast/repaint/body-background-image.html [ NeedsRebaseline ]
Bug(jchaffraix) fast/repaint/overflow-scroll-body-appear.html [ NeedsRebaseline ]
Bug(jchaffraix) fast/repaint/positioned-document-element.html [ NeedsRebaseline ]
crbug.com/390204 [ Release ] inspector/console/console-viewport-selection.html [ Pass Failure ]
crbug.com/390204 [ Debug ] inspector/console/console-viewport-selection.html [ Pass Failure Slow ]
crbug.com/394208 [ Win ] http/tests/security/link-crossorigin-stylesheet-use-credentials.html [ Timeout Pass ]
......
......@@ -10,9 +10,8 @@
[138, 88, 606, 512],
[138, 88, 606, 56],
[8, 8, 866, 592],
[8, 8, 866, 592],
[8, 8, 866, 216],
[8, 8, 866, 216]
[0, 0, 800, 600]
]
}
]
......
......@@ -6,7 +6,6 @@
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[50, 50, 700, 500],
[0, 0, 800, 600]
]
}
......
......@@ -7,6 +7,7 @@
"drawsContent": true,
"repaintRects": [
[0, 200, 200, 100],
[0, 0, 200, 200],
[0, 0, 200, 200]
]
}
......
......@@ -6,8 +6,7 @@
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[8, 240, 784, 288],
[8, 240, 784, 288],
[0, 0, 800, 600],
[0, 0, 800, 600]
]
}
......
......@@ -8,7 +8,6 @@
"repaintRects": [
[0, 0, 2008, 2096],
[0, 0, 2008, 2096],
[0, 0, 800, 600],
[0, 0, 785, 585]
]
}
......
......@@ -8,12 +8,10 @@
"repaintRects": [
[108, 116, 403, 20],
[108, 116, 403, 20],
[100, 100, 419, 52],
[8, 16, 784, 20],
[8, 16, 784, 20],
[0, 0, 800, 600],
[0, 0, 800, 52],
[0, 0, 800, 52]
[0, 0, 800, 600]
]
}
]
......
......@@ -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();
LayoutRect r = visualOverflowRect();
mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, false /*fixed*/, paintInvalidationState);
return r;
......
......@@ -389,6 +389,9 @@ public:
virtual bool isVideo() const { return false; }
virtual bool isWidget() const { return false; }
// The background of the root element or the body element could propagate up to the canvas.
bool backgroundCanBleedToCanvas() const { return isBody() || isDocumentElement(); }
bool isDocumentElement() const { return document().documentElement() == m_node; }
// isBody is called from RenderBox::styleWillChange and is thus quite hot.
bool isBody() const { return node() && node()->hasTagName(HTMLNames::bodyTag); }
......
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