Title: [228780] releases/WebKitGTK/webkit-2.20/Source/WebCore
Revision
228780
Author
carlo...@webkit.org
Date
2018-02-20 03:14:05 -0800 (Tue, 20 Feb 2018)

Log Message

Merge r228524 - FontPlatformData::harfBuzzFace() should return a reference
https://bugs.webkit.org/show_bug.cgi?id=182825

Reviewed by Carlos Garcia Campos.

Have FontPlatformData::harfBuzzFace() return a reference instead of a
pointer, given that the returned HarfBuzzFace object cannot be null.

Call-sites of FontPlatformData::harfBuzzFace() are adjusted.
OpenTypeMathData constructors are also changed to not rely on
preprocessor to correctly position the closing brace.

* platform/graphics/FontPlatformData.h:
* platform/graphics/freetype/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::harfBuzzFace const):
* platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* platform/graphics/opentype/OpenTypeMathData.cpp:
(WebCore::OpenTypeMathData::OpenTypeMathData):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (228779 => 228780)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-20 11:13:59 UTC (rev 228779)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-20 11:14:05 UTC (rev 228780)
@@ -1,3 +1,25 @@
+2018-02-15  Zan Dobersek  <zdober...@igalia.com>
+
+        FontPlatformData::harfBuzzFace() should return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=182825
+
+        Reviewed by Carlos Garcia Campos.
+
+        Have FontPlatformData::harfBuzzFace() return a reference instead of a
+        pointer, given that the returned HarfBuzzFace object cannot be null.
+
+        Call-sites of FontPlatformData::harfBuzzFace() are adjusted.
+        OpenTypeMathData constructors are also changed to not rely on
+        preprocessor to correctly position the closing brace.
+
+        * platform/graphics/FontPlatformData.h:
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::harfBuzzFace const):
+        * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+        * platform/graphics/opentype/OpenTypeMathData.cpp:
+        (WebCore::OpenTypeMathData::OpenTypeMathData):
+
 2018-02-15  Zalan Bujtas  <za...@apple.com>
 
         [RenderTreeBuilder] Move RenderInline/RenderGrid::addChild() to RenderTreeBuilder

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


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/FontPlatformData.h	2018-02-20 11:13:59 UTC (rev 228779)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/FontPlatformData.h	2018-02-20 11:14:05 UTC (rev 228780)
@@ -162,7 +162,7 @@
 #endif
 
 #if USE(FREETYPE)
-    HarfBuzzFace* harfBuzzFace() const;
+    HarfBuzzFace& harfBuzzFace() const;
     bool hasCompatibleCharmap() const;
     FcFontSet* fallbacks() const;
 #endif

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


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2018-02-20 11:13:59 UTC (rev 228779)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2018-02-20 11:14:05 UTC (rev 228780)
@@ -238,11 +238,11 @@
     return copy;
 }
 
-HarfBuzzFace* FontPlatformData::harfBuzzFace() const
+HarfBuzzFace& FontPlatformData::harfBuzzFace() const
 {
     if (!m_harfBuzzFace)
         m_harfBuzzFace = std::make_unique<HarfBuzzFace>(const_cast<FontPlatformData*>(this), hash());
-    return m_harfBuzzFace.get();
+    return *m_harfBuzzFace;
 }
 
 FcFontSet* FontPlatformData::fallbacks() const

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp (228779 => 228780)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp	2018-02-20 11:13:59 UTC (rev 228779)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp	2018-02-20 11:14:05 UTC (rev 228780)
@@ -207,12 +207,11 @@
         }
         hb_buffer_add_utf16(buffer.get(), reinterpret_cast<const uint16_t*>(characters), length, run.startIndex, run.endIndex - run.startIndex);
 
-        HarfBuzzFace* face = fontPlatformData.harfBuzzFace();
-        ASSERT(face);
+        auto& face = fontPlatformData.harfBuzzFace();
         if (fontPlatformData.orientation() == Vertical)
-            face->setScriptForVerticalGlyphSubstitution(buffer.get());
+            face.setScriptForVerticalGlyphSubstitution(buffer.get());
 
-        HbUniquePtr<hb_font_t> harfBuzzFont(face->createFont());
+        HbUniquePtr<hb_font_t> harfBuzzFont(face.createFont());
         hb_shape(harfBuzzFont.get(), buffer.get(), features.isEmpty() ? nullptr : features.data(), features.size());
         m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, run.startIndex, run.endIndex));
         hb_buffer_reset(buffer.get());

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp (228779 => 228780)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp	2018-02-20 11:13:59 UTC (rev 228779)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp	2018-02-20 11:14:05 UTC (rev 228780)
@@ -254,20 +254,17 @@
     const OpenType::MathVariants* mathVariants = math->mathVariants(*m_mathBuffer);
     if (!mathVariants)
         m_mathBuffer = nullptr;
+}
 #elif USE(HARFBUZZ)
 OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font)
+    : m_mathFont(font.harfBuzzFace().createFont())
 {
-    HarfBuzzFace* face = font.harfBuzzFace();
-    if (face) {
-        m_mathFont.reset(face->createFont());
-        if (!hb_ot_math_has_data(hb_font_get_face(m_mathFont.get())))
-            m_mathFont.release();
-    }
+    if (!hb_ot_math_has_data(hb_font_get_face(m_mathFont.get())))
+        m_mathFont = nullptr;
+}
 #else
-OpenTypeMathData::OpenTypeMathData(const FontPlatformData&)
-{
+OpenTypeMathData::OpenTypeMathData(const FontPlatformData&) = default;
 #endif
-}
 
 OpenTypeMathData::~OpenTypeMathData() = default;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to