[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

enrica at apple.com enrica at apple.com
Thu Apr 8 01:02:12 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 20c76bb0e788001b0368025cc59223b8ce2fc104
Author: enrica at apple.com <enrica at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 12 17:15:36 2010 +0000

    WebKit returns incorrect match count when first string match is on an element with user-select-none style
    https://bugs.webkit.org/show_bug.cgi?id=33508
    <rdar://problem/7482143>
    
    Reviewed by Darin Adler.
    
    If we use VisiblePosition to calculate the start of the new search range,
    we skip all the nodes with user-select-none style, producing an incorrect
    match count.
    
    No new tests: there are no API's available to Javascript to verify the
    number of matches found.
    
    * page/Frame.cpp:
    (WebCore::Frame::markAllMatchesForText): Changed to use the end of the previous
    result range as the start of the new search range.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53142 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6e921f6..a351088 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-12  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Darin Adler.
+
+        WebKit returns incorrect match count when first string match is on an element with user-select-none style
+        https://bugs.webkit.org/show_bug.cgi?id=33508
+        <rdar://problem/7482143>
+
+        If we use VisiblePosition to calculate the start of the new search range,
+        we skip all the nodes with user-select-none style, producing an incorrect
+        match count.
+        
+        No new tests: there are no API's available to Javascript to verify the
+        number of matches found.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::markAllMatchesForText): Changed to use the end of the previous
+        result range as the start of the new search range.
+
 2010-01-12  Mikhail Naganov  <mnaganov at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 993b27b..18bc3bf 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -1563,12 +1563,6 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsig
             continue;
         }
 
-        // A non-collapsed result range can in some funky whitespace cases still not
-        // advance the range's start position (4509328). Break to avoid infinite loop.
-        VisiblePosition newStart = endVisiblePosition(resultRange.get(), DOWNSTREAM);
-        if (newStart == startVisiblePosition(searchRange.get(), DOWNSTREAM))
-            break;
-
         // Only treat the result as a match if it is visible
         if (editor()->insideVisibleArea(resultRange.get())) {
             ++matchCount;
@@ -1579,7 +1573,12 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsig
         if (limit > 0 && matchCount >= limit)
             break;
 
-        setStart(searchRange.get(), newStart);
+        // Set the new start for the search range to be the end of the previous
+        // result range. There is no need to use a VisiblePosition here,
+        // since findPlainText will use a TextIterator to go over the visible
+        // text nodes. 
+        searchRange->setStart(resultRange->endContainer(exception), resultRange->endOffset(exception), exception);
+
         Node* shadowTreeRoot = searchRange->shadowTreeRootNode();
         if (searchRange->collapsed(exception) && shadowTreeRoot)
             searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), exception);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list