Changeset 102858 in webkit


Ignore:
Timestamp:
Dec 14, 2011 5:38:59 PM (12 years ago)
Author:
kbr@google.com
Message:

Unreviewed, rolling out r102816.
http://trac.webkit.org/changeset/102816
https://bugs.webkit.org/show_bug.cgi?id=74415

Implicated in font-related crashes on Chromium canaries.

  • platform/graphics/chromium/FontChromiumWin.cpp:

(WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::drawGlyphs):
(WebCore::Font::drawGlyphs):

  • platform/graphics/chromium/FontPlatformDataChromiumWin.cpp:

(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::operator=):
(WebCore::FontPlatformData::~FontPlatformData):

  • platform/graphics/chromium/FontPlatformDataChromiumWin.h:

(WebCore::FontPlatformData::size):
(WebCore::FontPlatformData::hash):

  • platform/graphics/skia/SkiaFontWin.cpp:

(WebCore::setupPaintForFont):
(WebCore::paintSkiaText):

  • platform/graphics/skia/SkiaFontWin.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102855 r102858  
     12011-12-14  Kenneth Russell  <kbr@google.com>
     2
     3        Unreviewed, rolling out r102816.
     4        http://trac.webkit.org/changeset/102816
     5        https://bugs.webkit.org/show_bug.cgi?id=74415
     6
     7        Implicated in font-related crashes on Chromium canaries.
     8
     9        * platform/graphics/chromium/FontChromiumWin.cpp:
     10        (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::drawGlyphs):
     11        (WebCore::Font::drawGlyphs):
     12        * platform/graphics/chromium/FontPlatformDataChromiumWin.cpp:
     13        (WebCore::FontPlatformData::FontPlatformData):
     14        (WebCore::FontPlatformData::operator=):
     15        (WebCore::FontPlatformData::~FontPlatformData):
     16        * platform/graphics/chromium/FontPlatformDataChromiumWin.h:
     17        (WebCore::FontPlatformData::size):
     18        (WebCore::FontPlatformData::hash):
     19        * platform/graphics/skia/SkiaFontWin.cpp:
     20        (WebCore::setupPaintForFont):
     21        (WebCore::paintSkiaText):
     22        * platform/graphics/skia/SkiaFontWin.h:
     23
    1242011-12-14  Simon Fraser  <simon.fraser@apple.com>
    225
  • trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp

    r102816 r102858  
    266266        SkPoint origin = m_point;
    267267        origin.fX += SkFloatToScalar(startAdvance);
    268         paintSkiaText(m_graphicsContext, m_font->platformData(),
     268        paintSkiaText(m_graphicsContext, m_font->platformData().hfont(),
    269269                      numGlyphs, glyphs, advances, 0, &origin);
    270270        return true;
     
    394394    if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStroke && !graphicsContext->hasShadow())
    395395        return;
     396
     397    HFONT hfont = font->platformData().hfont();
    396398
    397399    // We draw the glyphs in chunks to avoid having to do a heap allocation for
     
    435437        SkPoint origin = point;
    436438        origin.fX += SkFloatToScalar(horizontalOffset - point.x() - currentWidth);
    437         paintSkiaText(graphicsContext, font->platformData(), curLen, &glyphs[0], &advances[0], 0, &origin);
     439        paintSkiaText(graphicsContext, hfont, curLen, &glyphs[0], &advances[0], 0, &origin);
    438440    }
    439441}
  • trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp

    r102816 r102858  
    3838
    3939#include "PlatformSupport.h"
    40 #include "SkTypeface_win.h"
    4140#include "SkiaFontWin.h"
    4241#include "StdLibExtras.h"
    4342
    4443namespace WebCore {
    45 
    46 static SkTypeface* createTypefaceFromHFont(HFONT hfont, uint8_t* lfQuality)
    47 {
    48     LOGFONT info;
    49     GetObject(hfont, sizeof(info), &info);
    50     *lfQuality = info.lfQuality;
    51     return SkCreateTypefaceFromLOGFONT(info);
    52 }
    5344
    5445FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType)
     
    5748    , m_scriptCache(0)
    5849    , m_scriptFontProperties(0)
    59     , m_typeface(0)
    60     , m_lfQuality(DEFAULT_QUALITY)
    6150{
    6251}
     
    6756    , m_scriptCache(0)
    6857    , m_scriptFontProperties(0)
    69     , m_typeface(0)
    70     , m_lfQuality(DEFAULT_QUALITY)
    7158{
    7259}
     
    7764    , m_scriptCache(0)
    7865    , m_scriptFontProperties(0)
    79     , m_typeface(createTypefaceFromHFont(font, &m_lfQuality))
    8066{
    8167}
     
    8773    , m_scriptCache(0)
    8874    , m_scriptFontProperties(0)
    89     , m_typeface(0)
    90     , m_lfQuality(DEFAULT_QUALITY)
    9175{
    9276}
     
    9781    , m_scriptCache(0)
    9882    , m_scriptFontProperties(0)
    99     , m_typeface(data.m_typeface)
    100     , m_lfQuality(data.m_lfQuality)
    10183{
    102     SkSafeRef(m_typeface);
    10384}
    10485
     
    10889        m_font = data.m_font;
    10990        m_size = data.m_size;
    110         SkRefCnt_SafeAssign(m_typeface, data.m_typeface);
    111         m_lfQuality = data.m_lfQuality;
    11291
    11392        // The following fields will get re-computed if necessary.
     
    123102FontPlatformData::~FontPlatformData()
    124103{
    125     SkSafeUnref(m_typeface);
    126 
    127104    ScriptFreeCache(&m_scriptCache);
    128105    m_scriptCache = 0;
  • trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h

    r102816 r102858  
    3636
    3737#include "FontOrientation.h"
    38 #include "SkTypeface.h"
    3938#include <wtf/Forward.h>
    4039#include <wtf/PassRefPtr.h>
     
    7170    HFONT hfont() const { return m_font ? m_font->hfont() : 0; }
    7271    float size() const { return m_size; }
    73     SkTypeface* typeface() const { return m_typeface; }
    74     uint8_t lfQuality() const { return m_lfQuality; }
    7572
    7673    FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
     
    7875
    7976    unsigned hash() const
    80     {
     77    { 
    8178        return m_font ? m_font->hash() : NULL;
    8279    }
     
    133130    float m_size;  // Point size of the font in pixels.
    134131
    135     SkTypeface* m_typeface; // cached from m_font
    136     uint8_t m_lfQuality; // cached from m_font
    137 
    138132    mutable SCRIPT_CACHE m_scriptCache;
    139133    mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties;
  • trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp

    r102816 r102858  
    3333
    3434#include "AffineTransform.h"
     35#include "PlatformContextSkia.h"
     36#include "PlatformSupport.h"
    3537#include "Gradient.h"
    3638#include "Pattern.h"
    37 #include "PlatformContextSkia.h"
    38 #include "PlatformSupport.h"
    39 #include "SimpleFontData.h"
    4039#include "SkCanvas.h"
    4140#include "SkDevice.h"
     
    4342#include "SkShader.h"
    4443#include "SkTemplates.h"
     44#include "SkTypeface_win.h"
    4545
    4646namespace WebCore {
     
    180180}
    181181
    182 static void setupPaintForFont(SkPaint* paint, const FontPlatformData& font, PlatformContextSkia* pcs)
    183 {
    184     paint->setTextSize(SkFloatToScalar(font.size()));
    185     paint->setTypeface(font.typeface());
     182static void setupPaintForFont(HFONT hfont, SkPaint* paint, PlatformContextSkia* pcs)
     183{
     184    //  FIXME:
     185    //  Much of this logic could also happen in
     186    //  FontCustomPlatformData::fontPlatformData and be cached,
     187    //  allowing us to avoid talking to GDI at this point.
     188    //
     189    LOGFONT info;
     190    GetObject(hfont, sizeof(info), &info);
     191    int size = info.lfHeight;
     192    if (size < 0)
     193        size = -size; // We don't let GDI dpi-scale us (see SkFontHost_win.cpp).
     194    paint->setTextSize(SkIntToScalar(size));
     195
     196    SkTypeface* face = SkCreateTypefaceFromLOGFONT(info);
     197    paint->setTypeface(face);
     198    SkSafeUnref(face);
    186199
    187200    // turn lfQuality into text flags
    188201    uint32_t textFlags;
    189     switch (font.lfQuality()) {
     202    switch (info.lfQuality) {
    190203    case NONANTIALIASED_QUALITY:
    191204        textFlags = 0;
     
    216229
    217230void paintSkiaText(GraphicsContext* context,
    218                    const FontPlatformData& font,
     231                   HFONT hfont,
    219232                   int numGlyphs,
    220233                   const WORD* glyphs,
     
    228241    // Ensure font load for printing, because PDF device needs it.
    229242    if (canvas->getTopDevice()->getDeviceCapabilities() & SkDevice::kVector_Capability)
    230         PlatformSupport::ensureFontLoaded(font.hfont());
     243        PlatformSupport::ensureFontLoaded(hfont);
    231244
    232245    // Filling (if necessary). This is the common case.
     
    234247    platformContext->setupPaintForFilling(&paint);
    235248    paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
    236     setupPaintForFont(&paint, font, platformContext);
     249    setupPaintForFont(hfont, &paint, platformContext);
    237250
    238251    bool didFill = false;
     
    251264        platformContext->setupPaintForStroking(&paint, 0, 0);
    252265        paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
    253         setupPaintForFont(&paint, font, platformContext);
     266        setupPaintForFont(hfont, &paint, platformContext);
    254267
    255268        if (didFill) {
     
    270283}
    271284
    272 void paintSkiaText(GraphicsContext* context,
    273                    HFONT hfont,
    274                    int numGlyphs,
    275                    const WORD* glyphs,
    276                    const int* advances,
    277                    const GOFFSET* offsets,
    278                    const SkPoint* origin)
    279 {
    280     LOGFONT info;
    281     GetObject(hfont, sizeof(info), &info);
    282     float size = info.lfHeight;
    283     if (size < 0)
    284         size = -size;
    285 
    286     FontPlatformData font(hfont, size);
    287     paintSkiaText(context, font, numGlyphs, glyphs, advances, offsets, origin);
    288 }
    289 
    290285}  // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.h

    r102816 r102858  
    3939namespace WebCore {
    4040
    41 class FontPlatformData;
    4241class GraphicsContext;
    4342class PlatformContextSkia;
     
    7473// per glyph offset (such as returned by ScriptPlace Windows API function).
    7574void paintSkiaText(GraphicsContext*,
    76                    const FontPlatformData&,
    77                    int numGlyphs,
    78                    const WORD* glyphs,
    79                    const int* advances,
    80                    const GOFFSET* offsets,
    81                    const SkPoint* origin);
    82 
    83 // Convenience call for clients that don't cache the typeface or size
    84 void paintSkiaText(GraphicsContext*,
    8575                   HFONT,
    8676                   int numGlyphs,
Note: See TracChangeset for help on using the changeset viewer.