Index: third_party/WebKit/Source/web/tests/RootScrollerTest.cpp |
diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp |
index 8a75f24ef34a273c65fd24b965cb2c0deef5b40f..a90ecc8c0ea6a2658ec4c3f9073bf82cbcba5a3c 100644 |
--- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp |
@@ -742,194 +742,6 @@ TEST_F(RootScrollerTest, RemoteMainFrame) { |
m_helper.reset(); |
} |
-GraphicsLayer* scrollingLayer(LayoutView& layoutView) { |
- if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
- return layoutView.layer()->compositedLayerMapping()->scrollingLayer(); |
- return layoutView.compositor()->rootContentLayer(); |
-} |
- |
-// Tests that clipping layers belonging to any compositors in the ancestor chain |
-// of the global root scroller have their masking bit removed. |
-TEST_F(RootScrollerTest, RemoveClippingOnCompositorLayers) { |
- initialize("root-scroller-iframe.html"); |
- |
- HTMLFrameOwnerElement* iframe = toHTMLFrameOwnerElement( |
- mainFrame()->document()->getElementById("iframe")); |
- Element* container = iframe->contentDocument()->getElementById("container"); |
- |
- RootScrollerController& mainController = |
- mainFrame()->document()->rootScrollerController(); |
- RootScrollerController& childController = |
- iframe->contentDocument()->rootScrollerController(); |
- TopDocumentRootScrollerController& globalController = |
- page().globalRootScrollerController(); |
- |
- LayoutView* mainLayoutView = mainFrameView()->layoutView(); |
- LayoutView* childLayoutView = iframe->contentDocument()->layoutView(); |
- PaintLayerCompositor* mainCompositor = mainLayoutView->compositor(); |
- PaintLayerCompositor* childCompositor = childLayoutView->compositor(); |
- |
- NonThrowableExceptionState nonThrow; |
- |
- // No root scroller set, on the main frame the root content layer should |
- // clip. Additionally, on the child frame, the overflow controls host and |
- // container layers should also clip. |
- { |
- EXPECT_TRUE( |
- scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- |
- EXPECT_TRUE( |
- scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_TRUE( |
- childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_TRUE( |
- childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- } |
- |
- // Now set the root scrollers such that the container in the iframe is the |
- // global root scroller. All the previously clipping layers in both paint |
- // layer compositors should no longer clip. |
- { |
- iframe->contentDocument()->setRootScroller(container, nonThrow); |
- mainFrame()->document()->setRootScroller(iframe, nonThrow); |
- mainFrameView()->updateAllLifecyclePhases(); |
- |
- ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); |
- ASSERT_EQ(container, &childController.effectiveRootScroller()); |
- |
- EXPECT_FALSE( |
- scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- |
- EXPECT_FALSE( |
- scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- } |
- |
- // Now reset the iframe's root scroller. Since the iframe itself is now the |
- // global root scroller we want it to behave as if it were the main frame, |
- // which means it should clip only on its root content layer. |
- { |
- iframe->contentDocument()->setRootScroller(nullptr, nonThrow); |
- mainFrameView()->updateAllLifecyclePhases(); |
- |
- ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); |
- ASSERT_EQ(iframe->contentDocument(), |
- &childController.effectiveRootScroller()); |
- ASSERT_EQ(iframe->contentDocument()->documentElement(), |
- globalController.globalRootScroller()); |
- |
- EXPECT_FALSE( |
- scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- |
- EXPECT_TRUE( |
- scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- } |
- |
- // Now reset the main frame's root scroller. Its compositor should go back |
- // to clipping as well. Because the iframe is now no longer the global root |
- // scroller, it should go back to clipping its overflow host and container |
- // layers. This checks that we invalidate the compositing state even though |
- // the iframe's effective root scroller hasn't changed. |
- |
- { |
- mainFrame()->document()->setRootScroller(nullptr, nonThrow); |
- mainFrameView()->updateAllLifecyclePhases(); |
- |
- ASSERT_EQ(mainFrame()->document(), &mainController.effectiveRootScroller()); |
- ASSERT_EQ(iframe->contentDocument(), |
- &childController.effectiveRootScroller()); |
- ASSERT_EQ(mainFrame()->document()->documentElement(), |
- globalController.globalRootScroller()); |
- |
- EXPECT_TRUE( |
- scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- |
- EXPECT_TRUE( |
- scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_TRUE( |
- childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_TRUE( |
- childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- } |
- |
- // Set the iframe back as the main frame's root scroller. Since its the |
- // global root scroller again, it should clip like the root frame. This |
- // checks that we invalidate the compositing state even though the iframe's |
- // effective root scroller hasn't changed. |
- { |
- mainFrame()->document()->setRootScroller(iframe, nonThrow); |
- mainFrameView()->updateAllLifecyclePhases(); |
- |
- ASSERT_EQ(iframe, &mainController.effectiveRootScroller()); |
- ASSERT_EQ(iframe->contentDocument(), |
- &childController.effectiveRootScroller()); |
- ASSERT_EQ(iframe->contentDocument()->documentElement(), |
- globalController.globalRootScroller()); |
- |
- EXPECT_FALSE( |
- scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- |
- EXPECT_TRUE( |
- scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- } |
- |
- // Set just the iframe's root scroller. We should stop clipping the |
- // iframe's compositor's layers but not the main frame's. |
- { |
- mainFrame()->document()->setRootScroller(nullptr, nonThrow); |
- iframe->contentDocument()->setRootScroller(container, nonThrow); |
- mainFrameView()->updateAllLifecyclePhases(); |
- |
- ASSERT_EQ(mainFrame()->document(), &mainController.effectiveRootScroller()); |
- ASSERT_EQ(container, &childController.effectiveRootScroller()); |
- |
- EXPECT_TRUE( |
- scrollingLayer(*mainLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- mainCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- |
- EXPECT_FALSE( |
- scrollingLayer(*childLayoutView)->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->rootGraphicsLayer()->platformLayer()->masksToBounds()); |
- EXPECT_FALSE( |
- childCompositor->containerLayer()->platformLayer()->masksToBounds()); |
- } |
-} |
- |
// Tests that the clipping layer is resized on the root scroller element even |
// if the layout height doesn't change. |
TEST_F(RootScrollerTest, BrowserControlsResizeClippingLayer) { |