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

Unified Diff: Source/core/dom/Range.cpp

Issue 23071006: Make Range::selectNode() and Range::surroundContents() to work with detached node (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-08-22T16:53:38 Created 7 years, 4 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 | « LayoutTests/fast/dom/Range/surroundContents-for-detached-node-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index e9ddce35a9d3be597cf984417d1f11f56220618c..a72ad1be5243580d7c976cda18f879efbb76ab80 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -1326,13 +1326,18 @@ void Range::selectNode(Node* refNode, ExceptionState& es)
return;
}
+ if (!refNode->parentNode()) {
+ es.throwDOMException(InvalidNodeTypeError);
Mike West 2013/08/22 08:17:11 1. Perhaps you could move this up above the for lo
yosin_UTC9 2013/08/22 09:48:44 Done.
+ return;
+ }
+
if (m_ownerDocument != refNode->document())
setDocument(refNode->document());
- setStartBefore(refNode, es);
+ setStart(refNode->parentNode(), refNode->nodeIndex(), es);
Mike West 2013/08/22 08:17:11 Can this throw an exception, given the node-type c
yosin_UTC9 2013/08/22 09:48:44 Done.
Mike West 2013/08/22 10:23:47 This was an honest question. I don't think it can
if (es.hadException())
return;
- setEndAfter(refNode, es);
+ setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, es);
Mike West 2013/08/22 08:17:11 Same here.
yosin_UTC9 2013/08/22 09:48:44 Done.
}
void Range::selectNodeContents(Node* refNode, ExceptionState& es)
« no previous file with comments | « LayoutTests/fast/dom/Range/surroundContents-for-detached-node-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698