[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

mitz at apple.com mitz at apple.com
Wed Dec 22 17:49:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4bdecb9276904831095e405e2ee8c32aa7ad0728
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 1 01:48:07 2010 +0000

    Text search should treat all matches as word-start matches when the target begins with a separator character
    https://bugs.webkit.org/show_bug.cgi?id=50302
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    * editing/TextIterator.cpp:
    (WebCore::SearchBuffer::SearchBuffer): Disable the AtWordStarts option if it was specified and
    the target string begins with one of the "separator" characters.
    
    LayoutTests:
    
    * editing/text-iterator/findString.html:
    * editing/text-iterator/findString-expected.txt:
    * platform/mac-leopard/editing/text-iterator: Removed.
    * platform/mac-leopard/editing/text-iterator/findString-expected.txt: Removed.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72989 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9a140e2..04db57d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-30  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Text search should treat all matches as word-start matches when the target begins with a separator character
+        https://bugs.webkit.org/show_bug.cgi?id=50302
+
+        * editing/text-iterator/findString.html:
+        * editing/text-iterator/findString-expected.txt:
+        * platform/mac-leopard/editing/text-iterator: Removed.
+        * platform/mac-leopard/editing/text-iterator/findString-expected.txt: Removed.
+
 2010-11-30  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/LayoutTests/editing/text-iterator/findString-expected.txt b/LayoutTests/editing/text-iterator/findString-expected.txt
index e9cff74..ac9482f 100644
--- a/LayoutTests/editing/text-iterator/findString-expected.txt
+++ b/LayoutTests/editing/text-iterator/findString-expected.txt
@@ -52,6 +52,7 @@ Searching for ‘org’ in ‘webkit.org’ with options [AtWordStarts]:
 PASS: Got no match as expected.
 
 Searching for ‘.org’ in ‘webkit.org’ with options [AtWordStarts]:
+PASS: Got a match at 6,10 as expected.
 PASS: Got no match as expected.
 
 Searching for ‘rg’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
@@ -146,4 +147,18 @@ PASS: Got no match as expected.
 Searching for ‘กช’ in long string with options [AtWordStarts]:
 PASS: Got no match as expected.
 
+Searching for ‘ ’ in ‘Spaces, the final frontier’ with options [AtWordStarts]:
+PASS: Got a match at 7,8 as expected.
+PASS: Got a match at 11,12 as expected.
+PASS: Got a match at 17,18 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘@’ in ‘Use an @import rule’ with options [AtWordStarts]:
+PASS: Got a match at 7,8 as expected.
+PASS: Got no match as expected.
+
+Searching for ‘(x’ in ‘If ((x + 5) * 2) = 14, then x = 2’ with options [AtWordStarts]:
+PASS: Got a match at 4,6 as expected.
+PASS: Got no match as expected.
+
 
diff --git a/LayoutTests/editing/text-iterator/findString.html b/LayoutTests/editing/text-iterator/findString.html
index eb203a3..a147d26 100644
--- a/LayoutTests/editing/text-iterator/findString.html
+++ b/LayoutTests/editing/text-iterator/findString.html
@@ -51,7 +51,7 @@
     testFindString("cocoa", "co", ["AtWordStarts"], [[0, 2], []]);
 
     testFindString("webkit.org", "org", ["AtWordStarts"], [[]]);
-    testFindString("webkit.org", ".org", ["AtWordStarts"], [[]]);
+    testFindString("webkit.org", ".org", ["AtWordStarts"], [[6, 10], []]);
 
     testFindString("webkit.org", "rg", ["AtWordStarts", "TreatMedialCapitalAsWordStart"], [[]]);
     testFindString("webkit.org", "org", ["AtWordStarts", "TreatMedialCapitalAsWordStart"], [[7, 10], []]);
@@ -101,5 +101,9 @@
     testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize - 1) + " " + thaiWords.join("") + bufferSizedString, thaiWords[0], ["AtWordStarts"], [[searchBufferUnoverlappedSize, searchBufferUnoverlappedSize + 2], [searchBufferUnoverlappedSize + 12, searchBufferUnoverlappedSize + 14], []]);
     testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize - 3) + " " + thaiWords[4] + bufferSizedString, thaiWords[2], ["AtWordStarts"], [[]]);
 
+    testFindString("Spaces, the final frontier", " ", ["AtWordStarts"], [[7, 8], [11, 12], [17, 18], []]);
+    testFindString("Use an @import rule", "@", ["AtWordStarts"], [[7, 8], []]);
+    testFindString("If ((x + 5) * 2) = 14, then x = 2", "(x", ["AtWordStarts"], [[4, 6], []]);
+
     document.getElementById("console").style.removeProperty("visibility");
 </script>
diff --git a/LayoutTests/platform/mac-leopard/editing/text-iterator/findString-expected.txt b/LayoutTests/platform/mac-leopard/editing/text-iterator/findString-expected.txt
deleted file mode 100644
index 337d036..0000000
--- a/LayoutTests/platform/mac-leopard/editing/text-iterator/findString-expected.txt
+++ /dev/null
@@ -1,149 +0,0 @@
-Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options []:
-PASS: Got a match at 1,2 as expected.
-PASS: Got a match at 13,14 as expected.
-PASS: Got a match at 15,16 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options [WrapAround]:
-PASS: Got a match at 1,2 as expected.
-PASS: Got a match at 13,14 as expected.
-PASS: Got a match at 15,16 as expected.
-PASS: Got a match at 1,2 as expected.
-
-Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options [Backwards]:
-PASS: Got a match at 15,16 as expected.
-PASS: Got a match at 13,14 as expected.
-PASS: Got a match at 1,2 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘o’ in ‘Lorem ipsum dolor sit amet’ with options [Backwards, WrapAround]:
-PASS: Got a match at 15,16 as expected.
-PASS: Got a match at 13,14 as expected.
-PASS: Got a match at 1,2 as expected.
-PASS: Got a match at 15,16 as expected.
-
-Searching for ‘O’ in ‘Lorem ipsum dolor sit amet’ with options []:
-PASS: Got no match as expected.
-
-Searching for ‘O’ in ‘Lorem ipsum dolor sit amet’ with options [CaseInsensitive]:
-PASS: Got a match at 1,2 as expected.
-PASS: Got a match at 13,14 as expected.
-PASS: Got a match at 15,16 as expected.
-
-Searching for ‘mount’ in ‘insurmountable mountain’ with options []:
-PASS: Got a match at 5,10 as expected.
-PASS: Got a match at 15,20 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘mount’ in ‘insurmountable mountain’ with options [AtWordStarts]:
-PASS: Got a match at 15,20 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘co’ in ‘cocoa’ with options []:
-PASS: Got a match at 0,2 as expected.
-PASS: Got a match at 2,4 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘co’ in ‘cocoa’ with options [AtWordStarts]:
-PASS: Got a match at 0,2 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘org’ in ‘webkit.org’ with options [AtWordStarts]:
-FAIL: Expected a match at  but got a match at 7,10 instead.
-
-Searching for ‘.org’ in ‘webkit.org’ with options [AtWordStarts]:
-PASS: Got no match as expected.
-
-Searching for ‘rg’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘org’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got a match at 7,10 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘.org’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got a match at 6,10 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘t.org’ in ‘webkit.org’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘it’ in ‘WebKit’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘Kit’ in ‘WebKit’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got a match at 3,6 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘bKit’ in ‘WebKit’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘equest’ in ‘XMLHTTPRequest’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘Request’ in ‘XMLHTTPRequest’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got a match at 7,14 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘PRequest’ in ‘XMLHTTPRequest’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘64’ in ‘LP64’ with options [AtWordStarts]:
-PASS: Got no match as expected.
-
-Searching for ‘4’ in ‘LP64’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘64’ in ‘LP64’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got a match at 2,4 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘P64’ in ‘LP64’ with options [AtWordStarts, TreatMedialCapitalAsWordStart]:
-PASS: Got no match as expected.
-
-Searching for ‘a’ in long string with options [AtWordStarts]:
-PASS: Got a match at 6146,6147 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กร’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options []:
-PASS: Got a match at 0,2 as expected.
-PASS: Got a match at 10,12 as expected.
-PASS: Got a match at 12,14 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กร’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options [AtWordStarts]:
-PASS: Got a match at 0,2 as expected.
-PASS: Got a match at 12,14 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กช’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options []:
-PASS: Got a match at 6,8 as expected.
-PASS: Got a match at 8,10 as expected.
-PASS: Got a match at 14,16 as expected.
-PASS: Got a match at 18,20 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กช’ in ‘กรปูเลกชกชกรกรกชบงกช’ with options [AtWordStarts]:
-PASS: Got a match at 6,8 as expected.
-PASS: Got a match at 8,10 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กร’ in long string with options []:
-PASS: Got a match at 6144,6146 as expected.
-PASS: Got a match at 6154,6156 as expected.
-PASS: Got a match at 6156,6158 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กร’ in long string with options [AtWordStarts]:
-PASS: Got a match at 6156,6158 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กร’ in long string with options [AtWordStarts]:
-PASS: Got a match at 6144,6146 as expected.
-PASS: Got a match at 6156,6158 as expected.
-PASS: Got no match as expected.
-
-Searching for ‘กช’ in long string with options [AtWordStarts]:
-PASS: Got no match as expected.
-
-
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4019b92..41c2f1c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-30  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Text search should treat all matches as word-start matches when the target begins with a separator character
+        https://bugs.webkit.org/show_bug.cgi?id=50302
+
+        * editing/TextIterator.cpp:
+        (WebCore::SearchBuffer::SearchBuffer): Disable the AtWordStarts option if it was specified and
+        the target string begins with one of the "separator" characters.
+
 2010-11-30  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Dave Hyatt.
diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp
index 8313c9b..a3edd38 100644
--- a/WebCore/editing/TextIterator.cpp
+++ b/WebCore/editing/TextIterator.cpp
@@ -1892,6 +1892,17 @@ inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
     m_buffer.reserveInitialCapacity(max(targetLength * 8, minimumSearchBufferSize));
     m_overlap = m_buffer.capacity() / 4;
 
+    if ((m_options & AtWordStarts) && targetLength) {
+        UChar32 targetFirstCharacter;
+        U16_GET(m_target.characters(), 0, 0, targetLength, targetFirstCharacter);
+        // Characters in the separator category never really occur at the beginning of a word,
+        // so if the target begins with such a character, we just ignore the AtWordStart option.
+        if (isSeparator(targetFirstCharacter)) {
+            m_options &= ~AtWordStarts;
+            m_needsMoreContext = false;
+        }
+    }
+
     // Grab the single global searcher.
     // If we ever have a reason to do more than once search buffer at once, we'll have
     // to move to multiple searchers.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list