Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
index 9ef87575a5dbc22500791cd6b9a402a05d669278..d8d00ea4fd0beb204a3a1d11441ada9d7861046b 100644 |
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
@@ -167,10 +167,10 @@ const int touchPointPadding = 32; |
EXPECT_EQ(expected.height(), actual.height()); \ |
} while (false) |
-#define EXPECT_POINT_EQ(expected, actual) \ |
- do { \ |
- EXPECT_EQ(expected.x(), actual.x()); \ |
- EXPECT_EQ(expected.y(), actual.y()); \ |
+#define EXPECT_SIZE_EQ(expected, actual) \ |
+ do { \ |
+ EXPECT_EQ(expected.width(), actual.width()); \ |
+ EXPECT_EQ(expected.height(), actual.height()); \ |
} while (false) |
#define EXPECT_FLOAT_POINT_EQ(expected, actual) \ |
@@ -2926,9 +2926,10 @@ void setScaleAndScrollAndLayout(WebViewImpl* webView, |
} |
void simulatePageScale(WebViewImpl* webViewImpl, float& scale) { |
- IntSize scrollDelta = |
- webViewImpl->fakePageScaleAnimationTargetPositionForTesting() - |
- webViewImpl->mainFrameImpl()->frameView()->scrollPosition(); |
+ ScrollOffset scrollDelta = |
+ toScrollOffset( |
+ webViewImpl->fakePageScaleAnimationTargetPositionForTesting()) - |
+ webViewImpl->mainFrameImpl()->frameView()->scrollOffset(); |
float scaleDelta = webViewImpl->fakePageScaleAnimationPageScaleForTesting() / |
webViewImpl->pageScaleFactor(); |
webViewImpl->applyViewportDeltas(WebFloatSize(), FloatSize(scrollDelta), |
@@ -5705,7 +5706,7 @@ TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) { |
// Scroll main frame to the bottom of the document |
webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 400)); |
- EXPECT_POINT_EQ(IntPoint(0, 400), frame->view()->scrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 400), frame->view()->scrollOffset()); |
webViewImpl->setPageScaleFactor(2.0); |
@@ -6456,8 +6457,7 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) { |
EXPECT_FALSE(initialScrollState.wasScrolledByUser); |
// Do a compositor scroll, verify that this is counted as a user scroll. |
- frameViewLayer->platformLayer()->setScrollPositionDouble( |
- WebDoublePoint(0, 1)); |
+ frameViewLayer->platformLayer()->setScrollOffset(WebFloatSize(0, 1)); |
frameViewLayer->didScroll(); |
webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
WebFloatSize(), 1.7f, 0); |
@@ -6468,8 +6468,7 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) { |
initialScrollState.wasScrolledByUser = false; |
// The page scale 1.0f and scroll. |
- frameViewLayer->platformLayer()->setScrollPositionDouble( |
- WebDoublePoint(0, 2)); |
+ frameViewLayer->platformLayer()->setScrollOffset(WebFloatSize(0, 2)); |
frameViewLayer->didScroll(); |
webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
WebFloatSize(), 1.0f, 0); |
@@ -6487,8 +6486,7 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) { |
client.reset(); |
// Non zero page scale and scroll. |
- frameViewLayer->platformLayer()->setScrollPositionDouble( |
- WebDoublePoint(9, 15)); |
+ frameViewLayer->platformLayer()->setScrollOffset(WebFloatSize(9, 15)); |
frameViewLayer->didScroll(); |
webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
WebFloatSize(), 0.6f, 0); |
@@ -7246,24 +7244,24 @@ TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) { |
webView->updateAllLifecyclePhases(); |
webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
- EXPECT_POINT_EQ(IntPoint(0, 1900), IntPoint(frameView->scrollOffset())); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1900), frameView->scrollOffset()); |
// Simulate the top controls showing by 20px, thus shrinking the viewport |
// and allowing it to scroll an additional 20px. |
webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
1.0f, 20.0f / topControlsHeight); |
- EXPECT_POINT_EQ(IntPoint(0, 1920), frameView->maximumScrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1920), frameView->maximumScrollOffset()); |
// Show more, make sure the scroll actually gets clamped. |
webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
1.0f, 20.0f / topControlsHeight); |
webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
- EXPECT_POINT_EQ(IntPoint(0, 1940), IntPoint(frameView->scrollOffset())); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1940), frameView->scrollOffset()); |
// Hide until there's 10px showing. |
webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
1.0f, -30.0f / topControlsHeight); |
- EXPECT_POINT_EQ(IntPoint(0, 1910), frameView->maximumScrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1910), frameView->maximumScrollOffset()); |
// Simulate a LayoutPart::resize. The frame is resized to accomodate |
// the top controls and Blink's view of the top controls matches that of |
@@ -7272,19 +7270,19 @@ TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) { |
1.0f, 30.0f / topControlsHeight); |
webView->resizeWithTopControls(WebSize(100, 60), 40.0f, true); |
webView->updateAllLifecyclePhases(); |
- EXPECT_POINT_EQ(IntPoint(0, 1940), frameView->maximumScrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1940), frameView->maximumScrollOffset()); |
// Now simulate hiding. |
webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
1.0f, -10.0f / topControlsHeight); |
- EXPECT_POINT_EQ(IntPoint(0, 1930), frameView->maximumScrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1930), frameView->maximumScrollOffset()); |
// Reset to original state: 100px widget height, top controls fully hidden. |
webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
1.0f, -30.0f / topControlsHeight); |
webView->resizeWithTopControls(WebSize(100, 100), topControlsHeight, false); |
webView->updateAllLifecyclePhases(); |
- EXPECT_POINT_EQ(IntPoint(0, 1900), frameView->maximumScrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1900), frameView->maximumScrollOffset()); |
// Show the top controls by just 1px, since we're zoomed in to 2X, that |
// should allow an extra 0.5px of scrolling in the visual viewport. Make |
@@ -7292,11 +7290,11 @@ TEST_F(WebFrameTest, FrameViewScrollAccountsForTopControls) { |
// main frame. |
webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
1.0f, 1.0f / topControlsHeight); |
- EXPECT_POINT_EQ(IntPoint(0, 1901), frameView->maximumScrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1901), frameView->maximumScrollOffset()); |
webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(), |
1.0f, 2.0f / topControlsHeight); |
- EXPECT_POINT_EQ(IntPoint(0, 1903), frameView->maximumScrollPosition()); |
+ EXPECT_SIZE_EQ(ScrollOffset(0, 1903), frameView->maximumScrollOffset()); |
} |
TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) { |
@@ -7319,7 +7317,7 @@ TEST_F(WebFrameTest, MaximumScrollPositionCanBeNegative) { |
webViewHelper.webView()->updateAllLifecyclePhases(); |
FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView(); |
- EXPECT_LT(frameView->maximumScrollPosition().x(), 0); |
+ EXPECT_LT(frameView->maximumScrollOffset().width(), 0); |
} |
TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) { |