Title: [240231] trunk/Source/WebCore
Revision
240231
Author
carlo...@webkit.org
Date
2019-01-21 02:14:00 -0800 (Mon, 21 Jan 2019)

Log Message

REGRESSION(r239915): about 130 test failures on WPE
https://bugs.webkit.org/show_bug.cgi?id=193395

Reviewed by Žan Doberšek.

Since r239915 we are only overriding the characters with Default_Ignorable unicode property when the font
doesn't support the code point. If the font happens to provide a glyph for the character, it's later ignored by
harfbuzz when shaping, but the simple text code path doesn't ignore them unless there isn't a glyph.

* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal): Always ignore characters with Default_Ignorable unicode property.
(WebCore::characterMustDrawSomething): Moved to CharacterProperties.h and renamed as isDefaultIgnorableCodePoint().
* platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
(WebCore::GlyphPage::fill): Use isDefaultIgnorableCodePoint().
* platform/text/CharacterProperties.h:
(WebCore::isDefaultIgnorableCodePoint): Return whether the character has Default_Ignorable unicode property.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240230 => 240231)


--- trunk/Source/WebCore/ChangeLog	2019-01-21 07:31:29 UTC (rev 240230)
+++ trunk/Source/WebCore/ChangeLog	2019-01-21 10:14:00 UTC (rev 240231)
@@ -1,3 +1,22 @@
+2019-01-21  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r239915): about 130 test failures on WPE
+        https://bugs.webkit.org/show_bug.cgi?id=193395
+
+        Reviewed by Žan Doberšek.
+
+        Since r239915 we are only overriding the characters with Default_Ignorable unicode property when the font
+        doesn't support the code point. If the font happens to provide a glyph for the character, it's later ignored by
+        harfbuzz when shaping, but the simple text code path doesn't ignore them unless there isn't a glyph.
+
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::advanceInternal): Always ignore characters with Default_Ignorable unicode property.
+        (WebCore::characterMustDrawSomething): Moved to CharacterProperties.h and renamed as isDefaultIgnorableCodePoint().
+        * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
+        (WebCore::GlyphPage::fill): Use isDefaultIgnorableCodePoint().
+        * platform/text/CharacterProperties.h:
+        (WebCore::isDefaultIgnorableCodePoint): Return whether the character has Default_Ignorable unicode property.
+
 2019-01-20  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [WHLSL] Implement Metal code generation

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (240230 => 240231)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2019-01-21 07:31:29 UTC (rev 240230)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2019-01-21 10:14:00 UTC (rev 240231)
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "WidthIterator.h"
 
+#include "CharacterProperties.h"
 #include "Font.h"
 #include "FontCascade.h"
 #include "GlyphBuffer.h"
@@ -165,11 +166,6 @@
     return std::make_pair(expandLeft, expandRight);
 }
 
-static inline bool characterMustDrawSomething(UChar32 character)
-{
-    return !u_hasBinaryProperty(character, UCHAR_DEFAULT_IGNORABLE_CODE_POINT);
-}
-
 template <typename TextIterator>
 inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, GlyphBuffer* glyphBuffer)
 {
@@ -201,10 +197,19 @@
     // We are iterating in string order, not glyph order. Compare this to ComplexTextController::adjustGlyphsAndAdvances()
     while (textIterator.consume(character, clusterLength)) {
         unsigned advanceLength = clusterLength;
+        bool characterMustDrawSomething = !isDefaultIgnorableCodePoint(character);
+#if USE(FREETYPE)
+        // Freetype based ports only override the characters with Default_Ignorable unicode property when the font
+        // doesn't support the code point. We should ignore them at this point to ensure they are not displayed.
+        if (!characterMustDrawSomething) {
+            textIterator.advance(advanceLength);
+            continue;
+        }
+#endif
         int currentCharacter = textIterator.currentIndex();
         const GlyphData& glyphData = m_font->glyphDataForCharacter(character, rtl);
         Glyph glyph = glyphData.glyph;
-        if (!glyph && !characterMustDrawSomething(character)) {
+        if (!glyph && !characterMustDrawSomething) {
             textIterator.advance(advanceLength);
             continue;
         }

Modified: trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp (240230 => 240231)


--- trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp	2019-01-21 07:31:29 UTC (rev 240230)
+++ trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp	2019-01-21 10:14:00 UTC (rev 240231)
@@ -32,6 +32,7 @@
 #include "GlyphPage.h"
 
 #include "CairoUtilities.h"
+#include "CharacterProperties.h"
 #include "Font.h"
 #include "FontCascade.h"
 #include "UTF16UChar32Iterator.h"
@@ -70,7 +71,7 @@
 
         Glyph glyph = FcFreeTypeCharIndex(face, FontCascade::treatAsSpace(character) ? space : character);
         // If the font doesn't support a Default_Ignorable character, replace it with zero with space.
-        if (!glyph && u_hasBinaryProperty(character, UCHAR_DEFAULT_IGNORABLE_CODE_POINT))
+        if (!glyph && isDefaultIgnorableCodePoint(character))
             glyph = zeroWidthSpaceGlyph();
 
         if (!glyph)

Modified: trunk/Source/WebCore/platform/text/CharacterProperties.h (240230 => 240231)


--- trunk/Source/WebCore/platform/text/CharacterProperties.h	2019-01-21 07:31:29 UTC (rev 240230)
+++ trunk/Source/WebCore/platform/text/CharacterProperties.h	2019-01-21 10:14:00 UTC (rev 240231)
@@ -106,4 +106,9 @@
 #endif
 }
 
+inline bool isDefaultIgnorableCodePoint(UChar32 character)
+{
+    return u_hasBinaryProperty(character, UCHAR_DEFAULT_IGNORABLE_CODE_POINT);
 }
+
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to