Changeset 121360 in webkit


Ignore:
Timestamp:
Jun 27, 2012 1:22:32 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[gtk] Spell checker doesn't recognize contractions (apostrophes)
https://bugs.webkit.org/show_bug.cgi?id=86118

Patch by Martin Robinson <mrobinson@igalia.com> on 2012-06-27
Reviewed by Gustavo Noronha Silva.

Work-around a bug in Pango by trying to detect apostrophes
that create contractions. This work-around is similar to one
found in gtkspell.

  • webkit/webkitspellcheckerenchant.cpp:

(wordEndIsAContractionApostrophe): Added this helper which tries to detect
situations where a word end is both an apostrophe and followed by a alphabetic
character.
(checkSpellingOfString): When searching for the end of a word, skip over
apostrophes that appear to be part of contractions.

Location:
trunk/Source/WebKit/gtk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/gtk/ChangeLog

    r121332 r121360  
     12012-06-27  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [gtk] Spell checker doesn't recognize contractions (apostrophes)
     4        https://bugs.webkit.org/show_bug.cgi?id=86118
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Work-around a bug in Pango by trying to detect apostrophes
     9        that create contractions. This work-around is similar to one
     10        found in gtkspell.
     11
     12        * webkit/webkitspellcheckerenchant.cpp:
     13        (wordEndIsAContractionApostrophe): Added this helper which tries to detect
     14        situations where a word end is both an apostrophe and followed by a alphabetic
     15        character.
     16        (checkSpellingOfString): When searching for the end of a word, skip over
     17        apostrophes that appear to be part of contractions.
     18
    1192012-06-27  Zan Dobersek  <zandobersek@gmail.com>
    220
  • trunk/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp

    r119159 r121360  
    8787
    8888    priv->enchantDicts = 0;
     89}
     90
     91static bool wordEndIsAContractionApostrophe(const char* string, long offset)
     92{
     93    if (g_utf8_get_char(g_utf8_offset_to_pointer(string, offset)) != g_utf8_get_char("'"))
     94        return false;
     95
     96    // If this is the last character in the string, it cannot be the apostrophe part of a contraction.
     97    if (offset == g_utf8_strlen(string, -1))
     98        return false;
     99
     100    return g_unichar_isalpha(g_utf8_get_char(g_utf8_offset_to_pointer(string, offset + 1)));
    89101}
    90102
     
    114126            int wordLength;
    115127
    116             while (attrs.get()[end].is_word_end < 1)
     128            while (attrs.get()[end].is_word_end < 1 || wordEndIsAContractionApostrophe(string, end))
    117129                end++;
    118130
Note: See TracChangeset for help on using the changeset viewer.