Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2511893002: Paint solid color background into both scrolling contents layer and graphics layer. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698