Changeset 265833 in webkit


Ignore:
Timestamp:
Aug 18, 2020 2:24:51 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

[WebGL2] Pass user-defined-properties-on-context.html layout test
https://bugs.webkit.org/show_bug.cgi?id=215433

Patch by Kenneth Russell <kbr@chromium.org> on 2020-08-18
Reviewed by Yusuke Suzuki.

Source/WebCore:

Keep the canvas' rendering context alive from the canvas itself by
adding a custom mark function for HTMLCanvasElement, and adding a
new GenerateIsReachable=ImplCanvasBase extended IDL attribute,
used from all rendering context types (2D, WebGL, and WebGPU).

This patch does not touch OffscreenCanvas since the implementation
there seems to be incomplete and there are no associated tests of
GC behavior.

Tests: fast/canvas/2d.context.expando.html

webgpu/expando-properties.html

  • Modules/webgpu/GPUCanvasContext.idl:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSHTMLCanvasElementCustom.cpp: Copied from Source/WebCore/html/canvas/WebGLRenderingContext.idl.

(WebCore::JSHTMLCanvasElement::visitAdditionalChildren):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

  • bindings/scripts/IDLAttributes.json:
  • html/HTMLCanvasElement.idl:
  • html/canvas/WebGL2RenderingContext.idl:
  • html/canvas/WebGLRenderingContext.idl:

LayoutTests:

Rebaseline user-defined-properties-on-context.html, which is now
fully passing.

Add tests of expando properties on 2D and WebGPU contexts. Add a
FIXME to the WebGPU test, as that specification no longer defines
a canvas rendering context.

  • fast/canvas/2d.context.expando-expected.txt: Added.
  • fast/canvas/2d.context.expando.html: Added.
  • webgl/2.0.0/conformance/context/user-defined-properties-on-context-expected.txt:
  • webgpu/expando-properties-expected.txt: Added.
  • webgpu/expando-properties.html: Added.
Location:
trunk
Files:
4 added
11 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r265829 r265833  
     12020-08-18  Kenneth Russell  <kbr@chromium.org>
     2
     3        [WebGL2] Pass user-defined-properties-on-context.html layout test
     4        https://bugs.webkit.org/show_bug.cgi?id=215433
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Rebaseline user-defined-properties-on-context.html, which is now
     9        fully passing.
     10
     11        Add tests of expando properties on 2D and WebGPU contexts. Add a
     12        FIXME to the WebGPU test, as that specification no longer defines
     13        a canvas rendering context.
     14
     15        * fast/canvas/2d.context.expando-expected.txt: Added.
     16        * fast/canvas/2d.context.expando.html: Added.
     17        * webgl/2.0.0/conformance/context/user-defined-properties-on-context-expected.txt:
     18        * webgpu/expando-properties-expected.txt: Added.
     19        * webgpu/expando-properties.html: Added.
     20
    1212020-08-18  Karl Rackler  <rackler@apple.com>
    222
  • trunk/LayoutTests/webgl/2.0.0/conformance/context/user-defined-properties-on-context-expected.txt

    r265534 r265833  
    22
    33Test: ../../resources/webgl_test_files/conformance/context/user-defined-properties-on-context.html
    4 
    5 [ 1: PASS ] WebGL context exists
    6 [ 2: FAIL ] gl2.myProperty should be 2 (of type number). Was undefined (of type undefined).
    7 [ 3: PASS ] successfullyParsed is true
    8 [ FAIL ] 1 failures reported
     4[ PASS ] All tests passed
  • trunk/Source/WebCore/ChangeLog

    r265832 r265833  
     12020-08-18  Kenneth Russell  <kbr@chromium.org>
     2
     3        [WebGL2] Pass user-defined-properties-on-context.html layout test
     4        https://bugs.webkit.org/show_bug.cgi?id=215433
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Keep the canvas' rendering context alive from the canvas itself by
     9        adding a custom mark function for HTMLCanvasElement, and adding a
     10        new GenerateIsReachable=ImplCanvasBase extended IDL attribute,
     11        used from all rendering context types (2D, WebGL, and WebGPU).
     12
     13        This patch does not touch OffscreenCanvas since the implementation
     14        there seems to be incomplete and there are no associated tests of
     15        GC behavior.
     16
     17        Tests: fast/canvas/2d.context.expando.html
     18               webgpu/expando-properties.html
     19
     20        * Modules/webgpu/GPUCanvasContext.idl:
     21        * Sources.txt:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * bindings/js/JSHTMLCanvasElementCustom.cpp: Copied from Source/WebCore/html/canvas/WebGLRenderingContext.idl.
     24        (WebCore::JSHTMLCanvasElement::visitAdditionalChildren):
     25        * bindings/scripts/CodeGeneratorJS.pm:
     26        (GenerateImplementation):
     27        * bindings/scripts/IDLAttributes.json:
     28        * html/HTMLCanvasElement.idl:
     29        * html/canvas/WebGL2RenderingContext.idl:
     30        * html/canvas/WebGLRenderingContext.idl:
     31
    1322020-08-18  Chris Dumez  <cdumez@apple.com>
    233
  • trunk/Source/WebCore/Modules/webgpu/GPUCanvasContext.idl

    r251053 r265833  
    4040    ActiveDOMObject,
    4141    Conditional=WEBGPU,
    42     EnabledAtRuntime=WebGPU
     42    EnabledAtRuntime=WebGPU,
     43    GenerateIsReachable=ImplCanvasBase
    4344] interface GPUCanvasContext {
    4445    // back-reference to the canvas
  • trunk/Source/WebCore/Sources.txt

    r265797 r265833  
    510510bindings/js/JSFetchEventCustom.cpp
    511511bindings/js/JSFileSystemEntryCustom.cpp
     512bindings/js/JSHTMLCanvasElementCustom.cpp
    512513bindings/js/JSHTMLCollectionCustom.cpp
    513514bindings/js/JSHTMLDocumentCustom.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r265797 r265833  
    94959495                6E5388E02458AE1D0076AE03 /* WebGLColorBufferFloat.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLColorBufferFloat.cpp; sourceTree = "<group>"; };
    94969496                6E5388E12458AE1D0076AE03 /* WebGLColorBufferFloat.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGLColorBufferFloat.idl; sourceTree = "<group>"; };
     9497                6E576BC324EB509C0094D4AA /* JSHTMLCanvasElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLCanvasElementCustom.cpp; sourceTree = "<group>"; };
    94979498                6E67D2A41280E8A4008758F7 /* ExtensionsGLOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtensionsGLOpenGL.cpp; sourceTree = "<group>"; };
    94989499                6E67D2A51280E8A4008758F7 /* ExtensionsGLOpenGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionsGLOpenGL.h; sourceTree = "<group>"; };
     
    2193621937                                4131F3B11F9552810059995A /* JSFetchEventCustom.cpp */,
    2193721938                                835B680E1F548BDE0071F7F6 /* JSFileSystemEntryCustom.cpp */,
     21939                                6E576BC324EB509C0094D4AA /* JSHTMLCanvasElementCustom.cpp */,
    2193821940                                BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */,
    2193921941                                BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */,
  • trunk/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp

    r265832 r265833  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    26 typedef unsigned long GLenum;
    27 typedef long GLint;
    28 typedef long GLsizei;
     26#include "config.h"
     27#include "JSHTMLCanvasElement.h"
    2928
    30 #ifdef ENABLE_VIDEO
    31 typedef (ImageBitmap or ImageData or HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) TexImageSource;
    32 #else
    33 typedef (ImageBitmap or ImageData or HTMLImageElement or HTMLCanvasElement) TexImageSource;
    34 #endif
     29#include <JavaScriptCore/SlotVisitor.h>
     30#include <JavaScriptCore/SlotVisitorInlines.h>
    3531
    36 [
    37     ActiveDOMObject,
    38     Conditional=WEBGL,
    39     JSCustomMarkFunction,
    40     JSGenerateToJSObject,
    41     DoNotCheckConstants,
    42     ExportMacro=WEBCORE_EXPORT,
    43     CallTracingCallback=recordCanvasAction,
    44 ] interface WebGLRenderingContext {
    45 };
     32namespace WebCore {
    4633
    47 WebGLRenderingContext implements WebGLRenderingContextBase;
     34void JSHTMLCanvasElement::visitAdditionalChildren(SlotVisitor& visitor)
     35{
     36    visitor.addOpaqueRoot(static_cast<CanvasBase*>(&wrapped()));
     37}
     38
     39} // namespace WebCore
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r265387 r265833  
    48424842                $rootString .= "    if (UNLIKELY(reason))\n";
    48434843                $rootString .= "        *reason = \"Reachable from Navigator\";\n";
     4844            } elsif (GetGenerateIsReachable($interface) eq "ImplCanvasBase") {
     4845                $rootString  = "    CanvasBase* root = WTF::getPtr(&(js${interfaceName}->wrapped().canvasBase()));\n";
     4846                $rootString .= "    if (!root)\n";
     4847                $rootString .= "        return false;\n";
     4848                $rootString .= "    if (UNLIKELY(reason))\n";
     4849                $rootString .= "        *reason = \"Reachable from CanvasBase\";\n";
    48444850            } elsif (GetGenerateIsReachable($interface) eq "ImplDocument") {
    48454851                $rootString  = "    Document* root = WTF::getPtr(js${interfaceName}->wrapped().document());\n";
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.json

    r263450 r265833  
    222222        "GenerateIsReachable": {
    223223            "contextsAllowed": ["interface"],
    224             "values": ["", "Impl", "ImplWebGLRenderingContext", "ImplDocument", "ImplElementRoot", "ImplOwnerNodeRoot", "ImplScriptExecutionContext", "ReachableFromDOMWindow", "ReachableFromNavigator"]
     224            "values": ["", "Impl", "ImplWebGLRenderingContext", "ImplCanvasBase", "ImplDocument", "ImplElementRoot", "ImplOwnerNodeRoot", "ImplScriptExecutionContext", "ReachableFromDOMWindow", "ReachableFromNavigator"]
    225225        },
    226226        "Global": {
  • trunk/Source/WebCore/html/HTMLCanvasElement.idl

    r265543 r265833  
    4040[
    4141    ActiveDOMObject,
     42    JSCustomMarkFunction,
    4243    JSGenerateToNativeObject,
    4344    ReportExtraMemoryCost,
  • trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl

    r254148 r265833  
    5555    Conditional=WEBGL2,
    5656    EnabledAtRuntime=WebGL2,
     57    GenerateIsReachable=ImplCanvasBase,
    5758    JSCustomMarkFunction,
    5859    JSGenerateToJSObject,
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.idl

    r254148 r265833  
    3737    ActiveDOMObject,
    3838    Conditional=WEBGL,
     39    GenerateIsReachable=ImplCanvasBase,
    3940    JSCustomMarkFunction,
    4041    JSGenerateToJSObject,
Note: See TracChangeset for help on using the changeset viewer.