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

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

Issue 2701083002: Preserve handles visibility when modifying selection (Closed)
Patch Set: Removed redundant EXPECTs 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/FrameSelection.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/FrameSelectionTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
index d124ac45be723eae551ef135514992fcf0c9aad5..9047d807d2984a0b6b298c4b77bcdea5ae0faba9 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -293,4 +293,37 @@ TEST_F(FrameSelectionTest, SelectAllPreservesHandle) {
"after it.";
}
+TEST_F(FrameSelectionTest, SetSelectedRangePreservesHandle) {
+ Text* text = appendTextNode("Hello, World!");
+ document().view()->updateAllLifecyclePhases();
+ selection().setSelection(
+ SelectionInDOMTree::Builder()
+ .setBaseAndExtent(Position(text, 0), Position(text, 5))
+ .setIsHandleVisible(false)
+ .build());
+
+ selection().setSelectedRange(
+ EphemeralRange(Position(text, 0), Position(text, 12)),
+ VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0);
+
+ EXPECT_FALSE(selection().isHandleVisible())
+ << "If handles weren't present before"
+ "setSelectedRange they shouldn't be present"
+ "after it.";
+
+ selection().setSelection(
+ SelectionInDOMTree::Builder()
+ .setBaseAndExtent(Position(text, 0), Position(text, 5))
+ .setIsHandleVisible(true)
+ .build());
+
+ selection().setSelectedRange(
+ EphemeralRange(Position(text, 0), Position(text, 12)),
+ VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0);
+
+ EXPECT_TRUE(selection().isHandleVisible())
+ << "If handles were present before"
+ "selectSetSelectedRange they should be present after it.";
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698