⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 291771 in webkit


Ignore:
Timestamp:
Mar 23, 2022, 3:50:35 PM (5 years ago)
Author:
Said Abou-Hallawa
Message:

[GPU Process] Ensure DisplayList::Recorder and its base class are initialized with the same GraphicsContextState
​https://bugs.webkit.org/show_bug.cgi?id=238278
rdar://84602660

Reviewed by Simon Fraser.

DisplayList::RecorderImpl passes the initial GraphicsContextState to its
base class DisplayList::Recorder which pushes it on its stack. But
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 owner GraphicsContext when it finishes.
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.

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::GraphicsContext):

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/displaylists/DisplayListRecorder.cpp:

(WebCore::DisplayList::Recorder::Recorder):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r291769 r291771  
     12022-03-23  Said Abou-Hallawa  <said@apple.com>
     2
     3        [GPU Process] Ensure DisplayList::Recorder and its base class are initialized with the same GraphicsContextState
     4        https://bugs.webkit.org/show_bug.cgi?id=238278
     5        rdar://84602660
     6
     7        Reviewed by Simon Fraser.
     8
     9        DisplayList::RecorderImpl passes the initial GraphicsContextState to its
     10        base class DisplayList::Recorder which pushes it on its stack. But
     11        DisplayList::Recorder does not pass this initial GraphicsContextState to
     12        its base class which is GraphicsContext. So DisplayList::Recorder ends up
     13        having the initial state but the GraphicsContext ends up having the default
     14        state.
     15
     16        DisplayList::Recorder::drawGlyphs() calls DrawGlyphsRecorder::drawGlyphs()
     17        which stores the original fillBrush, strokeBrush and dropShadow. It uses
     18        these original values to restore the owner GraphicsContext when it finishes.
     19        The problem is DrawGlyphsRecorder::drawGlyphs() stores the values in the
     20        state of the GraphicsContext which are the default. So in some cases we
     21        may restore the default state to the drawing GraphicsContext.
     22
     23        * platform/graphics/GraphicsContext.cpp:
     24        (WebCore::GraphicsContext::GraphicsContext):
     25        * platform/graphics/GraphicsContext.h:
     26        * platform/graphics/displaylists/DisplayListRecorder.cpp:
     27        (WebCore::DisplayList::Recorder::Recorder):
     28
    1292022-03-23  Andres Gonzalez  <andresg_22@apple.com>
    230
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r291696 r291771  
    4949}
    5050
     51GraphicsContext::GraphicsContext(const GraphicsContextState& state)
     52    : m_state(state)
     53{
     54}
     55
    5156GraphicsContext::~GraphicsContext()
    5257{
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r291696 r291771  
    6767public:
    6868    WEBCORE_EXPORT GraphicsContext(const GraphicsContextState::ChangeFlags& = { }, InterpolationQuality = InterpolationQuality::Default);
     69    WEBCORE_EXPORT GraphicsContext(const GraphicsContextState&);
    6970    WEBCORE_EXPORT virtual ~GraphicsContext();
    7071
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp

    r291696 r291771  
    4444
    4545Recorder::Recorder(const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM, DrawGlyphsRecorder::DeconstructDrawGlyphs deconstructDrawGlyphs)
    46     : m_drawGlyphsRecorder(*this, deconstructDrawGlyphs)
     46    : GraphicsContext(state)
     47    , m_drawGlyphsRecorder(*this, deconstructDrawGlyphs)
    4748{
    4849    m_stateStack.append({ state, initialCTM, initialCTM.mapRect(initialClip) });
Note: See TracChangeset for help on using the changeset viewer.