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

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp

Issue 2720593005: Make PositionIterator to skip contents of INPUT/SELECT/TEXTAREA (Closed)
Patch Set: 2017-03-02T19:03:48 Add FrameSelectionTest.SelectAllWithInputElement Created 3 years, 10 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: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
index 722dbb0452d4b09cf878c401071c4246bf8cbb36..403316ed57e21e4963eb59e3782097ead5a75065 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -218,6 +218,28 @@ TEST_F(FrameSelectionTest, MoveRangeSelectionTest) {
EXPECT_EQ_SELECTED_TEXT("Foo Bar");
}
+// For http://crbug.com/695317
+TEST_F(FrameSelectionTest, SelectAllWithInputElement) {
+ setBodyContent("<input>123");
+ Element* const input = document().querySelector("input");
+ Node* const lastChild = document().body()->lastChild();
+ selection().selectAll();
+ const SelectionInDOMTree& resultInDOMTree =
+ selection().computeVisibleSelectionInDOMTree().asSelection();
+ const SelectionInFlatTree& resultInFlatTree =
+ selection().computeVisibleSelectionInFlatTree().asSelection();
+ EXPECT_EQ(SelectionInDOMTree::Builder(resultInDOMTree)
+ .collapse(Position::beforeNode(input))
+ .extend(Position(lastChild, 3))
+ .build(),
+ resultInDOMTree);
+ EXPECT_EQ(SelectionInFlatTree::Builder(resultInFlatTree)
+ .collapse(PositionInFlatTree::beforeNode(input))
+ .extend(PositionInFlatTree(lastChild, 3))
+ .build(),
+ resultInFlatTree);
+}
+
TEST_F(FrameSelectionTest, SelectAllWithUnselectableRoot) {
Element* select = document().createElement("select");
document().replaceChild(select, document().documentElement());

Powered by Google App Engine
This is Rietveld 408576698