Bug 230913 - Allow `DrawGlyphsRecorder` to be used with any `GraphicsContext` instead of just `DisplayList::Recorder`
Summary: Allow `DrawGlyphsRecorder` to be used with any `GraphicsContext` instead of j...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on: 230912
Blocks: 230781
  Show dependency treegraph
 
Reported: 2021-09-28 14:02 PDT by Devin Rousso
Modified: 2021-09-29 16:05 PDT (History)
4 users (show)

See Also:


Attachments
Patch (14.67 KB, patch)
2021-09-28 15:19 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (15.22 KB, patch)
2021-09-28 16:32 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (15.22 KB, patch)
2021-09-29 14:52 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2021-09-28 14:02:34 PDT
there's really nothing about `DrawGlyphsRecorder` that's specific to display lists other than it only being used by `DisplayList::Recorder`
Comment 1 Devin Rousso 2021-09-28 15:19:40 PDT
Created attachment 439530 [details]
Patch
Comment 2 Myles C. Maxfield 2021-09-28 15:23:35 PDT
Comment on attachment 439530 [details]
Patch

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

> Source/WebCore/platform/graphics/GraphicsContext.h:358
> +    virtual const GraphicsContextState& lastStateChange() const { return state(); }

Still don't like the word "change"

> Source/WebCore/platform/graphics/GraphicsContext.h:477
> +        drawGlyphs(font, glyphs, advances, numGlyphs, point, fontSmoothingMode);

If all the arguments are identical, why doesn't DrawGlyphsRecorder just call drawGlyphs() instead of this renamed function?

> Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:153
> +const GraphicsContextState& Recorder::lastStateChange() const

ditto

> Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h:97
> +    const GraphicsContextState& lastStateChange() const final;

ditto.
Comment 3 Devin Rousso 2021-09-28 15:34:32 PDT
Comment on attachment 439530 [details]
Patch

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

>> Source/WebCore/platform/graphics/GraphicsContext.h:358
>> +    virtual const GraphicsContextState& lastStateChange() const { return state(); }
> 
> Still don't like the word "change"

Do you have any suggestions as to a different name?

Alternatively, do you know why `m_owner.currentState().stateChange.m_state` was written the way it was originally?  Perhaps if I understand that then I can come up with a better name :)

>> Source/WebCore/platform/graphics/GraphicsContext.h:477
>> +        drawGlyphs(font, glyphs, advances, numGlyphs, point, fontSmoothingMode);
> 
> If all the arguments are identical, why doesn't DrawGlyphsRecorder just call drawGlyphs() instead of this renamed function?

`drawGlyphs` is what calls into `DrawGlyphsRecorder`, which then calls into `drawGlyphsAndCacheFont` (which `DisplayList::Recorder` overrides to append a `DrawGlyphs` display list item)

Also FWIW this code already existed before.  I just moved it from being only on `DisplayList::Recorder` to also being on `GraphicsContext`.  Currently the only caller of `DrawGlyphsRecorder::drawGlyphs` is `DisplayList::Recorder::drawGlyphs`, meaning that we need some other method that `DrawGlyphsRecorder` can call once it's done its work to pass it back to the `DisplayList::Recorder`.  I'm open to other naming ideas if you have any suggestions :)
Comment 4 Devin Rousso 2021-09-28 16:32:47 PDT
Created attachment 439542 [details]
Patch
Comment 5 Wenson Hsieh 2021-09-28 17:14:52 PDT
Comment on attachment 439542 [details]
Patch

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

> Source/WebCore/ChangeLog:41
> +        for the `state` "getter" so that `DrawGlypsRecorder` is able to access the current state in

Nit - DrawGlypsRecorder
Comment 6 Devin Rousso 2021-09-29 14:52:02 PDT
Created attachment 439664 [details]
Patch

fix typo in ChangeLog
Comment 7 EWS 2021-09-29 16:04:59 PDT
Committed r283273 (242302@main): <https://commits.webkit.org/242302@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 439664 [details].
Comment 8 Radar WebKit Bug Importer 2021-09-29 16:05:27 PDT
<rdar://problem/83693148>