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

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

Issue 2747113003: Let Range::expand not crash when Range's start node is not connected to document. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Range.cpp ('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/HTMLDocument.h" 16 #include "core/html/HTMLDocument.h"
16 #include "core/html/HTMLElement.h" 17 #include "core/html/HTMLElement.h"
17 #include "core/html/HTMLHtmlElement.h" 18 #include "core/html/HTMLHtmlElement.h"
18 #include "platform/heap/Handle.h" 19 #include "platform/heap/Handle.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "wtf/Compiler.h" 21 #include "wtf/Compiler.h"
21 #include "wtf/RefPtr.h" 22 #include "wtf/RefPtr.h"
22 #include "wtf/text/AtomicString.h" 23 #include "wtf/text/AtomicString.h"
23 24
24 namespace blink { 25 namespace blink {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 div->removeChild(span1); 224 div->removeChild(span1);
224 text->deleteData(0, 3, ASSERT_NO_EXCEPTION); 225 text->deleteData(0, 3, ASSERT_NO_EXCEPTION);
225 226
226 EXPECT_TRUE(range->boundaryPointsValid()); 227 EXPECT_TRUE(range->boundaryPointsValid());
227 EXPECT_EQ(span2, range->startContainer()); 228 EXPECT_EQ(span2, range->startContainer());
228 EXPECT_EQ(0u, range->startOffset()); 229 EXPECT_EQ(0u, range->startOffset());
229 EXPECT_EQ(div, range->endContainer()); 230 EXPECT_EQ(div, range->endContainer());
230 EXPECT_EQ(2u, range->endOffset()); 231 EXPECT_EQ(2u, range->endOffset());
231 } 232 }
232 233
234 // Regression test for crbug.com/698123
235 TEST_F(RangeTest, ExpandNotCrash) {
236 Range* range = Range::create(document());
237 Node* div = HTMLDivElement::create(document());
238 range->setStart(div, 0, ASSERT_NO_EXCEPTION);
239 range->expand("", ASSERT_NO_EXCEPTION);
240 }
241
233 } // namespace blink 242 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Range.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698