Title: [220848] releases/WebKitGTK/webkit-2.18
Revision
220848
Author
[email protected]
Date
2017-08-17 01:01:05 -0700 (Thu, 17 Aug 2017)

Log Message

Merge r220797 - [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
https://bugs.webkit.org/show_bug.cgi?id=174418

Patch by Fujii Hironori <[email protected]> on 2017-08-16
Reviewed by Michael Catanzaro.

Source/WebCore:

HarfBuzzShaper should normalize the input text before collecting
HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
the task. But, this function hasn't been called from anywhere
since Bug 90951.

Test: fast/text/international/vietnamese-nfd.html
      imported/blink/fast/text/international/text-shaping-arabic-diffs.html

* platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
(WebCore::HarfBuzzShaper::HarfBuzzShaper):
Call setNormalizedBuffer instead of normalizeCharacters.
(WebCore::normalizeCharacters): Deleted.
(WebCore::normalizeSpacesAndMirrorChars) Use
FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.

LayoutTests:

* fast/text/international/vietnamese-nfd-expected.html: Added.
* fast/text/international/vietnamese-nfd.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog (220847 => 220848)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-08-17 08:00:55 UTC (rev 220847)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-08-17 08:01:05 UTC (rev 220848)
@@ -1,3 +1,13 @@
+2017-08-16  Fujii Hironori  <[email protected]>
+
+        [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=174418
+
+        Reviewed by Michael Catanzaro.
+
+        * fast/text/international/vietnamese-nfd-expected.html: Added.
+        * fast/text/international/vietnamese-nfd.html: Added.
+
 2017-08-15  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r219504.

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/international/vietnamese-nfd-expected.html (0 => 220848)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/international/vietnamese-nfd-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/international/vietnamese-nfd-expected.html	2017-08-17 08:01:05 UTC (rev 220848)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+ body {
+     font-size: 30px;
+     font-family: Helvetica, sans;
+ }
+</style>
+<body>
+    ã ẫ ẵ ẽ ễ ĩ õ ỗ ỡ ũ ữ ỹ<br>
+    ạ ậ ặ ẹ ệ ị ọ ộ ợ ụ ự ỵ<br>
+    ả ẩ ẳ ẻ ể ỉ ỏ ổ ở ủ ử ỷ<br>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/international/vietnamese-nfd.html (0 => 220848)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/international/vietnamese-nfd.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/fast/text/international/vietnamese-nfd.html	2017-08-17 08:01:05 UTC (rev 220848)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+ body {
+     font-size: 30px;
+     font-family: Helvetica, sans;
+ }
+</style>
+<body>
+    ã ẫ ẵ ẽ ễ ĩ õ ỗ ỡ ũ ữ ỹ<br>
+    ạ ậ ặ ẹ ệ ị ọ ộ ợ ụ ự ỵ<br>
+    ả ẩ ẳ ẻ ể ỉ ỏ ổ ở ủ ử ỷ<br>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (220847 => 220848)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-08-17 08:00:55 UTC (rev 220847)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-08-17 08:01:05 UTC (rev 220848)
@@ -1,3 +1,26 @@
+2017-08-16  Fujii Hironori  <[email protected]>
+
+        [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=174418
+
+        Reviewed by Michael Catanzaro.
+
+        HarfBuzzShaper should normalize the input text before collecting
+        HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
+        the task. But, this function hasn't been called from anywhere
+        since Bug 90951.
+
+        Test: fast/text/international/vietnamese-nfd.html
+              imported/blink/fast/text/international/text-shaping-arabic-diffs.html
+
+        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
+        (WebCore::HarfBuzzShaper::HarfBuzzShaper):
+        Call setNormalizedBuffer instead of normalizeCharacters.
+        (WebCore::normalizeCharacters): Deleted.
+        (WebCore::normalizeSpacesAndMirrorChars) Use
+        FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
+        FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.
+
 2017-08-15  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r219504.

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (220847 => 220848)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2017-08-17 08:00:55 UTC (rev 220847)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2017-08-17 08:01:05 UTC (rev 220848)
@@ -160,33 +160,6 @@
     return position;
 }
 
-static void normalizeCharacters(const TextRun& run, UChar* destination, unsigned length)
-{
-    unsigned position = 0;
-    bool error = false;
-    const UChar* source;
-    String stringFor8BitRun;
-    if (run.is8Bit()) {
-        stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
-        source = stringFor8BitRun.characters16();
-    } else
-        source = run.characters16();
-
-    while (position < length) {
-        UChar32 character;
-        unsigned nextPosition = position;
-        U16_NEXT(source, nextPosition, length, character);
-        // Don't normalize tabs as they are not treated as spaces for word-end.
-        if (FontCascade::treatAsSpace(character) && character != '\t')
-            character = ' ';
-        else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
-            character = zeroWidthSpace;
-        U16_APPEND(destination, position, length, character, error);
-        ASSERT_UNUSED(error, !error);
-        position = nextPosition;
-    }
-}
-
 HarfBuzzShaper::HarfBuzzShaper(const FontCascade* font, const TextRun& run)
     : m_font(font)
     , m_normalizedBufferLength(0)
@@ -197,9 +170,7 @@
     , m_padError(0)
     , m_letterSpacing(font->letterSpacing())
 {
-    m_normalizedBuffer = std::make_unique<UChar[]>(m_run.length() + 1);
-    m_normalizedBufferLength = m_run.length();
-    normalizeCharacters(m_run, m_normalizedBuffer.get(), m_normalizedBufferLength);
+    setNormalizedBuffer();
     setPadding(m_run.expansion());
     setFontFeatures();
 }
@@ -220,7 +191,7 @@
         // Don't normalize tabs as they are not treated as spaces for word-end
         if (FontCascade::treatAsSpace(character) && character != '\t')
             character = ' ';
-        else if (FontCascade::treatAsZeroWidthSpace(character))
+        else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
             character = zeroWidthSpace;
         else if (normalizeMode == HarfBuzzShaper::NormalizeMirrorChars)
             character = u_charMirror(character);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to