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 c0818175026a76d87c86744541c6ad4b8ad425d8..e80a003d02f94cb49fb7d58cc62fac133a86ee97 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
@@ -309,8 +309,16 @@ void CompositedLayerMapping::updateContentsOpaque() |
m_graphicsLayer->setContentsOpaque(false); |
m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
} else { |
- // For non-root layers, background is always painted by the primary graphics layer. |
- m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
+ const bool backgroundOpaque = m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()); |
+ // Whether or not the background is painted into the primary graphics layer, it will be |
+ // entirely occluded by an opaque background. |
+ m_graphicsLayer->setContentsOpaque(backgroundOpaque); |
+ |
+ // For non-root layers, background is painted by the scrolling contents layer if all backgrounds |
+ // are solid color or background attachment local, otherwise background is painted by |
+ // the primary graphics layer. |
+ if (hasScrollingLayer() && m_owningLayer.shouldPaintBackgroundOntoForeground()) |
+ m_scrollingContentsLayer->setContentsOpaque(backgroundOpaque); |
} |
} |