Title: [229272] releases/WebKitGTK/webkit-2.20
Revision
229272
Author
[email protected]
Date
2018-03-05 05:17:11 -0800 (Mon, 05 Mar 2018)

Log Message

Merge r229164 - [FreeType] Remove FontPlatformData fallbacks
https://bugs.webkit.org/show_bug.cgi?id=183210

Reviewed by Michael Catanzaro.

Source/WebCore:

They are only used by FontCache::systemFallbackForCharacters() where a direct FcFontMatch provides the same
or better results.

* platform/graphics/FontPlatformData.h: Remove fallbacks.
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::FontCache::systemFallbackForCharacters): Use FcFontMatch() only.
* platform/graphics/freetype/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::fallbacks): Removed.

LayoutTests:

Rebaseline 3 tests that progressed.

* platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.png:
* platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.txt:
* platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.png:
* platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.txt:
* platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.png:
* platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog	2018-03-05 13:17:11 UTC (rev 229272)
@@ -1,3 +1,19 @@
+2018-03-01  Carlos Garcia Campos  <[email protected]>
+
+        [FreeType] Remove FontPlatformData fallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=183210
+
+        Reviewed by Michael Catanzaro.
+
+        Rebaseline 3 tests that progressed.
+
+        * platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.png:
+        * platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.txt:
+        * platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.png:
+        * platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.txt:
+        * platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.png:
+        * platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt:
+
 2018-03-01  Chris Dumez  <[email protected]>
 
         imported/w3c/web-platform-tests/html/browsers/windows/browsing-context.html fails with async policy delegates

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.png


(Binary files differ)

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.txt (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.txt	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-CSS-expected.txt	2018-03-05 13:17:11 UTC (rev 229272)
@@ -4,8 +4,8 @@
   RenderBlock {HTML} at (0,0) size 800x554
     RenderBody {BODY} at (8,21) size 784x517
       RenderBlock {H1} at (0,0) size 784x37
-        RenderText {#text} at (0,0) size 488x36
-          text run at (0,0) width 488: "Bidirectional Text Test 2 - CSS"
+        RenderText {#text} at (0,0) size 547x36
+          text run at (0,0) width 547: "Bidirectional Text Test 2 - CSS"
       RenderBlock {P} at (0,58) size 784x19
         RenderText {#text} at (0,0) size 167x17
           text run at (0,0) width 167: "This test is based on "

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.png


(Binary files differ)

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.txt (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.txt	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-HTML-expected.txt	2018-03-05 13:17:11 UTC (rev 229272)
@@ -4,8 +4,8 @@
   RenderBlock {HTML} at (0,0) size 800x502
     RenderBody {BODY} at (8,21) size 784x465
       RenderBlock {H1} at (0,0) size 784x37
-        RenderText {#text} at (0,0) size 516x36
-          text run at (0,0) width 516: "Bidirectional Text Test 2 - HTML"
+        RenderText {#text} at (0,0) size 579x36
+          text run at (0,0) width 579: "Bidirectional Text Test 2 - HTML"
       RenderBlock {P} at (0,58) size 784x19
         RenderText {#text} at (0,0) size 167x17
           text run at (0,0) width 167: "This test is based on "

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.png


(Binary files differ)

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/platform/gtk/fast/text/international/bidi-LDB-2-formatting-characters-expected.txt	2018-03-05 13:17:11 UTC (rev 229272)
@@ -4,9 +4,9 @@
   RenderBlock {HTML} at (0,0) size 785x633
     RenderBody {BODY} at (8,21) size 769x596
       RenderBlock {H1} at (0,0) size 769x74
-        RenderText {#text} at (0,0) size 603x73
-          text run at (0,0) width 603: "Bidirectional Text Test 2 - Formatting"
-          text run at (0,37) width 176: "Characters"
+        RenderText {#text} at (0,0) size 680x73
+          text run at (0,0) width 680: "Bidirectional Text Test 2 - Formatting"
+          text run at (0,37) width 197: "Characters"
       RenderBlock {P} at (0,95) size 769x19
         RenderText {#text} at (0,0) size 167x17
           text run at (0,0) width 167: "This test is based on "

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-03-05 13:17:11 UTC (rev 229272)
@@ -1,3 +1,19 @@
+2018-03-01  Carlos Garcia Campos  <[email protected]>
+
+        [FreeType] Remove FontPlatformData fallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=183210
+
+        Reviewed by Michael Catanzaro.
+
+        They are only used by FontCache::systemFallbackForCharacters() where a direct FcFontMatch provides the same
+        or better results.
+
+        * platform/graphics/FontPlatformData.h: Remove fallbacks.
+        * platform/graphics/freetype/FontCacheFreeType.cpp:
+        (WebCore::FontCache::systemFallbackForCharacters): Use FcFontMatch() only.
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::fallbacks): Removed.
+
 2018-03-01  Zalan Bujtas  <[email protected]>
 
         Remove RenderElement::s_noLongerAffectsParentBlock

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/FontPlatformData.h (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/FontPlatformData.h	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/FontPlatformData.h	2018-03-05 13:17:11 UTC (rev 229272)
@@ -164,7 +164,6 @@
 #if USE(FREETYPE)
     HarfBuzzFace& harfBuzzFace() const;
     bool hasCompatibleCharmap() const;
-    FcFontSet* fallbacks() const;
 #endif
 
     unsigned hash() const;
@@ -242,7 +241,6 @@
 
 #if USE(FREETYPE)
     RefPtr<FcPattern> m_pattern;
-    mutable FcUniquePtr<FcFontSet> m_fallbacks;
     mutable std::unique_ptr<HarfBuzzFace> m_harfBuzzFace;
 #endif
 

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp	2018-03-05 13:17:11 UTC (rev 229272)
@@ -78,12 +78,10 @@
     return true;
 }
 
-static RefPtr<FcPattern> createFontConfigPatternForCharacters(const FontDescription& fontDescription, const UChar* characters, int bufferLength)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font*, bool, const UChar* characters, unsigned length)
 {
-    RefPtr<FcPattern> pattern = adoptRef(FcPatternCreate());
     FcUniquePtr<FcCharSet> fontConfigCharSet(FcCharSetCreate());
-
-    UTF16UChar32Iterator iterator(characters, bufferLength);
+    UTF16UChar32Iterator iterator(characters, length);
     UChar32 character = iterator.next();
     while (character != iterator.end()) {
         FcCharSetAddChar(fontConfigCharSet.get(), character);
@@ -90,48 +88,25 @@
         character = iterator.next();
     }
 
+    RefPtr<FcPattern> pattern = adoptRef(FcPatternCreate());
     FcPatternAddCharSet(pattern.get(), FC_CHARSET, fontConfigCharSet.get());
 
     FcPatternAddBool(pattern.get(), FC_SCALABLE, FcTrue);
 
-    if (!configurePatternForFontDescription(pattern.get(), fontDescription))
+    if (!configurePatternForFontDescription(pattern.get(), description))
         return nullptr;
 
     FcConfigSubstitute(nullptr, pattern.get(), FcMatchPattern);
     cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern.get());
     FcDefaultSubstitute(pattern.get());
-    return pattern;
-}
 
-static RefPtr<FcPattern> findBestFontGivenFallbacks(const FontPlatformData& fontData, FcPattern* pattern)
-{
-    FcFontSet* fallbacks = fontData.fallbacks();
-    if (!fallbacks)
-        return nullptr;
-
     FcResult fontConfigResult;
-    return adoptRef(FcFontSetMatch(nullptr, &fallbacks, 1, pattern, &fontConfigResult));
-}
-
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, unsigned length)
-{
-    RefPtr<FcPattern> pattern = createFontConfigPatternForCharacters(description, characters, length);
-    if (!pattern)
+    RefPtr<FcPattern> resultPattern = adoptRef(FcFontMatch(nullptr, pattern.get(), &fontConfigResult));
+    if (!resultPattern)
         return nullptr;
 
-
-    if (RefPtr<FcPattern> fallbackPattern = findBestFontGivenFallbacks(originalFontData->platformData(), pattern.get())) {
-        FontPlatformData alternateFontData(fallbackPattern.get(), description);
-        return fontForPlatformData(alternateFontData);
-    }
-
-    FcResult fontConfigResult;
-    if (RefPtr<FcPattern> resultPattern = adoptRef(FcFontMatch(nullptr, pattern.get(), &fontConfigResult))) {
-        FontPlatformData alternateFontData(resultPattern.get(), description);
-        return fontForPlatformData(alternateFontData);
-    }
-
-    return nullptr;
+    FontPlatformData alternateFontData(resultPattern.get(), description);
+    return fontForPlatformData(alternateFontData);
 }
 
 static Vector<String> patternToFamilies(FcPattern& pattern)

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (229271 => 229272)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2018-03-05 13:16:55 UTC (rev 229271)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2018-03-05 13:17:11 UTC (rev 229272)
@@ -198,7 +198,6 @@
     m_scaledFont = other.m_scaledFont;
 
     // This will be re-created on demand.
-    m_fallbacks = nullptr;
     m_harfBuzzFace = nullptr;
 
     return *this;
@@ -245,21 +244,6 @@
     return *m_harfBuzzFace;
 }
 
-FcFontSet* FontPlatformData::fallbacks() const
-{
-    if (m_fallbacks)
-        return m_fallbacks.get();
-
-    if (m_pattern) {
-        FcResult fontConfigResult;
-        FcUniquePtr<FcFontSet> unpreparedFallbacks(FcFontSort(nullptr, m_pattern.get(), FcTrue, nullptr, &fontConfigResult));
-        m_fallbacks.reset(FcFontSetCreate());
-        for (int i = 0; i < unpreparedFallbacks.get()->nfont; i++)
-            FcFontSetAdd(m_fallbacks.get(), FcFontRenderPrepare(nullptr, m_pattern.get(), unpreparedFallbacks.get()->fonts[i]));
-    }
-    return m_fallbacks.get();
-}
-
 bool FontPlatformData::isFixedPitch() const
 {
     return m_fixedWidth;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to