Bug 777529 - Don't spellcheck Unicode numbers; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Tue, 31 Jul 2012 11:50:04 +0300
changeset 106447 a1db720c9c3659566aa820a017c3cc8abe8ef01e
parent 106446 1c029ecea8e792cb58be740040a0afcbdb2f2283
child 106448 0a570be19457ca654909efcbf5336aabda68ad3b
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs777529
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 777529 - Don't spellcheck Unicode numbers; r=ehsan
editor/reftests/reftest.list
editor/reftests/spellcheck-superscript-1-ref.html
editor/reftests/spellcheck-superscript-1.html
editor/reftests/spellcheck-superscript-2-ref.html
editor/reftests/spellcheck-superscript-2.html
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
--- a/editor/reftests/reftest.list
+++ b/editor/reftests/reftest.list
@@ -91,8 +91,10 @@ skip-if(Android) == 462758-grabbers-resi
 == readwrite-editable.html readwrite-editable-ref.html
 == readonly-non-editable.html readonly-non-editable-ref.html
 == readonly-editable.html readonly-editable-ref.html
 == dynamic-overflow-change.html dynamic-overflow-change-ref.html
 == 694880-1.html 694880-ref.html
 == 694880-2.html 694880-ref.html
 == 694880-3.html 694880-ref.html
 == 388980-1.html 388980-1-ref.html
+needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html
+needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html
new file mode 100644
--- /dev/null
+++ b/editor/reftests/spellcheck-superscript-1-ref.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<textarea spellcheck=false>&sup1; &sup2; &sup3;</textarea>
+<script>document.body.firstChild.focus()</script>
new file mode 100644
--- /dev/null
+++ b/editor/reftests/spellcheck-superscript-1.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<textarea>&sup1; &sup2; &sup3;</textarea>
+<script>document.body.firstChild.focus()</script>
new file mode 100644
--- /dev/null
+++ b/editor/reftests/spellcheck-superscript-2-ref.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<textarea>&sup1; &sup2; &sup3; mispeled</textarea>
+<script>document.body.firstChild.focus()</script>
new file mode 100644
--- /dev/null
+++ b/editor/reftests/spellcheck-superscript-2.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<textarea spellcheck=false>&sup1; &sup2; &sup3; mispeled</textarea>
+<script>document.body.firstChild.focus()</script>
--- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
@@ -943,20 +943,19 @@ WordSplitState::IsSpecialWord()
 
 bool
 WordSplitState::ShouldSkipWord(PRInt32 aStart, PRInt32 aLength)
 {
   PRInt32 last = aStart + aLength;
 
   // check to see if the word contains a digit
   for (PRInt32 i = aStart; i < last; i ++) {
-    PRUnichar ch = mDOMWordText[i];
-    // XXX Shouldn't this be something a lot more complex, Unicode-based?
-    if (ch >= '0' && ch <= '9')
+    if (unicode::GetGenCategory(mDOMWordText[i]) == nsIUGenCategory::kNumber) {
       return true;
+    }
   }
 
   // not special
   return false;
 }
 
 // mozInlineSpellWordUtil::SplitDOMWord