Title: [224836] trunk
Revision
224836
Author
d...@apple.com
Date
2017-11-14 13:11:18 -0800 (Tue, 14 Nov 2017)

Log Message

Stub implementations of OffscreenCanvas getContext and transferToImageBitmap
https://bugs.webkit.org/show_bug.cgi?id=179671
<rdar://problem/35534018>

Reviewed by Antoine Quint.

Source/WebCore:

Empty implementations of getContext and transferToImageBitmap. At the moment
only return a WebGLRenderingContext from getContext, since we don't
have an Offscreen 2d context type yet.

Tests: http/wpt/offscreen-canvas/getContext-webgl.html
       http/wpt/offscreen-canvas/transferToImageBitmap.html

* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::getContext):
(WebCore::OffscreenCanvas::transferToImageBitmap):
* html/OffscreenCanvas.h:
* html/OffscreenCanvas.idl:
* html/canvas/GPUBasedCanvasRenderingContext.h: Drive-by parameter rename.
(WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):

LayoutTests:

* http/wpt/offscreen-canvas/getContext-webgl-expected.txt: Added.
* http/wpt/offscreen-canvas/getContext-webgl.html: Added.
* http/wpt/offscreen-canvas/transferToImageBitmap-expected.txt: Added.
* http/wpt/offscreen-canvas/transferToImageBitmap.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (224835 => 224836)


--- trunk/LayoutTests/ChangeLog	2017-11-14 20:48:49 UTC (rev 224835)
+++ trunk/LayoutTests/ChangeLog	2017-11-14 21:11:18 UTC (rev 224836)
@@ -1,3 +1,16 @@
+2017-11-14  Dean Jackson  <d...@apple.com>
+
+        Stub implementations of OffscreenCanvas getContext and transferToImageBitmap
+        https://bugs.webkit.org/show_bug.cgi?id=179671
+        <rdar://problem/35534018>
+
+        Reviewed by Antoine Quint.
+
+        * http/wpt/offscreen-canvas/getContext-webgl-expected.txt: Added.
+        * http/wpt/offscreen-canvas/getContext-webgl.html: Added.
+        * http/wpt/offscreen-canvas/transferToImageBitmap-expected.txt: Added.
+        * http/wpt/offscreen-canvas/transferToImageBitmap.html: Added.
+
 2017-11-14  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed test gardening for High Sierra.

Added: trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl-expected.txt (0 => 224836)


--- trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl-expected.txt	2017-11-14 21:11:18 UTC (rev 224836)
@@ -0,0 +1,3 @@
+
+PASS Test getContext('webgl'). 
+
Property changes on: trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl.html (0 => 224836)


--- trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl.html	2017-11-14 21:11:18 UTC (rev 224836)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+
+test(function() {
+    let offscreenCanvas = new OffscreenCanvas(100, 100);
+    let gl = offscreenCanvas.getContext("webgl");
+    assert_equals(gl, null);
+}, "Test getContext('webgl').");
+
+</script>
+
Property changes on: trunk/LayoutTests/http/wpt/offscreen-canvas/getContext-webgl.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap-expected.txt (0 => 224836)


--- trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap-expected.txt	2017-11-14 21:11:18 UTC (rev 224836)
@@ -0,0 +1,3 @@
+
+PASS Test transferToImageBitmap. 
+
Property changes on: trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap.html (0 => 224836)


--- trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap.html	                        (rev 0)
+++ trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap.html	2017-11-14 21:11:18 UTC (rev 224836)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+
+test(function() {
+    let offscreenCanvas = new OffscreenCanvas(100, 100);
+    // let gl = offscreenCanvas.getContext("webgl");
+    // assert_equals(gl, null);
+    let imageBitmap = offscreenCanvas.transferToImageBitmap();
+    assert_equals(imageBitmap, null);
+}, "Test transferToImageBitmap.");
+
+</script>
+
Property changes on: trunk/LayoutTests/http/wpt/offscreen-canvas/transferToImageBitmap.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Modified: trunk/Source/WebCore/ChangeLog (224835 => 224836)


--- trunk/Source/WebCore/ChangeLog	2017-11-14 20:48:49 UTC (rev 224835)
+++ trunk/Source/WebCore/ChangeLog	2017-11-14 21:11:18 UTC (rev 224836)
@@ -1,3 +1,26 @@
+2017-11-14  Dean Jackson  <d...@apple.com>
+
+        Stub implementations of OffscreenCanvas getContext and transferToImageBitmap
+        https://bugs.webkit.org/show_bug.cgi?id=179671
+        <rdar://problem/35534018>
+
+        Reviewed by Antoine Quint.
+
+        Empty implementations of getContext and transferToImageBitmap. At the moment
+        only return a WebGLRenderingContext from getContext, since we don't
+        have an Offscreen 2d context type yet.
+
+        Tests: http/wpt/offscreen-canvas/getContext-webgl.html
+               http/wpt/offscreen-canvas/transferToImageBitmap.html
+
+        * html/OffscreenCanvas.cpp:
+        (WebCore::OffscreenCanvas::getContext):
+        (WebCore::OffscreenCanvas::transferToImageBitmap):
+        * html/OffscreenCanvas.h:
+        * html/OffscreenCanvas.idl:
+        * html/canvas/GPUBasedCanvasRenderingContext.h: Drive-by parameter rename.
+        (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
+
 2017-11-14  Youenn Fablet  <you...@apple.com>
 
         WebSWClientConnection should do IPC to StorageProcess if its WebSWOriginTable is not yet initialized

Modified: trunk/Source/WebCore/html/OffscreenCanvas.cpp (224835 => 224836)


--- trunk/Source/WebCore/html/OffscreenCanvas.cpp	2017-11-14 20:48:49 UTC (rev 224835)
+++ trunk/Source/WebCore/html/OffscreenCanvas.cpp	2017-11-14 21:11:18 UTC (rev 224836)
@@ -26,6 +26,9 @@
 #include "config.h"
 #include "OffscreenCanvas.h"
 
+#include "ImageBitmap.h"
+#include "WebGLRenderingContext.h"
+
 namespace WebCore {
 
 Ref<OffscreenCanvas> OffscreenCanvas::create(ScriptExecutionContext& context, unsigned width, unsigned height)
@@ -61,4 +64,16 @@
     return m_size.setHeight(newHeight);
 }
 
+ExceptionOr<RefPtr<WebGLRenderingContext>> OffscreenCanvas::getContext(JSC::ExecState&, RenderingContextType contextType, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+{
+    UNUSED_PARAM(contextType);
+    UNUSED_PARAM(arguments);
+    return { nullptr };
 }
+
+RefPtr<ImageBitmap> OffscreenCanvas::transferToImageBitmap()
+{
+    return nullptr;
+}
+
+}

Modified: trunk/Source/WebCore/html/OffscreenCanvas.h (224835 => 224836)


--- trunk/Source/WebCore/html/OffscreenCanvas.h	2017-11-14 20:48:49 UTC (rev 224835)
+++ trunk/Source/WebCore/html/OffscreenCanvas.h	2017-11-14 21:11:18 UTC (rev 224836)
@@ -26,14 +26,26 @@
 #pragma once
 
 #include "EventTarget.h"
+#include "ExceptionOr.h"
 #include "IntSize.h"
 #include "JSDOMPromiseDeferred.h"
 #include "ScriptWrappable.h"
+#include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
+class ImageBitmap;
+class WebGLRenderingContext;
+
+// using OffscreenRenderingContext = Variant<
+// #if ENABLE(WEBGL)
+// RefPtr<WebGLRenderingContext>,
+// #endif
+// RefPtr<OffscreenCanvasRenderingContext2D>
+// >;
+
 class OffscreenCanvas : public RefCounted<OffscreenCanvas>, public EventTargetWithInlineData {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -56,9 +68,9 @@
     unsigned height() const;
     void setHeight(unsigned);
 
-    // The currently unimplemented OffscreenCanvas methods.
-    // OffscreenRenderingContext? getContext(OffscreenRenderingContextType contextType, any... arguments);
-    // ImageBitmap transferToImageBitmap();
+    // FIXME: Should be optional<OffscreenRenderingContext> from above.
+    ExceptionOr<RefPtr<WebGLRenderingContext>> getContext(JSC::ExecState&, RenderingContextType, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
+    RefPtr<ImageBitmap> transferToImageBitmap();
     // void convertToBlob(ImageEncodeOptions options);
 
     using RefCounted::ref;

Modified: trunk/Source/WebCore/html/OffscreenCanvas.idl (224835 => 224836)


--- trunk/Source/WebCore/html/OffscreenCanvas.idl	2017-11-14 20:48:49 UTC (rev 224835)
+++ trunk/Source/WebCore/html/OffscreenCanvas.idl	2017-11-14 21:11:18 UTC (rev 224836)
@@ -45,8 +45,8 @@
     attribute [EnforceRange] unsigned long width;
     attribute [EnforceRange] unsigned long height;
 
-    // [CallWith=ScriptState, MayThrowException] OffscreenRenderingContext? getContext(OffscreenRenderingContextType contextType, any... arguments);
-    // ImageBitmap transferToImageBitmap();
+    [CallWith=ScriptState, MayThrowException] WebGLRenderingContext? getContext(OffscreenRenderingContextType contextType, any... arguments);
+    ImageBitmap transferToImageBitmap();
     // Promise<Blob> convertToBlob(optional ImageEncodeOptions options);
 
 };

Modified: trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h (224835 => 224836)


--- trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h	2017-11-14 20:48:49 UTC (rev 224835)
+++ trunk/Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h	2017-11-14 21:11:18 UTC (rev 224836)
@@ -49,9 +49,9 @@
     virtual void markLayerComposited() = 0;
 
 protected:
-    GPUBasedCanvasRenderingContext(HTMLCanvasElement& passedCanvas)
-        : CanvasRenderingContext(passedCanvas)
-        , ActiveDOMObject(&passedCanvas.document())
+    GPUBasedCanvasRenderingContext(HTMLCanvasElement& canvas)
+        : CanvasRenderingContext(canvas)
+        , ActiveDOMObject(&canvas.document())
     {
     }
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to