Range.isPointInRange check root node before verifying offset
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Sep 2015 16:25:02 +0000 (16:25 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Sep 2015 16:25:02 +0000 (16:25 +0000)
commitfe1d7deb634f2b7b95163eb1cfe4700d939a3e59
tree617aeffa52ecfc8f446ae713ec1047bf0aa7dec4
parent4c8c2765317945f72b8c3b3b026ed0d0e7122e2f
Range.isPointInRange check root node before verifying offset
https://bugs.webkit.org/show_bug.cgi?id=148776

isPointInRange should never throw WrongDocumentError
https://bugs.webkit.org/show_bug.cgi?id=148779

Reviewed by Darin Adler.

Source/WebCore:

Fixed two bugs since they were inter-dependent on each other.

We use the same trick we used for comparePoint in r189327 to avoid O(n) operation in common cases
and return false when either calls to compareBoundaryPoints yields a WrongDocumentError.

No new tests since this is covered by an existing W3C test.

* dom/Range.cpp:
(WebCore::Range::isPointInRange):
(WebCore::Range::comparePoint):

LayoutTests:

Rebaselined the test now that all test cases pass.

* http/tests/w3c/dom/ranges/Range-isPointInRange-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189347 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/w3c/dom/ranges/Range-isPointInRange-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Range.cpp