Title: [192895] trunk
Revision
192895
Author
mmaxfi...@apple.com
Date
2015-12-01 11:24:52 -0800 (Tue, 01 Dec 2015)

Log Message

[iOS] Adjacent emoji overlap each other
https://bugs.webkit.org/show_bug.cgi?id=151690
<rdar://problem/23430453>

Reviewed by Simon Fraser.

Source/WebCore:

This is a partial revert of r188737. It turns out that only CoreText gives correct
glyph advances for emoji. In r188737, I reverted the special iOS emoji processing,
but also removed the logic of using CoreText for emoji advances. This patch adds
the m_isEmoji boolean back, so we can tell if we need to force
platformWidthForGlyph() to use CoreText.

This patch also performs a little bit of cleanup by moving Font's m_isSystemFont
to FontPlatformData where it belongs.

Test: fast/text/emoji-overlap.html

* platform/graphics/Font.cpp:
(WebCore::fillGlyphPage): Removed unnecessary argument.
(WebCore::Font::Font): Deleted.
* platform/graphics/Font.h: Moved getters and booleans to FontPlatformData.
(WebCore::Font::hasCustomTracking): Deleted.
(WebCore::Font::isSystemFont): Deleted.
* platform/graphics/FontPlatformData.cpp:
(WebCore::FontPlatformData::FontPlatformData): Initialize new booleans.
(WebCore::FontPlatformData::operator=): Ditto.
* platform/graphics/FontPlatformData.h: Getters for new booleans.
(WebCore::FontPlatformData::isSystemFont):
(WebCore::FontPlatformData::hasCustomTracking):
(WebCore::FontPlatformData::isEmoji):
* platform/graphics/GlyphPage.h: Remove unnecessary argument.
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::advanceForColorBitmapFont): Return an Optional instead of using an out
argument.
(WebCore::canUseFastGlyphAdvanceGetter): Make sure that we use CoreText if we are
using the Emoji font.
(WebCore::Font::platformWidthForGlyph):
(WebCore::Font::platformInit): Deleted.
* platform/graphics/cocoa/FontPlatformDataCocoa.mm: Deal with the new booleans.
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::platformDataInit):
(WebCore::FontPlatformData::platformDataAssign):
(WebCore::FontPlatformData::setFont):
* platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
(WebCore::GlyphPage::fill): Removed unnecessary argument.
* platform/graphics/mac/GlyphPageMac.cpp:
(WebCore::shouldUseCoreText): Use a reference instead of a pointer.
(WebCore::GlyphPage::fill): Removed unnecessary argument.
* platform/graphics/win/FontCGWin.cpp:
(WebCore::FontCascade::drawGlyphs): Update for new location of booleans.
* platform/graphics/win/GlyphPageTreeNodeCGWin.cpp:
(WebCore::GlyphPage::fill): Removed unnecessary argument.
* platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
(WebCore::GlyphPage::fill): Removed unnecessary argument.
* platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::shapeAndPlaceItem): Update for new location of
booleans.

LayoutTests:

* fast/text/emoji-overlap-expected.html: Added.
* fast/text/emoji-overlap.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192894 => 192895)


--- trunk/LayoutTests/ChangeLog	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/LayoutTests/ChangeLog	2015-12-01 19:24:52 UTC (rev 192895)
@@ -1,5 +1,16 @@
 2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [iOS] Adjacent emoji overlap each other
+        https://bugs.webkit.org/show_bug.cgi?id=151690
+        <rdar://problem/23430453>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/emoji-overlap-expected.html: Added.
+        * fast/text/emoji-overlap.html: Added.
+
+2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         [Win] Web fonts with small caps have excess whitespace with the complex text codepath
         https://bugs.webkit.org/show_bug.cgi?id=151698
 

Added: trunk/LayoutTests/fast/text/emoji-overlap-expected.html (0 => 192895)


--- trunk/LayoutTests/fast/text/emoji-overlap-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/emoji-overlap-expected.html	2015-12-01 19:24:52 UTC (rev 192895)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<body>
+This test makes sure that adjacent emoji don't overlap. The test passes if there is some (narrow) whitespace between the emoji below.
+<div><span style="display: inline-block; transform-origin: top left; transform: scale(5); border-right: solid black 1px;"><span style="display: inline-block; width: 21px;">😉</span><span style="display: inline-block; width: 21px;">😌</span><span style="display: inline-block; width: 21px;">😗</span></span></div>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/emoji-overlap.html (0 => 192895)


--- trunk/LayoutTests/fast/text/emoji-overlap.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/emoji-overlap.html	2015-12-01 19:24:52 UTC (rev 192895)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<body>
+This test makes sure that adjacent emoji don't overlap. The test passes if there is some (narrow) whitespace between the emoji below.
+<div><span style="display: inline-block; transform-origin: top left; transform: scale(5); border-right: solid black 1px;">😉😌😗</span></div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (192894 => 192895)


--- trunk/Source/WebCore/ChangeLog	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/ChangeLog	2015-12-01 19:24:52 UTC (rev 192895)
@@ -1,5 +1,65 @@
 2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [iOS] Adjacent emoji overlap each other
+        https://bugs.webkit.org/show_bug.cgi?id=151690
+        <rdar://problem/23430453>
+
+        Reviewed by Simon Fraser.
+
+        This is a partial revert of r188737. It turns out that only CoreText gives correct
+        glyph advances for emoji. In r188737, I reverted the special iOS emoji processing,
+        but also removed the logic of using CoreText for emoji advances. This patch adds
+        the m_isEmoji boolean back, so we can tell if we need to force
+        platformWidthForGlyph() to use CoreText.
+
+        This patch also performs a little bit of cleanup by moving Font's m_isSystemFont
+        to FontPlatformData where it belongs.
+
+        Test: fast/text/emoji-overlap.html
+
+        * platform/graphics/Font.cpp:
+        (WebCore::fillGlyphPage): Removed unnecessary argument.
+        (WebCore::Font::Font): Deleted.
+        * platform/graphics/Font.h: Moved getters and booleans to FontPlatformData.
+        (WebCore::Font::hasCustomTracking): Deleted.
+        (WebCore::Font::isSystemFont): Deleted.
+        * platform/graphics/FontPlatformData.cpp:
+        (WebCore::FontPlatformData::FontPlatformData): Initialize new booleans.
+        (WebCore::FontPlatformData::operator=): Ditto.
+        * platform/graphics/FontPlatformData.h: Getters for new booleans.
+        (WebCore::FontPlatformData::isSystemFont):
+        (WebCore::FontPlatformData::hasCustomTracking):
+        (WebCore::FontPlatformData::isEmoji):
+        * platform/graphics/GlyphPage.h: Remove unnecessary argument.
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::advanceForColorBitmapFont): Return an Optional instead of using an out
+        argument.
+        (WebCore::canUseFastGlyphAdvanceGetter): Make sure that we use CoreText if we are
+        using the Emoji font.
+        (WebCore::Font::platformWidthForGlyph):
+        (WebCore::Font::platformInit): Deleted.
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm: Deal with the new booleans.
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::platformDataInit):
+        (WebCore::FontPlatformData::platformDataAssign):
+        (WebCore::FontPlatformData::setFont):
+        * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
+        (WebCore::GlyphPage::fill): Removed unnecessary argument.
+        * platform/graphics/mac/GlyphPageMac.cpp:
+        (WebCore::shouldUseCoreText): Use a reference instead of a pointer.
+        (WebCore::GlyphPage::fill): Removed unnecessary argument.
+        * platform/graphics/win/FontCGWin.cpp:
+        (WebCore::FontCascade::drawGlyphs): Update for new location of booleans.
+        * platform/graphics/win/GlyphPageTreeNodeCGWin.cpp:
+        (WebCore::GlyphPage::fill): Removed unnecessary argument.
+        * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
+        (WebCore::GlyphPage::fill): Removed unnecessary argument.
+        * platform/graphics/win/UniscribeController.cpp:
+        (WebCore::UniscribeController::shapeAndPlaceItem): Update for new location of
+        booleans.
+
+2015-12-01  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         [Win] Web fonts with small caps have excess whitespace with the complex text codepath
         https://bugs.webkit.org/show_bug.cgi?id=151698
 

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -64,9 +64,6 @@
     , m_isBrokenIdeographFallback(false)
     , m_hasVerticalGlyphs(false)
     , m_isUsedInSystemFallbackCache(false)
-#if PLATFORM(COCOA) || PLATFORM(WIN)
-    , m_isSystemFont(false)
-#endif
 #if PLATFORM(IOS)
     , m_shouldNotBeUsedForArabic(false)
 #endif
@@ -155,7 +152,7 @@
     if (auto* svgData = font.svgData())
         return svgData->fillSVGGlyphPage(&pageToFill, buffer, bufferLength);
 #endif
-    bool hasGlyphs = pageToFill.fill(buffer, bufferLength, &font);
+    bool hasGlyphs = pageToFill.fill(buffer, bufferLength);
 #if ENABLE(OPENTYPE_VERTICAL)
     if (hasGlyphs && font.verticalData())
         font.verticalData()->substituteWithVerticalGlyphs(&font, &pageToFill);

Modified: trunk/Source/WebCore/platform/graphics/Font.h (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/Font.h	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2015-12-01 19:24:52 UTC (rev 192895)
@@ -193,7 +193,6 @@
 #endif
 #if PLATFORM(COCOA)
     CFDictionaryRef getCFStringAttributes(bool enableKerning, FontOrientation) const;
-    bool hasCustomTracking() const { return isSystemFont(); }
 #endif
 
 #if PLATFORM(COCOA) || USE(HARFBUZZ)
@@ -203,7 +202,6 @@
     bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t glyphCount, bool enableKerning, bool requiresShaping) const;
 
 #if PLATFORM(COCOA) || PLATFORM(WIN)
-    bool isSystemFont() const { return m_isSystemFont; }
 #endif
 
 #if PLATFORM(WIN)
@@ -313,9 +311,6 @@
 
     unsigned m_isUsedInSystemFallbackCache : 1;
 
-#if PLATFORM(COCOA) || PLATFORM(WIN)
-    unsigned m_isSystemFont : 1;
-#endif
 #if PLATFORM(IOS)
     unsigned m_shouldNotBeUsedForArabic : 1;
 #endif

Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -66,6 +66,7 @@
 {
     m_isHashTableDeletedValue = source.m_isHashTableDeletedValue;
     m_isColorBitmapFont = source.m_isColorBitmapFont;
+    m_isSystemFont = source.m_isSystemFont;
     platformDataInit(source);
 }
 
@@ -83,6 +84,7 @@
     m_widthVariant = other.m_widthVariant;
     m_isColorBitmapFont = other.m_isColorBitmapFont;
     m_textRenderingMode = other.m_textRenderingMode;
+    m_isSystemFont = other.m_isSystemFont;
 
     return platformDataAssign(other);
 }

Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2015-12-01 19:24:52 UTC (rev 192895)
@@ -115,6 +115,9 @@
     static RetainPtr<CFTypeRef> objectForEqualityCheck(CTFontRef);
     RetainPtr<CFTypeRef> objectForEqualityCheck() const;
 
+    bool isSystemFont() const { return m_isSystemFont; }
+    bool hasCustomTracking() const { return isSystemFont(); }
+
 #if USE(APPKIT)
     // FIXME: Remove this when all NSFont usage is removed.
     NSFont *nsFont() const { return (NSFont *)m_font.get(); }
@@ -182,6 +185,15 @@
         return m_isHashTableDeletedValue;
     }
 
+    bool isEmoji() const
+    {
+#if PLATFORM(IOS)
+        return m_isEmoji;
+#else
+        return false;
+#endif
+    }
+
 #if PLATFORM(COCOA) || PLATFORM(WIN)
     PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
 #endif
@@ -227,10 +239,10 @@
 
     bool m_isColorBitmapFont { false };
     bool m_isHashTableDeletedValue { false };
+    bool m_isSystemFont { false };
 #if PLATFORM(IOS)
     bool m_isEmoji { false };
 #endif
-
 #if PLATFORM(WIN)
     bool m_useGDI { false };
 #endif

Modified: trunk/Source/WebCore/platform/graphics/GlyphPage.h (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/GlyphPage.h	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/GlyphPage.h	2015-12-01 19:24:52 UTC (rev 192895)
@@ -111,7 +111,7 @@
     }
 
     // Implemented by the platform.
-    bool fill(UChar* characterBuffer, unsigned bufferLength, const Font*);
+    bool fill(UChar* characterBuffer, unsigned bufferLength);
 
 private:
     explicit GlyphPage(const Font& font)

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2015-12-01 19:24:52 UTC (rev 192895)
@@ -154,8 +154,6 @@
         LOG_ERROR("failed to set up font, using system font %s", m_platformData.font());
     }
 
-    m_isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(m_platformData.font())).get());
-
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100
     // Work around <rdar://problem/19433490>
     CGGlyph dummyGlyphs[] = {0, 0};
@@ -232,7 +230,6 @@
 
 #else
 
-    m_isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(m_platformData.font())).get());
     m_syntheticBoldOffset = m_platformData.m_syntheticBold ? ceilf(m_platformData.size()  / 24.0f) : 0.f;
 
     CTFontRef ctFont = m_platformData.font();
@@ -413,30 +410,27 @@
 #endif
 }
 
-static inline bool advanceForColorBitmapFont(const FontPlatformData& platformData, Glyph glyph, CGSize& advance)
+static inline Optional<CGSize> advanceForColorBitmapFont(const FontPlatformData& platformData, Glyph glyph)
 {
 #if PLATFORM(MAC)
     NSFont *font = platformData.nsFont();
     if (!font || !platformData.isColorBitmapFont())
-        return false;
-    advance = NSSizeToCGSize([font advancementForGlyph:glyph]);
-    return true;
+        return Nullopt;
+    return NSSizeToCGSize([font advancementForGlyph:glyph]);
 #else
     UNUSED_PARAM(platformData);
     UNUSED_PARAM(glyph);
-    UNUSED_PARAM(advance);
-    return false;
+    return Nullopt;
 #endif
 }
 
-static inline bool canUseFastGlyphAdvanceGetter(const Font& font, Glyph glyph, CGSize& advance, bool& populatedAdvance)
+static inline bool canUseFastGlyphAdvanceGetter(const FontPlatformData& platformData, Glyph glyph, CGSize& advance, bool& populatedAdvance)
 {
-    const FontPlatformData& platformData = font.platformData();
-    // Fast getter doesn't doesn't work for emoji, bitmap fonts, or take custom tracking into account
-    if (font.hasCustomTracking() || platformData.textRenderingMode() == OptimizeLegibility)
+    if (platformData.isEmoji() || platformData.hasCustomTracking() || platformData.textRenderingMode() == OptimizeLegibility)
         return false;
-    if (advanceForColorBitmapFont(platformData, glyph, advance)) {
+    if (auto size = advanceForColorBitmapFont(platformData, glyph)) {
         populatedAdvance = true;
+        advance = size.value();
         return false;
     }
     return true;
@@ -447,7 +441,7 @@
     CGSize advance = CGSizeZero;
     bool horizontal = platformData().orientation() == Horizontal;
     bool populatedAdvance = false;
-    if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(*this, glyph, advance, populatedAdvance)) {
+    if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(this->platformData(), glyph, advance, populatedAdvance)) {
         float pointSize = platformData().m_size;
         CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
         if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, renderingStyle(platformData()), &glyph, 1, &advance)) {

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2015-12-01 19:24:52 UTC (rev 192895)
@@ -47,6 +47,11 @@
     ASSERT_ARG(font, font);
     m_font = font;
     m_isColorBitmapFont = CTFontGetSymbolicTraits(font) & kCTFontTraitColorGlyphs;
+    m_isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(m_font.get())).get());
+
+#if PLATFORM(IOS)
+    m_isEmoji = CTFontIsAppleColorEmoji(m_font.get());
+#endif
 }
 
 FontPlatformData::~FontPlatformData()
@@ -59,6 +64,10 @@
 
     m_cgFont = f.m_cgFont;
     m_ctFont = f.m_ctFont;
+
+#if PLATFORM(IOS)
+    m_isEmoji = f.m_isEmoji;
+#endif
 }
 
 const FontPlatformData& FontPlatformData::platformDataAssign(const FontPlatformData& f)
@@ -69,6 +78,10 @@
     m_font = f.m_font;
     m_ctFont = f.m_ctFont;
 
+#if PLATFORM(IOS)
+    m_isEmoji = f.m_isEmoji;
+#endif
+
     return *this;
 }
 
@@ -108,6 +121,11 @@
 
     CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(m_font.get());
     m_isColorBitmapFont = traits & kCTFontTraitColorGlyphs;
+    m_isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(m_font.get())).get());
+
+#if PLATFORM(IOS)
+    m_isEmoji = CTFontIsAppleColorEmoji(m_font.get());
+#endif
     
     m_ctFont = nullptr;
 }

Modified: trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -39,9 +39,10 @@
 
 namespace WebCore {
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData)
+bool GlyphPage::fill(UChar* buffer, unsigned bufferLength)
 {
-    cairo_scaled_font_t* scaledFont = fontData->platformData().scaledFont();
+    const Font& font = this->font();
+    cairo_scaled_font_t* scaledFont = font.platformData().scaledFont();
     ASSERT(scaledFont);
 
     FT_Face face = cairo_ft_scaled_font_lock_face(scaledFont);

Modified: trunk/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -40,14 +40,14 @@
 
 namespace WebCore {
 
-static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const Font* fontData)
+static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const Font& fontData)
 {
     // This needs to be kept in sync with GlyphPage::fill(). Currently, the CoreText paths are not able to handle
     // every situtation. Returning true from this function in a new situation will require you to explicitly add
     // handling for that situation in the CoreText paths of GlyphPage::fill().
-    if (fontData->isSystemFont())
+    if (fontData.platformData().isSystemFont())
         return true;
-    if (fontData->platformData().isForTextCombine() || fontData->hasVerticalGlyphs()) {
+    if (fontData.platformData().isForTextCombine() || fontData.hasVerticalGlyphs()) {
         // Ideographs don't have a vertical variant or width variants.
         for (unsigned i = 0; i < bufferLength; ++i) {
             if (!FontCascade::isCJKIdeograph(buffer[i]))
@@ -58,27 +58,27 @@
     return false;
 }
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData)
+bool GlyphPage::fill(UChar* buffer, unsigned bufferLength)
 {
-    ASSERT(fontData == &font());
     ASSERT(bufferLength == GlyphPage::size || bufferLength == 2 * GlyphPage::size);
 
+    const Font& font = this->font();
     Vector<CGGlyph, 512> glyphs(bufferLength);
     unsigned glyphStep;
-    if (!shouldUseCoreText(buffer, bufferLength, fontData)) {
+    if (!shouldUseCoreText(buffer, bufferLength, font)) {
         // We pass in either 256 or 512 UTF-16 characters: 256 for U+FFFF and less, 512 (double character surrogates)
         // for U+10000 and above. It is indeed possible to get back 512 glyphs back from the API, so the glyph buffer
         // we pass in must be 512. If we get back more than 256 glyphs though we'll ignore all the ones after 256,
         // this should not happen as the only time we pass in 512 characters is when they are surrogates.
-        CGFontGetGlyphsForUnichars(fontData->platformData().cgFont(), buffer, glyphs.data(), bufferLength);
+        CGFontGetGlyphsForUnichars(font.platformData().cgFont(), buffer, glyphs.data(), bufferLength);
         glyphStep = 1;
     } else {
         // Because we know the implementation of shouldUseCoreText(), if the font isn't for text combine and it isn't a system font,
         // we know it must have vertical glyphs.
-        if (fontData->platformData().isForTextCombine() || fontData->isSystemFont())
-            CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
+        if (font.platformData().isForTextCombine() || font.platformData().isSystemFont())
+            CTFontGetGlyphsForCharacters(font.platformData().ctFont(), buffer, glyphs.data(), bufferLength);
         else
-            CTFontGetVerticalGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength);
+            CTFontGetVerticalGlyphsForCharacters(font.platformData().ctFont(), buffer, glyphs.data(), bufferLength);
 
         // When buffer consists of surrogate pairs, CTFontGetVerticalGlyphsForCharacters and CTFontGetGlyphsForCharacters
         // place the glyphs at indices corresponding to the first character of each pair.

Modified: trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -178,7 +178,7 @@
     FloatSize translation = glyphBuffer.offsetAt(from);
 
     CGContextSetFontSize(cgContext, platformData.size());
-    wkSetCGContextFontRenderingStyle(cgContext, font.isSystemFont(), false, font.platformData().useGDI());
+    wkSetCGContextFontRenderingStyle(cgContext, font.platformData().isSystemFont(), false, font.platformData().useGDI());
 
     FloatSize shadowOffset;
     float shadowBlur;

Modified: trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -34,16 +34,17 @@
 
 namespace WebCore {
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData)
+bool GlyphPage::fill(UChar* buffer, unsigned bufferLength)
 {
     // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs.
     // We won't support this for now.
     if (bufferLength > GlyphPage::size)
         return false;
 
+    const Font& font = this->font();
     bool haveGlyphs = false;
     CGGlyph localGlyphBuffer[GlyphPage::size];
-    wkGetGlyphs(fontData->platformData().cgFont(), buffer, localGlyphBuffer, bufferLength);
+    wkGetGlyphs(font.platformData().cgFont(), buffer, localGlyphBuffer, bufferLength);
     for (unsigned i = 0; i < GlyphPage::size; i++) {
         Glyph glyph = localGlyphBuffer[i];
         if (!glyph)

Modified: trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -34,18 +34,19 @@
 
 namespace WebCore {
 
-bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData)
+bool GlyphPage::fill(UChar* buffer, unsigned bufferLength)
 {
     // bufferLength will be greater than the requested number of glyphs if the buffer contains surrogate pairs.
     // We won't support this for now.
     if (bufferLength > GlyphPage::size)
         return false;
 
+    const Font& font = this->font();
     bool haveGlyphs = false;
 
     HWndDC dc(0);
     SaveDC(dc);
-    SelectObject(dc, fontData->platformData().hfont());
+    SelectObject(dc, font.platformData().hfont());
 
     WORD localGlyphBuffer[GlyphPage::size * 2];
     DWORD result = GetGlyphIndices(dc, buffer, bufferLength, localGlyphBuffer, GGI_MARK_NONEXISTING_GLYPHS);

Modified: trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp (192894 => 192895)


--- trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2015-12-01 19:10:07 UTC (rev 192894)
+++ trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2015-12-01 19:24:52 UTC (rev 192895)
@@ -313,7 +313,7 @@
 
         // Match AppKit's rules for the integer vs. non-integer rendering modes.
         float roundedAdvance = roundf(advance);
-        if (!fontData->isSystemFont()) {
+        if (!fontData->platformData().isSystemFont()) {
             advance = roundedAdvance;
             offsetX = roundf(offsetX);
             offsetY = roundf(offsetY);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to