Bug 820263 - Mark as CLASS_COMPLEX for Khmer language. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 04 Mar 2013 19:17:03 +0900
changeset 123655 fb1497be5dbb6c38baa16111a2585a115094b188
parent 123654 781d180f8a0fbe9943dadd5250e13a754f86d3f0
child 123656 fd362dcf94a5e5e7514a620050bccce842c51f59
push id23968
push userm_kato@ga2.so-net.ne.jp
push dateMon, 04 Mar 2013 10:17:39 +0000
treeherdermozilla-inbound@fb1497be5dbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs820263
milestone22.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 820263 - Mark as CLASS_COMPLEX for Khmer language. r=masayuki
intl/lwbrk/public/nsILineBreaker.h
intl/lwbrk/src/jisx4051class.h
intl/lwbrk/src/nsJISx4051LineBreaker.cpp
intl/lwbrk/tools/anzx4051.html
intl/lwbrk/tools/anzx4051.pl
intl/lwbrk/tools/jisx4051class.txt
layout/reftests/line-breaking/khmer-1-ref.html
layout/reftests/line-breaking/khmer-1.html
layout/reftests/line-breaking/reftest.list
--- a/intl/lwbrk/public/nsILineBreaker.h
+++ b/intl/lwbrk/public/nsILineBreaker.h
@@ -62,12 +62,13 @@ NS_IsSpace(PRUnichar u)
          (0x2008 <= u && u <= 0x200B) || // PUNCTUATION SPACE, THIN SPACE,
                                          // HAIR SPACE, ZERO WIDTH SPACE
          u == 0x205F;                    // MEDIUM MATHEMATICAL SPACE 
 }
 
 static inline bool
 NS_NeedsPlatformNativeHandling(PRUnichar aChar)
 {
-  return (0x0e01 <= aChar && aChar <= 0x0fff); // Thai, Lao, Tibetan
+  return (0x0e01 <= aChar && aChar <= 0x0fff) || // Thai, Lao, Tibetan
+         (0x1780 <= aChar && aChar <= 0x17ff);   // Khmer
 }
 
 #endif  /* nsILineBreaker_h__ */
--- a/intl/lwbrk/src/jisx4051class.h
+++ b/intl/lwbrk/src/jisx4051class.h
@@ -176,8 +176,43 @@ 0x88888888, // U+0EC8 - U+0ECF
 0x66666666, // U+0ED0 - U+0ED7
 0x88888866, // U+0ED8 - U+0EDF
 0x88888888, // U+0EE0 - U+0EE7
 0x88888888, // U+0EE8 - U+0EEF
 0x88888888, // U+0EF0 - U+0EF7
 0x88888888, // U+0EF8 - U+0EFF
 };
 
+static const uint32_t gLBClass17[32] = {
+0x77777777, // U+1700 - U+1707
+0x77777777, // U+1708 - U+170F
+0x77777777, // U+1710 - U+1717
+0x77777777, // U+1718 - U+171F
+0x77777777, // U+1720 - U+1727
+0x77777777, // U+1728 - U+172F
+0x70077777, // U+1730 - U+1737
+0x77777777, // U+1738 - U+173F
+0x77777777, // U+1740 - U+1747
+0x77777777, // U+1748 - U+174F
+0x77777777, // U+1750 - U+1757
+0x77777777, // U+1758 - U+175F
+0x77777777, // U+1760 - U+1767
+0x77777777, // U+1768 - U+176F
+0x77777777, // U+1770 - U+1777
+0x77777777, // U+1778 - U+177F
+0x88888888, // U+1780 - U+1787
+0x88888888, // U+1788 - U+178F
+0x88888888, // U+1790 - U+1797
+0x88888888, // U+1798 - U+179F
+0x88888888, // U+17A0 - U+17A7
+0x88888888, // U+17A8 - U+17AF
+0x88888888, // U+17B0 - U+17B7
+0x88888888, // U+17B8 - U+17BF
+0x88888888, // U+17C0 - U+17C7
+0x88888888, // U+17C8 - U+17CF
+0x88118888, // U+17D0 - U+17D7
+0x77888181, // U+17D8 - U+17DF
+0x88888888, // U+17E0 - U+17E7
+0x77777788, // U+17E8 - U+17EF
+0x88888888, // U+17F0 - U+17F7
+0x77777788, // U+17F8 - U+17FF
+};
+
--- a/intl/lwbrk/src/nsJISx4051LineBreaker.cpp
+++ b/intl/lwbrk/src/nsJISx4051LineBreaker.cpp
@@ -408,16 +408,18 @@ GetClass(PRUnichar u)
 {
    uint16_t h = u & 0xFF00;
    uint16_t l = u & 0x00ff;
    int8_t c;
 
    // Handle 3 range table first
    if (0x0000 == h) {
      c = GETCLASSFROMTABLE(gLBClass00, l);
+   } else if (0x1700 == h) {
+     c = GETCLASSFROMTABLE(gLBClass17, l);
    } else if (NS_NeedsPlatformNativeHandling(u)) {
      c = CLASS_COMPLEX;
    } else if (0x0E00 == h) {
      c = GETCLASSFROMTABLE(gLBClass0E, l);
    } else if (0x2000 == h) {
      c = GETCLASSFROMTABLE(gLBClass20, l);
    } else if (0x2100 == h) {
      c = GETCLASSFROMTABLE(gLBClass21, l);
--- a/intl/lwbrk/tools/anzx4051.html
+++ b/intl/lwbrk/tools/anzx4051.html
@@ -52,20 +52,20 @@ Analysis of JIS X 4051 to Unicode Genera
 <TD BGCOLOR=yellow>Zp</TD>
 <TD BGCOLOR=yellow>Zs</TD>
 </TR>
 <TR><TH>00_1<TH>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
-<TD>12</TD>
+<TD>14</TD>
 <TD>1</TD>
 <TD></TD>
-<TD BGCOLOR=white>13</TD>
+<TD BGCOLOR=white>15</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
@@ -76,35 +76,35 @@ Analysis of JIS X 4051 to Unicode Genera
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD>1</TD>
-<TD></TD>
+<TD>2</TD>
 <TD>11</TD>
 <TD>1</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 </TR>
 <TR><TH>01_[a]<TH>
 <TD></TD>
 <TD>32</TD>
 <TD>2</TD>
 <TD></TD>
-<TD>24</TD>
+<TD>28</TD>
 <TD>3</TD>
 <TD></TD>
-<TD BGCOLOR=white>61</TD>
+<TD BGCOLOR=white>65</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD>8</TD>
 <TD>24</TD>
 <TD></TD>
@@ -115,17 +115,17 @@ Analysis of JIS X 4051 to Unicode Genera
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD>1</TD>
 <TD>12</TD>
 <TD>1</TD>
 <TD></TD>
-<TD>10</TD>
+<TD>14</TD>
 <TD></TD>
 <TD></TD>
 <TD>2</TD>
 <TD>1</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
@@ -361,46 +361,46 @@ Analysis of JIS X 4051 to Unicode Genera
 <TD>24</TD>
 <TD>98</TD>
 <TD>1</TD>
 <TD>1</TD>
 <TD></TD>
 </TR>
 <TR><TH>08_COMPLEX<TH>
 <TD></TD>
-<TD></TD>
-<TD></TD>
-<TD></TD>
-<TD></TD>
+<TD>54</TD>
+<TD>33</TD>
+<TD>20</TD>
+<TD>2</TD>
+<TD>1</TD>
 <TD></TD>
-<TD></TD>
-<TD BGCOLOR=white>0</TD>
-<TD></TD>
-<TD></TD>
-<TD></TD>
+<TD BGCOLOR=white>110</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
+<TD>1</TD>
+<TD>53</TD>
 <TD></TD>
 <TD></TD>
+<TD>11</TD>
 <TD></TD>
+<TD>22</TD>
+<TD>10</TD>
+<TD></TD>
+<TD>10</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
-<TD></TD>
-<TD></TD>
-<TD></TD>
+<TD>2</TD>
 <TD></TD>
-<TD></TD>
-<TD></TD>
-<TD></TD>
+<TD>1</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 </TR>
 <TR><TH>09_[c]<TH>
@@ -601,16 +601,31 @@ Analysis of JIS X 4051 to Unicode Genera
 <TD>20</TD>
 <TD>1</TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 <TD></TD>
 </TR>
+<TR><TH>17<TH>
+<TD>2</TD>
+<TD>4</TD>
+<TD></TD>
+<TD></TD>
+<TD></TD>
+<TD></TD>
+<TD></TD>
+<TD></TD>
+<TD>110</TD>
+<TD></TD>
+<TD></TD>
+<TD></TD>
+<TD></TD>
+</TR>
 <TR><TH>20<TH>
 <TD>2</TD>
 <TD>8</TD>
 <TD>1</TD>
 <TD></TD>
 <TD>5</TD>
 <TD>13</TD>
 <TD></TD>
--- a/intl/lwbrk/tools/anzx4051.pl
+++ b/intl/lwbrk/tools/anzx4051.pl
@@ -336,16 +336,17 @@ printf "[%s || %s]\n", $r, $def;
    }
    print HEADER "};\n\n";
 }
 printarray("00", "7");
 printarray("20", "7");
 printarray("21", "7");
 printarray("30", "5");
 printarray("0E", "8");
+printarray("17", "7");
 
 #print %rangecount;
 
 ######################################################################
 #
 # Close files
 #
 ######################################################################
--- a/intl/lwbrk/tools/jisx4051class.txt
+++ b/intl/lwbrk/tools/jisx4051class.txt
@@ -36,16 +36,23 @@ 0E3F;;1
 0E2F;;4
 0E46;;4
 0E5A;0E5B;4
 0E50;0E59;15
 0E4F;;18
 0EAF;;4
 0EC6;;4
 0ED0;0ED9;15
+1735;1736;1
+17D4;17D5;4
+17D8;;4
+17DA;;4
+1780;17DD;21
+17E0;17E9;21
+17F0;17F9;21
 2007;;24
 2000;200B;17
 200C;200F;18
 2010;;18
 2011;;24
 2012;2013;18
 2014;;7
 2015;;18
new file mode 100644
--- /dev/null
+++ b/layout/reftests/line-breaking/khmer-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <style type="text/css"> div { width: 1em; } </style>
+  </head>
+  <body lang="km">
+    <div>aaaaaaaaaa&#x17D8;<br>bbbbbbbbbb</div>
+    <div>aaaaaaaaaa&#x17DA;<br>bbbbbbbbbb</div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/line-breaking/khmer-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <style type="text/css"> div { width: 1em; } </style>
+  </head>
+  <body lang="km">
+    <div>aaaaaaaaaa&#x17D8;bbbbbbbbbb</div>
+    <div>aaaaaaaaaa&#x17DA;bbbbbbbbbb</div>
+  </body>
+</html>
--- a/layout/reftests/line-breaking/reftest.list
+++ b/layout/reftests/line-breaking/reftest.list
@@ -5,16 +5,17 @@
 == datetime-1.html datetime-1-ref.html
 == hyphens-1.html hyphens-1-ref.html
 # The following three tests may fail if rendering with Core Text (see bug 389074)
 # due to subpixel glyph positioning differences between the reference cases with <br>
 # and the automatically-wrapped lines in the test file
 random-if(cocoaWidget) == ja-1.html ja-1-ref.html
 random-if(cocoaWidget) == ja-2.html ja-2-ref.html
 random-if(cocoaWidget) == ja-3.html ja-3-ref.html
+== khmer-1.html khmer-1-ref.html
 == leaders-1.html leaders-1-ref.html
 == markup-src-1.html markup-src-1-ref.html
 == non-breakable-1.html non-breakable-1-ref.html
 == non-breakable-2.html non-breakable-2-ref.html
 == numerics-1.html numerics-1-ref.html
 == parentheses-1.html parentheses-1-ref.html
 == punctuation-open-1.html punctuation-open-1-ref.html
 == punctuation-open-2.html punctuation-open-2-ref.html