RESOLVED FIXED 240363
Simplify the usage of DrawGlyphsRecorder
https://bugs.webkit.org/show_bug.cgi?id=240363
Summary Simplify the usage of DrawGlyphsRecorder
Simon Fraser (smfr)
Reported 2022-05-12 16:33:00 PDT
Simplify the usage of DrawGlyphsRecorder
Attachments
Patch (18.03 KB, patch)
2022-05-12 16:36 PDT, Simon Fraser (smfr)
mmaxfield: review+
ews-feeder: commit-queue-
Patch (18.71 KB, patch)
2022-05-12 16:49 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Patch (18.51 KB, patch)
2022-05-12 17:11 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Patch (19.48 KB, patch)
2022-05-12 20:59 PDT, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2022-05-12 16:36:49 PDT
Simon Fraser (smfr)
Comment 2 2022-05-12 16:49:08 PDT
Myles C. Maxfield
Comment 3 2022-05-12 16:50:41 PDT
Comment on attachment 459258 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459258&action=review > Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:168 > + if (!m_drawGlyphsRecorder) > + m_drawGlyphsRecorder = makeUnique<DrawGlyphsRecorder>(*this, m_initialScale); I still think an "ensure" function would make this more readable. > Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h:50 > +enum class DeconstructDrawGlyphs : bool { No, Yes }; I generally like to put these things inside classes to not pollute the global namespace. This type is only meaningful inside the class anyway. > Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h:38 > - WEBCORE_EXPORT RecorderImpl(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, DrawGlyphsRecorder::DeconstructDrawGlyphs = DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes); > + WEBCORE_EXPORT RecorderImpl(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, DeconstructDrawGlyphs = DeconstructDrawGlyphs::No); Changing the default value is suspicious. Surely the default option should be the one which is more secure, right? > Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:53 > + ASSERT(deconstructDrawGlyphs == DisplayList::DeconstructDrawGlyphs::Yes); Why not just remove the parameter then?
Myles C. Maxfield
Comment 4 2022-05-12 16:51:30 PDT
Comment on attachment 459258 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459258&action=review >> Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h:50 >> +enum class DeconstructDrawGlyphs : bool { No, Yes }; > > I generally like to put these things inside classes to not pollute the global namespace. This type is only meaningful inside the class anyway. s/inside the class/within the context of the class/
Simon Fraser (smfr)
Comment 5 2022-05-12 17:04:21 PDT
(In reply to Myles C. Maxfield from comment #3) > Comment on attachment 459258 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=459258&action=review > > > Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:168 > > + if (!m_drawGlyphsRecorder) > > + m_drawGlyphsRecorder = makeUnique<DrawGlyphsRecorder>(*this, m_initialScale); > > I still think an "ensure" function would make this more readable. > > > Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h:50 > > +enum class DeconstructDrawGlyphs : bool { No, Yes }; > > I generally like to put these things inside classes to not pollute the > global namespace. This type is only meaningful inside the class anyway. OK > > Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h:38 > > - WEBCORE_EXPORT RecorderImpl(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, DrawGlyphsRecorder::DeconstructDrawGlyphs = DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes); > > + WEBCORE_EXPORT RecorderImpl(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, DeconstructDrawGlyphs = DeconstructDrawGlyphs::No); > > Changing the default value is suspicious. Surely the default option should > be the one which is more secure, right? But it's only relevant for the GPU Process. If it defaults to Yes, then we're doing the CGContext stuff when we don't need to in, WebKit1 for example. > > Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:53 > > + ASSERT(deconstructDrawGlyphs == DisplayList::DeconstructDrawGlyphs::Yes); > > Why not just remove the parameter then? Indeed.
Simon Fraser (smfr)
Comment 6 2022-05-12 17:11:46 PDT
Simon Fraser (smfr)
Comment 7 2022-05-12 20:59:30 PDT
EWS
Comment 8 2022-05-13 00:30:18 PDT
Committed r294145 (250515@main): <https://commits.webkit.org/250515@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 459272 [details].
Radar WebKit Bug Importer
Comment 9 2022-05-13 00:31:14 PDT
Note You need to log in before you can comment on or make changes to this bug.