Fix the positioning of diacritics in right-to-left languages and clean up a bunch of typos in bidi reftests. Bug 386573, r+sr=roc, a=vlad
authorsmontagu@smontagu.org
Thu, 25 Oct 2007 02:32:01 -0700
changeset 7168 f15cb3eff96bfc79af326a57f9b5d9bb3544e230
parent 7167 49a02e7bd1a28d41179f80248ee467e46d941503
child 7169 3a341905360d9201f2af5371adfad14650c9d6a9
push idunknown
push userunknown
push dateunknown
reviewersvlad
bugs386573
milestone1.9a9pre
Fix the positioning of diacritics in right-to-left languages and clean up a bunch of typos in bidi reftests. Bug 386573, r+sr=roc, a=vlad
gfx/thebes/src/gfxAtsuiFonts.cpp
layout/reftests/bidi/bidi-000-ref.html
layout/reftests/bidi/bidi-000.html
layout/reftests/bidi/bidi-001-j.html
layout/reftests/bidi/bidi-001-ref.html
layout/reftests/bidi/bidi-001-v.html
layout/reftests/bidi/bidi-001.html
layout/reftests/bidi/bidi-002-ref.html
layout/reftests/bidi/bidi-002.html
layout/reftests/bidi/bidi-003-ref.html
layout/reftests/bidi/bidi-003.html
layout/reftests/bidi/bidi-004-j.html
layout/reftests/bidi/bidi-004-ref.html
layout/reftests/bidi/bidi-004.html
layout/reftests/bidi/bidi-005-ref.html
layout/reftests/bidi/bidi-005.html
layout/reftests/bidi/reftest.list
--- a/gfx/thebes/src/gfxAtsuiFonts.cpp
+++ b/gfx/thebes/src/gfxAtsuiFonts.cpp
@@ -816,41 +816,45 @@ SetGlyphsForCharacterGroup(ATSLayoutReco
         }
     }
 
     nsAutoTArray<gfxTextRun::DetailedGlyph,10> detailedGlyphs;
     ATSLayoutRecord *advanceStart = aGlyphs;
     for (i = 0; i < aGlyphCount; ++i) {
         ATSLayoutRecord *glyph = &aGlyphs[i];
         if (glyph->glyphID != ATSUI_SPECIAL_GLYPH_ID) {
-            if (detailedGlyphs.Length() > 0) {
-                detailedGlyphs[detailedGlyphs.Length() - 1].mAdvance =
-                    GetAdvanceAppUnits(advanceStart, glyph - advanceStart, aAppUnitsPerDevUnit);
-                advanceStart = glyph;
-            }
-
             gfxTextRun::DetailedGlyph *details = detailedGlyphs.AppendElement();
             if (!details)
                 return;
+            details->mAdvance = 0;
             details->mIsLastGlyph = PR_FALSE;
             details->mGlyphID = glyph->glyphID;
             details->mXOffset = 0;
+            if (detailedGlyphs.Length() > 1) {
+                details->mXOffset +=
+                    GetAdvanceAppUnits(advanceStart, glyph - advanceStart,
+                                       aAppUnitsPerDevUnit);
+            }
             details->mYOffset = !aBaselineDeltas ? 0.0f
                 : FixedToFloat(aBaselineDeltas[i])*aAppUnitsPerDevUnit;
         }
     }
     if (detailedGlyphs.Length() == 0) {
         NS_WARNING("No glyphs visible at all!");
         aRun->SetCharacterGlyph(aSegmentStart + index, g.SetMissing());
         return;
     }
 
+    // The advance width for the whole cluster
+    PRInt32 clusterAdvance = GetAdvanceAppUnits(aGlyphs, aGlyphCount, aAppUnitsPerDevUnit);
     detailedGlyphs[detailedGlyphs.Length() - 1].mIsLastGlyph = PR_TRUE;
-    detailedGlyphs[detailedGlyphs.Length() - 1].mAdvance =
-        GetAdvanceAppUnits(advanceStart, aGlyphs + aGlyphCount - advanceStart, aAppUnitsPerDevUnit);
+    if (aRun->IsRightToLeft())
+        detailedGlyphs[0].mAdvance = clusterAdvance;
+    else
+        detailedGlyphs[detailedGlyphs.Length() - 1].mAdvance = clusterAdvance;
     aRun->SetDetailedGlyphs(aSegmentStart + index, detailedGlyphs.Elements(), detailedGlyphs.Length());    
 }
 
 /**
  * Returns true if there are overrunning glyphs
  */
 static PRBool
 PostLayoutCallback(ATSULineRef aLine, gfxTextRun *aRun,
--- a/layout/reftests/bidi/bidi-000-ref.html
+++ b/layout/reftests/bidi/bidi-000-ref.html
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 000: bidi overrides. If this fails, none of the tests in this
      directory can be relied upon -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
   </style>
  <body>
--- a/layout/reftests/bidi/bidi-000.html
+++ b/layout/reftests/bidi/bidi-000.html
@@ -1,17 +1,17 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 000: bidi overrides. If this fails, none of the tests in this
      directory can be relied upon -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  <body>
   <p><span style="direction: rtl; unicode-bidi: bidi-override">the quick brown fox jumps over the lazy dog</span></p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-001-j.html
+++ b/layout/reftests/bidi/bidi-001-j.html
@@ -1,18 +1,16 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 001-j: rtl text only with justification -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  <body>
-  <p lang="he" style="text-align: justify">המשא אשר חזה חבקוק הנביא</td>
-   </tr>
-  </table>
+  <p lang="he" style="text-align: justify">המשא אשר חזה חבקוק הנביא</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-001-ref.html
+++ b/layout/reftests/bidi/bidi-001-ref.html
@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  </head>
  <body>
   <p lang="he" style="unicode-bidi: bidi-override">איבנה קוקבח הזח רשא אשמה</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-001-v.html
+++ b/layout/reftests/bidi/bidi-001-v.html
@@ -1,16 +1,16 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 001-v: rtl text only in visual order -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=iso-8859-8";
+  <meta http-equiv="content-type" content="text/html; charset=iso-8859-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  <body>
   <p lang="he">    </p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-001.html
+++ b/layout/reftests/bidi/bidi-001.html
@@ -1,18 +1,16 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 001: rtl text only -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
   </style
  <body>
-  <p lang="he">המשא אשר חזה חבקוק הנביא</td>
-   </tr>
-  </table>
+  <p lang="he">המשא אשר חזה חבקוק הנביא</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-002-ref.html
+++ b/layout/reftests/bidi/bidi-002-ref.html
@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  </head>
  <body>
   <p lang="he" style="unicode-bidi: bidi-override">v2.0.0.4 תירבעה הסריגה Mozilla Firefox</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-002.html
+++ b/layout/reftests/bidi/bidi-002.html
@@ -1,16 +1,16 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 002: mixed rtl and ltr text -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  <body>
   <p lang="he" style="direction: rtl; text-align: left;">Mozilla Firefox הגירסה העברית v2.0.0.4</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-003-ref.html
+++ b/layout/reftests/bidi/bidi-003-ref.html
@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  </head>
  <body>
   <p lang="he" style="unicode-bidi: bidi-override">v2.0.0.4 תירבעה <b>הסריגה </b>Mozilla <b>Firefox</b></p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-003.html
+++ b/layout/reftests/bidi/bidi-003.html
@@ -1,17 +1,17 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 003: mixed rtl and ltr text with element boundaries crossing
      directional run boundaries -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  <body>
   <p lang="he" style="direction: rtl; text-align: left;">Mozilla <b>Firefox הגירסה</b> העברית v2.0.0.4</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-004-j.html
+++ b/layout/reftests/bidi/bidi-004-j.html
@@ -1,16 +1,16 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 004-j: rtl text with diacritics and justification -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  <body>
   <p lang="he" style="direction: rtl; text-align: justify;">אַבּוּשׁ</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-004-ref.html
+++ b/layout/reftests/bidi/bidi-004-ref.html
@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  </head>
  <body>
   <p lang="he" style="unicode-bidi: bidi-override; text-align: right">שׁוּבּאַ</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-004.html
+++ b/layout/reftests/bidi/bidi-004.html
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 004: rtl text with diacritics -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {   
   font-family: serif;
   font-size: 24px;
 }
   </style>
  <body>
--- a/layout/reftests/bidi/bidi-005-ref.html
+++ b/layout/reftests/bidi/bidi-005-ref.html
@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  </head>
  <body>
   <p lang="he" style="unicode-bidi: bidi-override">&#x10906;&#x10905;&#x10907;&#x10913;&#x10909;&#x1091F;&#x10910;&#x1090E;&#x10900;&#x10905;&#x10907;&#x10913;&#x10909;</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-005.html
+++ b/layout/reftests/bidi/bidi-005.html
@@ -1,18 +1,16 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 005: rtl text in SMP -->
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8";
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
   font-family: serif;
   font-size: 24px;
 }
-  </style
+  </style>
  <body>
-  <p lang="he">&#x10909;&#x10913;&#x10907;&#x10905;&#x10900;&#x1090E;&#x10910;&#x1091F;&#x10909;&#x10913;&#x10907;&#x10905;&#x10906;</td>
-   </tr>
-  </table>
+  <p lang="he">&#x10909;&#x10913;&#x10907;&#x10905;&#x10900;&#x1090E;&#x10910;&#x1091F;&#x10909;&#x10913;&#x10907;&#x10905;&#x10906;</p>
  </body>
 </html>
--- a/layout/reftests/bidi/reftest.list
+++ b/layout/reftests/bidi/reftest.list
@@ -2,12 +2,12 @@
 == bidi-001.html bidi-001-ref.html
 == bidi-001-j.html bidi-001-ref.html
 == bidi-001-v.html bidi-001-ref.html
 == bidi-002.html bidi-002-ref.html
 == bidi-003.html bidi-003-ref.html
 fails-if(MOZ_WIDGET_TOOLKIT!="windows") == bidi-004.html bidi-004-ref.html # Bug 386567 (Linux), bug 386573 (Mac)
 fails-if(MOZ_WIDGET_TOOLKIT!="windows") == bidi-004-j.html bidi-004-ref.html
 == bidi-005.html bidi-005-ref.html
-fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == bidi-006.html bidi-006-ref.html # Bug 386573
-fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == bidi-006-j.html bidi-006-ref.html # Bug 386573
+== bidi-006.html bidi-006-ref.html
+== bidi-006-j.html bidi-006-ref.html
 == 386339.html 386339-ref.html
 fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") == 387653.html 387653-ref.html # Linux-specific bug