Changeset 147859 in webkit


Ignore:
Timestamp:
Apr 6, 2013 4:19:08 PM (11 years ago)
Author:
benjamin@webkit.org
Message:

Remove the Chromium code from Mac's FontPlatformData
https://bugs.webkit.org/show_bug.cgi?id=114103

Reviewed by Sam Weinig.

  • platform/graphics/FontPlatformData.h:

(WebCore):
(FontPlatformData):

  • platform/graphics/cocoa/FontPlatformDataCocoa.mm:

(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::platformDataInit):
(WebCore::FontPlatformData::platformDataAssign):
(WebCore::FontPlatformData::setFont):
(WebCore::FontPlatformData::ctFont):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147858 r147859  
     12013-04-06  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        Remove the Chromium code from Mac's FontPlatformData
     4        https://bugs.webkit.org/show_bug.cgi?id=114103
     5
     6        Reviewed by Sam Weinig.
     7
     8        * platform/graphics/FontPlatformData.h:
     9        (WebCore):
     10        (FontPlatformData):
     11        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
     12        (WebCore::FontPlatformData::FontPlatformData):
     13        (WebCore::FontPlatformData::platformDataInit):
     14        (WebCore::FontPlatformData::platformDataAssign):
     15        (WebCore::FontPlatformData::setFont):
     16        (WebCore::FontPlatformData::ctFont):
     17
    1182013-04-06  Oliver Hunt  <oliver@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/FontPlatformData.h

    r147855 r147859  
    6464#include <wtf/text/StringImpl.h>
    6565
    66 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    67 #include "CrossProcessFontLoading.h" 
    68 #endif
    69 
    7066#if PLATFORM(WIN)
    7167typedef struct HFONT__* HFONT;
     
    8682class FontDescription;
    8783class SharedBuffer;
    88 
    89 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    90 class HarfBuzzFace;
    91 #endif
    9284
    9385#if OS(DARWIN)
     
    159151#if USE(CAIRO)
    160152    cairo_scaled_font_t* scaledFont() const { return m_scaledFont; }
    161 #endif
    162 
    163 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    164     HarfBuzzFace* harfBuzzFace();
    165153#endif
    166154
     
    222210#if OS(DARWIN)
    223211    // Load various data about the font specified by |nsFont| with the size fontSize into the following output paramters:
    224     // Note: Callers should always take into account that for the Chromium port, |outNSFont| isn't necessarily the same
    225     // font as |nsFont|. This because the sandbox may block loading of the original font.
    226     // * outNSFont - The font that was actually loaded, for the Chromium port this may be different than nsFont.
    227     // The caller is responsible for calling CFRelease() on this parameter when done with it.
    228     // * cgFont - CGFontRef representing the input font at the specified point size.
    229212    void loadFont(NSFont*, float fontSize, NSFont*& outNSFont, CGFontRef&);
    230213    static NSFont* hashTableDeletedFontValue() { return reinterpret_cast<NSFont *>(-1); }
     
    264247#endif
    265248
    266 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    267     RefPtr<MemoryActivatedFont> m_inMemoryFont;
    268     RefPtr<HarfBuzzFace> m_harfBuzzFace;
    269 #endif
    270 
    271249    bool m_isColorBitmapFont;
    272250    bool m_isCompositeFontReference;
  • trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm

    r147710 r147859  
    2828#import <AppKit/NSFont.h>
    2929#import <wtf/text/WTFString.h>
    30 
    31 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    32 #import "HarfBuzzFace.h"
    33 #endif
    3430
    3531namespace WebCore {
     
    6359   
    6460#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    65     // FIXME: Chromium: The following code isn't correct for the Chromium port since the sandbox might
    66     // have blocked font loading, in which case we'll only have the real loaded font file after the call to loadFont().
    6761    {
    6862        CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font));
     
    9286    m_cgFont = f.m_cgFont;
    9387    m_CTFont = f.m_CTFont;
    94 
    95 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    96     m_inMemoryFont = f.m_inMemoryFont;
    97     m_harfBuzzFace = f.m_harfBuzzFace;
    98 #endif
    9988}
    10089
     
    11099    m_font = f.m_font;
    111100    m_CTFont = f.m_CTFont;
    112 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    113     m_inMemoryFont = f.m_inMemoryFont;
    114     m_harfBuzzFace = f.m_harfBuzzFace;
    115 #endif
    116101    return *this;
    117102}
     
    141126    NSFont* loadedFont = 0;
    142127    loadFont(m_font, m_size, loadedFont, cgFont);
    143    
    144 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    145     // If loadFont replaced m_font with a fallback font, then release the
    146     // previous font to counter the retain above. Then retain the new font.
    147     if (loadedFont != m_font) {
    148         CFRelease(m_font);
    149         CFRetain(loadedFont);
    150         m_font = loadedFont;
    151     }
    152 #endif
    153    
     128
    154129    m_cgFont.adoptCF(cgFont);
    155130#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
     
    247222    if (m_CTFont)
    248223        return m_CTFont.get();
    249 
    250 #if PLATFORM(CHROMIUM)
    251     if (m_inMemoryFont) {
    252         m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_inMemoryFont->cgFont(), m_size, 0, cascadeToLastResortFontDescriptor()));
    253         return m_CTFont.get();
    254     }
    255 #endif
    256224
    257225    m_CTFont = toCTFontRef(m_font);
     
    284252}
    285253
    286 #if PLATFORM(CHROMIUM) && OS(DARWIN)
    287 static bool isAATFont(CTFontRef ctFont)
    288 {
    289     CFDataRef table = CTFontCopyTable(ctFont, kCTFontTableMort, 0);
    290     if (table) {
    291         CFRelease(table);
    292         return true;
    293     }
    294     table = CTFontCopyTable(ctFont, kCTFontTableMorx, 0);
    295     if (table) {
    296         CFRelease(table);
    297         return true;
    298     }
    299     return false;
    300 }
    301 
    302 HarfBuzzFace* FontPlatformData::harfBuzzFace()
    303 {
    304     CTFontRef font = ctFont();
    305     // HarfBuzz can't handle AAT font
    306     if (isAATFont(font))
    307         return 0;
    308 
    309     if (!m_harfBuzzFace) {
    310         uint64_t uniqueID = reinterpret_cast<uintptr_t>(font);
    311         m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this), uniqueID);
    312     }
    313     return m_harfBuzzFace.get();
    314 }
    315 #endif
    316 
    317254#ifndef NDEBUG
    318255String FontPlatformData::description() const
Note: See TracChangeset for help on using the changeset viewer.