Commit 5a28ce53 authored by schenney's avatar schenney Committed by Commit bot

Remove unnecessary checks in PaintLayer::backgroundIsKnownToBeOpaqueInRect

The PaintLayer::backgroundIsKnownToBeOpaque method is currently
only called by GraphicsLayers on their owning paint layer, or
by the recursive child call. The former is by definition
always called on a self painting layer, while the latter
already has a test to prevent consideration of layers that
do not paint into the backing in question. Hence we can
remove the check for self painting layer status.

These checks cause chicken-and-egg problems when the method
is called by the layer itself in order to identify compositing
reasons. In such cases we are not concerned with self layer
status; we are in fact trying to determine that status.

This is a relanding of issue 2297873002 at patchset 140001
(http://crrev.com/2297873002#ps140001) without the DCHECK that was in the that patch.

R=chrishtr@chromium.org
BUG=381840
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2320713002
Cr-Commit-Position: refs/heads/master@{#417002}
parent 8b54987d
...@@ -2407,9 +2407,6 @@ bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const ...@@ -2407,9 +2407,6 @@ bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const
bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
{ {
if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
return false;
if (paintsWithTransparency(GlobalPaintNormalPhase)) if (paintsWithTransparency(GlobalPaintNormalPhase))
return false; return false;
...@@ -2425,14 +2422,15 @@ bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) ...@@ -2425,14 +2422,15 @@ bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
if (paintsWithTransform(GlobalPaintNormalPhase)) if (paintsWithTransform(GlobalPaintNormalPhase))
return false; return false;
// FIXME: Remove this check.
// This function should not be called when layer-lists are dirty. // This function should not be called when layer-lists are dirty.
// It is somehow getting triggered during style update. // TODO(schenney) This check never hits in layout tests or most platforms, but does hit in
// PopupBlockerBrowserTest.AllowPopupThroughContentSetting on Win 7 Test Builder.
if (m_stackingNode->zOrderListsDirty()) if (m_stackingNode->zOrderListsDirty())
return false; return false;
// FIXME: We currently only check the immediate layoutObject, // FIXME: We currently only check the immediate layoutObject,
// which will miss many cases. // which will miss many cases where additional layout objects paint
// into this layer.
if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect))
return true; return true;
...@@ -2441,13 +2439,17 @@ bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) ...@@ -2441,13 +2439,17 @@ bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
if (layoutObject()->hasClipRelatedProperty()) if (layoutObject()->hasClipRelatedProperty())
return false; return false;
// TODO(schenney): This could be improved by unioning the opaque regions of all the children.
// That would require a refactoring because currently children just check they at least
// cover the given rect, but a unioning method would require children to compute and report
// their rects.
return childBackgroundIsKnownToBeOpaqueInRect(localRect); return childBackgroundIsKnownToBeOpaqueInRect(localRect);
} }
bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
{ {
PaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, PositiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); PaintLayerStackingNodeReverseIterator reverseIterator(*m_stackingNode, PositiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren);
while (PaintLayerStackingNode* child = revertseIterator.next()) { while (PaintLayerStackingNode* child = reverseIterator.next()) {
const PaintLayer* childLayer = child->layer(); const PaintLayer* childLayer = child->layer();
// Stop at composited paint boundaries. // Stop at composited paint boundaries.
if (childLayer->isPaintInvalidationContainer()) if (childLayer->isPaintInvalidationContainer())
......
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