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

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

Issue 1958093002: CONTINUED Make FrameSelection to hold non-canonicalized positions Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2017-01-16T20:04:35 Created 3 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: 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 0ae1c218a917f3b8beef7727bee1ce8e74ed37f0..382915918aba0336a8e78532eacd80ff068600c5 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -33,7 +33,7 @@ class FrameSelectionTest : public EditingTestBase {
return selection().selection();
}
const VisibleSelectionInFlatTree& visibleSelectionInFlatTree() const {
- return selection().selectionInFlatTree();
+ return selection().computeVisibleSelectionInFlatTree();
}
Text* appendTextNode(const String& data);
@@ -91,6 +91,9 @@ TEST_F(FrameSelectionTest, InvalidateCaretRect) {
EXPECT_FALSE(selection().isCaretBoundsDirty());
}
+// TODO(yosin): We should get rid of |PaintCaretShouldNotLayout| since
+// |FrameSelection::paintCaret()| requires up-to-date layout.
+#if 0
TEST_F(FrameSelectionTest, PaintCaretShouldNotLayout) {
Text* text = appendTextNode("Hello, World!");
document().view()->updateAllLifecyclePhases();
@@ -122,6 +125,7 @@ TEST_F(FrameSelectionTest, PaintCaretShouldNotLayout) {
paintController->commitNewDisplayItems();
EXPECT_EQ(startCount, layoutCount());
}
+#endif
TEST_F(FrameSelectionTest, InvalidatePreviousCaretAfterRemovingLastCharacter) {
Text* text = appendTextNode("Hello, World!");
@@ -155,7 +159,7 @@ TEST_F(FrameSelectionTest, InvalidatePreviousCaretAfterRemovingLastCharacter) {
selection().setCaretRectNeedsUpdate();
EXPECT_TRUE(selection().isCaretBoundsDirty());
// "H" remains so early previousCaret invalidation isn't needed.
- EXPECT_TRUE(isPreviousCaretDirtyForTesting());
+ EXPECT_FALSE(isPreviousCaretDirtyForTesting());
selection().invalidateCaretRect();
EXPECT_FALSE(selection().isCaretBoundsDirty());
EXPECT_TRUE(isPreviousCaretDirtyForTesting());
@@ -285,7 +289,7 @@ class SelectionControllerTest : public EditingTestBase {
}
const VisibleSelectionInFlatTree& visibleSelectionInFlatTree() const {
- return selection().selectionInFlatTree();
+ return selection().computeVisibleSelectionInFlatTree();
}
void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInFlatTree&,
@@ -314,17 +318,14 @@ TEST_F(FrameSelectionTest, updateIfNeededAndFrameCaret) {
EXPECT_EQ(Position(document().body(), 0), selection().start());
EXPECT_EQ(selection().start(), caretPosition().position());
document().body()->remove();
- // TODO(yosin): Once lazy canonicalization implemented, selection.start
- // should be Position(HTML, 0).
- EXPECT_EQ(Position(document().documentElement(), 1), selection().start());
+ EXPECT_EQ(Position(), selection().start())
+ << "Selection has been removed by BODY.remove().";
EXPECT_EQ(selection().start(), caretPosition().position());
document().updateStyleAndLayout();
selection().updateIfNeeded();
- // TODO(yosin): Once lazy canonicalization implemented, selection.start
- // should be Position(HTML, 0).
EXPECT_EQ(Position(), selection().start())
- << "updateIfNeeded() makes selection to null.";
+ << "updateIfNeeded() does nothing.";
EXPECT_EQ(selection().start(), caretPosition().position());
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | third_party/WebKit/Source/core/editing/PendingSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698