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

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

Issue 2775663008: LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange (Closed)
Patch Set: Addressed Review comments 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..37ab4788b864c2458ac47ef0424bfcc9b6a83bf0 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
@@ -1977,4 +1977,61 @@ TEST_F(VisibleUnitsTest,
EXPECT_EQ(Position(text, 2), start);
}
+TEST_F(VisibleUnitsTest, textQuadDOM) {
+ const char* bodyContent =
+ "<p id='host'>00"
+ "<b id='one'>11111</b>"
+ "<b id='two'>22</b>"
+ "<b id='three'>33</b>"
+ "</p>";
+ setBodyContent(bodyContent);
+
+ const Position startPosition(document().getElementById("host"), 0);
+ const Position midPosition(document().getElementById("two"), 0);
+ const Position endPosition(document().getElementById("three"), 0);
+ const EphemeralRange rangeStartToTwo(startPosition, midPosition);
+ const EphemeralRange rangeStartToThree(startPosition, endPosition);
+ Vector<FloatQuad> quadsStartToTwo;
+ Vector<FloatQuad> quadsStartToThree;
+ textQuads(quadsStartToTwo, rangeStartToTwo);
+ textQuads(quadsStartToThree, rangeStartToThree);
+
+ EXPECT_EQ(1u, quadsStartToTwo.size());
+ EXPECT_EQ(1u, quadsStartToThree.size());
+ EXPECT_EQ("10,8; 15,8; 15,9; 10,9", quadsStartToTwo[0].toString());
Xiaocheng 2017/03/31 18:01:19 Wait... Doesn't https://codereview.chromium.org/27
tanvir 2017/04/03 13:00:48 Based on the discussion in https://bugs.chromium.o
+ EXPECT_EQ("15,8; 17,8; 17,9; 15,9", quadsStartToThree[0].toString());
Xiaocheng 2017/03/31 18:01:19 Same here, "15,8; 17,8; 17,9; 15,9" is the quad fo
+}
+
+TEST_F(VisibleUnitsTest, textQuadFlatTree) {
+ const char* bodyContent =
+ "<b id='zero'>0</b>"
+ "<p id='host'>"
+ "<b id='one'>1</b>"
+ "<b id='two'>22</b>"
+ "</p>"
+ "<b id='three'>333</b>";
+ const char* shadowContent =
+ "<p id='four'>4444</p>"
+ "<content select=#two></content>"
+ "<content select=#one></content>"
+ "<p id='five'>55555</p>";
+ setBodyContent(bodyContent);
+ ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host");
+
+ const PositionInFlatTree startPosition(document().getElementById("host"), 0);
+ const PositionInFlatTree threePosition(document().getElementById("three"), 0);
+ const PositionInFlatTree fivePosition(shadowRoot->getElementById("five"), 0);
+ const EphemeralRangeInFlatTree rangeStartToThree(startPosition,
+ threePosition);
+ const EphemeralRangeInFlatTree rangeStartToFive(startPosition, fivePosition);
+ Vector<FloatQuad> quadsStartToThree;
+ Vector<FloatQuad> quadsStartToFive;
+ textQuads(quadsStartToThree, rangeStartToThree);
+ textQuads(quadsStartToFive, rangeStartToFive);
+
+ EXPECT_EQ(1u, quadsStartToThree.size());
+ EXPECT_EQ(1u, quadsStartToFive.size());
+ EXPECT_EQ("8,14; 13,14; 13,15; 8,15", quadsStartToThree[0].toString());
+ EXPECT_EQ("10,12; 11,12; 11,13; 10,13", quadsStartToFive[0].toString());
+}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698