Simplify the usage of DrawGlyphsRecorder
Created attachment 459258 [details] Patch
Created attachment 459260 [details] Patch
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?
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/
(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.
Created attachment 459262 [details] Patch
Created attachment 459272 [details] Patch
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].
<rdar://problem/93230142>