[Webkit-unassigned] [Bug 238278] New: [GPU Process] [GraphicsContextState 4/] Ensure DisplayList::Recorder and its base class are initialized with the same GraphicsContextState

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 23 12:10:18 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=238278

            Bug ID: 238278
           Summary: [GPU Process] [GraphicsContextState 4/] Ensure
                    DisplayList::Recorder and its base class are
                    initialized with the same GraphicsContextState
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Layout and Rendering
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: sabouhallawa at apple.com
                CC: bfulgham at webkit.org, simon.fraser at apple.com,
                    zalan at apple.com

When a glyph run is redisplayed, we tend to cache its drawing for perf gain. We create a DisplayList::RecorderImpl, pass it the current GraphicsContextState and ask it to drawGlyphs(). We then cache the recorded DisplayList.

DisplayList::RecorderImpl passes the initial GraphicsContextState to its base class DisplayList::Recorder which pushes it on its stack. The problem is DisplayList::Recorder does not pass this initial GraphicsContextState to its base class which is GraphicsContext. So DisplayList::Recorder ends up having the initial state but the GraphicsContext ends up having the default state.

DisplayList::Recorder::drawGlyphs() calls DrawGlyphsRecorder::drawGlyphs() which stores the original fillBrush, strokeBrush and dropShadow. It uses these original values to restore the m_owner when it finishes. The m_owner in this case is of type DisplayList::RecorderImpl. The problem is DrawGlyphsRecorder::drawGlyphs() stores the values in the state of the GraphicsContext which are the default. So in some cases we may restore the default state to the drawing GraphicsContext.

For example let's assume the initial GraphicsContextState in the drawing GraphicsContext has fillColor = 'green':

1. DisplayList::RecorderImpl will pass the initial state to DisplayList::Recorder. So the state of its DisplayList::Recorder will have fillColor = 'green' but its GraphicsContext will have fillColor = 'black'
2. DrawGlyphsRecorder::drawGlyphs() will store fillColor = 'black' before recording.
3. DrawGlyphsRecorder::drawGlyphs() will restore fillColor = 'black' to DisplayList::Recorder. So a DisplayList item will be recorded to set the fillColor back to 'black'.
4. When replaying back the glyph DisplayList, the drawing GraphicsContext has fillColor = 'black.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220323/e6ad452d/attachment.htm>


More information about the webkit-unassigned mailing list