Bug 217749

Summary: [Cocoa] Don't change the text matrix multiple times inside FontCascade::drawGlyphs()
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, jonlee, sabouhallawa, sam, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 217506    
Attachments:
Description Flags
Patch simon.fraser: review+, ews-feeder: commit-queue-

Description Myles C. Maxfield 2020-10-15 00:23:28 PDT
[Cocoa] Don't change the text matrix multiple times inside FontCascade::drawGlyphs()
Comment 1 Myles C. Maxfield 2020-10-15 00:41:34 PDT
Created attachment 411415 [details]
Patch
Comment 2 Sam Weinig 2020-10-15 09:28:40 PDT
Comment on attachment 411415 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=411415&action=review

> Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:66
> +    static NeverDestroyed<AffineTransform> result(0, -1, 1, 0, 0, 0);

I don't think a NeverDestroyed should be needed here, as AffineTransform should have a trivial destructor. We should probably make constructions of AffineTransform constexpr (given it is built on std::array, this should be easy enough) so we can make this even moar const. (none of that is needed for this change, just writing this here to note it).

> Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:85
> +    CGPoint position = FloatPoint(point.x(), point.y() + ascentDelta);

Seems a bit weird to make a CGPoint this way. Any reason not to use CGPointMake directly?
Comment 3 Simon Fraser (smfr) 2020-10-15 09:59:35 PDT
Comment on attachment 411415 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=411415&action=review

> Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:144
> +    if (!platformData.isColorBitmapFont())

Why are color bitmap fonts special?
Comment 4 Myles C. Maxfield 2020-10-15 10:58:23 PDT
Comment on attachment 411415 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=411415&action=review

>> Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:144
>> +    if (!platformData.isColorBitmapFont())
> 
> Why are color bitmap fonts special?

I have no idea 😅 This branch is probably wrong, but this patch just moves the code around. I've filed https://bugs.webkit.org/show_bug.cgi?id=217767 to see if we can remove it.
Comment 5 Myles C. Maxfield 2020-10-15 10:59:48 PDT
Comment on attachment 411415 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=411415&action=review

> Source/WebCore/ChangeLog:18
> +        calls, we have now way of knowing whether it was modified by WebKit or

now way
Comment 6 Myles C. Maxfield 2020-10-15 16:51:14 PDT
Committed r268561: <https://trac.webkit.org/changeset/268561>
Comment 7 Radar WebKit Bug Importer 2020-10-15 16:52:20 PDT
<rdar://problem/70358054>