Changeset 281792 in webkit
- Timestamp:
- Aug 31, 2021, 12:18:14 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/text/draw-synthetic-system-bold-font-into-canvas-expected-mismatch.html (added)
-
LayoutTests/fast/text/draw-synthetic-system-bold-font-into-canvas.html (added)
-
LayoutTests/fast/text/system-fallback-canvas-expected.txt (added)
-
LayoutTests/fast/text/system-fallback-canvas.html (added)
-
Source/WebCore/PAL/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r281784 r281792 1 2021-08-31 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Drawing system fallback fonts to canvas causes a crash 4 https://bugs.webkit.org/show_bug.cgi?id=229633 5 <rdar://problem/81889036> 6 7 Reviewed by Wenson Hsieh. 8 9 * fast/text/system-fallback-canvas-expected.txt: Added. 10 * fast/text/system-fallback-canvas.html: Added. 11 1 12 2021-08-30 Megan Gardner <megan_gardner@apple.com> 2 13 -
trunk/Source/WebCore/PAL/ChangeLog
r281791 r281792 1 2021-08-31 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Drawing system fallback fonts to canvas causes a crash 4 https://bugs.webkit.org/show_bug.cgi?id=229633 5 <rdar://problem/81889036> 6 7 Reviewed by Wenson Hsieh. 8 9 * pal/spi/cf/CoreTextSPI.h: 10 1 11 2021-08-26 Darin Adler <darin@apple.com> 2 12 -
trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h
r278151 r281792 60 60 61 61 enum { 62 kCTFontOptionsSystemUIFont = 1 << 1, 63 }; 64 65 enum { 62 66 kCTRunStatusHasOrigins = (1 << 4), 63 67 }; … … 149 153 bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef); 150 154 bool CTFontIsSystemUIFont(CTFontRef); 155 CTFontRef CTFontCreateWithFontDescriptorAndOptions(CTFontDescriptorRef, CGFloat size, const CGAffineTransform*, CTFontOptions); 151 156 CTFontRef CTFontCreateForCSS(CFStringRef name, uint16_t weight, CTFontSymbolicTraits, CGFloat size); 152 157 CTFontRef CTFontCreateForCharactersWithLanguage(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFStringRef language, CFIndex *coveredLength); -
trunk/Source/WebKit/ChangeLog
r281791 r281792 1 2021-08-31 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Drawing system fallback fonts to canvas causes a crash 4 https://bugs.webkit.org/show_bug.cgi?id=229633 5 <rdar://problem/81889036> 6 7 Reviewed by Wenson Hsieh. 8 9 Dot-prefixed font names don't survive the round-trip through 10 CTFontDescriptorCopyAttributes(CTFontCopyFontDescriptor(font)) unless you also 11 pass in the kCTFontOptionsSystemUIFont option. 12 13 Tests: fast/text/system-fallback-canvas.html 14 fast/text/draw-synthetic-system-bold-font-into-canvas.html 15 16 * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: 17 (IPC::createCTFont): 18 (IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData): 19 1 20 2021-08-26 Darin Adler <darin@apple.com> 2 21 -
trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
r279750 r281792 502 502 } 503 503 504 static RetainPtr<CTFontRef> createCTFont(CFDictionaryRef attributes, float size, const String& referenceURL, const String& postScriptName) 505 { 506 if (auto name = static_cast<CFStringRef>(CFDictionaryGetValue(attributes, kCTFontNameAttribute))) { 507 if (CFStringHasPrefix(name, CFSTR("."))) { 508 auto fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes)); 509 if (!fontDescriptor) 510 return nullptr; 511 return adoptCF(CTFontCreateWithFontDescriptorAndOptions(fontDescriptor.get(), size, nullptr, kCTFontOptionsSystemUIFont)); 512 } 513 } 514 515 auto fontDescriptor = findFontDescriptor(referenceURL, postScriptName); 516 if (!fontDescriptor) 517 return nullptr; 518 fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor.get(), attributes)); 519 return adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr)); 520 } 521 504 522 std::optional<WebCore::FontPlatformData> ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData(Decoder& decoder) 505 523 { … … 581 599 return std::nullopt; 582 600 583 auto fontDescriptor = findFontDescriptor(*referenceURL, *postScriptName); 584 if (!fontDescriptor) 585 return std::nullopt; 586 fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor.get(), attributes->get())); 587 auto ctFont = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), *size, nullptr)); 601 auto ctFont = createCTFont(attributes->get(), *size, *referenceURL, *postScriptName); 602 if (!ctFont) 603 return std::nullopt; 588 604 589 605 return WebCore::FontPlatformData(ctFont.get(), *size, *syntheticBold, *syntheticOblique, *orientation, *widthVariant, *textRenderingMode);
Note:
See TracChangeset
for help on using the changeset viewer.