summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/Range.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebCore/dom/Range.cpp
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebCore/dom/Range.cpp')
-rw-r--r--Source/WebCore/dom/Range.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp
index 298220e4a..9b569b3e0 100644
--- a/Source/WebCore/dom/Range.cpp
+++ b/Source/WebCore/dom/Range.cpp
@@ -589,14 +589,17 @@ bool Range::intersectsNode(Node* refNode, ExceptionCode& ec)
// http://developer.mozilla.org/en/docs/DOM:range.intersectsNode
// Returns a bool if the node intersects the range.
+ // Throw exception if the range is already detached.
+ if (!m_start.container()) {
+ ec = INVALID_STATE_ERR;
+ return false;
+ }
if (!refNode) {
ec = NOT_FOUND_ERR;
return false;
}
-
- if ((!m_start.container() && refNode->attached())
- || (m_start.container() && !refNode->attached())
- || refNode->document() != m_ownerDocument) {
+
+ if (!refNode->attached() || refNode->document() != m_ownerDocument) {
// Firefox doesn't throw an exception for these cases; it returns false.
return false;
}