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

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

Issue 1407383005: Fix flattening for scrollable areas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years 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/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 283be2ff23491f030cce8f7b135386aade40d5b0..c6deda04fb893d0e326f537506141b1f85540458 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -34,6 +34,11 @@ protected:
return compositedLayerMapping->computeInterestRect(graphicsLayer, previousInterestRect);
}
+ bool shouldFlattenTransform(const GraphicsLayer& layer) const
+ {
+ return layer.shouldFlattenTransform();
+ }
+
bool interestRectChangedEnoughToRepaint(const IntRect& previousInterestRect, const IntRect& newInterestRect, const IntSize& layerSize)
{
return CompositedLayerMapping::interestRectChangedEnoughToRepaint(previousInterestRect, newInterestRect, layerSize);
@@ -264,6 +269,25 @@ TEST_F(CompositedLayerMappingTest, ClippingMaskLayer)
EXPECT_FALSE(graphicsLayer->contentsClippingMaskLayer());
}
+TEST_F(CompositedLayerMappingTest, ScrollContentsFlattenForScroller)
+{
+ setBodyInnerHTML(
+ "<style>div::-webkit-scrollbar{ width: 5px; }</style>"
+ "<div id='scroller' style='width: 100px; height: 100px; overflow: scroll; will-change: transform'>"
+ "<div style='width: 1000px; height: 1000px;'>Foo</div>Foo</div>");
+
+ document().view()->updateAllLifecyclePhases();
+ Element* element = document().getElementById("scroller");
+ PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
+ CompositedLayerMapping* compositedLayerMapping = paintLayer->compositedLayerMapping();
+
+ ASSERT_TRUE(compositedLayerMapping);
+
+ EXPECT_FALSE(shouldFlattenTransform(*compositedLayerMapping->mainGraphicsLayer()));
+ EXPECT_FALSE(shouldFlattenTransform(*compositedLayerMapping->scrollingLayer()));
+ EXPECT_TRUE(shouldFlattenTransform(*compositedLayerMapping->scrollingContentsLayer()));
+}
+
TEST_F(CompositedLayerMappingTest, InterestRectChangedEnoughToRepaintEmpty)
{
IntSize layerSize(1000, 1000);

Powered by Google App Engine
This is Rietveld 408576698