[Cocoa] Guarantee FontPlatformData's m_cgFont is never nullptr
Created attachment 277097 [details] Patch
Created attachment 277098 [details] WIP
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.
Created attachment 277118 [details] Patch
I should delete FontPlatformData::setFont()
Does not build?
Created attachment 277126 [details] Patch
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.
Created attachment 277304 [details] Patch for committing
Committed r200070: <http://trac.webkit.org/changeset/200070>