| 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 d92b3d3f96ef384b9a9186c8989342ac004f3156..e092185b20439e26b00511898cc5742b8f720cb2 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp
|
| @@ -41,16 +41,17 @@ TEST_F(LayoutBoxModelObjectTest, StickyPositionConstraints) {
|
| "id='sticky'></div></div><div class='spacer'></div></div>");
|
| LayoutBoxModelObject* scroller =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
|
| - scroller->getScrollableArea()->scrollToYOffset(50);
|
| - ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
|
| + PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
|
| + scrollableArea->scrollToOffsetFromOrigin(
|
| + DoubleSize(scrollableArea->offsetFromOrigin().width(), 50));
|
| + ASSERT_EQ(50.0, scrollableArea->offsetFromOrigin().height());
|
| LayoutBoxModelObject* sticky =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
|
| sticky->updateStickyPositionConstraints();
|
| ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
|
|
|
| const StickyPositionScrollingConstraints& constraints =
|
| - scroller->getScrollableArea()->stickyConstraintsMap().get(
|
| - sticky->layer());
|
| + scrollableArea->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.
|
| @@ -77,8 +78,10 @@ TEST_F(LayoutBoxModelObjectTest, StickyPositionTransforms) {
|
| "id='sticky'></div></div><div class='spacer'></div></div>");
|
| LayoutBoxModelObject* scroller =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
|
| - scroller->getScrollableArea()->scrollToYOffset(50);
|
| - ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
|
| + DoubleSize newOffset(
|
| + scroller->getScrollableArea()->offsetFromOrigin().width(), 50);
|
| + scroller->getScrollableArea()->scrollToOffsetFromOrigin(newOffset);
|
| + ASSERT_EQ(50.0, scroller->getScrollableArea()->offsetFromOrigin().height());
|
| LayoutBoxModelObject* sticky =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
|
| sticky->updateStickyPositionConstraints();
|
| @@ -112,16 +115,17 @@ TEST_F(LayoutBoxModelObjectTest, StickyPositionPercentageStyles) {
|
| "id='sticky'></div></div><div class='spacer'></div></div>");
|
| LayoutBoxModelObject* scroller =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
|
| - scroller->getScrollableArea()->scrollToYOffset(50);
|
| - ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
|
| + PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
|
| + scrollableArea->scrollToOffsetFromOrigin(
|
| + DoubleSize(scrollableArea->offsetFromOrigin().width(), 50));
|
| + ASSERT_EQ(50.0, scrollableArea->offsetFromOrigin().height());
|
| LayoutBoxModelObject* sticky =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
|
| sticky->updateStickyPositionConstraints();
|
| ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
|
|
|
| const StickyPositionScrollingConstraints& constraints =
|
| - scroller->getScrollableArea()->stickyConstraintsMap().get(
|
| - sticky->layer());
|
| + scrollableArea->stickyConstraintsMap().get(sticky->layer());
|
| ASSERT_EQ(0.f, constraints.topOffset());
|
|
|
| ASSERT_EQ(IntRect(25, 145, 200, 330),
|
| @@ -145,16 +149,17 @@ TEST_F(LayoutBoxModelObjectTest, StickyPositionContainerIsScroller) {
|
| "class='spacer'></div></div>");
|
| LayoutBoxModelObject* scroller =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
|
| - scroller->getScrollableArea()->scrollToYOffset(50);
|
| - ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
|
| + PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
|
| + scrollableArea->scrollToOffsetFromOrigin(
|
| + DoubleSize(scrollableArea->offsetFromOrigin().width(), 50));
|
| + ASSERT_EQ(50.0, scrollableArea->offsetFromOrigin().height());
|
| LayoutBoxModelObject* sticky =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
|
| sticky->updateStickyPositionConstraints();
|
| ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
|
|
|
| const StickyPositionScrollingConstraints& constraints =
|
| - scroller->getScrollableArea()->stickyConstraintsMap().get(
|
| - sticky->layer());
|
| + scrollableArea->stickyConstraintsMap().get(sticky->layer());
|
| ASSERT_EQ(IntRect(0, 0, 400, 1100),
|
| enclosingIntRect(
|
| getScrollContainerRelativeContainingBlockRect(constraints)));
|
| @@ -179,16 +184,17 @@ TEST_F(LayoutBoxModelObjectTest, StickyPositionAnonymousContainer) {
|
| "id='sticky'></div></div><div class='spacer'></div></div>");
|
| LayoutBoxModelObject* scroller =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("scroller"));
|
| - scroller->getScrollableArea()->scrollToYOffset(50);
|
| - ASSERT_EQ(50.0, scroller->getScrollableArea()->scrollYOffset());
|
| + PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea();
|
| + scrollableArea->scrollToOffsetFromOrigin(
|
| + DoubleSize(scrollableArea->offsetFromOrigin().width(), 50));
|
| + ASSERT_EQ(50.0, scrollableArea->offsetFromOrigin().height());
|
| LayoutBoxModelObject* sticky =
|
| toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
|
| sticky->updateStickyPositionConstraints();
|
| ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
|
|
|
| const StickyPositionScrollingConstraints& constraints =
|
| - scroller->getScrollableArea()->stickyConstraintsMap().get(
|
| - sticky->layer());
|
| + scrollableArea->stickyConstraintsMap().get(sticky->layer());
|
| ASSERT_EQ(IntRect(15, 115, 170, 370),
|
| enclosingIntRect(
|
| getScrollContainerRelativeContainingBlockRect(constraints)));
|
|
|