Chromium Code Reviews| 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 5356075bbc232b79d5b9cefd8b484425c421f1dc..fce9b00b195e2d9672f35a875a413638a0ef7069 100644 |
| --- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp |
| @@ -1029,4 +1029,46 @@ TEST_F(ScrollingCoordinatorTest, |
| MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects); |
| } |
| +TEST_F(ScrollingCoordinatorTest, StyleRelatedMainThreadScrollingReason) { |
| + registerMockedHttpURLLoad("two_transparent_scrollable_area.html"); |
| + navigateTo(m_baseURL + "two_transparent_scrollable_area.html"); |
| + webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false); |
|
bokan
2016/12/20 20:09:07
Please add another test where setPreferCompositing
yigu
2016/12/20 20:17:11
Done.
|
| + forceFullCompositingUpdate(); |
| + |
| + FrameView* frameView = frame()->view(); |
| + ASSERT_TRUE(frameView); |
| + ASSERT_TRUE(frameView->mainThreadScrollingReasons() & |
| + MainThreadScrollingReason::kHasOpacity); |
| + |
| + // Remove opacity from one of the scrollers. |
| + // Still need to scroll on main thread. |
| + Document* document = frame()->document(); |
| + Element* container = document->getElementById("scroller1"); |
| + DCHECK(container); |
| + |
| + container->removeAttribute("class"); |
| + forceFullCompositingUpdate(); |
| + |
| + ASSERT_TRUE(frameView->mainThreadScrollingReasons() & |
| + MainThreadScrollingReason::kHasOpacity); |
| + |
| + // Remove opacity from the other layout would lead to |
|
bokan
2016/12/20 20:09:07
nit: layout->scroller
yigu
2016/12/20 20:17:11
Done.
|
| + // scroll on impl. |
| + container = document->getElementById("scroller2"); |
| + DCHECK(container); |
| + |
| + container->removeAttribute("class"); |
| + forceFullCompositingUpdate(); |
| + |
| + ASSERT_FALSE(frameView->mainThreadScrollingReasons() & |
| + MainThreadScrollingReason::kHasOpacity); |
| + |
| + // Add opacity would again lead to scroll on main thread |
| + container->setAttribute("class", "transparent", ASSERT_NO_EXCEPTION); |
| + forceFullCompositingUpdate(); |
| + |
| + ASSERT_TRUE(frameView->mainThreadScrollingReasons() & |
| + MainThreadScrollingReason::kHasOpacity); |
| +} |
| + |
| } // namespace blink |