Title: [283675] trunk
Revision
283675
Author
[email protected]
Date
2021-10-06 15:41:36 -0700 (Wed, 06 Oct 2021)

Log Message

Make ImageBuffer::drawingContext() return GraphicsContext instead of DisplayList::DrawingContext
https://bugs.webkit.org/show_bug.cgi?id=231296

Reviewed by Simon Fraser.

Source/WebCore:

In preparation for decoupling RemoteImageBufferProxy from DisplayList::ImageBuffer (as well as DrawingContext),
we refactor `ImageBuffer::drawingContext()` to no longer return a DisplayList::DrawingContext, but rather a
generic GraphicsContext. In future patches, this allows us to create a new GraphicsContext subclass that doesn't
manage its own DisplayList, but instead uses streamable IPC messages to send individual display list items (or
eventually, just their arguments) over to the GPU process.

Unfortunately, this means that HTMLCanvasElement can no longer use its display list drawing context to track
display list items. However, since this capability was only used for a single layout test, we can simply remove
it altogether (and simplify some of the code in HTMLCanvasElement in the process).

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createImageBuffer const):
(WebCore::HTMLCanvasElement::setTracksDisplayListReplay): Deleted.
(WebCore::HTMLCanvasElement::displayListAsText const): Deleted.
(WebCore::HTMLCanvasElement::replayDisplayListAsText const): Deleted.
* html/HTMLCanvasElement.h:
* platform/graphics/displaylists/DisplayListImageBuffer.h:
* testing/Internals.cpp:
(WebCore::Internals::setElementTracksDisplayListReplay):
(WebCore::Internals::displayListForElement):
(WebCore::Internals::replayDisplayListForElement):

LayoutTests:

Remove support for display list tracking in the canvas element. See WebCore ChangeLog for more details.

* displaylists/canvas-display-list-expected.txt: Removed.
* displaylists/canvas-display-list.html: Removed.
* platform/ios/TestExpectations:
* platform/mac-wk1/TestExpectations:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283674 => 283675)


--- trunk/LayoutTests/ChangeLog	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/LayoutTests/ChangeLog	2021-10-06 22:41:36 UTC (rev 283675)
@@ -1,3 +1,17 @@
+2021-10-06  Wenson Hsieh  <[email protected]>
+
+        Make ImageBuffer::drawingContext() return GraphicsContext instead of DisplayList::DrawingContext
+        https://bugs.webkit.org/show_bug.cgi?id=231296
+
+        Reviewed by Simon Fraser.
+
+        Remove support for display list tracking in the canvas element. See WebCore ChangeLog for more details.
+
+        * displaylists/canvas-display-list-expected.txt: Removed.
+        * displaylists/canvas-display-list.html: Removed.
+        * platform/ios/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+
 2021-10-06  Ayumi Kojima  <[email protected]>
 
         [ iOS 15 ] media/track/track-forced-subtitles-in-band.html is failing.

Deleted: trunk/LayoutTests/displaylists/canvas-display-list-expected.txt (283674 => 283675)


--- trunk/LayoutTests/displaylists/canvas-display-list-expected.txt	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/LayoutTests/displaylists/canvas-display-list-expected.txt	2021-10-06 22:41:36 UTC (rev 283675)
@@ -1,13 +0,0 @@
-
-(save)
-(set-state
-  (change-flags 525456)
-  (stroke-thickness 1.00)
-  (fill-color #C80000)
-  (shadows-ignore-transforms 1))
-(fill-rect
-  (rect at (10,10) size 55x50) extent at (10,140) size 55x50)
-(set-inline-fill-color
-  (color #0000C880))
-(fill-rect
-  (rect at (30,30) size 55x50) extent at (30,120) size 55x50)

Deleted: trunk/LayoutTests/displaylists/canvas-display-list.html (283674 => 283675)


--- trunk/LayoutTests/displaylists/canvas-display-list.html	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/LayoutTests/displaylists/canvas-display-list.html	2021-10-06 22:41:36 UTC (rev 283675)
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
-    <script>
-        function drawCanvas()
-        {
-            var ctx = document.getElementById('canvas').getContext('2d');
-            ctx.fillStyle = "rgb(200,0,0)";
-            ctx.fillRect (10, 10, 55, 50);
-
-            ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
-            ctx.fillRect (30, 30, 55, 50);
-        }
-
-        if (window.testRunner)
-            testRunner.dumpAsText();
-
-        var canvas;
-        function doTest()
-        {
-            document.body.offsetWidth;
-            canvas = document.getElementById('canvas');
-            if (window.internals) {
-                internals.setElementUsesDisplayListDrawing(canvas, true);
-                internals.setElementTracksDisplayListReplay(canvas, true);
-            }
-            
-            drawCanvas();
-
-            if (window.testRunner)
-                testRunner.displayAndTrackRepaints();
-
-            if (window.internals)
-                document.getElementById('output').textContent = internals.replayDisplayListForElement(canvas);
-        }
-        window.addEventListener('load', doTest, false);
-    </script>
-</head>
-<body>
-<canvas id="canvas" width="300" height="200"></canvas>
-<pre id="output"></pre>
-</body>
-</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (283674 => 283675)


--- trunk/LayoutTests/platform/ios/TestExpectations	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2021-10-06 22:41:36 UTC (rev 283675)
@@ -2213,7 +2213,6 @@
 webkit.org/b/169210 imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html [ Failure ]
 
 # displaylist tests are flaky on ios-simulator wk2
-webkit.org/b/153656 displaylists/canvas-display-list.html [ Pass Failure ]
 webkit.org/b/153656 displaylists/extent-includes-transforms.html [ Pass Failure ]
 webkit.org/b/153656 displaylists/extent-includes-shadow.html [ Pass Failure ]
 webkit.org/b/153656 displaylists/layer-dispay-list.html [ Pass Failure ]

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (283674 => 283675)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-10-06 22:41:36 UTC (rev 283675)
@@ -800,7 +800,6 @@
 media/video-restricted-invisible-autoplay-not-allowed.html [ Skip ]
 
 # <rdar://problem/42736213>
-displaylists/canvas-display-list.html [ Failure ]
 displaylists/extent-includes-shadow.html [ Failure ]
 displaylists/extent-includes-transforms.html [ Failure ]
 displaylists/layer-dispay-list.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (283674 => 283675)


--- trunk/Source/WebCore/ChangeLog	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/Source/WebCore/ChangeLog	2021-10-06 22:41:36 UTC (rev 283675)
@@ -1,3 +1,32 @@
+2021-10-06  Wenson Hsieh  <[email protected]>
+
+        Make ImageBuffer::drawingContext() return GraphicsContext instead of DisplayList::DrawingContext
+        https://bugs.webkit.org/show_bug.cgi?id=231296
+
+        Reviewed by Simon Fraser.
+
+        In preparation for decoupling RemoteImageBufferProxy from DisplayList::ImageBuffer (as well as DrawingContext),
+        we refactor `ImageBuffer::drawingContext()` to no longer return a DisplayList::DrawingContext, but rather a
+        generic GraphicsContext. In future patches, this allows us to create a new GraphicsContext subclass that doesn't
+        manage its own DisplayList, but instead uses streamable IPC messages to send individual display list items (or
+        eventually, just their arguments) over to the GPU process.
+
+        Unfortunately, this means that HTMLCanvasElement can no longer use its display list drawing context to track
+        display list items. However, since this capability was only used for a single layout test, we can simply remove
+        it altogether (and simplify some of the code in HTMLCanvasElement in the process).
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::createImageBuffer const):
+        (WebCore::HTMLCanvasElement::setTracksDisplayListReplay): Deleted.
+        (WebCore::HTMLCanvasElement::displayListAsText const): Deleted.
+        (WebCore::HTMLCanvasElement::replayDisplayListAsText const): Deleted.
+        * html/HTMLCanvasElement.h:
+        * platform/graphics/displaylists/DisplayListImageBuffer.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::setElementTracksDisplayListReplay):
+        (WebCore::Internals::displayListForElement):
+        (WebCore::Internals::replayDisplayListForElement):
+
 2021-10-06  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r283634.

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (283674 => 283675)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2021-10-06 22:41:36 UTC (rev 283675)
@@ -840,42 +840,6 @@
     m_usesDisplayListDrawing = usesDisplayListDrawing;
 }
 
-void HTMLCanvasElement::setTracksDisplayListReplay(bool tracksDisplayListReplay)
-{
-    m_tracksDisplayListReplay = tracksDisplayListReplay;
-
-    if (!buffer())
-        return;
-
-    auto& buffer = *this->buffer();
-    if (buffer.drawingContext())
-        buffer.drawingContext()->setTracksDisplayListReplay(m_tracksDisplayListReplay);
-}
-
-String HTMLCanvasElement::displayListAsText(DisplayList::AsTextFlags flags) const
-{
-    if (!buffer())
-        return String();
-
-    auto& buffer = *this->buffer();
-    if (buffer.drawingContext())
-        return buffer.drawingContext()->displayList().asText(flags);
-
-    return String();
-}
-
-String HTMLCanvasElement::replayDisplayListAsText(DisplayList::AsTextFlags flags) const
-{
-    if (!buffer())
-        return String();
-
-    auto& buffer = *this->buffer();
-    if (buffer.drawingContext() && buffer.drawingContext()->replayedDisplayList())
-        return buffer.drawingContext()->replayedDisplayList()->asText(flags);
-
-    return String();
-}
-
 void HTMLCanvasElement::createImageBuffer() const
 {
     ASSERT(!hasCreatedImageBuffer());
@@ -917,9 +881,6 @@
 
     setImageBuffer(ImageBuffer::create(size(), renderingMode, useDisplayList, RenderingPurpose::Canvas, 1, colorSpace, pixelFormat, hostWindow));
 
-    if (buffer() && buffer()->drawingContext())
-        buffer()->drawingContext()->setTracksDisplayListReplay(m_tracksDisplayListReplay);
-
 #if USE(IOSURFACE_CANVAS_BACKING_STORE)
     if (m_context && m_context->is2d()) {
         // Recalculate compositing requirements if acceleration state changed.

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (283674 => 283675)


--- trunk/Source/WebCore/html/HTMLCanvasElement.h	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h	2021-10-06 22:41:36 UTC (rev 283675)
@@ -120,9 +120,6 @@
     bool shouldAccelerate(unsigned area) const;
 
     WEBCORE_EXPORT void setUsesDisplayListDrawing(bool);
-    WEBCORE_EXPORT void setTracksDisplayListReplay(bool);
-    WEBCORE_EXPORT String displayListAsText(DisplayList::AsTextFlags) const;
-    WEBCORE_EXPORT String replayDisplayListAsText(DisplayList::AsTextFlags) const;
 
     // FIXME: Only some canvas rendering contexts need an ImageBuffer.
     // It would be better to have the contexts own the buffers.
@@ -183,7 +180,6 @@
     mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue).
 
     std::optional<bool> m_usesDisplayListDrawing;
-    bool m_tracksDisplayListReplay { false };
 
     bool m_ignoreReset { false };
     // m_hasCreatedImageBuffer means we tried to malloc the buffer. We didn't necessarily get it.

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (283674 => 283675)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2021-10-06 22:41:36 UTC (rev 283675)
@@ -76,7 +76,7 @@
     virtual GraphicsContext& context() const = 0;
     virtual void flushContext() = 0;
 
-    virtual DisplayList::DrawingContext* drawingContext() { return nullptr; }
+    virtual GraphicsContext* drawingContext() { return nullptr; }
     virtual bool prefersPreparationForDisplay() { return false; }
     virtual void flushDrawingContext() { }
     virtual void flushDrawingContextAsync() { }

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h (283674 => 283675)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h	2021-10-06 22:41:36 UTC (rev 283675)
@@ -79,7 +79,7 @@
         return m_drawingContext.context();
     }
 
-    DrawingContext* drawingContext() override { return &m_drawingContext; }
+    GraphicsContext* drawingContext() override { return &m_drawingContext.context(); }
 
     void flushDrawingContext() override
     {

Modified: trunk/Source/WebCore/testing/Internals.cpp (283674 => 283675)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-10-06 22:41:00 UTC (rev 283674)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-10-06 22:41:36 UTC (rev 283675)
@@ -3112,11 +3112,6 @@
     if (!element.renderer())
         return Exception { InvalidAccessError };
 
-    if (is<HTMLCanvasElement>(element)) {
-        downcast<HTMLCanvasElement>(element).setTracksDisplayListReplay(isTrackingReplay);
-        return { };
-    }
-
     if (!element.renderer()->hasLayer())
         return Exception { InvalidAccessError };
 
@@ -3143,9 +3138,6 @@
     if (flags & DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS)
         displayListFlags |= DisplayList::AsTextFlag::IncludesPlatformOperations;
 
-    if (is<HTMLCanvasElement>(element))
-        return downcast<HTMLCanvasElement>(element).displayListAsText(displayListFlags);
-
     if (!element.renderer()->hasLayer())
         return Exception { InvalidAccessError };
 
@@ -3171,9 +3163,6 @@
     if (flags & DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS)
         displayListFlags |= DisplayList::AsTextFlag::IncludesPlatformOperations;
 
-    if (is<HTMLCanvasElement>(element))
-        return downcast<HTMLCanvasElement>(element).replayDisplayListAsText(displayListFlags);
-
     if (!element.renderer()->hasLayer())
         return Exception { InvalidAccessError };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to