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

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

Issue 319643002: Fixed touch selection handle manipulation when pinched in. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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/WebLocalFrameImpl.cpp ('k') | Source/web/tests/data/move_range.html » ('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 118e3a367d803f87f5d831a8222cc86aa50c502e..6fa9efdf855f837a54fff2c82a4a32f902f7900a 100644
--- a/Source/web/tests/PinchViewportTest.cpp
+++ b/Source/web/tests/PinchViewportTest.cpp
@@ -598,6 +598,41 @@ TEST_F(PinchViewportTest, TestRestoredFromLegacyHistoryItem)
EXPECT_FLOAT_POINT_EQ(FloatPoint(20, 30), pinchViewport.visibleRect().location());
}
+// Test that the coordinates sent into moveRangeSelection are offset by the
+// pinch viewport's location.
+TEST_F(PinchViewportTest, TestWebFrameRangeAccountsForPinchViewportScroll)
+{
+ initializeWithDesktopSettings();
+ webViewImpl()->settings()->setDefaultFontSize(12);
+ webViewImpl()->resize(WebSize(640, 480));
+ registerMockedHttpURLLoad("move_range.html");
+ navigateTo(m_baseURL + "move_range.html");
+
+ WebRect baseRect;
+ WebRect extentRect;
+
+ webViewImpl()->setPageScaleFactor(2);
+ WebFrame* mainFrame = webViewImpl()->mainFrame();
+
+ // Select some text and get the base and extent rects (that's the start of
+ // the range and its end). Do a sanity check that the expected text is
+ // selected
+ mainFrame->executeScript(WebScriptSource("selectRange();"));
+ EXPECT_EQ("ir", mainFrame->selectionAsText().utf8());
+
+ webViewImpl()->selectionBounds(baseRect, extentRect);
+ WebPoint initialPoint(baseRect.x, baseRect.y);
+ WebPoint endPoint(extentRect.x, extentRect.y);
+
+ // Move the pinch viewport over and make the selection in the same
+ // screen-space location. The selection should change to two characters to
+ // the right and down one line.
+ PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
+ pinchViewport.move(FloatPoint(60, 25));
+ mainFrame->moveRangeSelection(initialPoint, endPoint);
+ EXPECT_EQ("t ", mainFrame->selectionAsText().utf8());
+}
+
// Test that the scrollFocusedNodeIntoRect method works with the pinch viewport.
TEST_F(PinchViewportTest, TestScrollFocusedNodeIntoRect)
{
« no previous file with comments | « Source/web/WebLocalFrameImpl.cpp ('k') | Source/web/tests/data/move_range.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698