Index: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp |
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp |
index a2194782061ed57c8b036b8c1d5418d3dfd5a2c3..b03f959c07710fd95e0080875d294e371c433d6c 100644 |
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp |
@@ -29,6 +29,7 @@ |
#include "core/frame/FrameHost.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/VisualViewport.h" |
+#include "core/html/HTMLIFrameElement.h" |
#include "core/layout/LayoutPart.h" |
#include "core/layout/api/LayoutViewItem.h" |
#include "core/layout/compositing/CompositedLayerMapping.h" |
@@ -849,4 +850,60 @@ TEST_F(ScrollingCoordinatorTest, CustomScrollbarShouldTriggerMainThreadScroll) { |
MainThreadScrollingReason::kCustomScrollbarScrolling); |
} |
+TEST_F(ScrollingCoordinatorTest, |
+ BackgroundAttachmentFixedShouldTriggerMainThreadScroll) { |
+ registerMockedHttpURLLoad("iframe-background-attachment-fixed.html"); |
+ registerMockedHttpURLLoad("iframe-background-attachment-fixed-inner.html"); |
+ registerMockedHttpURLLoad("white-1x1.png"); |
+ navigateTo(m_baseURL + "iframe-background-attachment-fixed.html"); |
+ forceFullCompositingUpdate(); |
+ |
+ Element* iframe = frame()->document()->getElementById("iframe"); |
+ ASSERT_TRUE(iframe); |
+ |
+ LayoutObject* layoutObject = iframe->layoutObject(); |
+ ASSERT_TRUE(layoutObject); |
+ ASSERT_TRUE(layoutObject->isLayoutPart()); |
+ |
+ LayoutPart* layoutPart = toLayoutPart(layoutObject); |
+ ASSERT_TRUE(layoutPart); |
+ ASSERT_TRUE(layoutPart->widget()); |
+ ASSERT_TRUE(layoutPart->widget()->isFrameView()); |
+ |
+ FrameView* innerFrameView = toFrameView(layoutPart->widget()); |
+ LayoutViewItem innerLayoutViewItem = innerFrameView->layoutViewItem(); |
+ ASSERT_FALSE(innerLayoutViewItem.isNull()); |
+ |
+ PaintLayerCompositor* innerCompositor = innerLayoutViewItem.compositor(); |
+ ASSERT_TRUE(innerCompositor->inCompositingMode()); |
+ ASSERT_TRUE(innerCompositor->scrollLayer()); |
+ |
+ GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
+ ASSERT_EQ(innerFrameView, scrollLayer->getScrollableArea()); |
+ |
+ WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
+ ASSERT_TRUE(webScrollLayer->scrollable()); |
+ ASSERT_TRUE(webScrollLayer->mainThreadScrollingReasons() & |
+ MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); |
+ |
+ // remove custom scrollbar class, the scrollbar is expected to scroll on |
+ // impl thread as it is an overlay scrollbar. |
+ auto* iframeDoc = toHTMLIFrameElement(iframe)->contentDocument(); |
+ iframe = iframeDoc->getElementById("scrollable"); |
+ ASSERT_TRUE(iframe); |
+ |
+ iframe->removeAttribute("class"); |
+ forceFullCompositingUpdate(); |
+ |
+ layoutObject = iframe->layoutObject(); |
+ ASSERT_TRUE(layoutObject); |
+ |
+ scrollLayer = layoutObject->frameView()->layerForScrolling(); |
+ ASSERT_TRUE(scrollLayer); |
+ |
+ webScrollLayer = scrollLayer->platformLayer(); |
+ ASSERT_TRUE(webScrollLayer->scrollable()); |
+ ASSERT_FALSE(webScrollLayer->mainThreadScrollingReasons() & |
+ MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); |
+} |
} // namespace blink |