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

Unified Diff: Source/web/tests/PinchViewportTest.cpp

Issue 967213004: Removed FrameView's windowToContents and contentsToWindow methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 9 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 | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/TouchActionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/PinchViewportTest.cpp
diff --git a/Source/web/tests/PinchViewportTest.cpp b/Source/web/tests/PinchViewportTest.cpp
index c648b94d8ec256553cf2944eb0f6a00bd02dc482..804973912e594bba3d2e421213e2cc509fa1c17c 100644
--- a/Source/web/tests/PinchViewportTest.cpp
+++ b/Source/web/tests/PinchViewportTest.cpp
@@ -1636,4 +1636,41 @@ TEST_F(PinchViewportTest, AccessibilityHitTestWhileZoomedIn)
EXPECT_EQ(std::string("Target4"), hitNode.title().utf8());
}
+// Tests that the maximum scroll offset of the viewport can be fractional.
+TEST_F(PinchViewportTest, TestCoordinateTransforms)
+{
+ initializeWithAndroidSettings();
+ webViewImpl()->resize(IntSize(800, 600));
+ registerMockedHttpURLLoad("content-width-1000.html");
+ navigateTo(m_baseURL + "content-width-1000.html");
+
+ PinchViewport& pinchViewport = webViewImpl()->page()->frameHost().pinchViewport();
+ FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
+
+ // At scale = 1 the transform should be a no-op.
+ pinchViewport.setScale(1);
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(314, 273), pinchViewport.viewportToRootFrame(FloatPoint(314, 273)));
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(314, 273), pinchViewport.rootFrameToViewport(FloatPoint(314, 273)));
+
+ // At scale = 2.
+ pinchViewport.setScale(2);
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(55, 75), pinchViewport.viewportToRootFrame(FloatPoint(110, 150)));
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(110, 150), pinchViewport.rootFrameToViewport(FloatPoint(55, 75)));
+
+ // At scale = 2 and with the pinch viewport offset.
+ pinchViewport.setLocation(FloatPoint(10, 12));
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame(FloatPoint(80, 100)));
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport(FloatPoint(50, 62)));
+
+ // Test points that will cause non-integer values.
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(50.5, 62.4), pinchViewport.viewportToRootFrame(FloatPoint(81, 100.8)));
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewport(FloatPoint(50.5, 62.4)));
+
+
+ // Scrolling the main frame should have no effect.
+ frameView.scrollTo(DoublePoint(100, 120));
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame(FloatPoint(80, 100)));
+ EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport(FloatPoint(50, 62)));
+}
+
} // namespace
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/TouchActionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698