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

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

Issue 2436283002: Fix LayoutObject::mapLocalToAncestor() for fixed under absolute (Closed)
Patch Set: Rebaseline after rebase Created 4 years, 2 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/layout/MapCoordinatesTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp b/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
index ba227494e79df436af2bd64618b19a71dde765ee..ec39aad3e2dd583d8161ff00b59834add0751e57 100644
--- a/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
+++ b/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
@@ -505,6 +505,66 @@ TEST_F(MapCoordinatesTest, FixedPosInFixedPos) {
EXPECT_EQ(FloatPoint(), mappedPoint);
}
+TEST_F(MapCoordinatesTest, FixedPosInFixedPosScrollView) {
+ setBodyInnerHTML(
+ "<div style='height: 4000px'></div>"
+ "<div id='container' style='position:fixed; top: 100px; left: 100px'>"
+ " <div id='target' style='position:fixed; top: 200px; left: 200px'>"
+ " </div>"
+ "</div>");
+
+ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
+ LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container"));
+ LayoutBox* body = container->parentBox();
+ LayoutBox* html = body->parentBox();
+ LayoutBox* view = html->parentBox();
+ ASSERT_TRUE(view->isLayoutView());
+
+ document().view()->setScrollOffset(ScrollOffset(0.0, 50), ProgrammaticScroll);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(50, document().view()->scrollOffsetInt().height());
+
+ FloatPoint mappedPoint = mapLocalToAncestor(target, view, FloatPoint());
+ EXPECT_EQ(FloatPoint(200, 250), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, view, FloatPoint(200, 250));
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+
+ mappedPoint = mapLocalToAncestor(target, container, FloatPoint());
+ EXPECT_EQ(FloatPoint(100, 100), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, container, FloatPoint(100, 100));
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+}
+
+TEST_F(MapCoordinatesTest, FixedPosInAbsolutePosScrollView) {
+ setBodyInnerHTML(
+ "<div style='height: 4000px'></div>"
+ "<div id='container' style='position:absolute; top: 100px; left: 100px'>"
+ " <div id='target' style='position:fixed; top: 200px; left: 200px'>"
+ " </div>"
+ "</div>");
+
+ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
+ LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container"));
+ LayoutBox* body = container->parentBox();
+ LayoutBox* html = body->parentBox();
+ LayoutBox* view = html->parentBox();
+ ASSERT_TRUE(view->isLayoutView());
+
+ document().view()->setScrollOffset(ScrollOffset(0.0, 50), ProgrammaticScroll);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(50, document().view()->scrollOffsetInt().height());
+
+ FloatPoint mappedPoint = mapLocalToAncestor(target, view, FloatPoint());
+ EXPECT_EQ(FloatPoint(200, 250), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, view, FloatPoint(200, 250));
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+
+ mappedPoint = mapLocalToAncestor(target, container, FloatPoint());
+ EXPECT_EQ(FloatPoint(100, 150), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, container, FloatPoint(100, 150));
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+}
+
TEST_F(MapCoordinatesTest, FixedPosInTransform) {
setBodyInnerHTML(
"<style>#container { transform: translateY(100px); position: absolute; "
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698