OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/editing/EphemeralRange.h" | 5 #include "core/editing/EphemeralRange.h" |
6 | 6 |
7 #include "core/dom/Range.h" | 7 #include "core/dom/Range.h" |
8 #include "core/editing/EditingTestBase.h" | 8 #include "core/editing/EditingTestBase.h" |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 "<p id='five'>55555</p>"; | 214 "<p id='five'>55555</p>"; |
215 setBodyContent(bodyContent); | 215 setBodyContent(bodyContent); |
216 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); | 216 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); |
217 | 217 |
218 const PositionInFlatTree startPosition(document().getElementById("one"), 0); | 218 const PositionInFlatTree startPosition(document().getElementById("one"), 0); |
219 const PositionInFlatTree endPosition(shadowRoot->getElementById("five"), 0); | 219 const PositionInFlatTree endPosition(shadowRoot->getElementById("five"), 0); |
220 const EphemeralRangeInFlatTree range(startPosition, endPosition); | 220 const EphemeralRangeInFlatTree range(startPosition, endPosition); |
221 EXPECT_EQ(document().getElementById("host"), range.commonAncestorContainer()); | 221 EXPECT_EQ(document().getElementById("host"), range.commonAncestorContainer()); |
222 } | 222 } |
223 | 223 |
224 TEST_F(EphemeralRangeTest, boundingBox) { | |
Xiaocheng
2017/03/29 19:51:08
Please move the test case to VisibleUnitsTest, and
| |
225 const char* bodyContent = | |
226 "<p id='host'>1" | |
227 "<b id='one'>22</b>" | |
228 "<b id='two'>333</b>" | |
229 "<b id='three'>4444</b>" | |
230 "</p>"; | |
231 setBodyContent(bodyContent); | |
232 | |
233 const Position startPosition(document().getElementById("one"), 0); | |
234 const Position endPosition(document().getElementById("three"), 0); | |
235 Range* range = getBodyRange(); | |
236 range->setStart(document().getElementById("one"), 0, | |
237 IGNORE_EXCEPTION_FOR_TESTING); | |
238 range->setEnd(document().getElementById("three"), 0, | |
239 IGNORE_EXCEPTION_FOR_TESTING); | |
240 const EphemeralRange ephemeralRange(startPosition, endPosition); | |
241 EXPECT_EQ(range->boundingBox().toString(), | |
Xiaocheng
2017/03/29 19:51:07
Please inspect the return value directly. No need
| |
242 ephemeralRange.boundingBox().toString()); | |
243 } | |
244 | |
224 } // namespace blink | 245 } // namespace blink |
OLD | NEW |