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

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

Issue 1363833002: Drop unnecessary ancestor traversal in Range::selectNode() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 | 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 4fa8b8b9c967ac96e518ae08f00915e822a667e9..8ab9700a48a5c0c303ca51d19fdd55a244ce2c91 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -1080,26 +1080,7 @@ void Range::selectNode(Node* refNode, ExceptionState& exceptionState)
return;
}
- // InvalidNodeTypeError: Raised if an ancestor of refNode is an Entity, Notation or
- // DocumentType node or if refNode is a Document, DocumentFragment, ShadowRoot, Attr, Entity, or Notation
- // node.
- for (ContainerNode* anc = refNode->parentNode(); anc; anc = anc->parentNode()) {
- switch (anc->nodeType()) {
- case Node::ATTRIBUTE_NODE:
- case Node::CDATA_SECTION_NODE:
- case Node::COMMENT_NODE:
- case Node::DOCUMENT_FRAGMENT_NODE:
- case Node::DOCUMENT_NODE:
- case Node::ELEMENT_NODE:
- case Node::PROCESSING_INSTRUCTION_NODE:
- case Node::TEXT_NODE:
- break;
- case Node::DOCUMENT_TYPE_NODE:
- exceptionState.throwDOMException(InvalidNodeTypeError, "The node provided has an ancestor of type '" + anc->nodeName() + "'.");
- return;
- }
- }
-
+ // INVALID_NODE_TYPE_ERR: Raised if refNode is a Document, DocumentFragment or Attr node.
sof 2015/09/23 10:01:39 InvalidNodeTypeError, not INVALID_NODE_TYPE_ERR, b
pals 2015/09/23 11:34:35 Done.
switch (refNode->nodeType()) {
case Node::CDATA_SECTION_NODE:
case Node::COMMENT_NODE:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698