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

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

Issue 2776103002: Make RenderedRectsForMarkers() to ignore disconnected nodes. (Closed)
Patch Set: move to VisibleUnits 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/VisibleUnitsTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
index c4d76ac5dca6b6645be5214ea354509a89591a3f..c04b267d100c1e865c0b42eff045169b8b4a29ad 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
@@ -1977,4 +1977,47 @@ TEST_F(VisibleUnitsTest,
EXPECT_EQ(Position(text, 2), start);
}
+TEST_F(VisibleUnitsTest, boundingBoxWithEphemeralRange) {
+ const char* bodyContent =
+ "<p id='host'>1"
+ "<b id='one'>22</b>"
+ "<b id='two'>333</b>"
+ "<b id='three'>4444</b>"
+ "</p>";
+ setBodyContent(bodyContent);
+
+ const Position startPosition(document().getElementById("one"), 0);
+ const Position endPosition(document().getElementById("three"), 0);
+ Range* range = Range::create(document());
+ range->selectNode(document().body());
+ range->setStart(document().getElementById("one"), 0,
+ IGNORE_EXCEPTION_FOR_TESTING);
+ range->setEnd(document().getElementById("three"), 0,
+ IGNORE_EXCEPTION_FOR_TESTING);
+ const EphemeralRange ephemeralRange(startPosition, endPosition);
+ EXPECT_EQ(range->boundingBox(), boundingBox(ephemeralRange));
+}
+
+TEST_F(VisibleUnitsTest, boundingBoxWithEphemeralRangeInFlatTree) {
+ const char* bodyContent =
+ "<p id='host'>1"
+ "<b id='one'>22</b>"
+ "<b id='two'>333</b>"
+ "<b id='three'>4444</b>"
+ "</p>";
+ setBodyContent(bodyContent);
+
+ const PositionInFlatTree startPosition(document().getElementById("one"), 0);
+ const PositionInFlatTree endPosition(document().getElementById("three"), 0);
+ Range* range = Range::create(document());
+ range->selectNode(document().body());
+ range->setStart(document().getElementById("one"), 0,
+ IGNORE_EXCEPTION_FOR_TESTING);
+ range->setEnd(document().getElementById("three"), 0,
+ IGNORE_EXCEPTION_FOR_TESTING);
+ const EphemeralRangeInFlatTree ephemeralRangeInFlatTree(startPosition,
+ endPosition);
+ EXPECT_EQ(range->boundingBox(), boundingBox(ephemeralRangeInFlatTree));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698