Title: [290838] trunk/Source/WebCore
Revision
290838
Author
[email protected]
Date
2022-03-04 11:15:51 -0800 (Fri, 04 Mar 2022)

Log Message

"OffscreenCanvas" in IDLs doesn't seem to be able to be compiled
https://bugs.webkit.org/show_bug.cgi?id=232733
<rdar://problem/85318653>

Patch by Dan Glastonbury <[email protected]> on 2022-03-04
Reviewed by Sam Weinig.

OffscreenCanvas is controlled by ENABLE flags. Add conditional
compilation to handle OffscreenCanvas to the WebGPU IDL bindings
when the OffscreenCanvas feature is enabled.

* Modules/WebGPU/GPUCanvasContext.cpp:
(WebCore::GPUCanvasContext::canvas):
* Modules/WebGPU/GPUCanvasContext.h:
* Modules/WebGPU/GPUCanvasContext.idl:
Add OffscreenCanvas to canvas attribute when it is enabled.
* Modules/WebGPU/GPUImageCopyExternalImage.h:
* Modules/WebGPU/GPUImageCopyExternalImage.idl:
Add OffscreenCanvas to source attribute when it is enabled.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290837 => 290838)


--- trunk/Source/WebCore/ChangeLog	2022-03-04 18:46:06 UTC (rev 290837)
+++ trunk/Source/WebCore/ChangeLog	2022-03-04 19:15:51 UTC (rev 290838)
@@ -1,3 +1,24 @@
+2022-03-04  Dan Glastonbury  <[email protected]>
+
+        "OffscreenCanvas" in IDLs doesn't seem to be able to be compiled
+        https://bugs.webkit.org/show_bug.cgi?id=232733
+        <rdar://problem/85318653>
+
+        Reviewed by Sam Weinig.
+
+        OffscreenCanvas is controlled by ENABLE flags. Add conditional
+        compilation to handle OffscreenCanvas to the WebGPU IDL bindings
+        when the OffscreenCanvas feature is enabled.
+
+        * Modules/WebGPU/GPUCanvasContext.cpp:
+        (WebCore::GPUCanvasContext::canvas):
+        * Modules/WebGPU/GPUCanvasContext.h:
+        * Modules/WebGPU/GPUCanvasContext.idl:
+        Add OffscreenCanvas to canvas attribute when it is enabled.
+        * Modules/WebGPU/GPUImageCopyExternalImage.h:
+        * Modules/WebGPU/GPUImageCopyExternalImage.idl:
+        Add OffscreenCanvas to source attribute when it is enabled.
+
 2022-03-04  Eric Carlson  <[email protected]>
 
         [Cocoa] Crash in MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.cpp (290837 => 290838)


--- trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.cpp	2022-03-04 18:46:06 UTC (rev 290837)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.cpp	2022-03-04 19:15:51 UTC (rev 290838)
@@ -31,7 +31,7 @@
 
 namespace WebCore {
 
-RefPtr<HTMLCanvasElement> GPUCanvasContext::canvas()
+GPUCanvasContext::CanvasType GPUCanvasContext::canvas()
 {
     return { };
 }

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.h (290837 => 290838)


--- trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.h	2022-03-04 18:46:06 UTC (rev 290837)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.h	2022-03-04 19:15:51 UTC (rev 290838)
@@ -41,12 +41,18 @@
 
 class GPUCanvasContext : public RefCounted<GPUCanvasContext> {
 public:
+#if ENABLE(OFFSCREEN_CANVAS)
+    using CanvasType = std::variant<RefPtr<HTMLCanvasElement>, RefPtr<OffscreenCanvas>>;
+#else
+    using CanvasType = std::variant<RefPtr<HTMLCanvasElement>>;
+#endif
+
     static Ref<GPUCanvasContext> create()
     {
         return adoptRef(*new GPUCanvasContext());
     }
 
-    RefPtr<HTMLCanvasElement> canvas();
+    CanvasType canvas();
 
     void configure(const GPUCanvasConfiguration&);
     void unconfigure();

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.idl (290837 => 290838)


--- trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.idl	2022-03-04 18:46:06 UTC (rev 290837)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUCanvasContext.idl	2022-03-04 19:15:51 UTC (rev 290838)
@@ -31,7 +31,11 @@
     SecureContext
 ]
 interface GPUCanvasContext {
-    readonly attribute HTMLCanvasElement canvas; // FIXME: OffscreenCanvas doesn't seem to work with our bindings here.
+    readonly attribute (HTMLCanvasElement
+#if defined(ENABLE_OFFSCREEN_CANVAS) && ENABLE_OFFSCREEN_CANVAS
+        or OffscreenCanvas
+#endif
+    ) canvas;
 
     undefined configure(GPUCanvasConfiguration configuration);
     undefined unconfigure();

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUImageCopyExternalImage.h (290837 => 290838)


--- trunk/Source/WebCore/Modules/WebGPU/GPUImageCopyExternalImage.h	2022-03-04 18:46:06 UTC (rev 290837)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUImageCopyExternalImage.h	2022-03-04 19:15:51 UTC (rev 290838)
@@ -28,6 +28,7 @@
 #include "GPUOrigin2DDict.h"
 #include "HTMLCanvasElement.h"
 #include "ImageBitmap.h"
+#include "OffscreenCanvas.h"
 #include <optional>
 #include <pal/graphics/WebGPU/WebGPUImageCopyExternalImage.h>
 #include <variant>
@@ -36,6 +37,12 @@
 namespace WebCore {
 
 struct GPUImageCopyExternalImage {
+#if ENABLE(OFFSCREEN_CANVAS)
+    using SourceType = std::variant<RefPtr<ImageBitmap>, RefPtr<HTMLCanvasElement>, RefPtr<OffscreenCanvas>>;
+#else
+    using SourceType = std::variant<RefPtr<ImageBitmap>, RefPtr<HTMLCanvasElement>>;
+#endif
+
     PAL::WebGPU::ImageCopyExternalImage convertToBacking() const
     {
         return {
@@ -45,7 +52,7 @@
         };
     }
 
-    std::variant<RefPtr<ImageBitmap>, RefPtr<HTMLCanvasElement>> source;
+    SourceType source;
     std::optional<GPUOrigin2D> origin;
     bool flipY { false };
 };

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUImageCopyExternalImage.idl (290837 => 290838)


--- trunk/Source/WebCore/Modules/WebGPU/GPUImageCopyExternalImage.idl	2022-03-04 18:46:06 UTC (rev 290837)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUImageCopyExternalImage.idl	2022-03-04 19:15:51 UTC (rev 290838)
@@ -33,7 +33,11 @@
     EnabledBySetting=WebGPU
 ]
 dictionary GPUImageCopyExternalImage {
-    required (ImageBitmap or HTMLCanvasElement) source; // FIXME: OffscreenCanvas doesn't seem to work with our bindings here.
+    required (ImageBitmap or HTMLCanvasElement
+#if defined(ENABLE_OFFSCREEN_CANVAS) && ENABLE_OFFSCREEN_CANVAS
+        or OffscreenCanvas
+#endif
+    ) source;
     GPUOrigin2D origin;
     boolean flipY = false;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to