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

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

Issue 2729683002: Handle resize in PaintPropertyTreeBuilder::updateForObjectSizeAndLocation() (Closed)
Patch Set: Fix a typo (ScrollbarWithChange -> ScrollbarWidthChange) Created 3 years, 10 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/PaintPropertyTreeUpdateTests.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
index 83f20cf42d2496eb755d97ac9fea2365605032e4..a7758783dbbf4077048d4ccb62f18d1f9f1d2d82 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
@@ -679,4 +679,47 @@ TEST_P(PaintPropertyTreeUpdateTest, CSSClipDependingOnSize) {
clip->paintProperties()->cssClip()->clipRect().rect());
}
+TEST_P(PaintPropertyTreeUpdateTest, ScrollBoundsChange) {
+ setBodyInnerHTML(
+ "<div id='container'"
+ " style='width: 100px; height: 100px; overflow: scroll'>"
+ " <div id='content' style='width: 200px; height: 200px'></div>"
+ "</div>");
+
+ auto* container = getLayoutObjectByElementId("container");
+ auto* scrollNode =
+ container->paintProperties()->scrollTranslation()->scrollNode();
+ EXPECT_EQ(IntSize(100, 100), scrollNode->clip());
+ EXPECT_EQ(IntSize(200, 200), scrollNode->bounds());
+
+ document().getElementById("content")->setAttribute(
+ HTMLNames::styleAttr, "width: 200px; height: 300px");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(scrollNode,
+ container->paintProperties()->scrollTranslation()->scrollNode());
+ EXPECT_EQ(IntSize(100, 100), scrollNode->clip());
+ EXPECT_EQ(IntSize(200, 300), scrollNode->bounds());
+}
+
+TEST_P(PaintPropertyTreeUpdateTest, ScrollbarWidthChange) {
+ setBodyInnerHTML(
+ "<style>::-webkit-scrollbar {width: 20px; height: 20px}</style>"
+ "<div id='container'"
+ " style='width: 100px; height: 100px; overflow: scroll'>"
+ " <div id='content' style='width: 200px; height: 200px'></div>"
+ "</div>");
+
+ auto* container = getLayoutObjectByElementId("container");
+ auto* overflowClip = container->paintProperties()->overflowClip();
+ EXPECT_EQ(FloatSize(80, 80), overflowClip->clipRect().rect().size());
+
+ auto* newStyle = document().createElement("style");
+ newStyle->setTextContent("::-webkit-scrollbar {width: 40px; height: 40px}");
+ document().body()->appendChild(newStyle);
+
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(overflowClip, container->paintProperties()->overflowClip());
+ EXPECT_EQ(FloatSize(60, 60), overflowClip->clipRect().rect().size());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698