Fix by Graham Dennis, reviewed by Darin.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2006 18:58:16 +0000 (18:58 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2006 18:58:16 +0000 (18:58 +0000)
        - fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=10094
          Japanese characters improperly rendering in TOT

        Test: fast/encoding/denormalised-voiced-japanese-chars.html

        * platform/Font.cpp:
        (WebCore::WidthIterator::advance): pass currentCharacter to normalizeVoicingMarks
        (WebCore::WidthIterator::normalizeVoicingMarks): turn the currentCharacter variable
        into an argument as WidthIterator::advance doesn't update m_currentCharacter while
        looping

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15651 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.checksum [new file with mode: 0644]
LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.png [new file with mode: 0644]
LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/denormalised-voiced-japanese-chars.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/Font.cpp

index 7de9b6d..739c15c 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-27  Graham Dennis  <graham.dennis@gmail.com>
+
+        Reviewed by Darin.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=10094
+          Japanese characters improperly rendering in TOT
+
+        * fast/encoding/denormalised-voiced-japanese-chars-expected.checksum: Added.
+        * fast/encoding/denormalised-voiced-japanese-chars-expected.png: Added.
+        * fast/encoding/denormalised-voiced-japanese-chars-expected.txt: Added.
+        * fast/encoding/denormalised-voiced-japanese-chars.html: Added.
+
 2006-07-27  Eric Seidel  <eric@eseidel.com>
 
         Reviewed by ap.
diff --git a/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.checksum b/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.checksum
new file mode 100644 (file)
index 0000000..c30f920
--- /dev/null
@@ -0,0 +1 @@
+f0a4eab1483c813f357ac405e2e564b4
\ No newline at end of file
diff --git a/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.png b/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.png
new file mode 100644 (file)
index 0000000..8d200ca
Binary files /dev/null and b/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.png differ
diff --git a/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.txt b/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars-expected.txt
new file mode 100644 (file)
index 0000000..dc23321
--- /dev/null
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x246
+  RenderBlock {HTML} at (0,0) size 800x246
+    RenderBody {BODY} at (8,8) size 784x222
+      RenderBlock (anonymous) at (0,0) size 784x54
+        RenderText {#text} at (0,0) size 775x54
+          text run at (0,0) width 775: "This test checks that the decomposed unicode version of voiced japanese hiragana and katakana characters are rendered the"
+          text run at (0,18) width 724: "same as the precomposed version. This test is a pixel-test, and passes when the text in the two heading elements are"
+          text run at (0,36) width 57: "identical."
+      RenderBlock {H2} at (0,73) size 784x28
+        RenderText {#text} at (0,0) size 168x28
+          text run at (0,0) width 168: "\x{30CF}\x{3099}\x{30CA}\x{30CA}\x{3068}\x{30CF}\x{309A}\x{30CA}\x{30DE}"
+      RenderBlock {P} at (0,120) size 784x18
+        RenderText {#text} at (0,0) size 164x18
+          text run at (0,0) width 164: "The above is decomposed"
+      RenderBlock {H2} at (0,157) size 784x28
+        RenderText {#text} at (0,0) size 168x28
+          text run at (0,0) width 168: "\x{30D0}\x{30CA}\x{30CA}\x{3068}\x{30D1}\x{30CA}\x{30DE}"
+      RenderBlock {P} at (0,204) size 784x18
+        RenderText {#text} at (0,0) size 169x18
+          text run at (0,0) width 169: "The above is precomposed"
diff --git a/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars.html b/LayoutTests/fast/encoding/denormalised-voiced-japanese-chars.html
new file mode 100644 (file)
index 0000000..93791ee
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+This test checks that the decomposed unicode version of voiced japanese hiragana and katakana characters are rendered the same as the precomposed version. This test is a pixel-test, and passes when the text in the two heading elements are identical.
+<h2>バナナとパナマ</h2>
+<p>The above is decomposed</p>
+
+<h2>バナナとパナマ</h2>
+<p>The above is precomposed</p>
+
+</body>
+</html>
index f45c133..9a0c902 100644 (file)
@@ -1,3 +1,18 @@
+2006-07-27  Graham Dennis  <graham.dennis@gmail.com>
+
+        Reviewed by Darin.
+
+        - fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=10094
+          Japanese characters improperly rendering in TOT
+          
+        Test: fast/encoding/denormalised-voiced-japanese-chars.html
+
+        * platform/Font.cpp:
+        (WebCore::WidthIterator::advance): pass currentCharacter to normalizeVoicingMarks
+        (WebCore::WidthIterator::normalizeVoicingMarks): turn the currentCharacter variable
+        into an argument as WidthIterator::advance doesn't update m_currentCharacter while
+        looping
+
 2006-07-27  Eric Seidel  <eric@eseidel.com>
 
         Reviewed by ap.
index 758aa7b..5227253 100644 (file)
@@ -77,7 +77,7 @@ struct WidthIterator {
     float m_finalRoundingWidth;
     
 private:
-    UChar32 normalizeVoicingMarks();
+    UChar32 normalizeVoicingMarks(int currentCharacter);
 };
 
 WidthIterator::WidthIterator(const Font* font, const TextRun& run, const TextStyle& style, const FontData* substituteFontData)
@@ -140,7 +140,7 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer)
                 // Deal with Hiragana and Katakana voiced and semi-voiced syllables.
                 // Normalize into composed form, and then look for glyph with base + combined mark.
                 // Check above for character range to minimize performance impact.
-                UChar32 normalized = normalizeVoicingMarks();
+                UChar32 normalized = normalizeVoicingMarks(currentCharacter);
                 if (normalized) {
                     c = normalized;
                     clusterLength = 2;
@@ -289,9 +289,8 @@ bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer)
     return !glyphBuffer->isEmpty();
 }
 
-UChar32 WidthIterator::normalizeVoicingMarks()
+UChar32 WidthIterator::normalizeVoicingMarks(int currentCharacter)
 {
-    int currentCharacter = m_currentCharacter;
     if (currentCharacter + 1 < m_end) {
         if (u_getCombiningClass(m_run[currentCharacter + 1]) == HIRAGANA_KATAKANA_VOICING_MARKS) {
             // Normalize into composed form using 3.2 rules.