Changeset 180561 in webkit
- Timestamp:
- Feb 24, 2015, 8:46:18 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r180559 r180561 1 2015-02-24 Andreas Kling <akling@apple.com> 2 3 [Cocoa] Break internal reference cycle in WebCore::Font. 4 <https://webkit.org/b/141941> 5 <rdar://problem/19650570> 6 7 Reviewed by Antti Koivisto. 8 9 The Cocoa implementation of Font::platformCreateScaledFont() tried to be smart and use the FontCache. 10 This didn't work out well when scaling a 0pt Font, since scaling 0pt by any factor will return 0pt. 11 12 We'd have a 0pt font, scale it by 0.7 to get a small-caps variant, and then cache that small-caps 13 variant (really "this") in Font::m_derivedData->smallCaps. 14 15 Fix this by having Cocoa Font scaling do exactly what other platforms do: create a new Font every time. 16 This stops us from accumulating tons of abandoned Font objects over time. 17 18 * platform/graphics/Font.cpp: 19 (WebCore::Font::verticalRightOrientationFont): 20 (WebCore::Font::uprightOrientationFont): 21 (WebCore::Font::smallCapsFont): 22 (WebCore::Font::emphasisMarkFont): 23 (WebCore::Font::brokenIdeographFont): 24 (WebCore::Font::nonSyntheticItalicFont): Add assertions to guard against reference cycles inside a Font. 25 26 * platform/graphics/cocoa/FontCocoa.mm: 27 (WebCore::Font::platformCreateScaledFont): Always create a new Font when scaling an existing Font to a different size. 28 1 29 2015-02-24 Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr> 2 30 -
trunk/Source/WebCore/platform/graphics/Font.cpp
r180281 r180561 288 288 m_derivedFontData->verticalRightOrientation = create(verticalRightPlatformData, isCustomFont(), false, true); 289 289 } 290 ASSERT(m_derivedFontData->verticalRightOrientation != this); 290 291 return m_derivedFontData->verticalRightOrientation; 291 292 } … … 297 298 if (!m_derivedFontData->uprightOrientation) 298 299 m_derivedFontData->uprightOrientation = create(m_platformData, isCustomFont(), false, true); 300 ASSERT(m_derivedFontData->uprightOrientation != this); 299 301 return m_derivedFontData->uprightOrientation; 300 302 } … … 306 308 if (!m_derivedFontData->smallCaps) 307 309 m_derivedFontData->smallCaps = createScaledFont(fontDescription, smallCapsFontSizeMultiplier); 308 310 ASSERT(m_derivedFontData->smallCaps != this); 309 311 return m_derivedFontData->smallCaps; 310 312 } … … 316 318 if (!m_derivedFontData->emphasisMark) 317 319 m_derivedFontData->emphasisMark = createScaledFont(fontDescription, emphasisMarkFontSizeMultiplier); 318 320 ASSERT(m_derivedFontData->emphasisMark != this); 319 321 return m_derivedFontData->emphasisMark; 320 322 } … … 328 330 m_derivedFontData->brokenIdeograph->m_isBrokenIdeographFallback = true; 329 331 } 332 ASSERT(m_derivedFontData->brokenIdeograph != this); 330 333 return m_derivedFontData->brokenIdeograph; 331 334 } … … 342 345 m_derivedFontData->nonSyntheticItalic = create(nonSyntheticItalicFontPlatformData, isCustomFont()); 343 346 } 347 ASSERT(m_derivedFontData->nonSyntheticItalic != this); 344 348 return m_derivedFontData->nonSyntheticItalic; 345 349 } -
trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
r180281 r180561 340 340 scaledFontData.m_syntheticOblique = (fontTraits & NSItalicFontMask) && !(scaledFontTraits & NSItalicFontMask); 341 341 342 return Font Cache::singleton().fontForPlatformData(scaledFontData);342 return Font::create(scaledFontData); 343 343 } 344 344 END_BLOCK_OBJC_EXCEPTIONS; … … 361 361 scaledFontData.m_syntheticOblique = (fontTraits & kCTFontItalicTrait) && !(scaledFontTraits & kCTFontTraitItalic); 362 362 363 return Font Cache::singleton().fontForPlatformData(scaledFontData);363 return Font::create(scaledFontData); 364 364 } 365 365
Note:
See TracChangeset
for help on using the changeset viewer.