| 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 10551bdfd3adc7563b3cdbd6931c2252f6f189b5..e8db583d8928518d02b52dbd0a80bdce100b62b9 100644
|
| --- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
|
| @@ -1034,6 +1034,11 @@ TEST_F(ScrollingCoordinatorTest,
|
|
|
| class StyleRelatedMainThreadScrollingReasonTest
|
| : public ScrollingCoordinatorTest {
|
| + static const uint32_t m_LCDTextRelatedReasons =
|
| + MainThreadScrollingReason::kHasOpacity |
|
| + MainThreadScrollingReason::kHasTransform |
|
| + MainThreadScrollingReason::kBackgroundNotOpaqueInRect;
|
| +
|
| protected:
|
| StyleRelatedMainThreadScrollingReasonTest() {
|
| registerMockedHttpURLLoad("two_scrollable_area.html");
|
| @@ -1078,10 +1083,12 @@ class StyleRelatedMainThreadScrollingReasonTest
|
|
|
| ASSERT_TRUE(frameView->mainThreadScrollingReasons() & reason);
|
|
|
| - webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(true);
|
| - forceFullCompositingUpdate();
|
| -
|
| - ASSERT_FALSE(frameView->mainThreadScrollingReasons());
|
| + if ((reason & m_LCDTextRelatedReasons) &&
|
| + !(reason & ~m_LCDTextRelatedReasons)) {
|
| + webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(true);
|
| + forceFullCompositingUpdate();
|
| + ASSERT_FALSE(frameView->mainThreadScrollingReasons());
|
| + }
|
| }
|
| };
|
|
|
| @@ -1098,4 +1105,53 @@ TEST_F(StyleRelatedMainThreadScrollingReasonTest, BackgroundNotOpaqueTest) {
|
| MainThreadScrollingReason::kBackgroundNotOpaqueInRect);
|
| }
|
|
|
| +TEST_F(StyleRelatedMainThreadScrollingReasonTest, BorderRadiusTest) {
|
| + testStyle("border-radius", MainThreadScrollingReason::kHasBorderRadius);
|
| +}
|
| +
|
| +TEST_F(StyleRelatedMainThreadScrollingReasonTest, ClipTest) {
|
| + testStyle("clip", MainThreadScrollingReason::kHasClipRelatedProperty);
|
| +}
|
| +
|
| +TEST_F(StyleRelatedMainThreadScrollingReasonTest, ClipPathTest) {
|
| + uint32_t reason = MainThreadScrollingReason::kHasClipRelatedProperty;
|
| + webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false);
|
| + Document* document = frame()->document();
|
| + // Test ancestor with ClipPath
|
| + Element* element = document->body();
|
| + DCHECK(element);
|
| + element->setAttribute(HTMLNames::styleAttr,
|
| + "clip-path:circle(115px at 20px 20px);");
|
| + forceFullCompositingUpdate();
|
| +
|
| + FrameView* frameView = frame()->view();
|
| + ASSERT_TRUE(frameView);
|
| + ASSERT_TRUE(frameView->mainThreadScrollingReasons() & reason);
|
| +
|
| + // Remove clip path from ancestor.
|
| + element->removeAttribute(HTMLNames::styleAttr);
|
| + forceFullCompositingUpdate();
|
| +
|
| + ASSERT_FALSE(frameView->mainThreadScrollingReasons() & reason);
|
| +
|
| + // Test descendant with ClipPath
|
| + element = document->getElementById("content1");
|
| + DCHECK(element);
|
| + element->setAttribute(HTMLNames::styleAttr,
|
| + "clip-path:circle(115px at 20px 20px);");
|
| + forceFullCompositingUpdate();
|
| + ASSERT_TRUE(frameView->mainThreadScrollingReasons() & reason);
|
| +
|
| + // Remove clip path from descendant.
|
| + element->removeAttribute(HTMLNames::styleAttr);
|
| + forceFullCompositingUpdate();
|
| + ASSERT_FALSE(frameView->mainThreadScrollingReasons() & reason);
|
| +}
|
| +
|
| +TEST_F(StyleRelatedMainThreadScrollingReasonTest, LCDTextEnabledTest) {
|
| + testStyle("transparent border-radius",
|
| + MainThreadScrollingReason::kHasOpacity |
|
| + MainThreadScrollingReason::kHasBorderRadius);
|
| +}
|
| +
|
| } // namespace blink
|
|
|