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

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

Issue 766753002: Scroll text field when selecting text (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 054308b7cab5dedacbaaa2c792b5f9b8ade5261f..14187666180df9eb75bfb63ce521c285c6124e19 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -4170,6 +4170,26 @@ TEST_F(WebFrameTest, MoveRangeSelectionExtentCannotCollapse)
EXPECT_EQ("This text is initially selected.", selectionAsString(frame));
}
+TEST_F(WebFrameTest, MoveRangeSelectionExtentScollsInputField)
+{
+ WebLocalFrameImpl* frame;
+ WebRect startWebRect;
+ WebRect endWebRect;
+
+ registerMockedHttpURLLoad("move_range_selection_extent_input_field.html");
+
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ initializeTextSelectionWebView(m_baseURL + "move_range_selection_extent_input_field.html", &webViewHelper);
+ frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame());
+ EXPECT_EQ("Length", selectionAsString(frame));
+ webViewHelper.webView()->selectionBounds(startWebRect, endWebRect);
+
+ EXPECT_EQ(0, frame->frame()->selection().rootEditableElement()->scrollLeft());
+ frame->moveRangeSelectionExtent(WebPoint(endWebRect.x + 500, endWebRect.y));
+ EXPECT_GE(frame->frame()->selection().rootEditableElement()->scrollLeft(), 1);
+ EXPECT_EQ("Lengthy text goes here.", selectionAsString(frame));
+}
+
static int computeOffset(RenderObject* renderer, int x, int y)
{
return VisiblePosition(renderer->positionForPoint(LayoutPoint(x, y))).deepEquivalent().computeOffsetInContainerNode();
« no previous file with comments | « Source/web/WebLocalFrameImpl.cpp ('k') | Source/web/tests/data/move_range_selection_extent_input_field.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698