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

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

Issue 2745533004: Range.surroundContents() should not check node types beforehand. (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 | « third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-surroundContents-expected.txt ('k') | no next file » | 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 57de739ef4e668c656ffeae75f5766f02a518a25..37c2126240caed0aa99cfb54a7a9c6ce54adfc15 100644
--- a/third_party/WebKit/Source/core/dom/Range.cpp
+++ b/third_party/WebKit/Source/core/dom/Range.cpp
@@ -1380,16 +1380,13 @@ void Range::surroundContents(Node* newParent, ExceptionState& exceptionState) {
return;
}
- if (!parentOfNewParent->childTypeAllowed(newParent->getNodeType())) {
- exceptionState.throwDOMException(HierarchyRequestError,
- "The node provided is of type '" +
- newParent->nodeName() +
- "', which may not be inserted here.");
- return;
- }
-
EventQueueScope scope;
+ // 3. Let fragment be the result of extracting context object.
+ DocumentFragment* fragment = extractContents(exceptionState);
+ if (exceptionState.hadException())
+ return;
+
// 4. If newParent has children, replace all with null within newParent.
while (Node* n = newParent->firstChild()) {
toContainerNode(newParent)->removeChild(n, exceptionState);
@@ -1397,11 +1394,6 @@ void Range::surroundContents(Node* newParent, ExceptionState& exceptionState) {
return;
}
- // 3. Let fragment be the result of extracting context object.
- DocumentFragment* fragment = extractContents(exceptionState);
- if (exceptionState.hadException())
- return;
-
// 5. If newParent has children, replace all with null within newParent.
insertNode(newParent, exceptionState);
if (exceptionState.hadException())
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-surroundContents-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698