Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| index ebe400f573dabc4f76ab52aa00f487e94387c851..b814b3676dddf8ee7e61c1f7e99306762b8b6c91 100644 |
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| @@ -176,7 +176,8 @@ CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) |
| m_isMainFrameLayoutViewLayer(false), |
| m_backgroundLayerPaintsFixedRootBackground(false), |
| m_scrollingContentsAreEmpty(false), |
| - m_backgroundPaintsOntoScrollingContentsLayer(false) { |
| + m_backgroundPaintsOntoScrollingContentsLayer(false), |
| + m_backgroundPaintsOntoGraphicsLayer(true) { |
|
chrishtr
2016/11/17 20:55:39
false
flackr
2016/11/17 23:38:00
Done.
|
| if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame()) |
| m_isMainFrameLayoutViewLayer = true; |
| @@ -361,8 +362,10 @@ void CompositedLayerMapping:: |
| // We can only paint the background onto the scrolling contents layer if |
| // it would be visually correct and we are using composited scrolling meaning |
| // we have a scrolling contents layer to paint it into. |
| + BackgroundPaintLocation paintLocation = |
| + m_owningLayer.backgroundPaintLocation(); |
| bool shouldPaintOntoScrollingContentsLayer = |
| - m_owningLayer.canPaintBackgroundOntoScrollingContentsLayer() && |
| + paintLocation & BackgroundPaintInScrollingContents && |
| m_owningLayer.getScrollableArea()->usesCompositedScrolling(); |
| if (shouldPaintOntoScrollingContentsLayer != |
| backgroundPaintsOntoScrollingContentsLayer()) { |
| @@ -375,6 +378,9 @@ void CompositedLayerMapping:: |
| if (hasScrollingLayer() && !shouldPaintOntoScrollingContentsLayer) |
| m_scrollingContentsLayer->setNeedsDisplay(); |
| } |
| + m_backgroundPaintsOntoGraphicsLayer = |
| + !m_backgroundPaintsOntoScrollingContentsLayer || |
| + paintLocation & BackgroundPaintInGraphicsLayer; |
| } |
| void CompositedLayerMapping::updateContentsOpaque() { |
| @@ -408,10 +414,17 @@ void CompositedLayerMapping::updateContentsOpaque() { |
| m_owningLayer.backgroundIsKnownToBeOpaqueInRect( |
| toLayoutBox(layoutObject())->paddingBoxRect())); |
| - // When we paint the background onto the scrolling contents layer we are |
| - // going to leave a hole in the m_graphicsLayer where the background is so |
| - // it is not opaque. |
| - m_graphicsLayer->setContentsOpaque(false); |
| + if (m_owningLayer.backgroundPaintLocation() & |
| + BackgroundPaintInGraphicsLayer) { |
| + m_graphicsLayer->setContentsOpaque( |
| + m_owningLayer.backgroundIsKnownToBeOpaqueInRect( |
| + compositedBounds())); |
| + } else { |
| + // If we only paint the background onto the scrolling contents layer we |
| + // are going to leave a hole in the m_graphicsLayer where the background |
| + // is so it is not opaque. |
| + m_graphicsLayer->setContentsOpaque(false); |
| + } |
| } else { |
| if (hasScrollingLayer()) |
| m_scrollingContentsLayer->setContentsOpaque(false); |
| @@ -2977,7 +2990,7 @@ void CompositedLayerMapping::paintContents( |
| if (paintRootBackgroundOntoScrollingContentsLayer) { |
| if (graphicsLayer == m_scrollingContentsLayer.get()) |
| paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; |
| - else |
| + else if (!m_backgroundPaintsOntoGraphicsLayer) |
| paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
| } |
| GraphicsLayerPaintInfo paintInfo; |