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

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

Issue 2353623004: Only paint the background onto the scrolling contents layer if we have a scrolling contents layer. (Closed)
Patch Set: Use local background on test. Created 4 years, 3 months 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
index 2328a074e1ea273a7cefc507a184623829d9ce95..5ce3dac5dae1aa93c4f6941a06b366b0148489f1 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -45,10 +45,10 @@ protected:
return graphicsLayer->m_previousInterestRect;
}
- bool shouldPaintBackgroundOntoScrollingContentsLayer(const char* elementId)
+ bool canPaintBackgroundOntoScrollingContentsLayer(const char* elementId)
{
CompositedLayerMapping* mapping = toLayoutBlock(getLayoutObjectByElementId(elementId))->layer()->compositedLayerMapping();
- return mapping->shouldPaintBackgroundOntoScrollingContentsLayer();
+ return mapping->canPaintBackgroundOntoScrollingContentsLayer();
}
private:
@@ -650,13 +650,32 @@ TEST_F(CompositedLayerMappingTest, ShouldPaintBackgroundOntoScrollingContentsLay
);
// First scroller cannot paint background into scrolling contents layer because it has a negative z-index child.
- EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1"));
+ EXPECT_FALSE(canPaintBackgroundOntoScrollingContentsLayer("scroller1"));
// Second scroller cannot paint background into scrolling contents layer because it has a content-box clip without local attachment.
- EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller2"));
+ EXPECT_FALSE(canPaintBackgroundOntoScrollingContentsLayer("scroller2"));
// Third scroller can paint background into scrolling contents layer.
- EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3"));
+ EXPECT_TRUE(canPaintBackgroundOntoScrollingContentsLayer("scroller3"));
+}
+
+TEST_F(CompositedLayerMappingTest, BackgroundPaintedIntoGraphicsLayerIfNotCompositedScrolling)
+{
+ document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
+ setBodyInnerHTML(
+ "<div id='container' style='overflow: scroll; width: 300px; height: 300px; border-radius: 5px; background: white local; will-change: transform;'>"
+ " <div style='background-color: blue; width: 2000px; height: 2000px;'></div>"
+ "</div>");
+
+ PaintLayer* layer = toLayoutBlock(getLayoutObjectByElementId("container"))->layer();
+ EXPECT_TRUE(canPaintBackgroundOntoScrollingContentsLayer("container"));
+
+ // We currently don't use composited scrolling when the container has a border-radius
+ // so even though we can paint the background onto the scrolling contents layer we
+ // don't have a scrolling contents layer to paint into in this case.
+ CompositedLayerMapping* mapping = layer->compositedLayerMapping();
+ EXPECT_FALSE(mapping->hasScrollingLayer());
+ EXPECT_FALSE(mapping->backgroundPaintsOntoScrollingContentsLayer());
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698