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

Unified Diff: third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp

Issue 1974953002: Descend into node with overflow and floating content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/layout/ScrollAnchor.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/layout/ScrollAnchorTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
index f9ea388c832e26c50230271ef999cc75bee14c7a..6a01de93bad910972d3a14633da7a7fbe65bd2b9 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
@@ -263,6 +263,68 @@ TEST_F(ScrollAnchorTest, ExcludeAbsolutePosition)
EXPECT_EQ(absPos->layoutObject(), scrollAnchor(scroller).anchorObject());
}
+// Test that we descend into zero-height containers that have overflowing content.
+TEST_F(ScrollAnchorTest, DescendsIntoContainerWithOverflow)
+{
+ setBodyInnerHTML(
+ "<style>"
+ " body { height: 1000; }"
+ " #outer { width: 300px; }"
+ " #zeroheight { height: 0px; }"
+ " #changer { height: 100px; background-color: red; }"
+ " #bottom { margin-top: 600px; }"
+ "</style>"
+ "<div id='outer'>"
+ " <div id='zeroheight'>"
+ " <div id='changer'></div>"
+ " <div id='bottom'>bottom</div>"
+ " </div>"
+ "</div>");
+
+ ScrollableArea* viewport = layoutViewport();
+
+ scrollLayoutViewport(DoubleSize(0, 200));
+ setHeight(document().getElementById("changer"), 200);
+
+ EXPECT_EQ(300, viewport->scrollPosition().y());
+ EXPECT_EQ(document().getElementById("bottom")->layoutObject(),
+ scrollAnchor(viewport).anchorObject());
+}
+
+// Test that we descend into zero-height containers that have floating content.
+TEST_F(ScrollAnchorTest, DescendsIntoContainerWithFloat)
+{
+ setBodyInnerHTML(
+ "<style>"
+ " body { height: 1000; }"
+ " #outer { width: 300px; }"
+ " #outer:after { content: ' '; clear:both; display: table; }"
+ " #float {"
+ " float: left; background-color: #ccc;"
+ " height: 500px; width: 100%;"
+ " }"
+ " #inner { height: 21px; background-color:#7f0; }"
+ "</style>"
+ "<div id='outer'>"
+ " <div id='zeroheight'>"
+ " <div id='float'>"
+ " <div id='inner'></div>"
+ " </div>"
+ " </div>"
+ "</div>");
+
+ EXPECT_EQ(0, toLayoutBox(document().getElementById("zeroheight")->layoutObject())->size().height());
+
+ ScrollableArea* viewport = layoutViewport();
+
+ scrollLayoutViewport(DoubleSize(0, 200));
+ setHeight(document().getElementById("float"), 600);
+
+ EXPECT_EQ(200, viewport->scrollPosition().y());
+ EXPECT_EQ(document().getElementById("float")->layoutObject(),
+ scrollAnchor(viewport).anchorObject());
+}
+
class ScrollAnchorCornerTest : public ScrollAnchorTest {
protected:
void checkCorner(const AtomicString& id, Corner corner, DoublePoint startPos, DoubleSize expectedAdjustment)
« no previous file with comments | « third_party/WebKit/Source/core/layout/ScrollAnchor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698