Changeset 166507 in webkit


Ignore:
Timestamp:
Mar 31, 2014 9:32:25 AM (10 years ago)
Author:
ap@apple.com
Message:

Remove special handling of soft hyphens in search code
https://bugs.webkit.org/show_bug.cgi?id=130940

Reviewed by Anders Carlsson.

ICU knows to ignore soft hyphens, so we don't need to replace them before searching.

Covered by existing tests.

  • editing/TextIterator.cpp:

(WebCore::foldQuoteMark):
(WebCore::foldQuoteMarks):
(WebCore::SearchBuffer::SearchBuffer):
(WebCore::SearchBuffer::append):
(WebCore::foldQuoteMarkOrSoftHyphen): Deleted.
(WebCore::foldQuoteMarksAndSoftHyphens): Deleted.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166506 r166507  
     12014-03-31  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Remove special handling of soft hyphens in search code
     4        https://bugs.webkit.org/show_bug.cgi?id=130940
     5
     6        Reviewed by Anders Carlsson.
     7
     8        ICU knows to ignore soft hyphens, so we don't need to replace them before searching.
     9
     10        Covered by existing tests.
     11
     12        * editing/TextIterator.cpp:
     13        (WebCore::foldQuoteMark):
     14        (WebCore::foldQuoteMarks):
     15        (WebCore::SearchBuffer::SearchBuffer):
     16        (WebCore::SearchBuffer::append):
     17        (WebCore::foldQuoteMarkOrSoftHyphen): Deleted.
     18        (WebCore::foldQuoteMarksAndSoftHyphens): Deleted.
     19
    1202014-03-31  Alex Christensen  <achristensen@webkit.org>
    221
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r166134 r166507  
    16221622// --------
    16231623
    1624 static inline UChar foldQuoteMarkOrSoftHyphen(UChar c)
     1624static inline UChar foldQuoteMark(UChar c)
    16251625{
    16261626    switch (c) {
     
    16331633        case rightSingleQuotationMark:
    16341634            return '\'';
    1635         case softHyphen:
    1636             // Replace soft hyphen with an ignorable character so that their presence or absence will
    1637             // not affect string comparison.
    1638             return 0;
    16391635        default:
    16401636            return c;
     
    16451641// of doing it in a separate replacement pass here, but ICU doesn't offer a way
    16461642// to add tailoring on top of the locale-specific tailoring as of this writing.
    1647 static inline String foldQuoteMarksAndSoftHyphens(String string)
     1643static inline String foldQuoteMarks(String string)
    16481644{
    16491645    string.replace(hebrewPunctuationGeresh, '\'');
     
    16531649    string.replace(rightDoubleQuotationMark, '"');
    16541650    string.replace(rightSingleQuotationMark, '\'');
    1655 
    1656     // Replace soft hyphens with an ignorable character so that presence or absence will not affect string comparison.
    1657     string.replace(softHyphen, 0);
    16581651
    16591652    return string;
     
    19411934
    19421935inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
    1943     : m_target(foldQuoteMarksAndSoftHyphens(target))
     1936    : m_target(foldQuoteMarks(target))
    19441937    , m_targetCharacters(StringView(m_target).upconvertedCharacters())
    19451938    , m_options(options)
     
    20312024    m_buffer.grow(oldLength + usableLength);
    20322025    for (unsigned i = 0; i < usableLength; ++i)
    2033         m_buffer[oldLength + i] = foldQuoteMarkOrSoftHyphen(text[i]);
     2026        m_buffer[oldLength + i] = foldQuoteMark(text[i]);
    20342027    return usableLength;
    20352028}
     
    22682261    ASSERT(!m_target.isEmpty());
    22692262    m_target.replace(noBreakSpace, ' ');
    2270     foldQuoteMarksAndSoftHyphens(m_target);
     2263    foldQuoteMarks(m_target);
    22712264}
    22722265
     
    22882281inline void SearchBuffer::append(UChar c, bool isStart)
    22892282{
    2290     m_buffer[m_cursor] = c == noBreakSpace ? ' ' : foldQuoteMarkOrSoftHyphen(c);
     2283    m_buffer[m_cursor] = c == noBreakSpace ? ' ' : foldQuoteMark(c);
    22912284    m_isCharacterStartBuffer[m_cursor] = isStart;
    22922285    if (++m_cursor == m_target.length()) {
Note: See TracChangeset for help on using the changeset viewer.