Changeset 102858 in webkit
- Timestamp:
- Dec 14, 2011 5:38:59 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102855 r102858 1 2011-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 1 24 2011-12-14 Simon Fraser <simon.fraser@apple.com> 2 25 -
trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
r102816 r102858 266 266 SkPoint origin = m_point; 267 267 origin.fX += SkFloatToScalar(startAdvance); 268 paintSkiaText(m_graphicsContext, m_font->platformData() ,268 paintSkiaText(m_graphicsContext, m_font->platformData().hfont(), 269 269 numGlyphs, glyphs, advances, 0, &origin); 270 270 return true; … … 394 394 if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStroke && !graphicsContext->hasShadow()) 395 395 return; 396 397 HFONT hfont = font->platformData().hfont(); 396 398 397 399 // We draw the glyphs in chunks to avoid having to do a heap allocation for … … 435 437 SkPoint origin = point; 436 438 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); 438 440 } 439 441 } -
trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
r102816 r102858 38 38 39 39 #include "PlatformSupport.h" 40 #include "SkTypeface_win.h"41 40 #include "SkiaFontWin.h" 42 41 #include "StdLibExtras.h" 43 42 44 43 namespace 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 }53 44 54 45 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) … … 57 48 , m_scriptCache(0) 58 49 , m_scriptFontProperties(0) 59 , m_typeface(0)60 , m_lfQuality(DEFAULT_QUALITY)61 50 { 62 51 } … … 67 56 , m_scriptCache(0) 68 57 , m_scriptFontProperties(0) 69 , m_typeface(0)70 , m_lfQuality(DEFAULT_QUALITY)71 58 { 72 59 } … … 77 64 , m_scriptCache(0) 78 65 , m_scriptFontProperties(0) 79 , m_typeface(createTypefaceFromHFont(font, &m_lfQuality))80 66 { 81 67 } … … 87 73 , m_scriptCache(0) 88 74 , m_scriptFontProperties(0) 89 , m_typeface(0)90 , m_lfQuality(DEFAULT_QUALITY)91 75 { 92 76 } … … 97 81 , m_scriptCache(0) 98 82 , m_scriptFontProperties(0) 99 , m_typeface(data.m_typeface)100 , m_lfQuality(data.m_lfQuality)101 83 { 102 SkSafeRef(m_typeface);103 84 } 104 85 … … 108 89 m_font = data.m_font; 109 90 m_size = data.m_size; 110 SkRefCnt_SafeAssign(m_typeface, data.m_typeface);111 m_lfQuality = data.m_lfQuality;112 91 113 92 // The following fields will get re-computed if necessary. … … 123 102 FontPlatformData::~FontPlatformData() 124 103 { 125 SkSafeUnref(m_typeface);126 127 104 ScriptFreeCache(&m_scriptCache); 128 105 m_scriptCache = 0; -
trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h
r102816 r102858 36 36 37 37 #include "FontOrientation.h" 38 #include "SkTypeface.h"39 38 #include <wtf/Forward.h> 40 39 #include <wtf/PassRefPtr.h> … … 71 70 HFONT hfont() const { return m_font ? m_font->hfont() : 0; } 72 71 float size() const { return m_size; } 73 SkTypeface* typeface() const { return m_typeface; }74 uint8_t lfQuality() const { return m_lfQuality; }75 72 76 73 FontOrientation orientation() const { return Horizontal; } // FIXME: Implement. … … 78 75 79 76 unsigned hash() const 80 { 77 { 81 78 return m_font ? m_font->hash() : NULL; 82 79 } … … 133 130 float m_size; // Point size of the font in pixels. 134 131 135 SkTypeface* m_typeface; // cached from m_font136 uint8_t m_lfQuality; // cached from m_font137 138 132 mutable SCRIPT_CACHE m_scriptCache; 139 133 mutable SCRIPT_FONTPROPERTIES* m_scriptFontProperties; -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp
r102816 r102858 33 33 34 34 #include "AffineTransform.h" 35 #include "PlatformContextSkia.h" 36 #include "PlatformSupport.h" 35 37 #include "Gradient.h" 36 38 #include "Pattern.h" 37 #include "PlatformContextSkia.h"38 #include "PlatformSupport.h"39 #include "SimpleFontData.h"40 39 #include "SkCanvas.h" 41 40 #include "SkDevice.h" … … 43 42 #include "SkShader.h" 44 43 #include "SkTemplates.h" 44 #include "SkTypeface_win.h" 45 45 46 46 namespace WebCore { … … 180 180 } 181 181 182 static void setupPaintForFont(SkPaint* paint, const FontPlatformData& font, PlatformContextSkia* pcs) 183 { 184 paint->setTextSize(SkFloatToScalar(font.size())); 185 paint->setTypeface(font.typeface()); 182 static 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); 186 199 187 200 // turn lfQuality into text flags 188 201 uint32_t textFlags; 189 switch ( font.lfQuality()) {202 switch (info.lfQuality) { 190 203 case NONANTIALIASED_QUALITY: 191 204 textFlags = 0; … … 216 229 217 230 void paintSkiaText(GraphicsContext* context, 218 const FontPlatformData&font,231 HFONT hfont, 219 232 int numGlyphs, 220 233 const WORD* glyphs, … … 228 241 // Ensure font load for printing, because PDF device needs it. 229 242 if (canvas->getTopDevice()->getDeviceCapabilities() & SkDevice::kVector_Capability) 230 PlatformSupport::ensureFontLoaded( font.hfont());243 PlatformSupport::ensureFontLoaded(hfont); 231 244 232 245 // Filling (if necessary). This is the common case. … … 234 247 platformContext->setupPaintForFilling(&paint); 235 248 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 236 setupPaintForFont( &paint, font, platformContext);249 setupPaintForFont(hfont, &paint, platformContext); 237 250 238 251 bool didFill = false; … … 251 264 platformContext->setupPaintForStroking(&paint, 0, 0); 252 265 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 253 setupPaintForFont( &paint, font, platformContext);266 setupPaintForFont(hfont, &paint, platformContext); 254 267 255 268 if (didFill) { … … 270 283 } 271 284 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 290 285 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.h
r102816 r102858 39 39 namespace WebCore { 40 40 41 class FontPlatformData;42 41 class GraphicsContext; 43 42 class PlatformContextSkia; … … 74 73 // per glyph offset (such as returned by ScriptPlace Windows API function). 75 74 void 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 size84 void paintSkiaText(GraphicsContext*,85 75 HFONT, 86 76 int numGlyphs,
Note: See TracChangeset
for help on using the changeset viewer.