Changeset 83805 in webkit


Ignore:
Timestamp:
Apr 13, 2011 7:13:31 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-13 Cary Clark <caryclark@google.com>

Reviewed by Eric Seidel.

Allow CG Font support in Chrome Darwin build using Skia
https://bugs.webkit.org/show_bug.cgi?id=58321

This allows Chrome to use Skia to do WebKit rendering, while
using CoreGraphics for glyph creation and computing font metrics.
It relies on an undefined platform token, WTF_USE_SKIA_ON_MAC_CHROME.

No new tests needed, no functionality change.

  • loader/cache/CachedFont.cpp: Make CGFontRef functions and CG-specific font code available to Chrome builds on Darwin using Skia.
  • platform/graphics/FontPlatformData.h: Ditto. (WebCore::FontPlatformData::hash): Ditto.
  • platform/graphics/GlyphBuffer.h: Ditto. (WebCore::GlyphBuffer::advanceAt): Ditto. (WebCore::GlyphBuffer::add): Ditto. (WebCore::GlyphBuffer::expandLastAdvance): Ditto.
  • platform/graphics/SimpleFontData.h: Ditto.
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83804 r83805  
     12011-04-13  Cary Clark  <caryclark@google.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Allow CG Font support in Chrome Darwin build using Skia
     6        https://bugs.webkit.org/show_bug.cgi?id=58321
     7       
     8        This allows Chrome to use Skia to do WebKit rendering, while
     9        using CoreGraphics for glyph creation and computing font metrics.
     10        It relies on an undefined platform token, WTF_USE_SKIA_ON_MAC_CHROME.
     11
     12        No new tests needed, no functionality change.
     13
     14        * loader/cache/CachedFont.cpp: Make CGFontRef functions and
     15        CG-specific font code available to Chrome builds on Darwin using Skia.
     16        * platform/graphics/FontPlatformData.h: Ditto.
     17        (WebCore::FontPlatformData::hash): Ditto.
     18        * platform/graphics/GlyphBuffer.h: Ditto.
     19        (WebCore::GlyphBuffer::advanceAt): Ditto.
     20        (WebCore::GlyphBuffer::add): Ditto.
     21        (WebCore::GlyphBuffer::expandLastAdvance): Ditto.
     22        * platform/graphics/SimpleFontData.h: Ditto.
     23
    1242011-04-13  Alexis Menard  <alexis.menard@openbossa.org>
    225
  • trunk/Source/WebCore/loader/cache/CachedFont.cpp

    r80582 r83805  
    2828#include "CachedFont.h"
    2929
    30 #if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(WINDOWS) || OS(LINUX) || OS(FREEBSD))) || PLATFORM(HAIKU) || OS(WINCE) || PLATFORM(ANDROID) || PLATFORM(BREWMP)
     30// FIXME: This should really be a blacklist instead of a whitelist
     31#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(WINDOWS) || OS(LINUX) || OS(FREEBSD) || USE(SKIA_MAC_ON_CHROME))) || PLATFORM(HAIKU) || OS(WINCE) || PLATFORM(ANDROID) || PLATFORM(BREWMP)
    3132#define STORE_FONT_CUSTOM_PLATFORM_DATA
    3233#endif
  • trunk/Source/WebCore/platform/graphics/FontPlatformData.h

    r82314 r83805  
    8585#endif
    8686
    87 #if PLATFORM(CG)
     87#if PLATFORM(CG) || USE(SKIA_ON_MAC_CHROME)
    8888typedef struct CGFont* CGFontRef;
    8989#if OS(DARWIN)
     
    180180    FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal,
    181181                     TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth);
     182#if PLATFORM(CG) || USE(SKIA_ON_MAC_CHROME)
    182183    FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation,
    183184                     TextOrientation textOrientation, FontWidthVariant widthVariant)
     
    194195    }
    195196#endif
     197#endif
    196198#if PLATFORM(WIN)
    197199    FontPlatformData(HFONT, float size, bool syntheticBold, bool syntheticOblique, bool useGDI);
     
    214216#endif
    215217
    216 #if PLATFORM(CG)
     218#if PLATFORM(CG) || USE(SKIA_ON_MAC_CHROME)
    217219#if OS(DARWIN)
    218220#ifndef BUILDING_ON_TIGER
     
    251253        return m_font ? m_font->hash() : 0;
    252254#elif OS(DARWIN)
     255#if PLATFORM(CG) || USE(SKIA_ON_MAC_CHROME)
    253256        ASSERT(m_font || !m_cgFont);
     257#endif
    254258        uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, m_textOrientation << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique };
    255259        return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
     
    325329#endif
    326330
    327 #if PLATFORM(CG)
     331#if PLATFORM(CG) || USE(SKIA_ON_MAC_CHROME)
    328332#if PLATFORM(WIN)
    329333    RetainPtr<CGFontRef> m_cgFont;
  • trunk/Source/WebCore/platform/graphics/GlyphBuffer.h

    r76743 r83805  
    3535#include <wtf/Vector.h>
    3636
    37 #if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN))
     37#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) || USE(SKIA_ON_MAC_CHROME)
    3838#include <ApplicationServices/ApplicationServices.h>
    3939#endif
     
    5959// CG uses CGSize instead of FloatSize so that the result of advances()
    6060// can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm
    61 #if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN))
     61#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) || USE(SKIA_ON_MAC_CHROME)
    6262typedef CGSize GlyphBufferAdvance;
    6363#elif OS(WINCE)
     
    123123    float advanceAt(int index) const
    124124    {
    125 #if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN))
     125#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) || USE(SKIA_ON_MAC_CHROME)
    126126        return m_advances[index].width;
    127127#elif OS(WINCE)
     
    154154#endif
    155155
    156 #if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN))
     156#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) || USE(SKIA_ON_MAC_CHROME)
    157157        CGSize advance = { width, 0 };
    158158        m_advances.append(advance);
     
    193193        ASSERT(!isEmpty());
    194194        GlyphBufferAdvance& lastAdvance = m_advances.last();
    195 #if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN))
     195#if PLATFORM(CG) || (PLATFORM(WX) && OS(DARWIN)) || USE(SKIA_ON_MAC_CHROME)
    196196        lastAdvance.width += width;
    197197#elif OS(WINCE)
  • trunk/Source/WebCore/platform/graphics/SimpleFontData.h

    r80582 r83805  
    116116    float spaceWidth() const { return m_spaceWidth; }
    117117
    118 #if PLATFORM(CG) || PLATFORM(CAIRO) || PLATFORM(WX)
     118#if PLATFORM(CG) || PLATFORM(CAIRO) || PLATFORM(WX) || USE(SKIA_ON_MAC_CHROME)
    119119    float syntheticBoldOffset() const { return m_syntheticBoldOffset; }
    120120#endif
     
    253253    mutable OwnPtr<DerivedFontData> m_derivedFontData;
    254254
    255 #if PLATFORM(CG) || PLATFORM(CAIRO) || PLATFORM(WX)
     255#if PLATFORM(CG) || PLATFORM(CAIRO) || PLATFORM(WX) || USE(SKIA_ON_MAC_CHROME)
    256256    float m_syntheticBoldOffset;
    257257#endif
Note: See TracChangeset for help on using the changeset viewer.