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

Unified Diff: third_party/WebKit/Source/core/dom/Range.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/RangeTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Range.cpp
diff --git a/third_party/WebKit/Source/core/dom/Range.cpp b/third_party/WebKit/Source/core/dom/Range.cpp
index 45618228a553fb8b3721f8e7b738d8269220a468..938dfec2fd5f1c6284af20b88ace609fa7d671b0 100644
--- a/third_party/WebKit/Source/core/dom/Range.cpp
+++ b/third_party/WebKit/Source/core/dom/Range.cpp
@@ -1644,8 +1644,9 @@ void Range::didSplitTextNode(const Text& oldNode) {
}
void Range::expand(const String& unit, ExceptionState& exceptionState) {
+ if (!startPosition().isConnected() || !endPosition().isConnected())
+ return;
m_ownerDocument->updateStyleAndLayoutIgnorePendingStylesheets();
-
VisiblePosition start = createVisiblePosition(startPosition());
VisiblePosition end = createVisiblePosition(endPosition());
if (unit == "word") {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/RangeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698