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

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

Issue 2723133004: Get rid of redundant member variable SelectionEditor::m_logicalRange (Closed)
Patch Set: 2017-03-06T13:02:21 rebase 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
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 403316ed57e21e4963eb59e3782097ead5a75065..d124ac45be723eae551ef135514992fcf0c9aad5 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -56,6 +56,22 @@ Text* FrameSelectionTest::appendTextNode(const String& data) {
return text;
}
+TEST_F(FrameSelectionTest, FirstRange) {
+ setBodyContent("<div id=sample>0123456789</div>abc");
+ Element* const sample = document().getElementById("sample");
+ Node* const text = sample->firstChild();
+ selection().setSelectedRange(
+ EphemeralRange(Position(text, 3), Position(text, 6)), VP_DEFAULT_AFFINITY,
+ SelectionDirectionalMode::NonDirectional, 0);
+ sample->setAttribute(HTMLNames::styleAttr, "display:none");
+ // Move |VisibleSelection| before "abc".
+ updateAllLifecyclePhases();
+ Range* const range = selection().firstRange();
+ EXPECT_EQ(Position(sample->nextSibling(), 0), range->startPosition())
+ << "firstRagne() should return current selection value";
+ EXPECT_EQ(Position(sample->nextSibling(), 0), range->endPosition());
+}
+
TEST_F(FrameSelectionTest, SetValidSelection) {
Text* text = appendTextNode("Hello, World!");
document().view()->updateAllLifecyclePhases();
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | third_party/WebKit/Source/core/editing/SelectionEditor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698