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

Unified Diff: third_party/WebKit/Source/core/frame/FrameViewTest.cpp

Issue 2811803003: Revert of Only create sticky position constraints for constrained sticky position. (Closed)
Patch Set: Created 3 years, 8 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/frame/FrameViewTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
index 98e593e0ae4f1ddb57590dee0f7ccb1cd5fd5c42..c290dfac8a808d28b0cc5cbbb2380fe017347f1f 100644
--- a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
@@ -178,59 +178,32 @@
GetDocument().body()->setInnerHTML(
"<style>.container { height: 200%; }"
- "#sticky1 { position: sticky; top: 0; height: 50px; }"
- "#sticky2 { position: sticky; height: 50px; }</style>"
- "<div class='container'>"
- " <div id='sticky1'></div>"
- " <div id='sticky2'></div>"
- "</div>");
- GetDocument().View()->UpdateAllLifecyclePhases();
-
- LayoutBoxModelObject* sticky1 = ToLayoutBoxModelObject(
- GetDocument().GetElementById("sticky1")->GetLayoutObject());
- LayoutBoxModelObject* sticky2 = ToLayoutBoxModelObject(
- GetDocument().GetElementById("sticky2")->GetLayoutObject());
+ "#sticky { position: sticky; top: 0; height: 50px; }</style>"
+ "<div class='container'><div id='sticky'></div></div>");
+ GetDocument().View()->UpdateAllLifecyclePhases();
+
+ LayoutBoxModelObject* sticky = ToLayoutBoxModelObject(
+ GetDocument().GetElementById("sticky")->GetLayoutObject());
EXPECT_TRUE(
- GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky1));
- // #sticky2 is not viewport constrained because it has no anchor edges.
- EXPECT_FALSE(
- GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2));
+ GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky));
// Making the element non-sticky should remove it from the set of
// viewport-constrained objects.
- GetDocument().GetElementById("sticky1")->setAttribute(HTMLNames::styleAttr,
- "position: relative");
+ GetDocument().GetElementById("sticky")->setAttribute(HTMLNames::styleAttr,
+ "position: relative");
GetDocument().View()->UpdateAllLifecyclePhases();
EXPECT_FALSE(
- GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky1));
+ GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky));
// And making it sticky again should put it back in that list.
- GetDocument().GetElementById("sticky1")->setAttribute(HTMLNames::styleAttr,
- "");
+ GetDocument().GetElementById("sticky")->setAttribute(HTMLNames::styleAttr,
+ "");
GetDocument().View()->UpdateAllLifecyclePhases();
EXPECT_TRUE(
- GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky1));
-
- // Adding an anchor edge on the non-anchored sticky should add it to the
- // viewport-constrained objects.
- GetDocument().GetElementById("sticky2")->setAttribute(HTMLNames::styleAttr,
- "top: 0");
- GetDocument().View()->UpdateAllLifecyclePhases();
-
- EXPECT_TRUE(
- GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2));
-
- // Removing the anchor edge on a sticky position element should remove it from
- // the viewport-constrained objects.
- GetDocument().GetElementById("sticky2")->setAttribute(HTMLNames::styleAttr,
- "");
- GetDocument().View()->UpdateAllLifecyclePhases();
-
- EXPECT_FALSE(
- GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2));
+ GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky));
}
} // namespace
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698