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

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

Issue 2619393002: Rewrite how paint properties are built with bg:fixed main thread scrolling (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a2a0a834421fcee4b33d383cb1d3fe7f7ac19dda..5aaeb8044252f258486772dc991c831d889abd8a 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
@@ -90,10 +90,10 @@ TEST_P(PaintPropertyTreeUpdateTest,
->paintProperties()
->scroll()
->hasBackgroundAttachmentFixedDescendants());
- EXPECT_FALSE(overflowB->layoutObject()
- ->paintProperties()
- ->scroll()
- ->hasBackgroundAttachmentFixedDescendants());
+ EXPECT_TRUE(overflowB->layoutObject()
+ ->paintProperties()
+ ->scroll()
+ ->hasBackgroundAttachmentFixedDescendants());
// Removing a main thread scrolling reason should update the entire tree.
overflowB->removeAttribute("class");
@@ -116,10 +116,82 @@ TEST_P(PaintPropertyTreeUpdateTest,
->paintProperties()
->scroll()
->hasBackgroundAttachmentFixedDescendants());
- EXPECT_FALSE(overflowB->layoutObject()
- ->paintProperties()
- ->scroll()
- ->hasBackgroundAttachmentFixedDescendants());
+ EXPECT_TRUE(overflowB->layoutObject()
+ ->paintProperties()
+ ->scroll()
+ ->hasBackgroundAttachmentFixedDescendants());
+}
+
+TEST_P(PaintPropertyTreeUpdateTest, ParentFrameMainThreadScrollReasons) {
+ setBodyInnerHTML(
+ "<style>"
+ " body { margin: 0; }"
+ " .fixedBackground {"
+ " background-image: url('foo');"
+ " background-attachment: fixed;"
+ " }"
+ "</style>"
+ "<iframe></iframe>"
+ "<div id='fixedBackground' class='fixedBackground'></div>"
+ "<div id='forceScroll' style='height: 8888px;'></div>");
+ setChildFrameHTML(
+ "<style>body { margin: 0; }</style>"
+ "<div id='forceScroll' style='height: 8888px;'></div>");
+ document().view()->updateAllLifecyclePhases();
+
+ FrameView* parent = document().view();
+ EXPECT_TRUE(frameScroll(parent)->hasBackgroundAttachmentFixedDescendants());
+ FrameView* child = childDocument().view();
+ EXPECT_TRUE(frameScroll(child)->hasBackgroundAttachmentFixedDescendants());
+
+ // Removing a main thread scrolling reason should update the entire tree.
+ auto* fixedBackground = document().getElementById("fixedBackground");
+ fixedBackground->removeAttribute(HTMLNames::classAttr);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_FALSE(frameScroll(parent)->hasBackgroundAttachmentFixedDescendants());
+ EXPECT_FALSE(frameScroll(child)->hasBackgroundAttachmentFixedDescendants());
+
+ // Adding a main thread scrolling reason should update the entire tree.
+ fixedBackground->setAttribute(HTMLNames::classAttr, "fixedBackground");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_TRUE(frameScroll(parent)->hasBackgroundAttachmentFixedDescendants());
+ EXPECT_TRUE(frameScroll(child)->hasBackgroundAttachmentFixedDescendants());
+}
+
+TEST_P(PaintPropertyTreeUpdateTest, ChildFrameMainThreadScrollReasons) {
+ setBodyInnerHTML(
+ "<style>body { margin: 0; }</style>"
+ "<iframe></iframe>"
+ "<div id='forceScroll' style='height: 8888px;'></div>");
+ setChildFrameHTML(
+ "<style>"
+ " body { margin: 0; }"
+ " .fixedBackground {"
+ " background-image: url('foo');"
+ " background-attachment: fixed;"
+ " }"
+ "</style>"
+ "<div id='fixedBackground' class='fixedBackground'></div>"
+ "<div id='forceScroll' style='height: 8888px;'></div>");
+ document().view()->updateAllLifecyclePhases();
+
+ FrameView* parent = document().view();
+ EXPECT_FALSE(frameScroll(parent)->hasBackgroundAttachmentFixedDescendants());
+ FrameView* child = childDocument().view();
+ EXPECT_TRUE(frameScroll(child)->hasBackgroundAttachmentFixedDescendants());
+
+ // Removing a main thread scrolling reason should update the entire tree.
+ auto* fixedBackground = childDocument().getElementById("fixedBackground");
+ fixedBackground->removeAttribute(HTMLNames::classAttr);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_FALSE(frameScroll(parent)->hasBackgroundAttachmentFixedDescendants());
+ EXPECT_FALSE(frameScroll(child)->hasBackgroundAttachmentFixedDescendants());
+
+ // Adding a main thread scrolling reason should update the entire tree.
+ fixedBackground->setAttribute(HTMLNames::classAttr, "fixedBackground");
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_FALSE(frameScroll(parent)->hasBackgroundAttachmentFixedDescendants());
+ EXPECT_TRUE(frameScroll(child)->hasBackgroundAttachmentFixedDescendants());
}
TEST_P(PaintPropertyTreeUpdateTest,
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698