[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

mitz at apple.com mitz at apple.com
Fri Jan 21 14:51:36 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit d828d744fe3741eba75ac0137b225146d87f55cc
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 3 04:45:24 2011 +0000

    <rdar://problem/8806570> REGRESSION (r73337): Incorrect text match count when a match occurs in a text field
    https://bugs.webkit.org/show_bug.cgi?id=51623
    
    Reviewed by Sam Weinig.
    
    * editing/Editor.cpp:
    (WebCore::Editor::countMatchesForText): Actually remember the original search range end
    container and offset and restore them when needed, instead of using two references to the
    same Range.
    * manual-tests/find-count-matches-after-text-control.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74886 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ec641b0..4d9c07f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2011-01-02  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        <rdar://problem/8806570> REGRESSION (r73337): Incorrect text match count when a match occurs in a text field
+        https://bugs.webkit.org/show_bug.cgi?id=51623
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::countMatchesForText): Actually remember the original search range end
+        container and offset and restore them when needed, instead of using two references to the
+        same Range.
+        * manual-tests/find-count-matches-after-text-control.html: Added.
+
 2011-01-02  Benjamin Poulain  <benjamin.poulain at nokia.com>
 
         Reviewed by Csaba Osztrogonác.
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 6619186..3b4dc25 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -3362,17 +3362,18 @@ unsigned Editor::countMatchesForText(const String& target, Range* range, FindOpt
     if (target.isEmpty())
         return 0;
 
-    RefPtr<Range> originalSearchRange;
+    RefPtr<Range> searchRange;
     if (range) {
         if (range->ownerDocument() == m_frame->document())
-            originalSearchRange = range;
+            searchRange = range;
         else if (!isFrameInRange(m_frame, range))
             return 0;
     }
-    if (!originalSearchRange)
-        originalSearchRange = rangeOfContents(m_frame->document());
+    if (!searchRange)
+        searchRange = rangeOfContents(m_frame->document());
 
-    RefPtr<Range> searchRange(originalSearchRange);
+    Node* originalEndContainer = searchRange->endContainer();
+    int originalEndOffset = searchRange->endOffset();
 
     ExceptionCode exception = 0;
     unsigned matchCount = 0;
@@ -3382,8 +3383,8 @@ unsigned Editor::countMatchesForText(const String& target, Range* range, FindOpt
             if (!resultRange->startContainer()->isInShadowTree())
                 break;
 
-            searchRange = originalSearchRange;
             searchRange->setStartAfter(resultRange->startContainer()->shadowAncestorNode(), exception);
+            searchRange->setEnd(originalEndContainer, originalEndOffset, exception);
             continue;
         }
 
diff --git a/WebCore/manual-tests/find-count-matches-after-text-control.html b/WebCore/manual-tests/find-count-matches-after-text-control.html
new file mode 100644
index 0000000..738be8c
--- /dev/null
+++ b/WebCore/manual-tests/find-count-matches-after-text-control.html
@@ -0,0 +1,14 @@
+<p>
+    Test that text matches are counted correctly when a match occurs inside a text field.
+</p>
+<p>
+    To test:
+    <ol>
+        <li>Choose Edit > Find > Find</li>
+        <li>In the Find field, type &ldquo;lemon&rdquo;
+    </ol>
+</p>
+<p>
+    The test passes if the Find banner says &ldquo;3 matches&rdquo;.
+</p>
+<input value="a lemon in a text field"> and another lemon.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list