Changeset 72989 in webkit


Ignore:
Timestamp:
Nov 30, 2010 5:48:07 PM (13 years ago)
Author:
mitz@apple.com
Message:

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.
Location:
trunk
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72987 r72989  
     12010-11-30  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Text search should treat all matches as word-start matches when the target begins with a separator character
     6        https://bugs.webkit.org/show_bug.cgi?id=50302
     7
     8        * editing/text-iterator/findString.html:
     9        * editing/text-iterator/findString-expected.txt:
     10        * platform/mac-leopard/editing/text-iterator: Removed.
     11        * platform/mac-leopard/editing/text-iterator/findString-expected.txt: Removed.
     12
    1132010-11-30  Martin Robinson  <mrobinson@igalia.com>
    214
  • trunk/LayoutTests/editing/text-iterator/findString-expected.txt

    r72887 r72989  
    5353
    5454Searching for ‘.org’ in ‘webkit.org’ with options [AtWordStarts]:
     55PASS: Got a match at 6,10 as expected.
    5556PASS: Got no match as expected.
    5657
     
    147148PASS: Got no match as expected.
    148149
     150Searching for ‘ ’ in ‘Spaces, the final frontier’ with options [AtWordStarts]:
     151PASS: Got a match at 7,8 as expected.
     152PASS: Got a match at 11,12 as expected.
     153PASS: Got a match at 17,18 as expected.
     154PASS: Got no match as expected.
    149155
     156Searching for ‘@’ in ‘Use an @import rule’ with options [AtWordStarts]:
     157PASS: Got a match at 7,8 as expected.
     158PASS: Got no match as expected.
     159
     160Searching for ‘(x’ in ‘If ((x + 5) * 2) = 14, then x = 2’ with options [AtWordStarts]:
     161PASS: Got a match at 4,6 as expected.
     162PASS: Got no match as expected.
     163
     164
  • trunk/LayoutTests/editing/text-iterator/findString.html

    r72887 r72989  
    5252
    5353    testFindString("webkit.org", "org", ["AtWordStarts"], [[]]);
    54     testFindString("webkit.org", ".org", ["AtWordStarts"], [[]]);
     54    testFindString("webkit.org", ".org", ["AtWordStarts"], [[6, 10], []]);
    5555
    5656    testFindString("webkit.org", "rg", ["AtWordStarts", "TreatMedialCapitalAsWordStart"], [[]]);
     
    102102    testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize - 3) + " " + thaiWords[4] + bufferSizedString, thaiWords[2], ["AtWordStarts"], [[]]);
    103103
     104    testFindString("Spaces, the final frontier", " ", ["AtWordStarts"], [[7, 8], [11, 12], [17, 18], []]);
     105    testFindString("Use an @import rule", "@", ["AtWordStarts"], [[7, 8], []]);
     106    testFindString("If ((x + 5) * 2) = 14, then x = 2", "(x", ["AtWordStarts"], [[4, 6], []]);
     107
    104108    document.getElementById("console").style.removeProperty("visibility");
    105109</script>
  • trunk/WebCore/ChangeLog

    r72988 r72989  
     12010-11-30  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Text search should treat all matches as word-start matches when the target begins with a separator character
     6        https://bugs.webkit.org/show_bug.cgi?id=50302
     7
     8        * editing/TextIterator.cpp:
     9        (WebCore::SearchBuffer::SearchBuffer): Disable the AtWordStarts option if it was specified and
     10        the target string begins with one of the "separator" characters.
     11
    1122010-11-30  Pavel Feldman  <pfeldman@chromium.org>
    213
  • trunk/WebCore/editing/TextIterator.cpp

    r72968 r72989  
    18931893    m_overlap = m_buffer.capacity() / 4;
    18941894
     1895    if ((m_options & AtWordStarts) && targetLength) {
     1896        UChar32 targetFirstCharacter;
     1897        U16_GET(m_target.characters(), 0, 0, targetLength, targetFirstCharacter);
     1898        // Characters in the separator category never really occur at the beginning of a word,
     1899        // so if the target begins with such a character, we just ignore the AtWordStart option.
     1900        if (isSeparator(targetFirstCharacter)) {
     1901            m_options &= ~AtWordStarts;
     1902            m_needsMoreContext = false;
     1903        }
     1904    }
     1905
    18951906    // Grab the single global searcher.
    18961907    // If we ever have a reason to do more than once search buffer at once, we'll have
Note: See TracChangeset for help on using the changeset viewer.