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

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

Issue 2387393003: Revert of Refactor ScrollableArea::setScrollPosition. (Closed)
Patch Set: 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/LayoutBoxModelObjectTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp
index 3ef9719f0918ead291cf54a18a7ebecbd9600e9d..d92b3d3f96ef384b9a9186c8989342ac004f3156 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp
@@ -41,17 +41,16 @@
"id='sticky'></div></div><div class='spacer'></div></div>");
LayoutBoxModelObject* scroller =
toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
- PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
- scrollableArea->scrollToOffset(
- DoubleSize(scrollableArea->adjustedScrollOffset().width(), 50));
- ASSERT_EQ(50.0, scrollableArea->adjustedScrollOffset().height());
+ scroller->getScrollableArea()->scrollToYOffset(50);
+ ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
LayoutBoxModelObject* sticky =
toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
sticky->updateStickyPositionConstraints();
ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
const StickyPositionScrollingConstraints& constraints =
- scrollableArea->stickyConstraintsMap().get(sticky->layer());
+ scroller->getScrollableArea()->stickyConstraintsMap().get(
+ sticky->layer());
ASSERT_EQ(0.f, constraints.topOffset());
// The coordinates of the constraint rects should all be with respect to the unscrolled scroller.
@@ -78,17 +77,16 @@
"id='sticky'></div></div><div class='spacer'></div></div>");
LayoutBoxModelObject* scroller =
toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
- PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
- scrollableArea->scrollToOffset(
- DoubleSize(scrollableArea->adjustedScrollOffset().width(), 50));
- ASSERT_EQ(50.0, scrollableArea->adjustedScrollOffset().height());
+ scroller->getScrollableArea()->scrollToYOffset(50);
+ ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
LayoutBoxModelObject* sticky =
toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
sticky->updateStickyPositionConstraints();
ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
const StickyPositionScrollingConstraints& constraints =
- scrollableArea->stickyConstraintsMap().get(sticky->layer());
+ scroller->getScrollableArea()->stickyConstraintsMap().get(
+ sticky->layer());
ASSERT_EQ(0.f, constraints.topOffset());
// The coordinates of the constraint rects should all be with respect to the unscrolled scroller.
@@ -114,17 +112,16 @@
"id='sticky'></div></div><div class='spacer'></div></div>");
LayoutBoxModelObject* scroller =
toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
- PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
- scrollableArea->scrollToOffset(
- DoubleSize(scrollableArea->adjustedScrollOffset().width(), 50));
- ASSERT_EQ(50.0, scrollableArea->adjustedScrollOffset().height());
+ scroller->getScrollableArea()->scrollToYOffset(50);
+ ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
LayoutBoxModelObject* sticky =
toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
sticky->updateStickyPositionConstraints();
ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
const StickyPositionScrollingConstraints& constraints =
- scrollableArea->stickyConstraintsMap().get(sticky->layer());
+ scroller->getScrollableArea()->stickyConstraintsMap().get(
+ sticky->layer());
ASSERT_EQ(0.f, constraints.topOffset());
ASSERT_EQ(IntRect(25, 145, 200, 330),
@@ -148,17 +145,16 @@
"class='spacer'></div></div>");
LayoutBoxModelObject* scroller =
toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
- PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
- scrollableArea->scrollToOffset(
- DoubleSize(scrollableArea->adjustedScrollOffset().width(), 50));
- ASSERT_EQ(50.0, scrollableArea->adjustedScrollOffset().height());
+ scroller->getScrollableArea()->scrollToYOffset(50);
+ ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
LayoutBoxModelObject* sticky =
toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
sticky->updateStickyPositionConstraints();
ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
const StickyPositionScrollingConstraints& constraints =
- scrollableArea->stickyConstraintsMap().get(sticky->layer());
+ scroller->getScrollableArea()->stickyConstraintsMap().get(
+ sticky->layer());
ASSERT_EQ(IntRect(0, 0, 400, 1100),
enclosingIntRect(
getScrollContainerRelativeContainingBlockRect(constraints)));
@@ -183,17 +179,16 @@
"id='sticky'></div></div><div class='spacer'></div></div>");
LayoutBoxModelObject* scroller =
toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
- PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
- scrollableArea->scrollToOffset(
- DoubleSize(scrollableArea->adjustedScrollOffset().width(), 50));
- ASSERT_EQ(50.0, scrollableArea->adjustedScrollOffset().height());
+ scroller->getScrollableArea()->scrollToYOffset(50);
+ ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
LayoutBoxModelObject* sticky =
toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
sticky->updateStickyPositionConstraints();
ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
const StickyPositionScrollingConstraints& constraints =
- scrollableArea->stickyConstraintsMap().get(sticky->layer());
+ scroller->getScrollableArea()->stickyConstraintsMap().get(
+ sticky->layer());
ASSERT_EQ(IntRect(15, 115, 170, 370),
enclosingIntRect(
getScrollContainerRelativeContainingBlockRect(constraints)));
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/layout/ScrollEnums.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698