Title: [289594] trunk/Source
Revision
289594
Author
[email protected]
Date
2022-02-10 16:27:14 -0800 (Thu, 10 Feb 2022)

Log Message

[GPU Process] Delete GraphicsContext::clipToDrawingCommands()
https://bugs.webkit.org/show_bug.cgi?id=225959
rdar://78495380

Reviewed by Darin Adler.

Source/WebCore:

This function was added in r267742 as a workaround for a GPUProcess case
which was happening because ImageBuffer::createCompatibleBuffer() used
to return in-process ImageBuffer. clipToDrawingCommands() was a way to
record the clipper mask image into a temporary remote ImageBuffer.

If GraphicsContext::createCompatibleImageBuffer() can create an
ImageBuffer similar to the underlying ImageBuffer of the GraphicsContext,
then GraphicsContext::clipToDrawingCommands() is not needed.

* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::clipToDrawingCommands): Deleted.
* platform/graphics/GraphicsContext.h:
* platform/graphics/NullGraphicsContext.h:
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::safeCopy const):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::BeginClipToDrawingCommands::BeginClipToDrawingCommands): Deleted.
(WebCore::DisplayList::BeginClipToDrawingCommands::~BeginClipToDrawingCommands): Deleted.
(WebCore::DisplayList::BeginClipToDrawingCommands::destination const): Deleted.
(WebCore::DisplayList::BeginClipToDrawingCommands::colorSpace const): Deleted.
(WebCore::DisplayList::BeginClipToDrawingCommands::encode const): Deleted.
(WebCore::DisplayList::BeginClipToDrawingCommands::decode): Deleted.
(WebCore::DisplayList::EndClipToDrawingCommands::EndClipToDrawingCommands): Deleted.
(WebCore::DisplayList::EndClipToDrawingCommands::destination const): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::clipToDrawingCommands): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::~RecorderImpl):
(WebCore::DisplayList::RecorderImpl::createNestedContext): Deleted.
(WebCore::DisplayList::RecorderImpl::recordBeginClipToDrawingCommands): Deleted.
(WebCore::DisplayList::RecorderImpl::recordEndClipToDrawingCommands): Deleted.
* platform/graphics/displaylists/DisplayListRecorderImpl.h:
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::applyItem):
(WebCore::DisplayList::Replayer::context const): Deleted.
* platform/graphics/displaylists/DisplayListReplayer.h:
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::clipToDrawingCommands): Deleted.
* platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:

Source/WebKit:

* GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::drawingContext):
(WebKit::RemoteDisplayListRecorder::beginClipToDrawingCommands): Deleted.
(WebKit::RemoteDisplayListRecorder::endClipToDrawingCommands): Deleted.
* GPUProcess/graphics/RemoteDisplayListRecorder.h:
* GPUProcess/graphics/RemoteDisplayListRecorder.messages.in:
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::recordBeginClipToDrawingCommands): Deleted.
(WebKit::RemoteDisplayListRecorderProxy::recordEndClipToDrawingCommands): Deleted.
(WebKit::RemoteDisplayListRecorderProxy::createNestedContext): Deleted.
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289593 => 289594)


--- trunk/Source/WebCore/ChangeLog	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/ChangeLog	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,3 +1,65 @@
+2022-02-10  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] Delete GraphicsContext::clipToDrawingCommands()
+        https://bugs.webkit.org/show_bug.cgi?id=225959
+        rdar://78495380
+
+        Reviewed by Darin Adler.
+
+        This function was added in r267742 as a workaround for a GPUProcess case
+        which was happening because ImageBuffer::createCompatibleBuffer() used
+        to return in-process ImageBuffer. clipToDrawingCommands() was a way to
+        record the clipper mask image into a temporary remote ImageBuffer.
+
+        If GraphicsContext::createCompatibleImageBuffer() can create an
+        ImageBuffer similar to the underlying ImageBuffer of the GraphicsContext,
+        then GraphicsContext::clipToDrawingCommands() is not needed.
+
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::clipToDrawingCommands): Deleted.
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/NullGraphicsContext.h:
+        * platform/graphics/displaylists/DisplayList.cpp:
+        (WebCore::DisplayList::DisplayList::append):
+        * platform/graphics/displaylists/DisplayListItemBuffer.cpp:
+        (WebCore::DisplayList::ItemHandle::apply):
+        (WebCore::DisplayList::ItemHandle::destroy):
+        (WebCore::DisplayList::ItemHandle::safeCopy const):
+        * platform/graphics/displaylists/DisplayListItemType.cpp:
+        (WebCore::DisplayList::sizeOfItemInBytes):
+        (WebCore::DisplayList::isDrawingItem):
+        (WebCore::DisplayList::isInlineItem):
+        * platform/graphics/displaylists/DisplayListItemType.h:
+        * platform/graphics/displaylists/DisplayListItems.cpp:
+        (WebCore::DisplayList::operator<<):
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::BeginClipToDrawingCommands::BeginClipToDrawingCommands): Deleted.
+        (WebCore::DisplayList::BeginClipToDrawingCommands::~BeginClipToDrawingCommands): Deleted.
+        (WebCore::DisplayList::BeginClipToDrawingCommands::destination const): Deleted.
+        (WebCore::DisplayList::BeginClipToDrawingCommands::colorSpace const): Deleted.
+        (WebCore::DisplayList::BeginClipToDrawingCommands::encode const): Deleted.
+        (WebCore::DisplayList::BeginClipToDrawingCommands::decode): Deleted.
+        (WebCore::DisplayList::EndClipToDrawingCommands::EndClipToDrawingCommands): Deleted.
+        (WebCore::DisplayList::EndClipToDrawingCommands::destination const): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::clipToDrawingCommands): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
+        (WebCore::DisplayList::RecorderImpl::~RecorderImpl):
+        (WebCore::DisplayList::RecorderImpl::createNestedContext): Deleted.
+        (WebCore::DisplayList::RecorderImpl::recordBeginClipToDrawingCommands): Deleted.
+        (WebCore::DisplayList::RecorderImpl::recordEndClipToDrawingCommands): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorderImpl.h:
+        * platform/graphics/displaylists/DisplayListReplayer.cpp:
+        (WebCore::DisplayList::Replayer::applyItem):
+        (WebCore::DisplayList::Replayer::context const): Deleted.
+        * platform/graphics/displaylists/DisplayListReplayer.h:
+        * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
+        (Nicosia::CairoOperationRecorder::clipToDrawingCommands): Deleted.
+        * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
+
 2022-02-10  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r289525.

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (289593 => 289594)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -2459,33 +2459,33 @@
             fontProxy.drawBidiText(*c, textRun, location + offset, FontCascade::UseFallbackIfFontNotReady);
         }
 
-        GraphicsContextStateSaver stateSaver(*c);
+        auto maskImage = c->createCompatibleImageBuffer(maskRect.size());
+        if (!maskImage)
+            return;
 
-        auto paintMaskImage = [&] (GraphicsContext& maskImageContext) {
-            if (fill)
-                maskImageContext.setFillColor(Color::black);
-            else {
-                maskImageContext.setStrokeColor(Color::black);
-                maskImageContext.setStrokeThickness(c->strokeThickness());
-            }
+        auto& maskImageContext = maskImage->context();
 
-            maskImageContext.setTextDrawingMode(fill ? TextDrawingMode::Fill : TextDrawingMode::Stroke);
+        if (fill)
+            maskImageContext.setFillColor(Color::black);
+        else {
+            maskImageContext.setStrokeColor(Color::black);
+            maskImageContext.setStrokeThickness(c->strokeThickness());
+        }
 
-            if (useMaxWidth) {
-                maskImageContext.translate(location - maskRect.location());
-                // We draw when fontWidth is 0 so compositing operations (eg, a "copy" op) still work.
-                maskImageContext.scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1));
-                fontProxy.drawBidiText(maskImageContext, textRun, FloatPoint(0, 0), FontCascade::UseFallbackIfFontNotReady);
-            } else {
-                maskImageContext.translate(-maskRect.location());
-                fontProxy.drawBidiText(maskImageContext, textRun, location, FontCascade::UseFallbackIfFontNotReady);
-            }
-        };
+        maskImageContext.setTextDrawingMode(fill ? TextDrawingMode::Fill : TextDrawingMode::Stroke);
 
-        // FIXME: Handling gradients and patterns by painting the text into a mask is probably the wrong thing to do in the presence of color glyphs.
-        if (c->clipToDrawingCommands(maskRect, colorSpace(), WTFMove(paintMaskImage)) == GraphicsContext::ClipToDrawingCommandsResult::FailedToCreateImageBuffer)
-            return;
+        if (useMaxWidth) {
+            maskImageContext.translate(location - maskRect.location());
+            // We draw when fontWidth is 0 so compositing operations (eg, a "copy" op) still work.
+            maskImageContext.scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1));
+            fontProxy.drawBidiText(maskImageContext, textRun, FloatPoint(0, 0), FontCascade::UseFallbackIfFontNotReady);
+        } else {
+            maskImageContext.translate(-maskRect.location());
+            fontProxy.drawBidiText(maskImageContext, textRun, location, FontCascade::UseFallbackIfFontNotReady);
+        }
 
+        GraphicsContextStateSaver stateSaver(*c);
+        c->clipToImageBuffer(*maskImage, maskRect);
         drawStyle.applyFillColor(*c);
         c->fillRect(maskRect);
         return;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -753,17 +753,6 @@
     clipOut(path);
 }
 
-GraphicsContext::ClipToDrawingCommandsResult GraphicsContext::clipToDrawingCommands(const FloatRect& destination, const DestinationColorSpace& colorSpace, Function<void(GraphicsContext&)>&& drawingFunction)
-{
-    auto imageBuffer = createCompatibleImageBuffer(destination.size(), colorSpace);
-    if (!imageBuffer)
-        return ClipToDrawingCommandsResult::FailedToCreateImageBuffer;
-
-    drawingFunction(imageBuffer->context());
-    clipToImageBuffer(*imageBuffer, destination);
-    return ClipToDrawingCommandsResult::Success;
-}
-
 void GraphicsContext::clipToImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destinationRect)
 {
     imageBuffer.clipToMask(*this, destinationRect);

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -461,10 +461,6 @@
     WEBCORE_EXPORT virtual void clipOutRoundedRect(const FloatRoundedRect&);
     virtual void clipPath(const Path&, WindRule = WindRule::EvenOdd) = 0;
     WEBCORE_EXPORT virtual void clipToImageBuffer(ImageBuffer&, const FloatRect&);
-
-    enum class ClipToDrawingCommandsResult : bool { Success, FailedToCreateImageBuffer };
-    WEBCORE_EXPORT virtual ClipToDrawingCommandsResult clipToDrawingCommands(const FloatRect& destination, const DestinationColorSpace&, Function<void(GraphicsContext&)>&&);
-
     WEBCORE_EXPORT virtual IntRect clipBounds() const;
 
     // Text

Modified: trunk/Source/WebCore/platform/graphics/NullGraphicsContext.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/NullGraphicsContext.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/NullGraphicsContext.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -131,8 +131,6 @@
 
     void clipRoundedRect(const FloatRoundedRect&) final { }
     void clipOutRoundedRect(const FloatRoundedRect&) final { }
-
-    ClipToDrawingCommandsResult clipToDrawingCommands(const FloatRect&, const DestinationColorSpace&, Function<void(GraphicsContext&)>&&) final { return ClipToDrawingCommandsResult::Success; }
     void clipToImageBuffer(ImageBuffer&, const FloatRect&) final { }
 
     void fillRect(const FloatRect&, Gradient&) final { }

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -240,10 +240,6 @@
         return append<ClipOutToPath>(item.get<ClipOutToPath>());
     case ItemType::ClipPath:
         return append<ClipPath>(item.get<ClipPath>());
-    case ItemType::BeginClipToDrawingCommands:
-        return append<BeginClipToDrawingCommands>(item.get<BeginClipToDrawingCommands>());
-    case ItemType::EndClipToDrawingCommands:
-        return append<EndClipToDrawingCommands>(item.get<EndClipToDrawingCommands>());
     case ItemType::DrawFilteredImageBuffer:
         return append<DrawFilteredImageBuffer>(item.get<DrawFilteredImageBuffer>());
     case ItemType::DrawGlyphs:

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -109,12 +109,6 @@
     case ItemType::ClipPath:
         get<ClipPath>().apply(context);
         return;
-    case ItemType::BeginClipToDrawingCommands:
-        ASSERT_NOT_REACHED();
-        return;
-    case ItemType::EndClipToDrawingCommands:
-        ASSERT_NOT_REACHED();
-        return;
     case ItemType::DrawFilteredImageBuffer:
         get<DrawFilteredImageBuffer>().apply(context);
         return;
@@ -311,9 +305,6 @@
         static_assert(std::is_trivially_destructible<ApplyStrokePattern>::value);
         return;
 #endif
-    case ItemType::BeginClipToDrawingCommands:
-        get<BeginClipToDrawingCommands>().~BeginClipToDrawingCommands();
-        return;
     case ItemType::BeginTransparencyLayer:
         static_assert(std::is_trivially_destructible<BeginTransparencyLayer>::value);
         return;
@@ -356,9 +347,6 @@
     case ItemType::DrawRect:
         static_assert(std::is_trivially_destructible<DrawRect>::value);
         return;
-    case ItemType::EndClipToDrawingCommands:
-        static_assert(std::is_trivially_destructible<EndClipToDrawingCommands>::value);
-        return;
     case ItemType::EndTransparencyLayer:
         static_assert(std::is_trivially_destructible<EndTransparencyLayer>::value);
         return;
@@ -531,8 +519,6 @@
     case ItemType::ApplyStrokePattern:
         return copyInto<ApplyStrokePattern>(itemOffset, *this);
 #endif
-    case ItemType::BeginClipToDrawingCommands:
-        return copyInto<BeginClipToDrawingCommands>(itemOffset, *this);
     case ItemType::BeginTransparencyLayer:
         return copyInto<BeginTransparencyLayer>(itemOffset, *this);
     case ItemType::ClearRect:
@@ -555,8 +541,6 @@
         return copyInto<DrawLine>(itemOffset, *this);
     case ItemType::DrawRect:
         return copyInto<DrawRect>(itemOffset, *this);
-    case ItemType::EndClipToDrawingCommands:
-        return copyInto<EndClipToDrawingCommands>(itemOffset, *this);
     case ItemType::EndTransparencyLayer:
         return copyInto<EndTransparencyLayer>(itemOffset, *this);
     case ItemType::FillEllipse:

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -76,10 +76,6 @@
         return sizeof(ClipOutToPath);
     case ItemType::ClipPath:
         return sizeof(ClipPath);
-    case ItemType::BeginClipToDrawingCommands:
-        return sizeof(BeginClipToDrawingCommands);
-    case ItemType::EndClipToDrawingCommands:
-        return sizeof(EndClipToDrawingCommands);
     case ItemType::DrawFilteredImageBuffer:
         return sizeof(DrawFilteredImageBuffer);
     case ItemType::DrawGlyphs:
@@ -190,8 +186,6 @@
     case ItemType::ClipToImageBuffer:
     case ItemType::ClipOutToPath:
     case ItemType::ClipPath:
-    case ItemType::BeginClipToDrawingCommands:
-    case ItemType::EndClipToDrawingCommands:
     case ItemType::ConcatenateCTM:
     case ItemType::FlushContext:
     case ItemType::Restore:
@@ -284,7 +278,6 @@
      * and (3) all the "static constexpr bool isInlineItem"s inside the individual item classes. */
 
     switch (type) {
-    case ItemType::BeginClipToDrawingCommands:
     case ItemType::ClipOutToPath:
     case ItemType::ClipPath:
     case ItemType::DrawFocusRingPath:
@@ -313,7 +306,6 @@
     case ItemType::Clip:
     case ItemType::ClipOut:
     case ItemType::ClipToImageBuffer:
-    case ItemType::EndClipToDrawingCommands:
     case ItemType::ConcatenateCTM:
     case ItemType::DrawDotsForDocumentMarker:
     case ItemType::DrawEllipse:

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,8 +50,6 @@
     ClipToImageBuffer,
     ClipOutToPath,
     ClipPath,
-    BeginClipToDrawingCommands,
-    EndClipToDrawingCommands,
     DrawFilteredImageBuffer,
     DrawGlyphs,
     DrawImageBuffer,

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -281,19 +281,6 @@
     return ts;
 }
 
-static TextStream& operator<<(TextStream& ts, const BeginClipToDrawingCommands& item)
-{
-    ts.dumpProperty("destination", item.destination());
-    ts.dumpProperty("color-space", item.colorSpace());
-    return ts;
-}
-
-static TextStream& operator<<(TextStream& ts, const EndClipToDrawingCommands& item)
-{
-    ts.dumpProperty("destination", item.destination());
-    return ts;
-}
-
 DrawFilteredImageBuffer::DrawFilteredImageBuffer(std::optional<RenderingResourceIdentifier> sourceImageIdentifier, const FloatRect& sourceImageRect, Filter& filter)
     : m_sourceImageIdentifier(sourceImageIdentifier)
     , m_sourceImageRect(sourceImageRect)
@@ -1021,8 +1008,6 @@
     case ItemType::ClipToImageBuffer: ts << "clip-to-image-buffer"; break;
     case ItemType::ClipOutToPath: ts << "clip-out-to-path"; break;
     case ItemType::ClipPath: ts << "clip-path"; break;
-    case ItemType::BeginClipToDrawingCommands: ts << "begin-clip-to-drawing-commands:"; break;
-    case ItemType::EndClipToDrawingCommands: ts << "end-clip-to-drawing-commands"; break;
     case ItemType::DrawFilteredImageBuffer: ts << "draw-filtered-image-buffer"; break;
     case ItemType::DrawGlyphs: ts << "draw-glyphs"; break;
     case ItemType::DrawImageBuffer: ts << "draw-image-buffer"; break;
@@ -1135,12 +1120,6 @@
     case ItemType::ClipPath:
         ts << item.get<ClipPath>();
         break;
-    case ItemType::BeginClipToDrawingCommands:
-        ts << item.get<BeginClipToDrawingCommands>();
-        break;
-    case ItemType::EndClipToDrawingCommands:
-        ts << item.get<EndClipToDrawingCommands>();
-        break;
     case ItemType::DrawFilteredImageBuffer:
         ts << item.get<DrawFilteredImageBuffer>();
         break;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -817,74 +817,6 @@
     return {{ WTFMove(*path), *windRule }};
 }
 
-class BeginClipToDrawingCommands {
-public:
-    static constexpr ItemType itemType = ItemType::BeginClipToDrawingCommands;
-    static constexpr bool isInlineItem = false;
-    static constexpr bool isDrawingItem = false;
-
-    BeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace colorSpace)
-        : m_destination(destination)
-        , m_colorSpace(WTFMove(colorSpace))
-    {
-    }
-
-    // Explicit destructor added to force non-trivial destructor on all platforms
-    // as the encoding logic currently hardcodes which display list item types need
-    // out of line treatment rather than using the isInlineItem constant.
-    ~BeginClipToDrawingCommands() { }
-
-    const FloatRect& destination() const { return m_destination; }
-    const DestinationColorSpace& colorSpace() const { return m_colorSpace; }
-
-    template<class Encoder> void encode(Encoder&) const;
-    template<class Decoder> static std::optional<BeginClipToDrawingCommands> decode(Decoder&);
-
-private:
-    FloatRect m_destination;
-    DestinationColorSpace m_colorSpace;
-};
-
-template<class Encoder>
-void BeginClipToDrawingCommands::encode(Encoder& encoder) const
-{
-    encoder << m_destination;
-    encoder << m_colorSpace;
-}
-
-template<class Decoder>
-std::optional<BeginClipToDrawingCommands> BeginClipToDrawingCommands::decode(Decoder& decoder)
-{
-    std::optional<FloatRect> destination;
-    decoder >> destination;
-    if (!destination)
-        return std::nullopt;
-
-    std::optional<DestinationColorSpace> colorSpace;
-    decoder >> colorSpace;
-    if (!colorSpace)
-        return std::nullopt;
-
-    return {{ *destination, WTFMove(*colorSpace) }};
-}
-
-class EndClipToDrawingCommands {
-public:
-    static constexpr ItemType itemType = ItemType::EndClipToDrawingCommands;
-    static constexpr bool isInlineItem = true;
-    static constexpr bool isDrawingItem = false;
-
-    EndClipToDrawingCommands(const FloatRect& destination)
-        : m_destination(destination)
-    {
-    }
-
-    const FloatRect& destination() const { return m_destination; }
-
-private:
-    FloatRect m_destination;
-};
-
 class DrawFilteredImageBuffer {
 public:
     static constexpr ItemType itemType = ItemType::DrawFilteredImageBuffer;
@@ -2268,7 +2200,6 @@
 
 using DisplayListItem = std::variant
     < ApplyDeviceScaleFactor
-    , BeginClipToDrawingCommands
     , BeginTransparencyLayer
     , ClearRect
     , ClearShadow
@@ -2291,7 +2222,6 @@
     , DrawPath
     , DrawPattern
     , DrawRect
-    , EndClipToDrawingCommands
     , EndTransparencyLayer
     , FillCompositedRect
     , FillEllipse
@@ -2375,8 +2305,6 @@
     WebCore::DisplayList::ItemType::ClipToImageBuffer,
     WebCore::DisplayList::ItemType::ClipOutToPath,
     WebCore::DisplayList::ItemType::ClipPath,
-    WebCore::DisplayList::ItemType::BeginClipToDrawingCommands,
-    WebCore::DisplayList::ItemType::EndClipToDrawingCommands,
     WebCore::DisplayList::ItemType::DrawGlyphs,
     WebCore::DisplayList::ItemType::DrawImageBuffer,
     WebCore::DisplayList::ItemType::DrawNativeImage,

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -486,27 +486,6 @@
     recordClipToImageBuffer(imageBuffer, destRect);
 }
 
-GraphicsContext::ClipToDrawingCommandsResult Recorder::clipToDrawingCommands(const FloatRect& destination, const DestinationColorSpace& colorSpace, Function<void(GraphicsContext&)>&& drawingFunction)
-{
-    auto initialClip = FloatRect(FloatPoint(), destination.size());
-
-    // The initial CTM matches ImageBuffer's initial CTM.
-    AffineTransform transform = getCTM(GraphicsContext::DefinitelyIncludeDeviceScale);
-    FloatSize scaleFactor(transform.xScale(), transform.yScale());
-    auto scaledSize = expandedIntSize(destination.size() * scaleFactor);
-    AffineTransform initialCTM;
-    initialCTM.scale(1, -1);
-    initialCTM.translate(0, -scaledSize.height());
-    initialCTM.scale(scaledSize / destination.size());
-
-    auto nestedContext = createNestedContext(initialClip, initialCTM);
-    recordBeginClipToDrawingCommands(destination, colorSpace);
-    drawingFunction(*nestedContext);
-    recordEndClipToDrawingCommands(destination);
-
-    return ClipToDrawingCommandsResult::Success;
-}
-
 RefPtr<ImageBuffer> Recorder::createImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMode renderingMode, RenderingMethod renderingMethod) const
 {
     if (renderingMethod == RenderingMethod::Default)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -82,8 +82,6 @@
     virtual void recordClipToImageBuffer(ImageBuffer&, const FloatRect& destinationRect) = 0;
     virtual void recordClipOutToPath(const Path&) = 0;
     virtual void recordClipPath(const Path&, WindRule) = 0;
-    virtual void recordBeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace) = 0;
-    virtual void recordEndClipToDrawingCommands(const FloatRect& destination) = 0;
     virtual void recordDrawFilteredImageBuffer(ImageBuffer*, const FloatRect& sourceImageRect, Filter&) = 0;
     virtual void recordDrawGlyphs(const Font&, const GlyphBufferGlyph*, const GlyphBufferAdvance*, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode) = 0;
     virtual void recordDrawImageBuffer(ImageBuffer&, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) = 0;
@@ -137,8 +135,6 @@
     virtual bool recordResourceUse(const SourceImage&) = 0;
     virtual bool recordResourceUse(Font&) = 0;
 
-    virtual std::unique_ptr<GraphicsContext> createNestedContext(const FloatRect& initialClip, const AffineTransform& initialCTM) = 0;
-
     struct ContextState {
         AffineTransform ctm;
         FloatRect clipBounds;
@@ -264,7 +260,6 @@
     WEBCORE_EXPORT void clipPath(const Path&, WindRule) final;
     WEBCORE_EXPORT IntRect clipBounds() const final;
     WEBCORE_EXPORT void clipToImageBuffer(ImageBuffer&, const FloatRect&) final;
-    WEBCORE_EXPORT GraphicsContext::ClipToDrawingCommandsResult clipToDrawingCommands(const FloatRect& destination, const DestinationColorSpace&, Function<void(GraphicsContext&)>&&) final;
 
 #if ENABLE(VIDEO)
     WEBCORE_EXPORT void paintFrameForMedia(MediaPlayer&, const FloatRect& destination) final;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -49,25 +49,11 @@
     LOG_WITH_STREAM(DisplayLists, stream << "\nRecording with clip " << initialClip);
 }
 
-RecorderImpl::RecorderImpl(RecorderImpl& parent, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM)
-    : Recorder(parent, state, initialClip, initialCTM)
-    , m_displayList(parent.m_displayList)
-    , m_isNested(true)
-{
-}
-
 RecorderImpl::~RecorderImpl()
 {
     ASSERT(stateStack().size() == 1); // If this fires, it indicates mismatched save/restore.
-    if (!m_isNested)
-        LOG(DisplayLists, "Recorded display list:\n%s", m_displayList.description().data());
 }
 
-std::unique_ptr<GraphicsContext> RecorderImpl::createNestedContext(const FloatRect& initialClip, const AffineTransform& initialCTM)
-{
-    return makeUnique<RecorderImpl>(*this, GraphicsContextState { }, initialClip, initialCTM);
-}
-
 void RecorderImpl::recordSave()
 {
     append<Save>();
@@ -173,16 +159,6 @@
     append<ClipPath>(path, rule);
 }
 
-void RecorderImpl::recordBeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace colorSpace)
-{
-    append<BeginClipToDrawingCommands>(destination, colorSpace);
-}
-
-void RecorderImpl::recordEndClipToDrawingCommands(const FloatRect& destination)
-{
-    append<EndClipToDrawingCommands>(destination);
-}
-
 void RecorderImpl::recordDrawFilteredImageBuffer(ImageBuffer* sourceImage, const FloatRect& sourceImageRect, Filter& filter)
 {
     std::optional<RenderingResourceIdentifier> identifier;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,8 +36,6 @@
     WTF_MAKE_NONCOPYABLE(RecorderImpl);
 public:
     WEBCORE_EXPORT RecorderImpl(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, DrawGlyphsRecorder::DeconstructDrawGlyphs = DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes);
-    RecorderImpl(RecorderImpl& parent, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform& initialCTM);
-
     WEBCORE_EXPORT virtual ~RecorderImpl();
 
     bool isEmpty() const { return m_displayList.isEmpty(); }
@@ -68,8 +66,6 @@
     void recordClipToImageBuffer(ImageBuffer&, const FloatRect& destinationRect) final;
     void recordClipOutToPath(const Path&) final;
     void recordClipPath(const Path&, WindRule) final;
-    void recordBeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace) final;
-    void recordEndClipToDrawingCommands(const FloatRect& destination) final;
     void recordDrawFilteredImageBuffer(ImageBuffer*, const FloatRect& sourceImageRect, Filter&) final;
     void recordDrawGlyphs(const Font&, const GlyphBufferGlyph*, const GlyphBufferAdvance*, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode) final;
     void recordDrawImageBuffer(ImageBuffer&, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) final;
@@ -123,8 +119,6 @@
     bool recordResourceUse(const SourceImage&) final;
     bool recordResourceUse(Font&) final;
 
-    std::unique_ptr<GraphicsContext> createNestedContext(const FloatRect& initialClip, const AffineTransform& initialCTM) final;
-
     template<typename T, class... Args>
     void append(Args&&... args)
     {
@@ -147,7 +141,6 @@
     FloatRect extentFromLocalBounds(const FloatRect&) const;
 
     DisplayList& m_displayList;
-    bool m_isNested { false };
 };
 
 }

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -44,11 +44,6 @@
 {
 }
 
-GraphicsContext& Replayer::context() const
-{
-    return m_maskImageBuffer ? m_maskImageBuffer->context() : m_context;
-}
-
 template<class T>
 inline static std::optional<RenderingResourceIdentifier> applyImageBufferItem(GraphicsContext& context, const ResourceHeap& resourceHeap, ItemHandle item)
 {
@@ -115,61 +110,42 @@
 std::pair<std::optional<StopReplayReason>, std::optional<RenderingResourceIdentifier>> Replayer::applyItem(ItemHandle item)
 {
     if (item.is<DrawImageBuffer>()) {
-        if (auto missingCachedResourceIdentifier = applyImageBufferItem<DrawImageBuffer>(context(), m_resourceHeap, item))
+        if (auto missingCachedResourceIdentifier = applyImageBufferItem<DrawImageBuffer>(m_context, m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<ClipToImageBuffer>()) {
-        if (auto missingCachedResourceIdentifier = applyImageBufferItem<ClipToImageBuffer>(context(), m_resourceHeap, item))
+        if (auto missingCachedResourceIdentifier = applyImageBufferItem<ClipToImageBuffer>(m_context, m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<DrawNativeImage>()) {
-        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawNativeImage>(context(), m_resourceHeap, item))
+        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawNativeImage>(m_context, m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<DrawGlyphs>()) {
-        if (auto missingCachedResourceIdentifier = applyFontItem<DrawGlyphs>(context(), m_resourceHeap, item))
+        if (auto missingCachedResourceIdentifier = applyFontItem<DrawGlyphs>(m_context, m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<DrawPattern>()) {
-        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawPattern>(context(), m_resourceHeap, item))
+        if (auto missingCachedResourceIdentifier = applyNativeImageItem<DrawPattern>(m_context, m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
     if (item.is<SetState>()) {
-        if (auto missingCachedResourceIdentifier = applySetStateItem(context(), m_resourceHeap, item))
+        if (auto missingCachedResourceIdentifier = applySetStateItem(m_context, m_resourceHeap, item))
             return { StopReplayReason::MissingCachedResource, WTFMove(missingCachedResourceIdentifier) };
         return { std::nullopt, std::nullopt };
     }
 
-    if (item.is<BeginClipToDrawingCommands>()) {
-        if (m_maskImageBuffer)
-            return { StopReplayReason::InvalidItemOrExtent, std::nullopt };
-        auto& clipItem = item.get<BeginClipToDrawingCommands>();
-        m_maskImageBuffer = m_context.createCompatibleImageBuffer(clipItem.destination().size(), clipItem.colorSpace());
-        if (!m_maskImageBuffer)
-            return { StopReplayReason::OutOfMemory, std::nullopt };
-        return { std::nullopt, std::nullopt };
-    }
-
-    if (item.is<EndClipToDrawingCommands>()) {
-        if (!m_maskImageBuffer)
-            return { StopReplayReason::InvalidItemOrExtent, std::nullopt };
-        auto& clipItem = item.get<EndClipToDrawingCommands>();
-        m_context.clipToImageBuffer(*m_maskImageBuffer, clipItem.destination());
-        m_maskImageBuffer = nullptr;
-        return { std::nullopt, std::nullopt };
-    }
-
-    item.apply(context());
+    item.apply(m_context);
     return { std::nullopt, std::nullopt };
 }
 

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -61,13 +61,11 @@
     WEBCORE_EXPORT ReplayResult replay(const FloatRect& initialClip = { }, bool trackReplayList = false);
 
 private:
-    GraphicsContext& context() const;
     std::pair<std::optional<StopReplayReason>, std::optional<RenderingResourceIdentifier>> applyItem(ItemHandle);
 
     GraphicsContext& m_context;
     const DisplayList& m_displayList;
     const ResourceHeap& m_resourceHeap;
-    RefPtr<WebCore::ImageBuffer> m_maskImageBuffer;
 };
 
 }

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


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1106,12 +1106,6 @@
     m_commandList.append(WTFMove(command));
 }
 
-GraphicsContext::ClipToDrawingCommandsResult CairoOperationRecorder::clipToDrawingCommands(const FloatRect&, const DestinationColorSpace&, Function<void(GraphicsContext&)>&&)
-{
-    // FIXME: Not implemented.
-    return ClipToDrawingCommandsResult::Success;
-}
-
 #if ENABLE(VIDEO)
 void CairoOperationRecorder::paintFrameForMedia(MediaPlayer& player, const FloatRect& destination)
 {

Modified: trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h (289593 => 289594)


--- trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -96,7 +96,6 @@
     void clipPath(const WebCore::Path&, WebCore::WindRule) override;
     WebCore::IntRect clipBounds() const override;
     void clipToImageBuffer(WebCore::ImageBuffer&, const WebCore::FloatRect&) override;
-    WebCore::GraphicsContext::ClipToDrawingCommandsResult clipToDrawingCommands(const WebCore::FloatRect& destination, const WebCore::DestinationColorSpace&, Function<void(WebCore::GraphicsContext&)>&&) override;
 #if ENABLE(VIDEO)
     void paintFrameForMedia(WebCore::MediaPlayer&, const WebCore::FloatRect& destination) override;
 #endif

Modified: trunk/Source/WebKit/ChangeLog (289593 => 289594)


--- trunk/Source/WebKit/ChangeLog	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebKit/ChangeLog	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,3 +1,23 @@
+2022-02-10  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] Delete GraphicsContext::clipToDrawingCommands()
+        https://bugs.webkit.org/show_bug.cgi?id=225959
+        rdar://78495380
+
+        Reviewed by Darin Adler.
+
+        * GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
+        (WebKit::RemoteDisplayListRecorder::drawingContext):
+        (WebKit::RemoteDisplayListRecorder::beginClipToDrawingCommands): Deleted.
+        (WebKit::RemoteDisplayListRecorder::endClipToDrawingCommands): Deleted.
+        * GPUProcess/graphics/RemoteDisplayListRecorder.h:
+        * GPUProcess/graphics/RemoteDisplayListRecorder.messages.in:
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
+        (WebKit::RemoteDisplayListRecorderProxy::recordBeginClipToDrawingCommands): Deleted.
+        (WebKit::RemoteDisplayListRecorderProxy::recordEndClipToDrawingCommands): Deleted.
+        (WebKit::RemoteDisplayListRecorderProxy::createNestedContext): Deleted.
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
+
 2022-02-10  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r289525.

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp (289593 => 289594)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -50,7 +50,7 @@
 
 GraphicsContext& RemoteDisplayListRecorder::drawingContext()
 {
-    return m_maskImageBuffer ? m_maskImageBuffer->context() : m_imageBuffer->context();
+    return m_imageBuffer->context();
 }
 
 void RemoteDisplayListRecorder::startListeningForIPC()
@@ -200,22 +200,6 @@
     handleItem(DisplayList::ClipPath(path, rule));
 }
 
-void RemoteDisplayListRecorder::beginClipToDrawingCommands(const FloatRect& destination, const DestinationColorSpace& colorSpace)
-{
-    m_maskImageBuffer = drawingContext().createCompatibleImageBuffer(destination.size(), colorSpace);
-}
-
-void RemoteDisplayListRecorder::endClipToDrawingCommands(const FloatRect& destination)
-{
-    auto maskImageBuffer = std::exchange(m_maskImageBuffer, { });
-    if (!maskImageBuffer) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    drawingContext().clipToImageBuffer(*maskImageBuffer, destination);
-}
-
 void RemoteDisplayListRecorder::drawFilteredImageBuffer(std::optional<RenderingResourceIdentifier> sourceImageIdentifier, const FloatRect& sourceImageRect, IPC::FilterReference filterReference)
 {
     RefPtr<ImageBuffer> sourceImage;

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h (289593 => 289594)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -78,8 +78,6 @@
     void clipToImageBuffer(WebCore::RenderingResourceIdentifier, const WebCore::FloatRect& destinationRect);
     void clipOutToPath(const WebCore::Path&);
     void clipPath(const WebCore::Path&, WebCore::WindRule);
-    void beginClipToDrawingCommands(const WebCore::FloatRect& destination, const WebCore::DestinationColorSpace&);
-    void endClipToDrawingCommands(const WebCore::FloatRect& destination);
     void drawGlyphs(WebCore::DisplayList::DrawGlyphs&&);
     void drawFilteredImageBuffer(std::optional<WebCore::RenderingResourceIdentifier> sourceImageIdentifier, const WebCore::FloatRect& sourceImageRect, IPC::FilterReference);
     void drawImageBuffer(WebCore::RenderingResourceIdentifier imageBufferIdentifier, const WebCore::FloatRect& destinationRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&);
@@ -158,7 +156,6 @@
     QualifiedRenderingResourceIdentifier m_imageBufferIdentifier;
     WebCore::ProcessIdentifier m_webProcessIdentifier;
     RefPtr<RemoteRenderingBackend> m_renderingBackend;
-    RefPtr<WebCore::ImageBuffer> m_maskImageBuffer;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in (289593 => 289594)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 Apple Inc. All rights reserved.
+# Copyright (C) 2021-2022 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -44,8 +44,6 @@
     ClipToImageBuffer(WebCore::RenderingResourceIdentifier renderingResourceIdentifier, WebCore::FloatRect destinationRect)
     ClipOutToPath(WebCore::Path path)
     ClipPath(WebCore::Path path, enum:uint8_t WebCore::WindRule windRule)
-    BeginClipToDrawingCommands(WebCore::FloatRect destination, WebCore::DestinationColorSpace colorSpace)
-    EndClipToDrawingCommands(WebCore::FloatRect destination)
     DrawGlyphs(WebCore::DisplayList::DrawGlyphs item)
     DrawFilteredImageBuffer(std::optional<WebCore::RenderingResourceIdentifier> sourceImageIdentifier, WebCore::FloatRect sourceImageRect, IPC::FilterReference filter)
     DrawImageBuffer(WebCore::RenderingResourceIdentifier imageBufferIdentifier, WebCore::FloatRect destinationRect, WebCore::FloatRect srcRect, struct WebCore::ImagePaintingOptions options)

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp (289593 => 289594)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-02-11 00:27:14 UTC (rev 289594)
@@ -180,16 +180,6 @@
     send(Messages::RemoteDisplayListRecorder::ClipPath(path, rule));
 }
 
-void RemoteDisplayListRecorderProxy::recordBeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace colorSpace)
-{
-    send(Messages::RemoteDisplayListRecorder::BeginClipToDrawingCommands(destination, colorSpace));
-}
-
-void RemoteDisplayListRecorderProxy::recordEndClipToDrawingCommands(const FloatRect& destination)
-{
-    send(Messages::RemoteDisplayListRecorder::EndClipToDrawingCommands(destination));
-}
-
 void RemoteDisplayListRecorderProxy::recordDrawFilteredImageBuffer(ImageBuffer* sourceImage, const FloatRect& sourceImageRect, Filter& filter)
 {
     std::optional<RenderingResourceIdentifier> identifier;
@@ -452,11 +442,6 @@
     send(Messages::RemoteDisplayListRecorder::FlushContext(identifier));
 }
 
-std::unique_ptr<GraphicsContext> RemoteDisplayListRecorderProxy::createNestedContext(const FloatRect& initialClip, const AffineTransform& initialCTM)
-{
-    return makeUnique<RemoteDisplayListRecorderProxy>(*this, initialClip, initialCTM);
-}
-
 RefPtr<ImageBuffer> RemoteDisplayListRecorderProxy::createImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMode renderingMode, RenderingMethod renderingMethod) const
 {
     if (UNLIKELY(!m_renderingBackend)) {

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h (289593 => 289594)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-02-11 00:24:05 UTC (rev 289593)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-02-11 00:27:14 UTC (rev 289594)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -87,8 +87,6 @@
     void recordClipToImageBuffer(WebCore::ImageBuffer&, const WebCore::FloatRect& destinationRect) final;
     void recordClipOutToPath(const WebCore::Path&) final;
     void recordClipPath(const WebCore::Path&, WebCore::WindRule) final;
-    void recordBeginClipToDrawingCommands(const WebCore::FloatRect& destination, WebCore::DestinationColorSpace) final;
-    void recordEndClipToDrawingCommands(const WebCore::FloatRect& destination) final;
     void recordDrawFilteredImageBuffer(WebCore::ImageBuffer*, const WebCore::FloatRect& sourceImageRect, WebCore::Filter&) final;
     void recordDrawGlyphs(const WebCore::Font&, const WebCore::GlyphBufferGlyph*, const WebCore::GlyphBufferAdvance*, unsigned count, const WebCore::FloatPoint& localAnchor, WebCore::FontSmoothingMode) final;
     void recordDrawImageBuffer(WebCore::ImageBuffer&, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&) final;
@@ -140,8 +138,6 @@
     bool recordResourceUse(const WebCore::SourceImage&) final;
     bool recordResourceUse(WebCore::Font&) final;
 
-    std::unique_ptr<WebCore::GraphicsContext> createNestedContext(const WebCore::FloatRect& initialClip, const WebCore::AffineTransform& initialCTM) final;
-
     RefPtr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, const WebCore::DestinationColorSpace&, WebCore::RenderingMode, WebCore::RenderingMethod) const final;
     RefPtr<WebCore::ImageBuffer> createCompatibleImageBuffer(const WebCore::FloatSize&, const WebCore::DestinationColorSpace& = WebCore::DestinationColorSpace::SRGB(), WebCore::RenderingMethod = WebCore::RenderingMethod::Default) const final;
     RefPtr<WebCore::ImageBuffer> createCompatibleImageBuffer(const WebCore::FloatRect&, const WebCore::DestinationColorSpace& = WebCore::DestinationColorSpace::SRGB(), WebCore::RenderingMethod = WebCore::RenderingMethod::Default) const final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to