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

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

Issue 2775663008: LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange (Closed)
Patch Set: Y 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 eef817703aad94da2366eb80bb9ba0f3301ebe54..736d92ffac8e3806e5cda6217d6a359517d8a074 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
@@ -2037,4 +2037,63 @@ 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;
+ textQuad(quadsStartToTwo, rangeStartToTwo);
+ textQuad(quadsStartToThree, rangeStartToThree);
+
+ EXPECT_EQ(2.0, quadsStartToTwo.size());
+ EXPECT_EQ(3.0, quadsStartToThree.size());
+ EXPECT_EQ(quadsStartToThree[0].toString(), quadsStartToTwo[0].toString());
Shanmuga Pandi 2017/03/28 12:02:41 toString() may not needed here
+ EXPECT_EQ(quadsStartToThree[1].toString(), quadsStartToTwo[1].toString());
+ EXPECT_EQ("15,8; 17,8; 17,9; 15,9", quadsStartToThree[2].toString());
+}
+
+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;
+ textQuad(quadsStartToThree, rangeStartToThree);
+ textQuad(quadsStartToFive, rangeStartToFive);
+
+ EXPECT_EQ(4.0, quadsStartToThree.size());
+ EXPECT_EQ(3.0, quadsStartToFive.size());
+ EXPECT_EQ(quadsStartToThree[0].toString(), quadsStartToFive[0].toString());
Shanmuga Pandi 2017/03/28 12:02:41 ditto
+ EXPECT_EQ(quadsStartToThree[1].toString(), quadsStartToFive[1].toString());
+ EXPECT_EQ("8,10; 12,10; 12,11; 8,11", quadsStartToFive[0].toString());
+}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698