Chromium Code Reviews| 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 127fdc983857351037aa2d0a3366ee6229ed8dda..61d9f38ba17746d1382aea26385f57a1b5a51b1a 100644 |
| --- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp |
| @@ -1980,4 +1980,35 @@ TEST_F(VisibleUnitsTest, |
| EXPECT_EQ(Position(text, 2), start); |
| } |
| +TEST_F(VisibleUnitsTest, computeTextQuadDOM) { |
| + const char* bodyContent = |
| + "<style> font-family: Ahem; </style>" |
|
Xiaocheng
2017/05/17 18:46:39
This is not correct CSS. There should be a selecto
|
| + "<p id='host'>00" |
| + "<b id='one'>11111</b>" |
| + "<b id='two'>22</b>" |
| + "<b id='three'>33</b>" |
| + "</p>"; |
| + SetBodyContent(bodyContent); |
| + |
| + const Position start_position(GetDocument().getElementById("host"), 0); |
| + const Position mid_position(GetDocument().getElementById("two"), 0); |
| + const Position end_position(GetDocument().getElementById("three"), 0); |
| + const EphemeralRange range_start_to_two(start_position, mid_position); |
| + const EphemeralRange range_start_to_three(start_position, end_position); |
| + Vector<FloatQuad> quads_start_to_two; |
| + Vector<FloatQuad> quads_start_to_three; |
| + quads_start_to_two.AppendVector(ComputeTextQuads(range_start_to_two)); |
| + quads_start_to_three.AppendVector(ComputeTextQuads(range_start_to_three)); |
| + |
| + EXPECT_EQ(2u, quads_start_to_two.size()); |
| + EXPECT_EQ(3u, quads_start_to_three.size()); |
| + EXPECT_EQ(quads_start_to_three[0], quads_start_to_two[0]); |
| + EXPECT_EQ(quads_start_to_three[1], quads_start_to_two[1]); |
| + EXPECT_EQ("8,8; 10,8; 10,9; 8,9", quads_start_to_two[0].ToString()); |
| + EXPECT_EQ("10,8; 15,8; 15,9; 10,9", quads_start_to_two[1].ToString()); |
| + EXPECT_EQ("8,8; 10,8; 10,9; 8,9", quads_start_to_three[0].ToString()); |
| + EXPECT_EQ("10,8; 15,8; 15,9; 10,9", quads_start_to_three[1].ToString()); |
| + EXPECT_EQ("15,8; 17,8; 17,9; 15,9", quads_start_to_three[2].ToString()); |
| +} |
| + |
| } // namespace blink |