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

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

Issue 2747333002: Make makeSearchRange() in VisibleSelection to handle BeforeAnchor and AfterAnchor position type (Closed)
Patch Set: 2017-03-15T14:33:19 Update a comment in test Created 3 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 | « third_party/WebKit/Source/core/editing/VisibleSelection.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/VisibleSelectionTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelectionTest.cpp b/third_party/WebKit/Source/core/editing/VisibleSelectionTest.cpp
index e0c1ebccd012d0dfb37624b74ba9f51157e18f4b..4dfa9fd4d9d913a2fb74b567578be19b9d5b2d07 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleSelectionTest.cpp
@@ -70,6 +70,29 @@ VisibleSelectionTemplate<Strategy> expandUsingGranularity(
.build());
}
+// For http://crbug.com/700368
+TEST_F(VisibleSelectionTest, appendTrailingWhitespaceWithAfterAnchor) {
+ setBodyContent(
+ "<input type=checkbox>"
+ "<div style='user-select:none'>abc</div>");
+ Element* const input = document().querySelector("input");
+
+ // Simulate double-clicking "abc".
+ // TODO(editing-dev): We should remove above comment once we fix [1].
+ // [1] http://crbug.com/701657 double-click on user-select:none should not
+ // compute selection.
+ VisibleSelection selection =
+ createVisibleSelection(SelectionInDOMTree::Builder()
+ .collapse(Position::beforeNode(input))
+ .extend(Position::afterNode(input))
+ .setGranularity(WordGranularity)
+ .build());
+ selection.appendTrailingWhitespace();
+
+ EXPECT_EQ(Position::beforeNode(input), selection.start());
+ EXPECT_EQ(Position::afterNode(input), selection.end());
+}
+
TEST_F(VisibleSelectionTest, expandUsingGranularity) {
const char* bodyContent =
"<span id=host><a id=one>1</a><a id=two>22</a></span>";
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698