Diff
Modified: trunk/Source/WebCore/ChangeLog (188129 => 188130)
--- trunk/Source/WebCore/ChangeLog 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/ChangeLog 2015-08-07 17:06:26 UTC (rev 188130)
@@ -1,3 +1,42 @@
+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-08-07 Xabier Rodriguez Calvar <calva...@igalia.com>
[Streams API] Create CountQueuingStrategy object as per spec
Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (188129 => 188130)
--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -151,7 +151,7 @@
if (!m_generatedOTFBuffer)
return nullptr;
std::unique_ptr<FontCustomPlatformData> customPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer);
- 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: trunk/Source/WebCore/loader/cache/CachedFont.cpp (188129 => 188130)
--- trunk/Source/WebCore/loader/cache/CachedFont.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/loader/cache/CachedFont.h (188129 => 188130)
--- trunk/Source/WebCore/loader/cache/CachedFont.h 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/loader/cache/CachedFont.h 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp (188129 => 188130)
--- trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/loader/cache/CachedSVGFont.h (188129 => 188130)
--- trunk/Source/WebCore/loader/cache/CachedSVGFont.h 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/loader/cache/CachedSVGFont.h 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -21,6 +21,7 @@
#include "config.h"
#include "FontCustomPlatformData.h"
+#include "FontDescription.h"
#include "FontPlatformData.h"
#include "SharedBuffer.h"
#include <CoreGraphics/CoreGraphics.h>
@@ -32,8 +33,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
return FontPlatformData(adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr)).get(), size, bold, italic, orientation, widthVariant);
#else
Modified: trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h (188129 => 188130)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h 2015-08-07 17:04:31 UTC (rev 188129)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h 2015-08-07 17:06:26 UTC (rev 188130)
@@ -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&);