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

Side by Side Diff: third_party/WebKit/Source/core/dom/RangeTest.cpp

Issue 2786853002: Let RangeBoundaryPoint::toPoisition return Position not considering Editing (Closed)
Patch Set: Rebase Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "core/dom/Text.h" 11 #include "core/dom/Text.h"
12 #include "core/editing/EditingTestBase.h" 12 #include "core/editing/EditingTestBase.h"
13 #include "core/frame/Settings.h" 13 #include "core/frame/Settings.h"
14 #include "core/html/HTMLBodyElement.h" 14 #include "core/html/HTMLBodyElement.h"
15 #include "core/html/HTMLDivElement.h" 15 #include "core/html/HTMLDivElement.h"
16 #include "core/html/HTMLDocument.h" 16 #include "core/html/HTMLDocument.h"
17 #include "core/html/HTMLElement.h" 17 #include "core/html/HTMLElement.h"
18 #include "core/html/HTMLHtmlElement.h" 18 #include "core/html/HTMLHtmlElement.h"
19 #include "core/html/HTMLTextAreaElement.h"
19 #include "platform/heap/Handle.h" 20 #include "platform/heap/Handle.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "wtf/Compiler.h" 22 #include "wtf/Compiler.h"
22 #include "wtf/RefPtr.h" 23 #include "wtf/RefPtr.h"
23 #include "wtf/text/AtomicString.h" 24 #include "wtf/text/AtomicString.h"
24 25
25 namespace blink { 26 namespace blink {
26 27
27 class RangeTest : public EditingTestBase {}; 28 class RangeTest : public EditingTestBase {};
28 29
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 TEST_F(RangeTest, MultipleTextQuads) { 243 TEST_F(RangeTest, MultipleTextQuads) {
243 setBodyContent("<div><p id='one'>one</p><p id='two'>two</p></div>"); 244 setBodyContent("<div><p id='one'>one</p><p id='two'>two</p></div>");
244 Position start(document().getElementById("one")->firstChild(), 0); 245 Position start(document().getElementById("one")->firstChild(), 0);
245 Position end(document().getElementById("two")->firstChild(), 3); 246 Position end(document().getElementById("two")->firstChild(), 3);
246 Range* range = Range::create(document(), start, end); 247 Range* range = Range::create(document(), start, end);
247 Vector<FloatQuad> quads; 248 Vector<FloatQuad> quads;
248 range->textQuads(quads); 249 range->textQuads(quads);
249 EXPECT_EQ(2u, quads.size()); 250 EXPECT_EQ(2u, quads.size());
250 } 251 }
251 252
253 TEST_F(RangeTest, ToPosition) {
254 Node& textarea = *HTMLTextAreaElement::create(document());
255 Range& range = *Range::create(document());
256 const Position position = Position(&textarea, 0);
257 range.setStart(position, ASSERT_NO_EXCEPTION);
258 EXPECT_EQ(position, range.startPosition());
259 EXPECT_EQ(position, range.endPosition());
260 }
261
252 } // namespace blink 262 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698