Title: [291696] trunk/Source
Revision
291696
Author
s...@apple.com
Date
2022-03-22 13:37:51 -0700 (Tue, 22 Mar 2022)

Log Message

[GPU Process] Make GraphicsContextState a class
https://bugs.webkit.org/show_bug.cgi?id=238192

Reviewed by Simon Fraser.

Source/WebCore:

This will make the members be private so we have to provide getters for
all of them. This change will prevent changing the members without going
through the setters.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::GraphicsContext):
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::fillBrush const):
(WebCore::GraphicsContext::fillColor const):
(WebCore::GraphicsContext::fillGradient const):
(WebCore::GraphicsContext::fillGradientSpaceTransform const):
(WebCore::GraphicsContext::fillPattern const):
(WebCore::GraphicsContext::fillRule const):
(WebCore::GraphicsContext::strokeBrush const):
(WebCore::GraphicsContext::strokeColor const):
(WebCore::GraphicsContext::strokeGradient const):
(WebCore::GraphicsContext::strokeGradientSpaceTransform const):
(WebCore::GraphicsContext::strokePattern const):
(WebCore::GraphicsContext::strokeThickness const):
(WebCore::GraphicsContext::strokeStyle const):
(WebCore::GraphicsContext::dropShadow const):
(WebCore::GraphicsContext::compositeMode const):
(WebCore::GraphicsContext::alpha const):
(WebCore::GraphicsContext::textDrawingMode const):
(WebCore::GraphicsContext::imageInterpolationQuality const):
(WebCore::GraphicsContext::shouldAntialias const):
(WebCore::GraphicsContext::shouldSmoothFonts const):
(WebCore::GraphicsContext::shouldSubpixelQuantizeFonts const):
(WebCore::GraphicsContext::shadowsIgnoreTransforms const):
(WebCore::GraphicsContext::drawLuminanceMask const):
(WebCore::GraphicsContext::useDarkAppearance const):
* platform/graphics/GraphicsContextState.cpp:
(WebCore::GraphicsContextState::GraphicsContextState):
(WebCore::GraphicsContextState::containsOnlyInlineChanges const):
(WebCore::GraphicsContextState::mergeChanges):
(WebCore::GraphicsContextState::didBeginTransparencyLayer):
(WebCore::GraphicsContextState::didEndTransparencyLayer):
(WebCore::GraphicsContextState::dump const):
* platform/graphics/GraphicsContextState.h:
(WebCore::GraphicsContextState::GraphicsContextState):
(WebCore::GraphicsContextState::changes const):
(WebCore::GraphicsContextState::didApplyChanges):
(WebCore::GraphicsContextState::fillBrush const):
(WebCore::GraphicsContextState::setFillBrush):
(WebCore::GraphicsContextState::setFillColor):
(WebCore::GraphicsContextState::setFillGradient):
(WebCore::GraphicsContextState::setFillPattern):
(WebCore::GraphicsContextState::fillRule const):
(WebCore::GraphicsContextState::setFillRule):
(WebCore::GraphicsContextState::strokeBrush const):
(WebCore::GraphicsContextState::setStrokeBrush):
(WebCore::GraphicsContextState::setStrokeColor):
(WebCore::GraphicsContextState::setStrokeGradient):
(WebCore::GraphicsContextState::setStrokePattern):
(WebCore::GraphicsContextState::strokeThickness const):
(WebCore::GraphicsContextState::setStrokeThickness):
(WebCore::GraphicsContextState::strokeStyle const):
(WebCore::GraphicsContextState::setStrokeStyle):
(WebCore::GraphicsContextState::compositeMode const):
(WebCore::GraphicsContextState::setCompositeMode):
(WebCore::GraphicsContextState::dropShadow const):
(WebCore::GraphicsContextState::setDropShadow):
(WebCore::GraphicsContextState::alpha const):
(WebCore::GraphicsContextState::setAlpha):
(WebCore::GraphicsContextState::imageInterpolationQuality const):
(WebCore::GraphicsContextState::setImageInterpolationQuality):
(WebCore::GraphicsContextState::textDrawingMode const):
(WebCore::GraphicsContextState::setTextDrawingMode):
(WebCore::GraphicsContextState::shouldAntialias const):
(WebCore::GraphicsContextState::setShouldAntialias):
(WebCore::GraphicsContextState::shouldSmoothFonts const):
(WebCore::GraphicsContextState::setShouldSmoothFonts):
(WebCore::GraphicsContextState::shouldSubpixelQuantizeFonts const):
(WebCore::GraphicsContextState::setShouldSubpixelQuantizeFonts):
(WebCore::GraphicsContextState::shadowsIgnoreTransforms const):
(WebCore::GraphicsContextState::setShadowsIgnoreTransforms):
(WebCore::GraphicsContextState::drawLuminanceMask const):
(WebCore::GraphicsContextState::setDrawLuminanceMask):
(WebCore::GraphicsContextState::useDarkAppearance const):
(WebCore::GraphicsContextState::setUseDarkAppearance):
(WebCore::GraphicsContextState::setProperty):
(WebCore::GraphicsContextState::encode const):
(WebCore::GraphicsContextState::decode):
* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::FillSource::FillSource):
(WebCore::Cairo::StrokeSource::StrokeSource):
(WebCore::Cairo::ShadowState::ShadowState):
* platform/graphics/cairo/FontCairo.cpp:
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContextCairo::drawNativeImage):
(WebCore::GraphicsContextCairo::didUpdateState):
(WebCore::GraphicsContextCairo::drawGlyphs):
* platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::draw):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::coreInterpolationQuality):
(WebCore::GraphicsContextCG::GraphicsContextCG):
(WebCore::GraphicsContextCG::didUpdateState):
(WebCore::GraphicsContextCG::strokeRect):
(WebCore::GraphicsContextCG::canUseShadowBlur const):
* platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:
(WebCore::DrawGlyphsRecorder::populateInternalState):
(WebCore::DrawGlyphsRecorder::populateInternalContext):
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::shouldDumpForFlags):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::endTransparencyLayer):
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::applySetStateItem):
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::didUpdateState):
(Nicosia::CairoOperationRecorder::fillRect):
(Nicosia::CairoOperationRecorder::fillRoundedRect):
(Nicosia::CairoOperationRecorder::drawGlyphs):
(Nicosia::CairoOperationRecorder::drawNativeImage):
(Nicosia::CairoOperationRecorder::drawRect):
(Nicosia::CairoOperationRecorder::drawLine):
(Nicosia::CairoOperationRecorder::drawLinesForText):
(Nicosia::CairoOperationRecorder::drawEllipse):

Source/WebKit:

* GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::setState):
* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::paint):
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
(WebKit::convertCairoSurfaceToShareableBitmap):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291695 => 291696)


--- trunk/Source/WebCore/ChangeLog	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/ChangeLog	2022-03-22 20:37:51 UTC (rev 291696)
@@ -1,3 +1,132 @@
+2022-03-22  Said Abou-Hallawa  <s...@apple.com>
+
+        [GPU Process] Make GraphicsContextState a class
+        https://bugs.webkit.org/show_bug.cgi?id=238192
+
+        Reviewed by Simon Fraser.
+
+        This will make the members be private so we have to provide getters for
+        all of them. This change will prevent changing the members without going
+        through the setters.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::GraphicsContext):
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::GraphicsContext::GraphicsContext):
+        (WebCore::GraphicsContext::fillBrush const):
+        (WebCore::GraphicsContext::fillColor const):
+        (WebCore::GraphicsContext::fillGradient const):
+        (WebCore::GraphicsContext::fillGradientSpaceTransform const):
+        (WebCore::GraphicsContext::fillPattern const):
+        (WebCore::GraphicsContext::fillRule const):
+        (WebCore::GraphicsContext::strokeBrush const):
+        (WebCore::GraphicsContext::strokeColor const):
+        (WebCore::GraphicsContext::strokeGradient const):
+        (WebCore::GraphicsContext::strokeGradientSpaceTransform const):
+        (WebCore::GraphicsContext::strokePattern const):
+        (WebCore::GraphicsContext::strokeThickness const):
+        (WebCore::GraphicsContext::strokeStyle const):
+        (WebCore::GraphicsContext::dropShadow const):
+        (WebCore::GraphicsContext::compositeMode const):
+        (WebCore::GraphicsContext::alpha const):
+        (WebCore::GraphicsContext::textDrawingMode const):
+        (WebCore::GraphicsContext::imageInterpolationQuality const):
+        (WebCore::GraphicsContext::shouldAntialias const):
+        (WebCore::GraphicsContext::shouldSmoothFonts const):
+        (WebCore::GraphicsContext::shouldSubpixelQuantizeFonts const):
+        (WebCore::GraphicsContext::shadowsIgnoreTransforms const):
+        (WebCore::GraphicsContext::drawLuminanceMask const):
+        (WebCore::GraphicsContext::useDarkAppearance const):
+        * platform/graphics/GraphicsContextState.cpp:
+        (WebCore::GraphicsContextState::GraphicsContextState):
+        (WebCore::GraphicsContextState::containsOnlyInlineChanges const):
+        (WebCore::GraphicsContextState::mergeChanges):
+        (WebCore::GraphicsContextState::didBeginTransparencyLayer):
+        (WebCore::GraphicsContextState::didEndTransparencyLayer):
+        (WebCore::GraphicsContextState::dump const):
+        * platform/graphics/GraphicsContextState.h:
+        (WebCore::GraphicsContextState::GraphicsContextState):
+        (WebCore::GraphicsContextState::changes const):
+        (WebCore::GraphicsContextState::didApplyChanges):
+        (WebCore::GraphicsContextState::fillBrush const):
+        (WebCore::GraphicsContextState::setFillBrush):
+        (WebCore::GraphicsContextState::setFillColor):
+        (WebCore::GraphicsContextState::setFillGradient):
+        (WebCore::GraphicsContextState::setFillPattern):
+        (WebCore::GraphicsContextState::fillRule const):
+        (WebCore::GraphicsContextState::setFillRule):
+        (WebCore::GraphicsContextState::strokeBrush const):
+        (WebCore::GraphicsContextState::setStrokeBrush):
+        (WebCore::GraphicsContextState::setStrokeColor):
+        (WebCore::GraphicsContextState::setStrokeGradient):
+        (WebCore::GraphicsContextState::setStrokePattern):
+        (WebCore::GraphicsContextState::strokeThickness const):
+        (WebCore::GraphicsContextState::setStrokeThickness):
+        (WebCore::GraphicsContextState::strokeStyle const):
+        (WebCore::GraphicsContextState::setStrokeStyle):
+        (WebCore::GraphicsContextState::compositeMode const):
+        (WebCore::GraphicsContextState::setCompositeMode):
+        (WebCore::GraphicsContextState::dropShadow const):
+        (WebCore::GraphicsContextState::setDropShadow):
+        (WebCore::GraphicsContextState::alpha const):
+        (WebCore::GraphicsContextState::setAlpha):
+        (WebCore::GraphicsContextState::imageInterpolationQuality const):
+        (WebCore::GraphicsContextState::setImageInterpolationQuality):
+        (WebCore::GraphicsContextState::textDrawingMode const):
+        (WebCore::GraphicsContextState::setTextDrawingMode):
+        (WebCore::GraphicsContextState::shouldAntialias const):
+        (WebCore::GraphicsContextState::setShouldAntialias):
+        (WebCore::GraphicsContextState::shouldSmoothFonts const):
+        (WebCore::GraphicsContextState::setShouldSmoothFonts):
+        (WebCore::GraphicsContextState::shouldSubpixelQuantizeFonts const):
+        (WebCore::GraphicsContextState::setShouldSubpixelQuantizeFonts):
+        (WebCore::GraphicsContextState::shadowsIgnoreTransforms const):
+        (WebCore::GraphicsContextState::setShadowsIgnoreTransforms):
+        (WebCore::GraphicsContextState::drawLuminanceMask const):
+        (WebCore::GraphicsContextState::setDrawLuminanceMask):
+        (WebCore::GraphicsContextState::useDarkAppearance const):
+        (WebCore::GraphicsContextState::setUseDarkAppearance):
+        (WebCore::GraphicsContextState::setProperty):
+        (WebCore::GraphicsContextState::encode const):
+        (WebCore::GraphicsContextState::decode):
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::FillSource::FillSource):
+        (WebCore::Cairo::StrokeSource::StrokeSource):
+        (WebCore::Cairo::ShadowState::ShadowState):
+        * platform/graphics/cairo/FontCairo.cpp:
+        (WebCore::FontCascade::drawGlyphs):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContextCairo::drawNativeImage):
+        (WebCore::GraphicsContextCairo::didUpdateState):
+        (WebCore::GraphicsContextCairo::drawGlyphs):
+        * platform/graphics/cairo/ImageBufferCairoBackend.cpp:
+        (WebCore::ImageBufferCairoBackend::draw):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::coreInterpolationQuality):
+        (WebCore::GraphicsContextCG::GraphicsContextCG):
+        (WebCore::GraphicsContextCG::didUpdateState):
+        (WebCore::GraphicsContextCG::strokeRect):
+        (WebCore::GraphicsContextCG::canUseShadowBlur const):
+        * platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:
+        (WebCore::DrawGlyphsRecorder::populateInternalState):
+        (WebCore::DrawGlyphsRecorder::populateInternalContext):
+        * platform/graphics/displaylists/DisplayList.cpp:
+        (WebCore::DisplayList::DisplayList::shouldDumpForFlags):
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::endTransparencyLayer):
+        * platform/graphics/displaylists/DisplayListReplayer.cpp:
+        (WebCore::DisplayList::applySetStateItem):
+        * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
+        (Nicosia::CairoOperationRecorder::didUpdateState):
+        (Nicosia::CairoOperationRecorder::fillRect):
+        (Nicosia::CairoOperationRecorder::fillRoundedRect):
+        (Nicosia::CairoOperationRecorder::drawGlyphs):
+        (Nicosia::CairoOperationRecorder::drawNativeImage):
+        (Nicosia::CairoOperationRecorder::drawRect):
+        (Nicosia::CairoOperationRecorder::drawLine):
+        (Nicosia::CairoOperationRecorder::drawLinesForText):
+        (Nicosia::CairoOperationRecorder::drawEllipse):
+
 2022-03-22  Alexey Shvayka  <ashva...@apple.com>
 
         REGRESSION(r288307): instanceof value wrong in MutationObserver callback for Safari extensions

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -43,8 +43,8 @@
 
 namespace WebCore {
 
-GraphicsContext::GraphicsContext(const GraphicsContextState::ChangeFlags& changeFlags)
-    : m_state(changeFlags)
+GraphicsContext::GraphicsContext(const GraphicsContextState::ChangeFlags& changeFlags, InterpolationQuality imageInterpolationQuality)
+    : m_state(changeFlags, imageInterpolationQuality)
 {
 }
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2022-03-22 20:37:51 UTC (rev 291696)
@@ -65,7 +65,7 @@
 class GraphicsContext {
     WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
 public:
-    WEBCORE_EXPORT GraphicsContext(const GraphicsContextState::ChangeFlags& = { });
+    WEBCORE_EXPORT GraphicsContext(const GraphicsContextState::ChangeFlags& = { }, InterpolationQuality = InterpolationQuality::Default);
     WEBCORE_EXPORT virtual ~GraphicsContext();
 
     virtual bool hasPlatformContext() const { return false; }
@@ -79,36 +79,36 @@
 
     // Context State
 
-    const SourceBrush& fillBrush() const { return m_state.fillBrush; }
-    const Color& fillColor() const { return m_state.fillBrush.color(); }
-    Gradient* fillGradient() const { return m_state.fillBrush.gradient(); }
-    const AffineTransform& fillGradientSpaceTransform() const { return m_state.fillBrush.gradientSpaceTransform(); }
-    Pattern* fillPattern() const { return m_state.fillBrush.pattern(); }
+    const SourceBrush& fillBrush() const { return m_state.fillBrush(); }
+    const Color& fillColor() const { return fillBrush().color(); }
+    Gradient* fillGradient() const { return fillBrush().gradient(); }
+    const AffineTransform& fillGradientSpaceTransform() const { return fillBrush().gradientSpaceTransform(); }
+    Pattern* fillPattern() const { return fillBrush().pattern(); }
     void setFillBrush(const SourceBrush& brush) { m_state.setFillBrush(brush); didUpdateState(m_state); }
     void setFillColor(const Color& color) { m_state.setFillColor(color); didUpdateState(m_state); }
     void setFillGradient(Ref<Gradient>&& gradient, const AffineTransform& spaceTransform = { }) { m_state.setFillGradient(WTFMove(gradient), spaceTransform); didUpdateState(m_state); }
     void setFillPattern(Ref<Pattern>&& pattern) { m_state.setFillPattern(WTFMove(pattern)); didUpdateState(m_state); }
 
-    WindRule fillRule() const { return m_state.fillRule; }
+    WindRule fillRule() const { return m_state.fillRule(); }
     void setFillRule(WindRule fillRule) { m_state.setFillRule(fillRule); didUpdateState(m_state); }
 
-    const SourceBrush& strokeBrush() const { return m_state.strokeBrush; }
-    const Color& strokeColor() const { return m_state.strokeBrush.color(); }
-    Gradient* strokeGradient() const { return m_state.strokeBrush.gradient(); }
-    const AffineTransform& strokeGradientSpaceTransform() const { return m_state.strokeBrush.gradientSpaceTransform(); }
-    Pattern* strokePattern() const { return m_state.strokeBrush.pattern(); }
+    const SourceBrush& strokeBrush() const { return m_state.strokeBrush(); }
+    const Color& strokeColor() const { return strokeBrush().color(); }
+    Gradient* strokeGradient() const { return strokeBrush().gradient(); }
+    const AffineTransform& strokeGradientSpaceTransform() const { return strokeBrush().gradientSpaceTransform(); }
+    Pattern* strokePattern() const { return strokeBrush().pattern(); }
     void setStrokeBrush(const SourceBrush& brush) { m_state.setStrokeBrush(brush); didUpdateState(m_state); }
     void setStrokeColor(const Color& color) { m_state.setStrokeColor(color); didUpdateState(m_state); }
     void setStrokeGradient(Ref<Gradient>&& gradient, const AffineTransform& spaceTransform = { }) { m_state.setStrokeGradient(WTFMove(gradient), spaceTransform); didUpdateState(m_state); }
     void setStrokePattern(Ref<Pattern>&& pattern) { m_state.setStrokePattern(WTFMove(pattern)); didUpdateState(m_state); }
 
-    float strokeThickness() const { return m_state.strokeThickness; }
+    float strokeThickness() const { return m_state.strokeThickness(); }
     void setStrokeThickness(float thickness) { m_state.setStrokeThickness(thickness); didUpdateState(m_state); }
 
-    StrokeStyle strokeStyle() const { return m_state.strokeStyle; }
+    StrokeStyle strokeStyle() const { return m_state.strokeStyle(); }
     void setStrokeStyle(StrokeStyle style) { m_state.setStrokeStyle(style); didUpdateState(m_state); }
 
-    const DropShadow& dropShadow() const { return m_state.dropShadow; }
+    const DropShadow& dropShadow() const { return m_state.dropShadow(); }
     FloatSize shadowOffset() const { return dropShadow().offset; }
     float shadowBlur() const { return dropShadow().blurRadius; }
     const Color& shadowColor() const { return dropShadow().color; }
@@ -123,40 +123,40 @@
     bool hasBlurredShadow() const { return dropShadow().isBlurred(); }
     bool hasShadow() const { return dropShadow().hasOutsets(); }
 
-    CompositeMode compositeMode() const { return m_state.compositeMode; }
+    CompositeMode compositeMode() const { return m_state.compositeMode(); }
     CompositeOperator compositeOperation() const { return compositeMode().operation; }
     BlendMode blendMode() const { return compositeMode().blendMode; }
     void setCompositeMode(CompositeMode compositeMode) { m_state.setCompositeMode(compositeMode); didUpdateState(m_state); }
     void setCompositeOperation(CompositeOperator operation, BlendMode blendMode = BlendMode::Normal) { setCompositeMode({ operation, blendMode }); }
 
-    float alpha() const { return m_state.alpha; }
+    float alpha() const { return m_state.alpha(); }
     void setAlpha(float alpha) { m_state.setAlpha(alpha); didUpdateState(m_state); }
 
-    TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode; }
+    TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode(); }
     void setTextDrawingMode(TextDrawingModeFlags textDrawingMode) { m_state.setTextDrawingMode(textDrawingMode); didUpdateState(m_state); }
     
-    InterpolationQuality imageInterpolationQuality() const { return m_state.imageInterpolationQuality; }
+    InterpolationQuality imageInterpolationQuality() const { return m_state.imageInterpolationQuality(); }
     void setImageInterpolationQuality(InterpolationQuality imageInterpolationQuality) { m_state.setImageInterpolationQuality(imageInterpolationQuality); didUpdateState(m_state); }
 
-    bool shouldAntialias() const { return m_state.shouldAntialias; }
+    bool shouldAntialias() const { return m_state.shouldAntialias(); }
     void setShouldAntialias(bool shouldAntialias) { m_state.setShouldAntialias(shouldAntialias); didUpdateState(m_state); }
 
-    bool shouldSmoothFonts() const { return m_state.shouldSmoothFonts; }
+    bool shouldSmoothFonts() const { return m_state.shouldSmoothFonts(); }
     void setShouldSmoothFonts(bool shouldSmoothFonts) { m_state.setShouldSmoothFonts(shouldSmoothFonts); didUpdateState(m_state); }
 
     // Normally CG enables subpixel-quantization because it improves the performance of aligning glyphs.
     // In some cases we have to disable to to ensure a high-quality output of the glyphs.
-    bool shouldSubpixelQuantizeFonts() const { return m_state.shouldSubpixelQuantizeFonts; }
+    bool shouldSubpixelQuantizeFonts() const { return m_state.shouldSubpixelQuantizeFonts(); }
     void setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts) { m_state.setShouldSubpixelQuantizeFonts(shouldSubpixelQuantizeFonts); didUpdateState(m_state); }
 
-    bool shadowsIgnoreTransforms() const { return m_state.shadowsIgnoreTransforms; }
+    bool shadowsIgnoreTransforms() const { return m_state.shadowsIgnoreTransforms(); }
     void setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms) { m_state.setShadowsIgnoreTransforms(shadowsIgnoreTransforms); didUpdateState(m_state); }
 
-    bool drawLuminanceMask() const { return m_state.drawLuminanceMask; }
+    bool drawLuminanceMask() const { return m_state.drawLuminanceMask(); }
     void setDrawLuminanceMask(bool drawLuminanceMask) { m_state.setDrawLuminanceMask(drawLuminanceMask); didUpdateState(m_state); }
 
 #if HAVE(OS_DARK_MODE_SUPPORT)
-    bool useDarkAppearance() const { return m_state.useDarkAppearance; }
+    bool useDarkAppearance() const { return m_state.useDarkAppearance(); }
     void setUseDarkAppearance(bool useDarkAppearance) { m_state.setUseDarkAppearance(useDarkAppearance); didUpdateState(m_state); }
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextState.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextState.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextState.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -30,22 +30,21 @@
 
 namespace WebCore {
 
-GraphicsContextState::GraphicsContextState(const ChangeFlags& changeFlags)
-    : changeFlags(changeFlags)
+GraphicsContextState::GraphicsContextState(const ChangeFlags& changeFlags, InterpolationQuality imageInterpolationQuality)
+    : m_changeFlags(changeFlags)
+    , m_imageInterpolationQuality(imageInterpolationQuality)
 {
 }
 
 bool GraphicsContextState::containsOnlyInlineChanges() const
 {
-    static constexpr ChangeFlags inlineChangeFlags { Change::StrokeThickness, Change::StrokeBrush, Change::FillBrush };
-
-    if (changeFlags != (changeFlags & inlineChangeFlags))
+    if (m_changeFlags != (m_changeFlags & basicChangeFlags))
         return false;
 
-    if (changeFlags.contains(Change::StrokeBrush) && !strokeBrush.isInlineColor())
+    if (m_changeFlags.contains(Change::StrokeBrush) && !m_strokeBrush.isInlineColor())
         return false;
 
-    if (changeFlags.contains(Change::FillBrush) && !fillBrush.isInlineColor())
+    if (m_changeFlags.contains(Change::FillBrush) && !m_fillBrush.isInlineColor())
         return false;
 
     return true;
@@ -54,33 +53,33 @@
 void GraphicsContextState::mergeChanges(const GraphicsContextState& state, const std::optional<GraphicsContextState>& lastDrawingState)
 {
     auto mergeChange = [&](Change change, auto GraphicsContextState::*property) {
-        if (!state.changeFlags.contains(change) || this->*property == state.*property)
+        if (!state.changes().contains(change) || this->*property == state.*property)
             return;
         this->*property = state.*property;
-        changeFlags.set(change, !lastDrawingState || (*lastDrawingState).*property != this->*property);
+        m_changeFlags.set(change, !lastDrawingState || (*lastDrawingState).*property != this->*property);
     };
 
-    mergeChange(Change::FillBrush,                      &GraphicsContextState::fillBrush);
-    mergeChange(Change::FillRule,                       &GraphicsContextState::fillRule);
+    mergeChange(Change::FillBrush,                      &GraphicsContextState::m_fillBrush);
+    mergeChange(Change::FillRule,                       &GraphicsContextState::m_fillRule);
 
-    mergeChange(Change::StrokeBrush,                    &GraphicsContextState::strokeBrush);
-    mergeChange(Change::StrokeThickness,                &GraphicsContextState::strokeThickness);
-    mergeChange(Change::StrokeStyle,                    &GraphicsContextState::strokeStyle);
+    mergeChange(Change::StrokeBrush,                    &GraphicsContextState::m_strokeBrush);
+    mergeChange(Change::StrokeThickness,                &GraphicsContextState::m_strokeThickness);
+    mergeChange(Change::StrokeStyle,                    &GraphicsContextState::m_strokeStyle);
 
-    mergeChange(Change::CompositeMode,                  &GraphicsContextState::compositeMode);
-    mergeChange(Change::DropShadow,                     &GraphicsContextState::dropShadow);
+    mergeChange(Change::CompositeMode,                  &GraphicsContextState::m_compositeMode);
+    mergeChange(Change::DropShadow,                     &GraphicsContextState::m_dropShadow);
 
-    mergeChange(Change::Alpha,                          &GraphicsContextState::alpha);
-    mergeChange(Change::ImageInterpolationQuality,      &GraphicsContextState::imageInterpolationQuality);
-    mergeChange(Change::TextDrawingMode,                &GraphicsContextState::textDrawingMode);
+    mergeChange(Change::Alpha,                          &GraphicsContextState::m_alpha);
+    mergeChange(Change::ImageInterpolationQuality,      &GraphicsContextState::m_imageInterpolationQuality);
+    mergeChange(Change::TextDrawingMode,                &GraphicsContextState::m_textDrawingMode);
 
-    mergeChange(Change::ShouldAntialias,                &GraphicsContextState::shouldAntialias);
-    mergeChange(Change::ShouldSmoothFonts,              &GraphicsContextState::shouldSmoothFonts);
-    mergeChange(Change::ShouldSubpixelQuantizeFonts,    &GraphicsContextState::shouldSubpixelQuantizeFonts);
-    mergeChange(Change::ShadowsIgnoreTransforms,        &GraphicsContextState::shadowsIgnoreTransforms);
-    mergeChange(Change::DrawLuminanceMask,              &GraphicsContextState::drawLuminanceMask);
+    mergeChange(Change::ShouldAntialias,                &GraphicsContextState::m_shouldAntialias);
+    mergeChange(Change::ShouldSmoothFonts,              &GraphicsContextState::m_shouldSmoothFonts);
+    mergeChange(Change::ShouldSubpixelQuantizeFonts,    &GraphicsContextState::m_shouldSubpixelQuantizeFonts);
+    mergeChange(Change::ShadowsIgnoreTransforms,        &GraphicsContextState::m_shadowsIgnoreTransforms);
+    mergeChange(Change::DrawLuminanceMask,              &GraphicsContextState::m_drawLuminanceMask);
 #if HAVE(OS_DARK_MODE_SUPPORT)
-    mergeChange(Change::UseDarkAppearance,              &GraphicsContextState::useDarkAppearance);
+    mergeChange(Change::UseDarkAppearance,              &GraphicsContextState::m_useDarkAppearance);
 #endif
 }
 
@@ -88,7 +87,7 @@
 {
 #if USE(CG)
     // CGContextBeginTransparencyLayer() sets the CG global alpha to 1. Keep our alpha in sync.
-    alpha = 1;
+    m_alpha = 1;
 #endif
 }
 
@@ -96,7 +95,7 @@
 {
 #if USE(CG)
     // CGContextBeginTransparencyLayer() sets the CG global alpha to 1. Resore our alpha now.
-    alpha = originalOpacity;
+    m_alpha = originalOpacity;
 #else
     UNUSED_PARAM(originalOpacity);
 #endif
@@ -160,33 +159,33 @@
 TextStream& GraphicsContextState::dump(TextStream& ts) const
 {
     auto dump = [&](Change change, auto GraphicsContextState::*property) {
-        if (changeFlags.contains(change))
+        if (m_changeFlags.contains(change))
             ts.dumpProperty(stateChangeName(change), this->*property);
     };
 
-    ts.dumpProperty("change-flags", changeFlags);
+    ts.dumpProperty("change-flags", m_changeFlags);
 
-    dump(Change::FillBrush,                     &GraphicsContextState::fillBrush);
-    dump(Change::FillRule,                      &GraphicsContextState::fillRule);
+    dump(Change::FillBrush,                     &GraphicsContextState::m_fillBrush);
+    dump(Change::FillRule,                      &GraphicsContextState::m_fillRule);
 
-    dump(Change::StrokeBrush,                   &GraphicsContextState::strokeBrush);
-    dump(Change::StrokeThickness,               &GraphicsContextState::strokeThickness);
-    dump(Change::StrokeStyle,                   &GraphicsContextState::strokeStyle);
+    dump(Change::StrokeBrush,                   &GraphicsContextState::m_strokeBrush);
+    dump(Change::StrokeThickness,               &GraphicsContextState::m_strokeThickness);
+    dump(Change::StrokeStyle,                   &GraphicsContextState::m_strokeStyle);
 
-    dump(Change::CompositeMode,                 &GraphicsContextState::compositeMode);
-    dump(Change::DropShadow,                    &GraphicsContextState::dropShadow);
+    dump(Change::CompositeMode,                 &GraphicsContextState::m_compositeMode);
+    dump(Change::DropShadow,                    &GraphicsContextState::m_dropShadow);
 
-    dump(Change::Alpha,                         &GraphicsContextState::alpha);
-    dump(Change::ImageInterpolationQuality,     &GraphicsContextState::imageInterpolationQuality);
-    dump(Change::TextDrawingMode,               &GraphicsContextState::textDrawingMode);
+    dump(Change::Alpha,                         &GraphicsContextState::m_alpha);
+    dump(Change::ImageInterpolationQuality,     &GraphicsContextState::m_imageInterpolationQuality);
+    dump(Change::TextDrawingMode,               &GraphicsContextState::m_textDrawingMode);
 
-    dump(Change::ShouldAntialias,               &GraphicsContextState::shouldAntialias);
-    dump(Change::ShouldSmoothFonts,             &GraphicsContextState::shouldSmoothFonts);
-    dump(Change::ShouldSubpixelQuantizeFonts,   &GraphicsContextState::shouldSubpixelQuantizeFonts);
-    dump(Change::ShadowsIgnoreTransforms,       &GraphicsContextState::shadowsIgnoreTransforms);
-    dump(Change::DrawLuminanceMask,             &GraphicsContextState::drawLuminanceMask);
+    dump(Change::ShouldAntialias,               &GraphicsContextState::m_shouldAntialias);
+    dump(Change::ShouldSmoothFonts,             &GraphicsContextState::m_shouldSmoothFonts);
+    dump(Change::ShouldSubpixelQuantizeFonts,   &GraphicsContextState::m_shouldSubpixelQuantizeFonts);
+    dump(Change::ShadowsIgnoreTransforms,       &GraphicsContextState::m_shadowsIgnoreTransforms);
+    dump(Change::DrawLuminanceMask,             &GraphicsContextState::m_drawLuminanceMask);
 #if HAVE(OS_DARK_MODE_SUPPORT)
-    dump(Change::UseDarkAppearance,             &GraphicsContextState::useDarkAppearance);
+    dump(Change::UseDarkAppearance,             &GraphicsContextState::m_useDarkAppearance);
 #endif
     return ts;
 }

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextState.h (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextState.h	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextState.h	2022-03-22 20:37:51 UTC (rev 291696)
@@ -32,7 +32,9 @@
 
 namespace WebCore {
 
-struct GraphicsContextState {
+class GraphicsContextState {
+    friend class GraphicsContextCairo;
+public:
     enum class Change : uint32_t {
         FillBrush                   = 1 << 0,
         FillRule                    = 1 << 1,
@@ -59,40 +61,67 @@
     };
     using ChangeFlags = OptionSet<Change>;
 
-    WEBCORE_EXPORT GraphicsContextState(const ChangeFlags& = { });
+    static constexpr ChangeFlags basicChangeFlags { Change::StrokeThickness, Change::StrokeBrush, Change::FillBrush };
 
-    ChangeFlags changes() const { return changeFlags; }
-    void didApplyChanges() { changeFlags = { }; }
+    WEBCORE_EXPORT GraphicsContextState(const ChangeFlags& = { }, InterpolationQuality = InterpolationQuality::Default);
 
-    void setFillBrush(const SourceBrush& brush) { setProperty(Change::FillBrush, &GraphicsContextState::fillBrush, brush); }
-    void setFillColor(const Color& color) { setProperty(Change::FillBrush, &GraphicsContextState::fillBrush, { color }); }
-    void setFillGradient(Ref<Gradient>&& gradient, const AffineTransform& spaceTransform) { fillBrush.setGradient(WTFMove(gradient), spaceTransform); changeFlags.add(Change::FillBrush); }
-    void setFillPattern(Ref<Pattern>&& pattern) { fillBrush.setPattern(WTFMove(pattern)); changeFlags.add(Change::FillBrush); }
+    ChangeFlags changes() const { return m_changeFlags; }
+    void didApplyChanges() { m_changeFlags = { }; }
 
-    void setFillRule(WindRule fillRule) { setProperty(Change::FillRule, &GraphicsContextState::fillRule, fillRule); }
+    const SourceBrush& fillBrush() const { return m_fillBrush; }
+    void setFillBrush(const SourceBrush& brush) { setProperty(Change::FillBrush, &GraphicsContextState::m_fillBrush, brush); }
+    void setFillColor(const Color& color) { setProperty(Change::FillBrush, &GraphicsContextState::m_fillBrush, { color }); }
+    void setFillGradient(Ref<Gradient>&& gradient, const AffineTransform& spaceTransform) { m_fillBrush.setGradient(WTFMove(gradient), spaceTransform); m_changeFlags.add(Change::FillBrush); }
+    void setFillPattern(Ref<Pattern>&& pattern) { m_fillBrush.setPattern(WTFMove(pattern)); m_changeFlags.add(Change::FillBrush); }
 
-    void setStrokeBrush(const SourceBrush& brush) { setProperty(Change::StrokeBrush, &GraphicsContextState::strokeBrush, brush); }
-    void setStrokeColor(const Color& color) { setProperty(Change::StrokeBrush, &GraphicsContextState::strokeBrush, { color }); }
-    void setStrokeGradient(Ref<Gradient>&& gradient, const AffineTransform& spaceTransform) { strokeBrush.setGradient(WTFMove(gradient), spaceTransform); changeFlags.add(Change::StrokeBrush); }
-    void setStrokePattern(Ref<Pattern>&& pattern) { strokeBrush.setPattern(WTFMove(pattern)); changeFlags.add(Change::StrokeBrush); }
+    WindRule fillRule() const { return m_fillRule; }
+    void setFillRule(WindRule fillRule) { setProperty(Change::FillRule, &GraphicsContextState::m_fillRule, fillRule); }
 
-    void setStrokeThickness(float strokeThickness) { setProperty(Change::StrokeThickness, &GraphicsContextState::strokeThickness, strokeThickness); }
-    void setStrokeStyle(StrokeStyle strokeStyle) { setProperty(Change::StrokeStyle, &GraphicsContextState::strokeStyle, strokeStyle); }
+    const SourceBrush& strokeBrush() const { return m_strokeBrush; }
+    void setStrokeBrush(const SourceBrush& brush) { setProperty(Change::StrokeBrush, &GraphicsContextState::m_strokeBrush, brush); }
+    void setStrokeColor(const Color& color) { setProperty(Change::StrokeBrush, &GraphicsContextState::m_strokeBrush, { color }); }
+    void setStrokeGradient(Ref<Gradient>&& gradient, const AffineTransform& spaceTransform) { m_strokeBrush.setGradient(WTFMove(gradient), spaceTransform); m_changeFlags.add(Change::StrokeBrush); }
+    void setStrokePattern(Ref<Pattern>&& pattern) { m_strokeBrush.setPattern(WTFMove(pattern)); m_changeFlags.add(Change::StrokeBrush); }
 
-    void setCompositeMode(CompositeMode compositeMode) { setProperty(Change::CompositeMode, &GraphicsContextState::compositeMode, compositeMode); }
-    void setDropShadow(const DropShadow& dropShadow) { setProperty(Change::DropShadow, &GraphicsContextState::dropShadow, dropShadow); }
+    float strokeThickness() const { return m_strokeThickness; }
+    void setStrokeThickness(float strokeThickness) { setProperty(Change::StrokeThickness, &GraphicsContextState::m_strokeThickness, strokeThickness); }
 
-    void setAlpha(float alpha) { setProperty(Change::Alpha, &GraphicsContextState::alpha, alpha); }
-    void setImageInterpolationQuality(InterpolationQuality imageInterpolationQuality) { setProperty(Change::ImageInterpolationQuality, &GraphicsContextState::imageInterpolationQuality, imageInterpolationQuality); }
-    void setTextDrawingMode(TextDrawingModeFlags textDrawingMode) { setProperty(Change::TextDrawingMode, &GraphicsContextState::textDrawingMode, textDrawingMode); }
+    StrokeStyle strokeStyle() const { return m_strokeStyle; }
+    void setStrokeStyle(StrokeStyle strokeStyle) { setProperty(Change::StrokeStyle, &GraphicsContextState::m_strokeStyle, strokeStyle); }
 
-    void setShouldAntialias(bool shouldAntialias) { setProperty(Change::ShouldAntialias, &GraphicsContextState::shouldAntialias, shouldAntialias); }
-    void setShouldSmoothFonts(bool shouldSmoothFonts) { setProperty(Change::ShouldSmoothFonts, &GraphicsContextState::shouldSmoothFonts, shouldSmoothFonts); }
-    void setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts) { setProperty(Change::ShouldSubpixelQuantizeFonts, &GraphicsContextState::shouldSubpixelQuantizeFonts, shouldSubpixelQuantizeFonts); }
-    void setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms) { setProperty(Change::ShadowsIgnoreTransforms, &GraphicsContextState::shadowsIgnoreTransforms, shadowsIgnoreTransforms); }
-    void setDrawLuminanceMask(bool drawLuminanceMask) { setProperty(Change::DrawLuminanceMask, &GraphicsContextState::drawLuminanceMask, drawLuminanceMask); }
+    const CompositeMode& compositeMode() const { return m_compositeMode; }
+    void setCompositeMode(CompositeMode compositeMode) { setProperty(Change::CompositeMode, &GraphicsContextState::m_compositeMode, compositeMode); }
+
+    const DropShadow& dropShadow() const { return m_dropShadow; }
+    void setDropShadow(const DropShadow& dropShadow) { setProperty(Change::DropShadow, &GraphicsContextState::m_dropShadow, dropShadow); }
+
+    float alpha() const { return m_alpha; }
+    void setAlpha(float alpha) { setProperty(Change::Alpha, &GraphicsContextState::m_alpha, alpha); }
+
+    InterpolationQuality imageInterpolationQuality() const { return m_imageInterpolationQuality; }
+    void setImageInterpolationQuality(InterpolationQuality imageInterpolationQuality) { setProperty(Change::ImageInterpolationQuality, &GraphicsContextState::m_imageInterpolationQuality, imageInterpolationQuality); }
+
+    TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; }
+    void setTextDrawingMode(TextDrawingModeFlags textDrawingMode) { setProperty(Change::TextDrawingMode, &GraphicsContextState::m_textDrawingMode, textDrawingMode); }
+
+    bool shouldAntialias() const { return m_shouldAntialias; }
+    void setShouldAntialias(bool shouldAntialias) { setProperty(Change::ShouldAntialias, &GraphicsContextState::m_shouldAntialias, shouldAntialias); }
+
+    bool shouldSmoothFonts() const { return m_shouldSmoothFonts; }
+    void setShouldSmoothFonts(bool shouldSmoothFonts) { setProperty(Change::ShouldSmoothFonts, &GraphicsContextState::m_shouldSmoothFonts, shouldSmoothFonts); }
+
+    bool shouldSubpixelQuantizeFonts() const { return m_shouldSubpixelQuantizeFonts; }
+    void setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts) { setProperty(Change::ShouldSubpixelQuantizeFonts, &GraphicsContextState::m_shouldSubpixelQuantizeFonts, shouldSubpixelQuantizeFonts); }
+
+    bool shadowsIgnoreTransforms() const { return m_shadowsIgnoreTransforms; }
+    void setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms) { setProperty(Change::ShadowsIgnoreTransforms, &GraphicsContextState::m_shadowsIgnoreTransforms, shadowsIgnoreTransforms); }
+
+    bool drawLuminanceMask() const { return m_drawLuminanceMask; }
+    void setDrawLuminanceMask(bool drawLuminanceMask) { setProperty(Change::DrawLuminanceMask, &GraphicsContextState::m_drawLuminanceMask, drawLuminanceMask); }
+
 #if HAVE(OS_DARK_MODE_SUPPORT)
-    void setUseDarkAppearance(bool useDarkAppearance) { setProperty(Change::UseDarkAppearance, &GraphicsContextState::useDarkAppearance, useDarkAppearance); }
+    bool useDarkAppearance() const { return m_useDarkAppearance; }
+    void setUseDarkAppearance(bool useDarkAppearance) { setProperty(Change::UseDarkAppearance, &GraphicsContextState::m_useDarkAppearance, useDarkAppearance); }
 #endif
     
     bool containsOnlyInlineChanges() const;
@@ -106,31 +135,6 @@
     template<class Encoder> void encode(Encoder&) const;
     template<class Decoder> static std::optional<GraphicsContextState> decode(Decoder&);
 
-    ChangeFlags changeFlags;
-
-    SourceBrush fillBrush { Color::black };
-    WindRule fillRule { WindRule::NonZero };
-    
-    SourceBrush strokeBrush { Color::black };
-    float strokeThickness { 0 };
-    StrokeStyle strokeStyle { SolidStroke };
-    
-    CompositeMode compositeMode { CompositeOperator::SourceOver, BlendMode::Normal };
-    DropShadow dropShadow;
-    
-    float alpha { 1 };
-    InterpolationQuality imageInterpolationQuality { InterpolationQuality::Default };
-    TextDrawingModeFlags textDrawingMode { TextDrawingMode::Fill };
-
-    bool shouldAntialias { true };
-    bool shouldSmoothFonts { true };
-    bool shouldSubpixelQuantizeFonts { true };
-    bool shadowsIgnoreTransforms { false };
-    bool drawLuminanceMask { false };
-#if HAVE(OS_DARK_MODE_SUPPORT)
-    bool useDarkAppearance { false };
-#endif
-    
 private:
     template<typename T>
     void setProperty(Change change, T GraphicsContextState::*property, const T& value)
@@ -140,7 +144,7 @@
             return;
 #endif
         this->*property = value;
-        changeFlags.add(change);
+        m_changeFlags.add(change);
     }
 
     template<typename T>
@@ -151,8 +155,33 @@
             return;
 #endif
         this->*property = WTFMove(value);
-        changeFlags.add(change);
+        m_changeFlags.add(change);
     }
+
+    ChangeFlags m_changeFlags;
+
+    SourceBrush m_fillBrush { Color::black };
+    WindRule m_fillRule { WindRule::NonZero };
+    
+    SourceBrush m_strokeBrush { Color::black };
+    float m_strokeThickness { 0 };
+    StrokeStyle m_strokeStyle { SolidStroke };
+    
+    CompositeMode m_compositeMode { CompositeOperator::SourceOver, BlendMode::Normal };
+    DropShadow m_dropShadow;
+    
+    float m_alpha { 1 };
+    InterpolationQuality m_imageInterpolationQuality { InterpolationQuality::Default };
+    TextDrawingModeFlags m_textDrawingMode { TextDrawingMode::Fill };
+
+    bool m_shouldAntialias { true };
+    bool m_shouldSmoothFonts { true };
+    bool m_shouldSubpixelQuantizeFonts { true };
+    bool m_shadowsIgnoreTransforms { false };
+    bool m_drawLuminanceMask { false };
+#if HAVE(OS_DARK_MODE_SUPPORT)
+    bool m_useDarkAppearance { false };
+#endif
 };
 
 template<class Encoder>
@@ -159,33 +188,33 @@
 void GraphicsContextState::encode(Encoder& encoder) const
 {
     auto encode = [&](Change change, auto GraphicsContextState::*property) {
-        if (changeFlags.contains(change))
+        if (m_changeFlags.contains(change))
             encoder << this->*property;
     };
 
-    encoder << changeFlags;
+    encoder << m_changeFlags;
 
-    encode(Change::FillBrush,                       &GraphicsContextState::fillBrush);
-    encode(Change::FillRule,                        &GraphicsContextState::fillRule);
+    encode(Change::FillBrush,                       &GraphicsContextState::m_fillBrush);
+    encode(Change::FillRule,                        &GraphicsContextState::m_fillRule);
 
-    encode(Change::StrokeBrush,                     &GraphicsContextState::strokeBrush);
-    encode(Change::StrokeThickness,                 &GraphicsContextState::strokeThickness);
-    encode(Change::StrokeStyle,                     &GraphicsContextState::strokeStyle);
+    encode(Change::StrokeBrush,                     &GraphicsContextState::m_strokeBrush);
+    encode(Change::StrokeThickness,                 &GraphicsContextState::m_strokeThickness);
+    encode(Change::StrokeStyle,                     &GraphicsContextState::m_strokeStyle);
 
-    encode(Change::CompositeMode,                   &GraphicsContextState::compositeMode);
-    encode(Change::DropShadow,                      &GraphicsContextState::dropShadow);
+    encode(Change::CompositeMode,                   &GraphicsContextState::m_compositeMode);
+    encode(Change::DropShadow,                      &GraphicsContextState::m_dropShadow);
 
-    encode(Change::Alpha,                           &GraphicsContextState::alpha);
-    encode(Change::ImageInterpolationQuality,       &GraphicsContextState::imageInterpolationQuality);
-    encode(Change::TextDrawingMode,                 &GraphicsContextState::textDrawingMode);
+    encode(Change::Alpha,                           &GraphicsContextState::m_alpha);
+    encode(Change::ImageInterpolationQuality,       &GraphicsContextState::m_imageInterpolationQuality);
+    encode(Change::TextDrawingMode,                 &GraphicsContextState::m_textDrawingMode);
 
-    encode(Change::ShouldAntialias,                 &GraphicsContextState::shouldAntialias);
-    encode(Change::ShouldSmoothFonts,               &GraphicsContextState::shouldSmoothFonts);
-    encode(Change::ShouldSubpixelQuantizeFonts,     &GraphicsContextState::shouldSubpixelQuantizeFonts);
-    encode(Change::ShadowsIgnoreTransforms,         &GraphicsContextState::shadowsIgnoreTransforms);
-    encode(Change::DrawLuminanceMask,               &GraphicsContextState::drawLuminanceMask);
+    encode(Change::ShouldAntialias,                 &GraphicsContextState::m_shouldAntialias);
+    encode(Change::ShouldSmoothFonts,               &GraphicsContextState::m_shouldSmoothFonts);
+    encode(Change::ShouldSubpixelQuantizeFonts,     &GraphicsContextState::m_shouldSubpixelQuantizeFonts);
+    encode(Change::ShadowsIgnoreTransforms,         &GraphicsContextState::m_shadowsIgnoreTransforms);
+    encode(Change::DrawLuminanceMask,               &GraphicsContextState::m_drawLuminanceMask);
 #if HAVE(OS_DARK_MODE_SUPPORT)
-    encode(Change::UseDarkAppearance,               &GraphicsContextState::useDarkAppearance);
+    encode(Change::UseDarkAppearance,               &GraphicsContextState::m_useDarkAppearance);
 #endif
 }
 
@@ -193,7 +222,7 @@
 std::optional<GraphicsContextState> GraphicsContextState::decode(Decoder& decoder)
 {
     auto decode = [&](GraphicsContextState& state, Change change, auto GraphicsContextState::*property) {
-        if (!state.changeFlags.contains(change))
+        if (!state.changes().contains(change))
             return true;
 
         using PropertyType = typename std::remove_reference<decltype(std::declval<GraphicsContextState>().*property)>::type;
@@ -213,42 +242,42 @@
 
     GraphicsContextState state(*changeFlags);
 
-    if (!decode(state, Change::FillBrush,                   &GraphicsContextState::fillBrush))
+    if (!decode(state, Change::FillBrush,                   &GraphicsContextState::m_fillBrush))
         return std::nullopt;
-    if (!decode(state, Change::FillRule,                    &GraphicsContextState::fillRule))
+    if (!decode(state, Change::FillRule,                    &GraphicsContextState::m_fillRule))
         return std::nullopt;
 
-    if (!decode(state, Change::StrokeBrush,                 &GraphicsContextState::strokeBrush))
+    if (!decode(state, Change::StrokeBrush,                 &GraphicsContextState::m_strokeBrush))
         return std::nullopt;
-    if (!decode(state, Change::StrokeThickness,             &GraphicsContextState::strokeThickness))
+    if (!decode(state, Change::StrokeThickness,             &GraphicsContextState::m_strokeThickness))
         return std::nullopt;
-    if (!decode(state, Change::StrokeStyle,                 &GraphicsContextState::strokeStyle))
+    if (!decode(state, Change::StrokeStyle,                 &GraphicsContextState::m_strokeStyle))
         return std::nullopt;
 
-    if (!decode(state, Change::CompositeMode,               &GraphicsContextState::compositeMode))
+    if (!decode(state, Change::CompositeMode,               &GraphicsContextState::m_compositeMode))
         return std::nullopt;
-    if (!decode(state, Change::DropShadow,                  &GraphicsContextState::dropShadow))
+    if (!decode(state, Change::DropShadow,                  &GraphicsContextState::m_dropShadow))
         return std::nullopt;
 
-    if (!decode(state, Change::Alpha,                       &GraphicsContextState::alpha))
+    if (!decode(state, Change::Alpha,                       &GraphicsContextState::m_alpha))
         return std::nullopt;
-    if (!decode(state, Change::ImageInterpolationQuality,   &GraphicsContextState::imageInterpolationQuality))
+    if (!decode(state, Change::ImageInterpolationQuality,   &GraphicsContextState::m_imageInterpolationQuality))
         return std::nullopt;
-    if (!decode(state, Change::TextDrawingMode,             &GraphicsContextState::textDrawingMode))
+    if (!decode(state, Change::TextDrawingMode,             &GraphicsContextState::m_textDrawingMode))
         return std::nullopt;
 
-    if (!decode(state, Change::ShouldAntialias,             &GraphicsContextState::shouldAntialias))
+    if (!decode(state, Change::ShouldAntialias,             &GraphicsContextState::m_shouldAntialias))
         return std::nullopt;
-    if (!decode(state, Change::ShouldSmoothFonts,           &GraphicsContextState::shouldSmoothFonts))
+    if (!decode(state, Change::ShouldSmoothFonts,           &GraphicsContextState::m_shouldSmoothFonts))
         return std::nullopt;
-    if (!decode(state, Change::ShouldSubpixelQuantizeFonts, &GraphicsContextState::shouldSubpixelQuantizeFonts))
+    if (!decode(state, Change::ShouldSubpixelQuantizeFonts, &GraphicsContextState::m_shouldSubpixelQuantizeFonts))
         return std::nullopt;
-    if (!decode(state, Change::ShadowsIgnoreTransforms,     &GraphicsContextState::shadowsIgnoreTransforms))
+    if (!decode(state, Change::ShadowsIgnoreTransforms,     &GraphicsContextState::m_shadowsIgnoreTransforms))
         return std::nullopt;
-    if (!decode(state, Change::DrawLuminanceMask,           &GraphicsContextState::drawLuminanceMask))
+    if (!decode(state, Change::DrawLuminanceMask,           &GraphicsContextState::m_drawLuminanceMask))
         return std::nullopt;
 #if HAVE(OS_DARK_MODE_SUPPORT)
-    if (!decode(state, Change::UseDarkAppearance,           &GraphicsContextState::useDarkAppearance))
+    if (!decode(state, Change::UseDarkAppearance,           &GraphicsContextState::m_useDarkAppearance))
         return std::nullopt;
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -556,10 +556,10 @@
 } // namespace State
 
 FillSource::FillSource(const GraphicsContextState& state)
-    : globalAlpha(state.alpha)
-    , fillRule(state.fillRule)
+    : globalAlpha(state.alpha())
+    , fillRule(state.fillRule())
 {
-    if (auto fillPattern = state.fillBrush.pattern()) {
+    if (auto fillPattern = state.fillBrush().pattern()) {
         pattern.object = adoptRef(fillPattern->createPlatformPattern(AffineTransform()));
 
         auto& patternImage = fillPattern->tileImage();
@@ -567,34 +567,34 @@
         pattern.transform = fillPattern->patternSpaceTransform();
         pattern.repeatX = fillPattern->repeatX();
         pattern.repeatY = fillPattern->repeatY();
-    } else if (auto fillGradient = state.fillBrush.gradient()) {
-        gradient.base = fillGradient->createPattern(1, state.fillBrush.gradientSpaceTransform());
-        if (state.alpha != 1)
-            gradient.alphaAdjusted = fillGradient->createPattern(state.alpha, state.fillBrush.gradientSpaceTransform());
+    } else if (auto fillGradient = state.fillBrush().gradient()) {
+        gradient.base = fillGradient->createPattern(1, state.fillBrush().gradientSpaceTransform());
+        if (state.alpha() != 1)
+            gradient.alphaAdjusted = fillGradient->createPattern(state.alpha(), state.fillBrush().gradientSpaceTransform());
     } else
-        color = state.fillBrush.color();
+        color = state.fillBrush().color();
 }
 
 StrokeSource::StrokeSource(const GraphicsContextState& state)
-    : globalAlpha(state.alpha)
+    : globalAlpha(state.alpha())
 {
-    if (auto strokePattern = state.strokeBrush.pattern())
+    if (auto strokePattern = state.strokeBrush().pattern())
         pattern = adoptRef(strokePattern->createPlatformPattern(AffineTransform()));
-    else if (auto strokeGradient = state.strokeBrush.gradient()) {
-        gradient.base = strokeGradient->createPattern(1, state.strokeBrush.gradientSpaceTransform());
-        if (state.alpha != 1)
-            gradient.alphaAdjusted = strokeGradient->createPattern(state.alpha, state.strokeBrush.gradientSpaceTransform());
+    else if (auto strokeGradient = state.strokeBrush().gradient()) {
+        gradient.base = strokeGradient->createPattern(1, state.strokeBrush().gradientSpaceTransform());
+        if (state.alpha() != 1)
+            gradient.alphaAdjusted = strokeGradient->createPattern(state.alpha(), state.strokeBrush().gradientSpaceTransform());
     } else
-        color = state.strokeBrush.color();
+        color = state.strokeBrush().color();
 }
 
 ShadowState::ShadowState(const GraphicsContextState& state)
-    : offset(state.dropShadow.offset)
-    , blur(state.dropShadow.blurRadius)
-    , color(state.dropShadow.color)
-    , ignoreTransforms(state.shadowsIgnoreTransforms)
-    , globalAlpha(state.alpha)
-    , globalCompositeOperator(state.compositeMode.operation)
+    : offset(state.dropShadow().offset)
+    , blur(state.dropShadow().blurRadius)
+    , color(state.dropShadow().color)
+    , ignoreTransforms(state.shadowsIgnoreTransforms())
+    , globalAlpha(state.alpha())
+    , globalCompositeOperator(state.compositeMode().operation)
 {
 }
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -72,7 +72,7 @@
     auto& state = context.state();
     Cairo::drawGlyphs(*context.platformContext(), Cairo::FillSource(state), Cairo::StrokeSource(state),
         Cairo::ShadowState(state), point, scaledFont, syntheticBoldOffset, cairoGlyphs, xOffset,
-        state.textDrawingMode, state.strokeThickness, state.dropShadow.offset, state.dropShadow.color,
+        state.textDrawingMode(), state.strokeThickness(), state.dropShadow().offset, state.dropShadow().color,
         fontSmoothingMode);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -144,7 +144,7 @@
 void GraphicsContextCairo::drawNativeImage(NativeImage& nativeImage, const FloatSize&, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
 {
     auto& state = this->state();
-    Cairo::drawPlatformImage(*this, nativeImage.platformImage().get(), destRect, srcRect, { options, state.imageInterpolationQuality }, state.alpha, Cairo::ShadowState(state));
+    Cairo::drawPlatformImage(*this, nativeImage.platformImage().get(), destRect, srcRect, { options, state.imageInterpolationQuality() }, state.alpha(), Cairo::ShadowState(state));
 }
 
 // This is only used to draw borders, so we should not draw shadows.
@@ -283,26 +283,26 @@
 void GraphicsContextCairo::didUpdateState(GraphicsContextState& state)
 {
     if (state.changes().contains(GraphicsContextState::Change::StrokeThickness))
-        Cairo::State::setStrokeThickness(*this, state.strokeThickness);
+        Cairo::State::setStrokeThickness(*this, state.strokeThickness());
 
     if (state.changes().contains(GraphicsContextState::Change::StrokeStyle))
-        Cairo::State::setStrokeStyle(*this, state.strokeStyle);
+        Cairo::State::setStrokeStyle(*this, state.strokeStyle());
 
     // FIXME: m_state should not be changed to flip the shadow offset. This can happen when the shadow is applied to the platform context.
     if (state.changes().contains(GraphicsContextState::Change::DropShadow)) {
-        if (state.shadowsIgnoreTransforms) {
+        if (state.shadowsIgnoreTransforms()) {
             // Meaning that this graphics context is associated with a CanvasRenderingContext
             // We flip the height since CG and HTML5 Canvas have opposite Y axis
-            auto& shadowOffset = state.dropShadow.offset;
-            m_state.dropShadow.offset = { shadowOffset.width(), -shadowOffset.height() };
+            auto& shadowOffset = state.dropShadow().offset;
+            m_state.m_dropShadow.offset = { shadowOffset.width(), -shadowOffset.height() };
         }
     }
 
     if (state.changes().contains(GraphicsContextState::Change::CompositeMode))
-        Cairo::State::setCompositeOperation(*this, state.compositeMode.operation, state.compositeMode.blendMode);
+        Cairo::State::setCompositeOperation(*this, state.compositeMode().operation, state.compositeMode().blendMode);
 
     if (state.changes().contains(GraphicsContextState::Change::ShouldAntialias))
-        Cairo::State::setShouldAntialias(*this, state.shouldAntialias);
+        Cairo::State::setShouldAntialias(*this, state.shouldAntialias());
 
     state.didApplyChanges();
 }
@@ -433,7 +433,7 @@
     auto& state = this->state();
     Cairo::drawGlyphs(*this, Cairo::FillSource(state), Cairo::StrokeSource(state),
         Cairo::ShadowState(state), point, scaledFont, syntheticBoldOffset, cairoGlyphs, xOffset,
-        state.textDrawingMode, state.strokeThickness, state.dropShadow.offset, state.dropShadow.color,
+        state.textDrawingMode(), state.strokeThickness(), state.dropShadow().offset, state.dropShadow().color,
         fontSmoothing);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -65,7 +65,7 @@
     const auto& destinationContextState = destContext.state();
 
     if (auto image = copyNativeImage(&destContext == &context() ? CopyBackingStore : DontCopyBackingStore))
-        drawPlatformImage(*destContext.platformContext(), image->platformImage().get(), destRect, srcRect, { options, destinationContextState.imageInterpolationQuality }, destinationContextState.alpha, WebCore::Cairo::ShadowState(destinationContextState));
+        drawPlatformImage(*destContext.platformContext(), image->platformImage().get(), destRect, srcRect, { options, destinationContextState.imageInterpolationQuality() }, destinationContextState.alpha(), WebCore::Cairo::ShadowState(destinationContextState));
 }
 
 void ImageBufferCairoBackend::drawPattern(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -60,9 +60,9 @@
     return CGAffineTransformConcat(CGContextGetCTM(context), CGAffineTransformInvert(CGContextGetBaseCTM(context)));
 }
 
-static InterpolationQuality coreInterpolationQuality(CGInterpolationQuality quality)
+static InterpolationQuality coreInterpolationQuality(CGContextRef context)
 {
-    switch (quality) {
+    switch (CGContextGetInterpolationQuality(context)) {
     case kCGInterpolationDefault:
         return InterpolationQuality::Default;
     case kCGInterpolationNone:
@@ -185,7 +185,7 @@
 }
 
 GraphicsContextCG::GraphicsContextCG(CGContextRef cgContext)
-    : GraphicsContext({ GraphicsContextState::Change::FillBrush, GraphicsContextState::Change::StrokeBrush, GraphicsContextState::Change::StrokeThickness })
+    : GraphicsContext(GraphicsContextState::basicChangeFlags, coreInterpolationQuality(cgContext))
 {
     if (!cgContext)
         return;
@@ -193,7 +193,6 @@
     m_data = new GraphicsContextPlatformPrivate(cgContext);
     // Make sure the context starts in sync with our state.
     didUpdateState(m_state);
-    m_state.imageInterpolationQuality = coreInterpolationQuality(CGContextGetInterpolationQuality(platformContext()));
 }
 
 GraphicsContextCG::~GraphicsContextCG()
@@ -1084,43 +1083,43 @@
     for (auto change : state.changes()) {
         switch (change) {
         case GraphicsContextState::Change::FillBrush:
-            setCGFillColor(context, state.fillBrush.color());
+            setCGFillColor(context, state.fillBrush().color());
             break;
 
         case GraphicsContextState::Change::StrokeThickness:
-            CGContextSetLineWidth(context, std::max(state.strokeThickness, 0.f));
+            CGContextSetLineWidth(context, std::max(state.strokeThickness(), 0.f));
             break;
 
         case GraphicsContextState::Change::StrokeBrush:
-            CGContextSetStrokeColorWithColor(context, cachedCGColor(state.strokeBrush.color()).get());
+            CGContextSetStrokeColorWithColor(context, cachedCGColor(state.strokeBrush().color()).get());
             break;
 
         case GraphicsContextState::Change::CompositeMode:
-            setCGBlendMode(context, state.compositeMode.operation, state.compositeMode.blendMode);
+            setCGBlendMode(context, state.compositeMode().operation, state.compositeMode().blendMode);
             break;
 
         case GraphicsContextState::Change::DropShadow:
-            setCGShadow(context, renderingMode(), state.dropShadow.offset, state.dropShadow.blurRadius, state.dropShadow.color, state.shadowsIgnoreTransforms);
+            setCGShadow(context, renderingMode(), state.dropShadow().offset, state.dropShadow().blurRadius, state.dropShadow().color, state.shadowsIgnoreTransforms());
             break;
 
         case GraphicsContextState::Change::Alpha:
-            CGContextSetAlpha(context, state.alpha);
+            CGContextSetAlpha(context, state.alpha());
             break;
 
         case GraphicsContextState::Change::ImageInterpolationQuality:
-            CGContextSetInterpolationQuality(context, cgInterpolationQuality(state.imageInterpolationQuality));
+            CGContextSetInterpolationQuality(context, cgInterpolationQuality(state.imageInterpolationQuality()));
             break;
 
         case GraphicsContextState::Change::TextDrawingMode:
-            CGContextSetTextDrawingMode(context, cgTextDrawingMode(state.textDrawingMode));
+            CGContextSetTextDrawingMode(context, cgTextDrawingMode(state.textDrawingMode()));
             break;
 
         case GraphicsContextState::Change::ShouldAntialias:
-            CGContextSetShouldAntialias(context, state.shouldAntialias);
+            CGContextSetShouldAntialias(context, state.shouldAntialias());
             break;
 
         case GraphicsContextState::Change::ShouldSmoothFonts:
-            CGContextSetShouldSmoothFonts(context, state.shouldSmoothFonts);
+            CGContextSetShouldSmoothFonts(context, state.shouldSmoothFonts());
             break;
 
         default:
@@ -1155,7 +1154,6 @@
             auto layer = adoptCF(CGLayerCreateWithContext(context, layerSize, 0));
 
             CGContextRef layerContext = CGLayerGetContext(layer.get());
-            m_state.strokeThickness = lineWidth;
             CGContextSetLineWidth(layerContext, lineWidth);
 
             // Compensate for the line width, otherwise the layer's top-left corner would be
@@ -1488,7 +1486,7 @@
 
 bool GraphicsContextCG::canUseShadowBlur() const
 {
-    return (renderingMode() == RenderingMode::Unaccelerated) && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms;
+    return (renderingMode() == RenderingMode::Unaccelerated) && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms();
 }
 
 }

Modified: trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -96,13 +96,13 @@
 
 void DrawGlyphsRecorder::populateInternalState(const GraphicsContextState& contextState)
 {
-    m_originalState.fillBrush = contextState.fillBrush;
-    m_originalState.strokeBrush = contextState.strokeBrush;
+    m_originalState.fillBrush = contextState.fillBrush();
+    m_originalState.strokeBrush = contextState.strokeBrush();
 
     m_originalState.ctm = m_owner.getCTM(); // FIXME: Deal with base CTM.
 
-    m_originalState.dropShadow = contextState.dropShadow;
-    m_originalState.ignoreTransforms = contextState.shadowsIgnoreTransforms;
+    m_originalState.dropShadow = contextState.dropShadow();
+    m_originalState.ignoreTransforms = contextState.shadowsIgnoreTransforms();
 }
 
 void DrawGlyphsRecorder::populateInternalContext(const GraphicsContextState& contextState)
@@ -115,7 +115,7 @@
     m_internalContext->setShadowsIgnoreTransforms(m_originalState.ignoreTransforms);
     m_internalContext->setDropShadow(m_originalState.dropShadow);
 
-    m_internalContext->setTextDrawingMode(contextState.textDrawingMode);
+    m_internalContext->setTextDrawingMode(contextState.textDrawingMode());
 }
 
 void DrawGlyphsRecorder::prepareInternalContext(const Font& font, FontSmoothingMode smoothingMode)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -90,7 +90,7 @@
         if (!(flags & AsTextFlag::IncludesPlatformOperations)) {
             const auto& stateItem = item.get<SetState>();
             // FIXME: for now, only drop the item if the only state-change flags are platform-specific.
-            if (stateItem.state().changeFlags == GraphicsContextState::Change::ShouldSubpixelQuantizeFonts)
+            if (stateItem.state().changes() == GraphicsContextState::Change::ShouldSubpixelQuantizeFonts)
                 return false;
         }
         break;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -284,7 +284,7 @@
     recordEndTransparencyLayer();
     m_stateStack.removeLast();
 
-    m_state.didEndTransparencyLayer(currentState().state.alpha);
+    m_state.didEndTransparencyLayer(currentState().state.alpha());
 }
 
 void Recorder::drawRect(const FloatRect& rect, float borderThickness)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -97,10 +97,10 @@
         return std::nullopt;
     };
 
-    if (auto imageIdentifier = fixPatternTileImage(setStateItem.state().strokeBrush.pattern()))
+    if (auto imageIdentifier = fixPatternTileImage(setStateItem.state().strokeBrush().pattern()))
         return *imageIdentifier;
 
-    if (auto imageIdentifier = fixPatternTileImage(setStateItem.state().fillBrush.pattern()))
+    if (auto imageIdentifier = fixPatternTileImage(setStateItem.state().fillBrush().pattern()))
         return *imageIdentifier;
 
     setStateItem.apply(context);

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp (291695 => 291696)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -99,7 +99,7 @@
             }
         };
 
-        append(createCommand<StrokeThicknessChange>(state.strokeThickness));
+        append(createCommand<StrokeThicknessChange>(state.strokeThickness()));
     }
 
     if (state.changes().contains(GraphicsContextState::Change::StrokeStyle)) {
@@ -117,7 +117,7 @@
             }
         };
 
-        append(createCommand<StrokeStyleChange>(state.strokeStyle));
+        append(createCommand<StrokeStyleChange>(state.strokeStyle()));
     }
 
     if (state.changes().contains(GraphicsContextState::Change::CompositeMode)) {
@@ -135,7 +135,7 @@
             }
         };
 
-        append(createCommand<CompositeOperationChange>(state.compositeMode.operation, state.compositeMode.blendMode));
+        append(createCommand<CompositeOperationChange>(state.compositeMode().operation, state.compositeMode().blendMode));
     }
 
     if (state.changes().contains(GraphicsContextState::Change::ShouldAntialias)) {
@@ -153,7 +153,7 @@
             }
         };
 
-        append(createCommand<ShouldAntialiasChange>(state.shouldAntialias));
+        append(createCommand<ShouldAntialiasChange>(state.shouldAntialias()));
     }
 
     state.didApplyChanges();
@@ -294,7 +294,7 @@
     };
 
     auto& state = this->state();
-    append(createCommand<FillRect>(rect, gradient.createPattern(1.0, state.fillBrush.gradientSpaceTransform())));
+    append(createCommand<FillRect>(rect, gradient.createPattern(1.0, state.fillBrush().gradientSpaceTransform())));
 }
 
 void CairoOperationRecorder::fillRect(const FloatRect& rect, const Color& color, CompositeOperator compositeOperator, BlendMode blendMode)
@@ -318,7 +318,7 @@
     };
 
     auto& state = this->state();
-    append(createCommand<FillRect>(rect, color, compositeOperator, blendMode, Cairo::ShadowState(state), state.compositeMode.operation));
+    append(createCommand<FillRect>(rect, color, compositeOperator, blendMode, Cairo::ShadowState(state), state.compositeMode().operation));
 }
 
 void CairoOperationRecorder::fillRoundedRect(const FloatRoundedRect& roundedRect, const Color& color, BlendMode blendMode)
@@ -348,7 +348,7 @@
     };
 
     auto& state = this->state();
-    append(createCommand<FillRoundedRect>(roundedRect, color, state.compositeMode.operation, blendMode, Cairo::ShadowState(state)));
+    append(createCommand<FillRoundedRect>(roundedRect, color, state.compositeMode().operation, blendMode, Cairo::ShadowState(state)));
 }
 
 void CairoOperationRecorder::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color)
@@ -534,8 +534,8 @@
     append(createCommand<DrawGlyphs>(Cairo::FillSource(state), Cairo::StrokeSource(state),
         Cairo::ShadowState(state), point,
         RefPtr<cairo_scaled_font_t>(font.platformData().scaledFont()),
-        font.syntheticBoldOffset(), WTFMove(cairoGlyphs), xOffset, state.textDrawingMode,
-        state.strokeThickness, state.dropShadow.offset, state.dropShadow.color, fontSmoothing));
+        font.syntheticBoldOffset(), WTFMove(cairoGlyphs), xOffset, state.textDrawingMode(),
+        state.strokeThickness(), state.dropShadow().offset, state.dropShadow().color, fontSmoothing));
 }
 
 void CairoOperationRecorder::drawImageBuffer(ImageBuffer&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&)
@@ -561,7 +561,7 @@
 
     UNUSED_PARAM(imageSize);
     auto& state = this->state();
-    append(createCommand<DrawNativeImage>(nativeImage.platformImage(), destRect, srcRect, ImagePaintingOptions(options, state.imageInterpolationQuality), state.alpha, Cairo::ShadowState(state)));
+    append(createCommand<DrawNativeImage>(nativeImage.platformImage(), destRect, srcRect, ImagePaintingOptions(options, state.imageInterpolationQuality()), state.alpha(), Cairo::ShadowState(state)));
 }
 
 void CairoOperationRecorder::drawPattern(NativeImage& nativeImage, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
@@ -601,7 +601,7 @@
     };
 
     auto& state = this->state();
-    append(createCommand<DrawRect>(rect, borderThickness, state.fillBrush.color(), state.strokeStyle, state.strokeBrush.color()));
+    append(createCommand<DrawRect>(rect, borderThickness, state.fillBrush().color(), state.strokeStyle(), state.strokeBrush().color()));
 }
 
 void CairoOperationRecorder::drawLine(const FloatPoint& point1, const FloatPoint& point2)
@@ -624,7 +624,7 @@
         return;
 
     auto& state = this->state();
-    append(createCommand<DrawLine>(point1, point2, state.strokeStyle, state.strokeBrush.color(), state.strokeThickness, state.shouldAntialias));
+    append(createCommand<DrawLine>(point1, point2, state.strokeStyle(), state.strokeBrush().color(), state.strokeThickness(), state.shouldAntialias()));
 }
 
 void CairoOperationRecorder::drawLinesForText(const FloatPoint& point, float thickness, const DashArray& widths, bool printing, bool doubleUnderlines, StrokeStyle)
@@ -647,7 +647,7 @@
         return;
 
     auto& state = this->state();
-    append(createCommand<DrawLinesForText>(point, thickness, widths, printing, doubleUnderlines, state.strokeBrush.color()));
+    append(createCommand<DrawLinesForText>(point, thickness, widths, printing, doubleUnderlines, state.strokeBrush().color()));
 }
 
 void CairoOperationRecorder::drawDotsForDocumentMarker(const FloatRect& rect, DocumentMarkerLineStyle style)
@@ -686,7 +686,7 @@
     };
 
     auto& state = this->state();
-    append(createCommand<DrawEllipse>(rect, state.fillBrush.color(), state.strokeStyle, state.strokeBrush.color(), state.strokeThickness));
+    append(createCommand<DrawEllipse>(rect, state.fillBrush().color(), state.strokeStyle(), state.strokeBrush().color(), state.strokeThickness()));
 }
 
 void CairoOperationRecorder::drawFocusRing(const Path& path, float width, float offset, const Color& color)

Modified: trunk/Source/WebKit/ChangeLog (291695 => 291696)


--- trunk/Source/WebKit/ChangeLog	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebKit/ChangeLog	2022-03-22 20:37:51 UTC (rev 291696)
@@ -1,3 +1,17 @@
+2022-03-22  Said Abou-Hallawa  <s...@apple.com>
+
+        [GPU Process] Make GraphicsContextState a class
+        https://bugs.webkit.org/show_bug.cgi?id=238192
+
+        Reviewed by Simon Fraser.
+
+        * GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
+        (WebKit::RemoteDisplayListRecorder::setState):
+        * Shared/cairo/ShareableBitmapCairo.cpp:
+        (WebKit::ShareableBitmap::paint):
+        * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
+        (WebKit::convertCairoSurfaceToShareableBitmap):
+
 2022-03-22  Tim Horton  <timothy_hor...@apple.com>
 
         Prefer WK_EXTERN to WK_EXPORT in Cocoa API headers

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp (291695 => 291696)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -128,10 +128,10 @@
         return true;
     };
 
-    if (!fixPatternTileImage(item.state().fillBrush.pattern()))
+    if (!fixPatternTileImage(item.state().fillBrush().pattern()))
         return;
 
-    if (!fixPatternTileImage(item.state().strokeBrush.pattern()))
+    if (!fixPatternTileImage(item.state().strokeBrush().pattern()))
         return;
 
     handleItem(WTFMove(item));

Modified: trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp (291695 => 291696)


--- trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -78,7 +78,7 @@
 
     ASSERT(context.hasPlatformContext());
     auto& state = context.state();
-    Cairo::drawSurface(*context.platformContext(), surface.get(), destRect, srcRect, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
+    Cairo::drawSurface(*context.platformContext(), surface.get(), destRect, srcRect, state.imageInterpolationQuality(), state.alpha(), Cairo::ShadowState(state));
 }
 
 RefPtr<cairo_surface_t> ShareableBitmap::createCairoSurface()

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp (291695 => 291696)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2022-03-22 20:33:50 UTC (rev 291695)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp	2022-03-22 20:37:51 UTC (rev 291696)
@@ -54,7 +54,7 @@
 
     ASSERT(graphicsContext->hasPlatformContext());
     auto& state = graphicsContext->state();
-    Cairo::drawSurface(*graphicsContext->platformContext(), surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state));
+    Cairo::drawSurface(*graphicsContext->platformContext(), surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), state.imageInterpolationQuality(), state.alpha(), Cairo::ShadowState(state));
     return bitmap;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to