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

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

Issue 1364683003: Range.intersectsNode() does not behave according to the specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test rebaselined 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 | « LayoutTests/fast/dom/Range/resources/intersectsNode.js ('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 4fa8b8b9c967ac96e518ae08f00915e822a667e9..e1082726394eb3dd883200f8501702732b7511dd 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -399,12 +399,8 @@ bool Range::intersectsNode(Node* refNode, ExceptionState& exceptionState)
ContainerNode* parentNode = refNode->parentNode();
int nodeIndex = refNode->nodeIndex();
- if (!parentNode) {
- // if the node is the top document we should return NODE_BEFORE_AND_AFTER
- // but we throw to match firefox behavior
- exceptionState.throwDOMException(NotFoundError, "The node provided has no parent.");
- return false;
- }
+ if (!parentNode)
sof 2015/09/25 09:17:04 Could you move this up to the line after where par
pals 2015/09/28 11:29:06 Done.
+ return true;
if (comparePoint(parentNode, nodeIndex, exceptionState) < 0 // starts before start
&& comparePoint(parentNode, nodeIndex + 1, exceptionState) < 0) { // ends before start
@@ -429,12 +425,8 @@ bool Range::intersectsNode(Node* refNode, const Position& start, const Position&
ContainerNode* parentNode = refNode->parentNode();
int nodeIndex = refNode->nodeIndex();
- if (!parentNode) {
- // if the node is the top document we should return NODE_BEFORE_AND_AFTER
- // but we throw to match firefox behavior
- exceptionState.throwDOMException(NotFoundError, "The node provided has no parent.");
- return false;
- }
+ if (!parentNode)
sof 2015/09/25 09:17:04 Ditto.
pals 2015/09/28 11:29:06 Done.
+ return true;
Node* startContainerNode = start.computeContainerNode();
int startOffset = start.computeOffsetInContainerNode();
« no previous file with comments | « LayoutTests/fast/dom/Range/resources/intersectsNode.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698