Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4620)

Unified Diff: chrome/renderer/spellchecker/spellcheck_worditerator.cc

Issue 10908031: Treats ASCII numbers as word characters only on LTR languages. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/spellchecker/spellcheck_worditerator.cc
===================================================================
--- chrome/renderer/spellchecker/spellcheck_worditerator.cc (revision 154314)
+++ chrome/renderer/spellchecker/spellcheck_worditerator.cc (working copy)
@@ -64,7 +64,7 @@
// For instance, U+05F4 is MidLetter. So, this may be
// better, but it leads to an empty set error in Thai.
// "$ALetter = [[\\p{script=%s}] & [\\p{Word_Break = ALetter}]];"
- "$ALetter = [\\p{script=%s} [0123456789]];"
+ "$ALetter = [\\p{script=%s}%s];"
"$MidNumLet = [\\p{Word_Break = MidNumLet}];"
"$MidLetter = [\\p{Word_Break = MidLetter}%s];"
"$MidNum = [\\p{Word_Break = MidNum}];"
@@ -154,6 +154,11 @@
if (script_code_ == USCRIPT_HANGUL || script_code_ == USCRIPT_THAI)
aletter_plus = kWithDictionary;
+ // Treat numbers as word characters except for Arabic and Hebrew.
+ const char* aletter_extra = " [0123456789]";
+ if (script_code_ == USCRIPT_HEBREW || script_code_ == USCRIPT_ARABIC)
+ aletter_extra = "";
+
const char kMidLetterExtra[] = "";
// For Hebrew, treat single/double quoation marks as MidLetter.
const char kMidLetterExtraHebrew[] = "\"'";
@@ -171,12 +176,14 @@
ruleset_allow_contraction_ = ASCIIToUTF16(
base::StringPrintf(kRuleTemplate,
aletter,
+ aletter_extra,
midletter_extra,
aletter_plus,
kAllowContraction));
ruleset_disallow_contraction_ = ASCIIToUTF16(
base::StringPrintf(kRuleTemplate,
aletter,
+ aletter_extra,
midletter_extra,
aletter_plus,
kDisallowContraction));
« no previous file with comments | « no previous file | chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698