Title: [193524] branches/safari-601-branch/Source/WebCore

Diff

Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2015-12-05 18:30:37 UTC (rev 193524)
@@ -1,5 +1,48 @@
 2015-12-05  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r188130. rdar://problem/23769732
+
+    2015-08-07  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+            Allow FontCustomPlatformData to consult with FontDescription
+            https://bugs.webkit.org/show_bug.cgi?id=147775
+
+            Reviewed by Zalan Bujtas.
+
+            In order to implement font-feature-settings, web fonts need to be
+            able to consult with the set of active font features. Rather than
+            add yet another argument to all the functions in this flow, this
+            patch passes around a reference to the FontDescription itself instead
+            of copies of constituent members of it.
+
+            No new tests because there is no behavior change.
+
+            * css/CSSFontFaceSource.cpp:
+            (WebCore::CSSFontFaceSource::font):
+            * loader/cache/CachedFont.cpp:
+            (WebCore::CachedFont::createFont):
+            (WebCore::CachedFont::platformDataFromCustomData):
+            * loader/cache/CachedFont.h:
+            * loader/cache/CachedSVGFont.cpp:
+            (WebCore::CachedSVGFont::platformDataFromCustomData):
+            * loader/cache/CachedSVGFont.h:
+            * platform/graphics/cairo/FontCustomPlatformData.h:
+            * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
+            (WebCore::FontCustomPlatformData::fontPlatformData):
+            * platform/graphics/freetype/FontPlatformData.h:
+            * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+            (WebCore::FontPlatformData::FontPlatformData):
+            * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
+            (WebCore::Font::platformCreateScaledFont):
+            * platform/graphics/mac/FontCustomPlatformData.cpp:
+            (WebCore::FontCustomPlatformData::fontPlatformData):
+            * platform/graphics/mac/FontCustomPlatformData.h:
+            * platform/graphics/win/FontCustomPlatformData.cpp:
+            (WebCore::FontCustomPlatformData::fontPlatformData):
+            * platform/graphics/win/FontCustomPlatformData.h:
+
+2015-12-05  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r187709. rdar://problem/23769732
 
     2015-07-31  Myles C. Maxfield  <mmaxfi...@apple.com>

Modified: branches/safari-601-branch/Source/WebCore/css/CSSFontFaceSource.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/css/CSSFontFaceSource.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/css/CSSFontFaceSource.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -153,7 +153,7 @@
                 auto customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer);
                 if (!customPlatformData)
                     return nullptr;
-                font = Font::create(customPlatformData->fontPlatformData(static_cast<int>(fontDescription.computedPixelSize()), syntheticBold, syntheticItalic, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
+                font = Font::create(customPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic), true, false);
 #else
                 font = Font::create(std::make_unique<SVGFontData>(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
 #endif

Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedFont.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedFont.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedFont.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -123,14 +123,13 @@
 
 RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomicString&, bool syntheticBold, bool syntheticItalic, bool)
 {
-    return Font::create(platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
-        fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false);
+    return Font::create(platformDataFromCustomData(fontDescription, syntheticBold, syntheticItalic), true, false);
 }
 
-FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
+FontPlatformData CachedFont::platformDataFromCustomData(const FontDescription& fontDescription, bool bold, bool italic)
 {
     ASSERT(m_fontCustomPlatformData);
-    return m_fontCustomPlatformData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);
+    return m_fontCustomPlatformData->fontPlatformData(fontDescription, bold, italic);
 }
 
 void CachedFont::allClientsRemoved()

Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedFont.h (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedFont.h	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedFont.h	2015-12-05 18:30:37 UTC (rev 193524)
@@ -53,7 +53,7 @@
     virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG);
 
 protected:
-    FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic);
 
     bool ensureCustomFontData(SharedBuffer* data);
 

Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGFont.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGFont.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGFont.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -66,11 +66,11 @@
     return nullptr;
 }
 
-FontPlatformData CachedSVGFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
+FontPlatformData CachedSVGFont::platformDataFromCustomData(const FontDescription& fontDescription, bool bold, bool italic)
 {
     if (m_externalSVGDocument)
-        return FontPlatformData(size, bold, italic);
-    return CachedFont::platformDataFromCustomData(size, bold, italic, orientation, widthVariant, renderingMode);
+        return FontPlatformData(fontDescription.computedPixelSize(), bold, italic);
+    return CachedFont::platformDataFromCustomData(fontDescription, bold, italic);
 }
 
 bool CachedSVGFont::ensureCustomFontData(bool externalSVG, const AtomicString& remoteURI)

Modified: branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGFont.h (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGFont.h	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/loader/cache/CachedSVGFont.h	2015-12-05 18:30:37 UTC (rev 193524)
@@ -43,7 +43,7 @@
     virtual RefPtr<Font> createFont(const FontDescription&, const AtomicString& remoteURI, bool syntheticBold, bool syntheticItalic, bool externalSVG) override;
 
 private:
-    FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData platformDataFromCustomData(const FontDescription&, bool bold, bool italic);
 
     SVGFontElement* getSVGFontById(const String&) const;
 

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h	2015-12-05 18:30:37 UTC (rev 193524)
@@ -33,6 +33,7 @@
 
 namespace WebCore {
 
+class FontDescription;
 class FontPlatformData;
 class SharedBuffer;
 
@@ -41,7 +42,7 @@
 public:
     FontCustomPlatformData(FT_Face, SharedBuffer&);
     ~FontCustomPlatformData();
-    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic);
     static bool supportsFormat(const String&);
 
 private:

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -68,9 +68,9 @@
     cairo_font_face_destroy(m_fontFace);
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant, FontRenderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& description, bool bold, bool italic)
 {
-    return FontPlatformData(m_fontFace, size, bold, italic, orientation);
+    return FontPlatformData(m_fontFace, description, bold, italic);
 }
 
 std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer)

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontPlatformData.h (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontPlatformData.h	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontPlatformData.h	2015-12-05 18:30:37 UTC (rev 193524)
@@ -63,7 +63,7 @@
         { }
 
     FontPlatformData(FcPattern*, const FontDescription&);
-    FontPlatformData(cairo_font_face_t*, float size, bool bold, bool italic, FontOrientation);
+    FontPlatformData(cairo_font_face_t*, const FontDescription&, bool bold, bool italic);
     FontPlatformData(float size, bool bold, bool italic);
     FontPlatformData(const FontPlatformData&);
     FontPlatformData(const FontPlatformData&, float size);

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -187,14 +187,14 @@
     // We cannot create a scaled font here.
 }
 
-FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool italic, FontOrientation orientation)
+FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, const FontDescription& description, bool bold, bool italic)
     : m_fallbacks(nullptr)
-    , m_size(size)
+    , m_size(description.computedPixelSize())
     , m_syntheticBold(bold)
     , m_syntheticOblique(italic)
     , m_fixedWidth(false)
     , m_scaledFont(nullptr)
-    , m_orientation(orientation)
+    , m_orientation(description.orientation())
 {
     buildScaledFont(fontFace);
 

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -103,11 +103,12 @@
 PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
 {
     ASSERT(m_platformData.scaledFont());
+    FontDescription scaledFontDescription = fontDescription;
+    scaledFontDescription.setComputedSize(scaleFactor * fontDescription.computedSize());
     return Font::create(FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()),
-        scaleFactor * fontDescription.computedSize(),
+        scaledFontDescription,
         m_platformData.syntheticBold(),
-        m_platformData.syntheticOblique(),
-        fontDescription.orientation()),
+        m_platformData.syntheticOblique()),
         isCustomFont(), false);
 }
 

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -22,6 +22,7 @@
 #include "FontCustomPlatformData.h"
 
 #include "FontCache.h"
+#include "FontDescription.h"
 #include "FontPlatformData.h"
 #include "SharedBuffer.h"
 #include <CoreGraphics/CoreGraphics.h>
@@ -33,8 +34,11 @@
 {
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic)
 {
+    int size = fontDescription.computedPixelSize();
+    FontOrientation orientation = fontDescription.orientation();
+    FontWidthVariant widthVariant = fontDescription.widthVariant();
 #if CORETEXT_WEB_FONTS
     RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr));
     font = applyFontFeatureSettings(font.get(), fontDescription.featureSettings());

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h	2015-12-05 18:30:37 UTC (rev 193524)
@@ -32,6 +32,7 @@
 
 namespace WebCore {
 
+class FontDescription;
 class FontPlatformData;
 class SharedBuffer;
 
@@ -50,7 +51,7 @@
 
     ~FontCustomPlatformData();
 
-    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic);
 
     static bool supportsFormat(const String&);
 

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp	2015-12-05 18:30:37 UTC (rev 193524)
@@ -40,8 +40,11 @@
             RemoveFontMemResourceEx(m_fontReference);
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, FontWidthVariant, FontRenderingMode renderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic)
 {
+    int size = fontDescription.computedPixelSize();
+    FontRenderingMode renderingMode = fontDescription.renderingMode();
+
     ASSERT(m_fontReference);
 
     LOGFONT& logFont = *static_cast<LOGFONT*>(malloc(sizeof(LOGFONT)));

Modified: branches/safari-601-branch/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h (193523 => 193524)


--- branches/safari-601-branch/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h	2015-12-05 18:30:30 UTC (rev 193523)
+++ branches/safari-601-branch/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h	2015-12-05 18:30:37 UTC (rev 193524)
@@ -31,6 +31,7 @@
 
 namespace WebCore {
 
+class FontDescription;
 class FontPlatformData;
 class SharedBuffer;
 
@@ -45,8 +46,7 @@
 
     ~FontCustomPlatformData();
 
-    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal,
-                                      FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+    FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic);
 
     static bool supportsFormat(const String&);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to