Bug 156929

Summary: [Cocoa] Guarantee FontPlatformData's m_cgFont is never nullptr
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
WIP
none
Patch
none
Patch
darin: review+
Patch for committing none

Myles C. Maxfield
Reported 2016-04-22 13:54:34 PDT
[Cocoa] Guarantee FontPlatformData's m_cgFont is never nullptr
Attachments
Patch (9.05 KB, patch)
2016-04-22 13:54 PDT, Myles C. Maxfield
no flags
WIP (13.26 KB, patch)
2016-04-22 14:00 PDT, Myles C. Maxfield
no flags
Patch (17.86 KB, patch)
2016-04-22 17:07 PDT, Myles C. Maxfield
no flags
Patch (19.30 KB, patch)
2016-04-22 18:33 PDT, Myles C. Maxfield
darin: review+
Patch for committing (19.76 KB, patch)
2016-04-25 19:05 PDT, Myles C. Maxfield
no flags
Myles C. Maxfield
Comment 1 2016-04-22 13:54:59 PDT
Myles C. Maxfield
Comment 2 2016-04-22 14:00:21 PDT
WebKit Commit Bot
Comment 3 2016-04-22 14:05:48 PDT
Attachment 277098 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 4 2016-04-22 17:07:43 PDT
Myles C. Maxfield
Comment 5 2016-04-22 17:39:19 PDT
I should delete FontPlatformData::setFont()
Chris Dumez
Comment 6 2016-04-22 18:20:54 PDT
Does not build?
Myles C. Maxfield
Comment 7 2016-04-22 18:33:17 PDT
Darin Adler
Comment 8 2016-04-23 16:52:48 PDT
Comment on attachment 277126 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277126&action=review r=me if you fix the Windows build > Source/WebCore/platform/graphics/FontPlatformData.cpp:60 > m_cgFont = cgFont; Could we construct this instead of initializing it? > Source/WebCore/platform/graphics/FontPlatformData.h:-221 > -#if USE(CG) > - void setFallbackCGFont(); > -#endif Broke the Windows build, which is still trying to call this function. > Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:265 > - ASSERT(CFGetTypeID(runCTFont) == CTFontGetTypeID()); > + ASSERT(runCTFont && CFGetTypeID(runCTFont) == CTFontGetTypeID()); If you want to add an assertion about this not being null, then it should be a separate assertion; we don’t use &&. But also, CFGetTypeID is already a function that crashes when passed null; I don’t think we really need any change here. > Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp:44 > + ASSERT(font); Is this really guaranteed? > Source/WebCore/platform/mac/DragImageMac.mm:336 > + if (drawURLString && urlFont) { Doesn’t seem like we need this. > Source/WebCore/platform/mac/DragImageMac.mm:343 > + if (labelFont) { Doesn’t seem like we need this. > Source/WebKit/mac/Misc/WebStringTruncator.mm:65 > + if (!menuFont.get()) > + return nil; I don’t think we need this. No chance of getting nil for the menu font. Probably don’t need the assertion either, since fontFromNSFont asserts. > Source/WebKit/mac/Misc/WebStringTruncator.mm:73 > + if (!font) > + return nil; Returning @"" or returning the string without doing truncation would be better than returning nil. > Source/WebKit/mac/Misc/WebStringTruncator.mm:81 > + if (!font) > + return nil; Returning @"" or returning the string without doing truncation would be better than returning nil.
Myles C. Maxfield
Comment 9 2016-04-25 19:05:59 PDT
Created attachment 277304 [details] Patch for committing
Myles C. Maxfield
Comment 10 2016-04-25 20:53:08 PDT
Note You need to log in before you can comment on or make changes to this bug.