| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/dom/Range.h" | 5 #include "core/dom/Range.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/V8BindingForTesting.h" | 8 #include "bindings/core/v8/V8BindingForTesting.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/NodeList.h" | 10 #include "core/dom/NodeList.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 // Regression test for crbug.com/698123 | 234 // Regression test for crbug.com/698123 |
| 235 TEST_F(RangeTest, ExpandNotCrash) { | 235 TEST_F(RangeTest, ExpandNotCrash) { |
| 236 Range* range = Range::create(document()); | 236 Range* range = Range::create(document()); |
| 237 Node* div = HTMLDivElement::create(document()); | 237 Node* div = HTMLDivElement::create(document()); |
| 238 range->setStart(div, 0, ASSERT_NO_EXCEPTION); | 238 range->setStart(div, 0, ASSERT_NO_EXCEPTION); |
| 239 range->expand("", ASSERT_NO_EXCEPTION); | 239 range->expand("", ASSERT_NO_EXCEPTION); |
| 240 } | 240 } |
| 241 | 241 |
| 242 TEST_F(RangeTest, MultipleTextQuads) { |
| 243 setBodyContent("<div><p id='one'>one</p><p id='two'>two</p></div>"); |
| 244 Position start(document().getElementById("one")->firstChild(), 0); |
| 245 Position end(document().getElementById("two")->firstChild(), 3); |
| 246 Range* range = Range::create(document(), start, end); |
| 247 Vector<FloatQuad> quads; |
| 248 range->textQuads(quads); |
| 249 EXPECT_EQ(2u, quads.size()); |
| 250 } |
| 251 |
| 242 } // namespace blink | 252 } // namespace blink |
| OLD | NEW |