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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2345403003: Add background attachment fixed main thread scrolling reason [spv2] (Closed)
Patch Set: Minor cleanup Created 4 years, 3 months 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/paint/PaintPropertyTreeBuilderTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 9b0078b2988c83d2c87d32eee6253cc5e495c07c..dfda5678ef2018e2f3ff54e2bc14a913e3de35e6 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -2009,4 +2009,103 @@ TEST_P(PaintPropertyTreeBuilderTest, SVGRootNoClip)
EXPECT_FALSE(getLayoutObjectByElementId("svg")->objectPaintProperties()->overflowClip());
}
+TEST_P(PaintPropertyTreeBuilderTest, MainThreadScrollReasonsWithNestedScrollers)
+{
+ setBodyInnerHTML(
+ "<style>"
+ " #overflowA {"
+ " position: absolute;"
+ " overflow: scroll;"
+ " width: 20px;"
+ " height: 20px;"
+ " }"
+ " #overflowB {"
+ " position: absolute;"
+ " overflow: scroll;"
+ " width: 5px;"
+ " height: 3px;"
+ " }"
+ " .backgroundAttachmentFixed {"
+ " background-image: url('foo');"
+ " background-attachment: fixed;"
+ " }"
+ " .forceScroll {"
+ " height: 4000px;"
+ " }"
+ "</style>"
+ "<div id='overflowA'>"
+ " <div id='overflowB' class='backgroundAttachmentFixed'>"
+ " <div class='forceScroll'></div>"
+ " </div>"
+ " <div class='forceScroll'></div>"
+ "</div>"
+ "<div class='forceScroll'></div>");
+ Element* overflowA = document().getElementById("overflowA");
+ Element* overflowB = document().getElementById("overflowB");
+
+ EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_TRUE(overflowA->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
ajuma 2016/09/19 14:38:02 Should overflowB also have a main-thread scrolling
pdr. 2016/09/19 20:25:50 Good question! The background of overflowB is pain
+
+ // Removing a main thread scrolling reason should update the entire tree.
+ overflowB->removeAttribute("class");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_FALSE(frameScroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+
+ // Adding a main thread scrolling reason should update the entire tree.
+ overflowB->setAttribute(HTMLNames::classAttr, "backgroundAttachmentFixed");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_TRUE(overflowA->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+}
+
+TEST_P(PaintPropertyTreeBuilderTest, MainThreadScrollReasonsWithFixedScroller)
+{
+ setBodyInnerHTML(
+ "<style>"
+ " #overflowA {"
+ " position: absolute;"
+ " overflow: scroll;"
+ " width: 20px;"
+ " height: 20px;"
+ " }"
+ " #overflowB {"
+ " position: fixed;"
+ " overflow: scroll;"
+ " width: 5px;"
+ " height: 3px;"
+ " }"
+ " .backgroundAttachmentFixed {"
+ " background-image: url('foo');"
+ " background-attachment: fixed;"
+ " }"
+ " .forceScroll {"
+ " height: 4000px;"
+ " }"
+ "</style>"
+ "<div id='overflowA'>"
+ " <div id='overflowB' class='backgroundAttachmentFixed'>"
+ " <div class='forceScroll'></div>"
+ " </div>"
+ " <div class='forceScroll'></div>"
+ "</div>"
+ "<div class='forceScroll'></div>");
+ Element* overflowA = document().getElementById("overflowA");
+ Element* overflowB = document().getElementById("overflowB");
+
+ EXPECT_TRUE(rootScroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+
+ // Removing a main thread scrolling reason should update the entire tree.
+ overflowB->removeAttribute("class");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_FALSE(rootScroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+ EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->hasBackgroundAttachmentFixedMainThreadScrollingReason());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698