<rdar://problem/10337033> DOMRangeOfString:relativeTo:options has problems with ...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 16:39:23 +0000 (16:39 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2011 16:39:23 +0000 (16:39 +0000)
Reviewed by Adam Roben.

Source/WebCore:

Test: added to TestWebKitAPI/Tests/mac/DOMRangeOfString.mm

* page/Page.cpp:
(WebCore::Page::rangeOfString): This function was incorrectly adding the StartInSelection option to
the initial search.

Tools:

* TestWebKitAPI/Tests/mac/DOMRangeOfString.mm:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98350 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/Page.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/mac/DOMRangeOfString.mm

index 421c76a566ff7243f193128f29596758fc092a15..29420efe7917f3bacedf49881b592e188bf1f2de 100644 (file)
@@ -1,3 +1,15 @@
+2011-10-25  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10337033> DOMRangeOfString:relativeTo:options has problems with -webkit-user-select: none
+
+        Reviewed by Adam Roben.
+
+        Test: added to TestWebKitAPI/Tests/mac/DOMRangeOfString.mm
+
+        * page/Page.cpp:
+        (WebCore::Page::rangeOfString): This function was incorrectly adding the StartInSelection option to
+        the initial search.
+
 2011-10-25  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: redesign workers sidebar pane
index 9c5b26d7c561b7af2df3899e0638f7a35337d22a..5302621ec3d782ab48f7db2d04e3f4340a20aa57 100644 (file)
@@ -522,7 +522,7 @@ PassRefPtr<Range> Page::rangeOfString(const String& target, Range* referenceRang
     Frame* frame = referenceRange ? referenceRange->ownerDocument()->frame() : mainFrame();
     Frame* startFrame = frame;
     do {
-        if (RefPtr<Range> resultRange = frame->editor()->rangeOfString(target, frame == startFrame ? referenceRange : 0, (options & ~WrapAround) | StartInSelection))
+        if (RefPtr<Range> resultRange = frame->editor()->rangeOfString(target, frame == startFrame ? referenceRange : 0, options & ~WrapAround))
             return resultRange.release();
 
         frame = incrementFrame(frame, !(options & Backwards), shouldWrap);
index 75fc2fde4fb4213d1709d537559f8b7b9565b595..b064eaa98988c3bbccadd025ed65cad07a71c392 100644 (file)
@@ -1,3 +1,12 @@
+2011-10-25  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10337033> DOMRangeOfString:relativeTo:options has problems with -webkit-user-select: none
+
+        Reviewed by Adam Roben.
+
+        * TestWebKitAPI/Tests/mac/DOMRangeOfString.mm:
+        (TestWebKitAPI::TEST):
+
 2011-10-25  Eric Seidel  <eric@webkit.org>
 
         WIN: editing tests fail under NRWT because editing delegate callbacks aren't stripped
index 80abb15152d83072117d5fbf8ea0e2ec7cc93566..8c353c77fa2b4574e421a7c6de31be6528f7ffa0 100644 (file)
@@ -68,6 +68,12 @@ TEST(WebKit1, DOMRangeOfString)
     resultRange = [webView.get() DOMRangeOfString:@"stack" relativeTo:needleRange options:WebFindOptionsBackwards];
     EXPECT_EQ(nil, resultRange);
 
+    resultRange = [webView.get() DOMRangeOfString:@"n" relativeTo:needleRange options:0];
+    EXPECT_EQ(36, resultRange.startOffset);
+
+    resultRange = [webView.get() DOMRangeOfString:@"n" relativeTo:needleRange options:WebFindOptionsStartInSelection];
+    EXPECT_EQ(28, resultRange.startOffset);
+
     RetainPtr<WebView> otherWebView(AdoptNS, [[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil]);
     DOMRange *foreignRange = [[[otherWebView.get() mainFrame] DOMDocument] createRange];
     resultRange = [webView.get() DOMRangeOfString:@"needle" relativeTo:foreignRange options:0];