Title: [228553] trunk/Source/WebCore
Revision
228553
Author
[email protected]
Date
2018-02-16 00:00:19 -0800 (Fri, 16 Feb 2018)

Log Message

HarfBuzzFace should operate with a FontPlatformData reference
https://bugs.webkit.org/show_bug.cgi?id=182863

Reviewed by Carlos Garcia Campos.

Instead of keeping a never-null pointer to FontPlatformData,
HarfBuzzFace should operate with a FontPlatformData reference.

* platform/graphics/freetype/FontPlatformDataFreeType.cpp:
(WebCore::FontPlatformData::harfBuzzFace const):
* platform/graphics/harfbuzz/HarfBuzzFace.cpp:
(WebCore::HarfBuzzFace::HarfBuzzFace):
* platform/graphics/harfbuzz/HarfBuzzFace.h:
* platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
(WebCore::HarfBuzzFace::createFace):
(WebCore::HarfBuzzFace::createFont):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228552 => 228553)


--- trunk/Source/WebCore/ChangeLog	2018-02-16 05:27:39 UTC (rev 228552)
+++ trunk/Source/WebCore/ChangeLog	2018-02-16 08:00:19 UTC (rev 228553)
@@ -1,3 +1,22 @@
+2018-02-16  Zan Dobersek  <[email protected]>
+
+        HarfBuzzFace should operate with a FontPlatformData reference
+        https://bugs.webkit.org/show_bug.cgi?id=182863
+
+        Reviewed by Carlos Garcia Campos.
+
+        Instead of keeping a never-null pointer to FontPlatformData,
+        HarfBuzzFace should operate with a FontPlatformData reference.
+
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::harfBuzzFace const):
+        * platform/graphics/harfbuzz/HarfBuzzFace.cpp:
+        (WebCore::HarfBuzzFace::HarfBuzzFace):
+        * platform/graphics/harfbuzz/HarfBuzzFace.h:
+        * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
+        (WebCore::HarfBuzzFace::createFace):
+        (WebCore::HarfBuzzFace::createFont):
+
 2018-02-15  Zalan Bujtas  <[email protected]>
 
         [RenderTreeBuilder] parent.Render*::addChild() cleanup

Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (228552 => 228553)


--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2018-02-16 05:27:39 UTC (rev 228552)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2018-02-16 08:00:19 UTC (rev 228553)
@@ -241,7 +241,7 @@
 HarfBuzzFace& FontPlatformData::harfBuzzFace() const
 {
     if (!m_harfBuzzFace)
-        m_harfBuzzFace = std::make_unique<HarfBuzzFace>(const_cast<FontPlatformData*>(this), hash());
+        m_harfBuzzFace = std::make_unique<HarfBuzzFace>(const_cast<FontPlatformData&>(*this), hash());
     return *m_harfBuzzFace;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.cpp (228552 => 228553)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.cpp	2018-02-16 05:27:39 UTC (rev 228552)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.cpp	2018-02-16 08:00:19 UTC (rev 228553)
@@ -64,7 +64,7 @@
     return s_cache;
 }
 
-HarfBuzzFace::HarfBuzzFace(FontPlatformData* platformData, uint64_t uniqueID)
+HarfBuzzFace::HarfBuzzFace(FontPlatformData& platformData, uint64_t uniqueID)
     : m_platformData(platformData)
     , m_uniqueID(uniqueID)
     , m_scriptForVerticalText(HB_SCRIPT_INVALID)

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h (228552 => 228553)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h	2018-02-16 05:27:39 UTC (rev 228552)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h	2018-02-16 08:00:19 UTC (rev 228553)
@@ -50,7 +50,7 @@
     static const hb_tag_t vrt2Tag;
     static const hb_tag_t kernTag;
 
-    HarfBuzzFace(FontPlatformData*, uint64_t);
+    HarfBuzzFace(FontPlatformData&, uint64_t);
     ~HarfBuzzFace();
 
     hb_font_t* createFont();
@@ -83,7 +83,7 @@
 
     hb_face_t* createFace();
 
-    FontPlatformData* m_platformData;
+    FontPlatformData& m_platformData;
     uint64_t m_uniqueID;
     RefPtr<CacheEntry> m_cacheEntry;
 

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp (228552 => 228553)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp	2018-02-16 05:27:39 UTC (rev 228552)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp	2018-02-16 08:00:19 UTC (rev 228553)
@@ -187,7 +187,7 @@
 
 hb_face_t* HarfBuzzFace::createFace()
 {
-    auto* scaledFont = m_platformData->scaledFont();
+    auto* scaledFont = m_platformData.scaledFont();
     cairo_scaled_font_reference(scaledFont);
 
     hb_face_t* face = hb_face_create_for_tables(harfBuzzCairoGetTable, scaledFont,
@@ -202,13 +202,13 @@
 hb_font_t* HarfBuzzFace::createFont()
 {
     hb_font_t* font = hb_font_create(m_cacheEntry->face());
-    hb_font_set_funcs(font, harfBuzzCairoTextGetFontFuncs(), new HarfBuzzFontData { m_cacheEntry->glyphCache(), m_platformData->scaledFont() },
+    hb_font_set_funcs(font, harfBuzzCairoTextGetFontFuncs(), new HarfBuzzFontData { m_cacheEntry->glyphCache(), m_platformData.scaledFont() },
         [](void* data)
         {
             delete static_cast<HarfBuzzFontData*>(data);
         });
 
-    const float size = m_platformData->size();
+    const float size = m_platformData.size();
     if (floorf(size) == size)
         hb_font_set_ppem(font, size, size);
     int scale = floatToHarfBuzzPosition(size);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to