Diff
Modified: trunk/LayoutTests/ChangeLog (276776 => 276777)
--- trunk/LayoutTests/ChangeLog 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/ChangeLog 2021-04-29 16:09:17 UTC (rev 276777)
@@ -1,3 +1,18 @@
+2021-04-29 Sam Weinig <wei...@apple.com>
+
+ Add support for CanvasRenderingContext2DSettings
+ https://bugs.webkit.org/show_bug.cgi?id=225173
+
+ Reviewed by Chris Dumez.
+
+ Update test results.
+
+ * platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+ * platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
+
2021-04-29 Rob Buis <rb...@igalia.com>
Resync web-platform-tests/css/css-sizing/aspect-ratio from upstream
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276776 => 276777)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-29 16:09:17 UTC (rev 276777)
@@ -1,5 +1,17 @@
2021-04-29 Sam Weinig <wei...@apple.com>
+ Add support for CanvasRenderingContext2DSettings
+ https://bugs.webkit.org/show_bug.cgi?id=225173
+
+ Reviewed by Chris Dumez.
+
+ Update test results.
+
+ * web-platform-tests/html/canvas/element/context-attributes/getContextAttributes-expected.txt:
+ * web-platform-tests/html/dom/idlharness.https-expected.txt:
+
+2021-04-29 Sam Weinig <wei...@apple.com>
+
Update WPT tests in html/canvas/element/wide-gamut-canvas
https://bugs.webkit.org/show_bug.cgi?id=225177
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/context-attributes/getContextAttributes-expected.txt (276776 => 276777)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/context-attributes/getContextAttributes-expected.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/context-attributes/getContextAttributes-expected.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -1,6 +1,6 @@
-FAIL Test default context creation attributes ctx.getContextAttributes is not a function. (In 'ctx.getContextAttributes()', 'ctx.getContextAttributes' is undefined)
-FAIL Test context creation attributes alpha: true ctx.getContextAttributes is not a function. (In 'ctx.getContextAttributes()', 'ctx.getContextAttributes' is undefined)
-FAIL Test context creation attributes alpha: false ctx.getContextAttributes is not a function. (In 'ctx.getContextAttributes()', 'ctx.getContextAttributes' is undefined)
-FAIL Test context creation attributes desynchronized: false ctx.getContextAttributes is not a function. (In 'ctx.getContextAttributes()', 'ctx.getContextAttributes' is undefined)
+FAIL Test default context creation attributes assert_equals: expected (boolean) true but got (undefined) undefined
+FAIL Test context creation attributes alpha: true assert_equals: expected (boolean) true but got (undefined) undefined
+FAIL Test context creation attributes alpha: false assert_equals: expected (boolean) false but got (undefined) undefined
+PASS Test context creation attributes desynchronized: false
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (276776 => 276777)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -3718,7 +3718,7 @@
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property
PASS CanvasRenderingContext2D interface: attribute canvas
-FAIL CanvasRenderingContext2D interface: operation getContextAttributes() assert_own_property: interface prototype object missing non-static operation expected property "getContextAttributes" missing
+PASS CanvasRenderingContext2D interface: operation getContextAttributes()
PASS CanvasRenderingContext2D interface: operation save()
PASS CanvasRenderingContext2D interface: operation restore()
PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double)
@@ -3795,7 +3795,7 @@
PASS CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d")
PASS Stringification of document.createElement("canvas").getContext("2d")
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type
-FAIL CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type assert_inherits: property "getContextAttributes" not found in prototype chain
+PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type
Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (276776 => 276777)
--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -3874,7 +3874,7 @@
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property
PASS CanvasRenderingContext2D interface: attribute canvas
-FAIL CanvasRenderingContext2D interface: operation getContextAttributes() assert_own_property: interface prototype object missing non-static operation expected property "getContextAttributes" missing
+PASS CanvasRenderingContext2D interface: operation getContextAttributes()
PASS CanvasRenderingContext2D interface: operation save()
PASS CanvasRenderingContext2D interface: operation restore()
PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double)
@@ -3951,7 +3951,7 @@
PASS CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d")
PASS Stringification of document.createElement("canvas").getContext("2d")
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type
-FAIL CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type assert_inherits: property "getContextAttributes" not found in prototype chain
+PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type
Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (276776 => 276777)
--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -3864,7 +3864,7 @@
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property
PASS CanvasRenderingContext2D interface: attribute canvas
-FAIL CanvasRenderingContext2D interface: operation getContextAttributes() assert_own_property: interface prototype object missing non-static operation expected property "getContextAttributes" missing
+PASS CanvasRenderingContext2D interface: operation getContextAttributes()
PASS CanvasRenderingContext2D interface: operation save()
PASS CanvasRenderingContext2D interface: operation restore()
PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double)
@@ -3941,7 +3941,7 @@
PASS CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d")
PASS Stringification of document.createElement("canvas").getContext("2d")
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type
-FAIL CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type assert_inherits: property "getContextAttributes" not found in prototype chain
+PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type
Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (276776 => 276777)
--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -3874,7 +3874,7 @@
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property
PASS CanvasRenderingContext2D interface: attribute canvas
-FAIL CanvasRenderingContext2D interface: operation getContextAttributes() assert_own_property: interface prototype object missing non-static operation expected property "getContextAttributes" missing
+PASS CanvasRenderingContext2D interface: operation getContextAttributes()
PASS CanvasRenderingContext2D interface: operation save()
PASS CanvasRenderingContext2D interface: operation restore()
PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double)
@@ -3951,7 +3951,7 @@
PASS CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d")
PASS Stringification of document.createElement("canvas").getContext("2d")
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type
-FAIL CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type assert_inherits: property "getContextAttributes" not found in prototype chain
+PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type
Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (276776 => 276777)
--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -3874,7 +3874,7 @@
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property
PASS CanvasRenderingContext2D interface: attribute canvas
-FAIL CanvasRenderingContext2D interface: operation getContextAttributes() assert_own_property: interface prototype object missing non-static operation expected property "getContextAttributes" missing
+PASS CanvasRenderingContext2D interface: operation getContextAttributes()
PASS CanvasRenderingContext2D interface: operation save()
PASS CanvasRenderingContext2D interface: operation restore()
PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double)
@@ -3951,7 +3951,7 @@
PASS CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d")
PASS Stringification of document.createElement("canvas").getContext("2d")
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type
-FAIL CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type assert_inherits: property "getContextAttributes" not found in prototype chain
+PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type
Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (276776 => 276777)
--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -3874,7 +3874,7 @@
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's "constructor" property
PASS CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property
PASS CanvasRenderingContext2D interface: attribute canvas
-FAIL CanvasRenderingContext2D interface: operation getContextAttributes() assert_own_property: interface prototype object missing non-static operation expected property "getContextAttributes" missing
+PASS CanvasRenderingContext2D interface: operation getContextAttributes()
PASS CanvasRenderingContext2D interface: operation save()
PASS CanvasRenderingContext2D interface: operation restore()
PASS CanvasRenderingContext2D interface: operation scale(unrestricted double, unrestricted double)
@@ -3951,7 +3951,7 @@
PASS CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d")
PASS Stringification of document.createElement("canvas").getContext("2d")
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type
-FAIL CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type assert_inherits: property "getContextAttributes" not found in prototype chain
+PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "save()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "restore()" with the proper type
PASS CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "scale(unrestricted double, unrestricted double)" with the proper type
Modified: trunk/Source/WebCore/CMakeLists.txt (276776 => 276777)
--- trunk/Source/WebCore/CMakeLists.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/CMakeLists.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -1051,6 +1051,7 @@
html/canvas/CanvasPattern.idl
html/canvas/CanvasRect.idl
html/canvas/CanvasRenderingContext2D.idl
+ html/canvas/CanvasRenderingContext2DSettings.idl
html/canvas/CanvasShadowStyles.idl
html/canvas/CanvasState.idl
html/canvas/CanvasText.idl
Modified: trunk/Source/WebCore/ChangeLog (276776 => 276777)
--- trunk/Source/WebCore/ChangeLog 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/ChangeLog 2021-04-29 16:09:17 UTC (rev 276777)
@@ -1,3 +1,50 @@
+2021-04-29 Sam Weinig <wei...@apple.com>
+
+ Add support for CanvasRenderingContext2DSettings
+ https://bugs.webkit.org/show_bug.cgi?id=225173
+
+ Reviewed by Chris Dumez.
+
+ Plumb infrastructure for passing a CanvasRenderingContext2DSettings to CanvasRenderingContext2D.
+
+ This change only adds the 'desynchronized' flag, which is only a hint, so ignoring
+ it is an exceptable implementation.
+
+ "When a CanvasRenderingContext2D object's desynchronized is true, then the user
+ agent may optimize the rendering of the canvas to reduce the latency."
+ - https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-desynchronized
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add new files.
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::getContext):
+ (WebCore::HTMLCanvasElement::createContext2d):
+ (WebCore::HTMLCanvasElement::getContext2d):
+ Pipe CanvasRenderingContext2DSettings to CanvasRenderingContext2D.
+ * html/HTMLCanvasElement.h:
+ Forward declare ImageBitmapRenderingContextSettings and remove default values
+ from functions taking a ImageBitmapRenderingContextSettings. There are few
+ callers and this allows us to remove an include.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::create):
+ (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
+ * html/canvas/CanvasRenderingContext2D.h:
+ Store settings. It is not currently used for anything but returning
+ itself but will have other state in the future.
+
+ * html/canvas/CanvasRenderingContext2D.idl:
+ Add getContextAttributes() operation from https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d
+
+ * html/canvas/CanvasRenderingContext2DSettings.h: Added.
+ * html/canvas/CanvasRenderingContext2DSettings.idl: Added.
+
2021-04-29 Chris Dumez <cdu...@apple.com>
Improve local storage size estimation for quota limitation
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (276776 => 276777)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-04-29 16:09:17 UTC (rev 276777)
@@ -1065,6 +1065,7 @@
$(PROJECT_DIR)/html/canvas/CanvasPattern.idl
$(PROJECT_DIR)/html/canvas/CanvasRect.idl
$(PROJECT_DIR)/html/canvas/CanvasRenderingContext2D.idl
+$(PROJECT_DIR)/html/canvas/CanvasRenderingContext2DSettings.idl
$(PROJECT_DIR)/html/canvas/CanvasShadowStyles.idl
$(PROJECT_DIR)/html/canvas/CanvasState.idl
$(PROJECT_DIR)/html/canvas/CanvasText.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (276776 => 276777)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-04-29 16:09:17 UTC (rev 276777)
@@ -361,6 +361,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasRect.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasRenderingContext2D.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasRenderingContext2D.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasRenderingContext2DSettings.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasRenderingContext2DSettings.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasShadowStyles.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasShadowStyles.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCanvasState.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (276776 => 276777)
--- trunk/Source/WebCore/DerivedSources.make 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/DerivedSources.make 2021-04-29 16:09:17 UTC (rev 276777)
@@ -926,6 +926,7 @@
$(WebCore)/html/canvas/CanvasPattern.idl \
$(WebCore)/html/canvas/CanvasRect.idl \
$(WebCore)/html/canvas/CanvasRenderingContext2D.idl \
+ $(WebCore)/html/canvas/CanvasRenderingContext2DSettings.idl \
$(WebCore)/html/canvas/CanvasShadowStyles.idl \
$(WebCore)/html/canvas/CanvasState.idl \
$(WebCore)/html/canvas/CanvasText.idl \
Modified: trunk/Source/WebCore/Sources.txt (276776 => 276777)
--- trunk/Source/WebCore/Sources.txt 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/Sources.txt 2021-04-29 16:09:17 UTC (rev 276777)
@@ -2877,6 +2877,7 @@
JSCanvasPattern.cpp
JSCanvasRect.cpp
JSCanvasRenderingContext2D.cpp
+JSCanvasRenderingContext2DSettings.cpp
JSCanvasShadowStyles.cpp
JSCanvasState.cpp
JSCanvasText.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (276776 => 276777)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-04-29 16:09:17 UTC (rev 276777)
@@ -14384,6 +14384,8 @@
BCDFD4940E30592F009D10AD /* JSXMLHttpRequestUpload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestUpload.h; sourceTree = "<group>"; };
BCE013980C0BEF180043860A /* JSStyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheet.cpp; sourceTree = "<group>"; };
BCE013990C0BEF180043860A /* JSStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStyleSheet.h; sourceTree = "<group>"; };
+ BCE0490C263A2F1C009DCBB8 /* CanvasRenderingContext2DSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CanvasRenderingContext2DSettings.h; sourceTree = "<group>"; };
+ BCE0490E263A2F1C009DCBB8 /* CanvasRenderingContext2DSettings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CanvasRenderingContext2DSettings.idl; sourceTree = "<group>"; };
BCE1C4190D982980003B02F2 /* Location.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Location.h; sourceTree = "<group>"; };
BCE1C41A0D982980003B02F2 /* Location.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Location.cpp; sourceTree = "<group>"; };
BCE1C4220D9829F2003B02F2 /* Location.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Location.idl; sourceTree = "<group>"; };
@@ -20099,6 +20101,8 @@
49484FBE102CF23C00187DD3 /* CanvasRenderingContext2D.idl */,
3140C5211FDF318400D2A873 /* CanvasRenderingContext2DBase.cpp */,
3140C5221FDF318600D2A873 /* CanvasRenderingContext2DBase.h */,
+ BCE0490C263A2F1C009DCBB8 /* CanvasRenderingContext2DSettings.h */,
+ BCE0490E263A2F1C009DCBB8 /* CanvasRenderingContext2DSettings.idl */,
7C193BAD1F5E0EB30088F3E6 /* CanvasShadowStyles.idl */,
7C193BB21F5E0EB60088F3E6 /* CanvasState.idl */,
49484FBF102CF23C00187DD3 /* CanvasStyle.cpp */,
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (276776 => 276777)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-04-29 16:09:17 UTC (rev 276777)
@@ -33,6 +33,7 @@
#include "CanvasGradient.h"
#include "CanvasPattern.h"
#include "CanvasRenderingContext2D.h"
+#include "CanvasRenderingContext2DSettings.h"
#include "DisplayListDrawingContext.h"
#include "Document.h"
#include "EventNames.h"
@@ -44,6 +45,7 @@
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
#include "ImageBitmapRenderingContext.h"
+#include "ImageBitmapRenderingContextSettings.h"
#include "ImageBuffer.h"
#include "ImageData.h"
#include "InMemoryDisplayList.h"
@@ -279,7 +281,11 @@
}
if (is2dType(contextId)) {
- auto context = createContext2d(contextId);
+ auto scope = DECLARE_THROW_SCOPE(state.vm());
+ auto settings = convert<IDLDictionary<CanvasRenderingContext2DSettings>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
+ RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
+
+ auto context = createContext2d(contextId, WTFMove(settings));
if (!context)
return Optional<RenderingContext> { WTF::nullopt };
return Optional<RenderingContext> { RefPtr<CanvasRenderingContext2D> { context } };
@@ -287,10 +293,10 @@
if (isBitmapRendererType(contextId)) {
auto scope = DECLARE_THROW_SCOPE(state.vm());
- auto attributes = convert<IDLDictionary<ImageBitmapRenderingContextSettings>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
+ auto settings = convert<IDLDictionary<ImageBitmapRenderingContextSettings>>(state, !arguments.isEmpty() ? arguments[0].get() : JSC::jsUndefined());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
- auto context = createContextBitmapRenderer(contextId, WTFMove(attributes));
+ auto context = createContextBitmapRenderer(contextId, WTFMove(settings));
if (!context)
return Optional<RenderingContext> { WTF::nullopt };
return Optional<RenderingContext> { RefPtr<ImageBitmapRenderingContext> { context } };
@@ -330,10 +336,10 @@
CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type)
{
if (HTMLCanvasElement::is2dType(type))
- return getContext2d(type);
+ return getContext2d(type, { });
if (HTMLCanvasElement::isBitmapRendererType(type))
- return getContextBitmapRenderer(type);
+ return getContextBitmapRenderer(type, { });
#if ENABLE(WEBGL)
if (HTMLCanvasElement::isWebGLType(type))
@@ -353,7 +359,7 @@
return type == "2d";
}
-CanvasRenderingContext2D* HTMLCanvasElement::createContext2d(const String& type)
+CanvasRenderingContext2D* HTMLCanvasElement::createContext2d(const String& type, CanvasRenderingContext2DSettings&& settings)
{
ASSERT_UNUSED(HTMLCanvasElement::is2dType(type), type);
ASSERT(!m_context);
@@ -369,7 +375,7 @@
return nullptr;
}
- m_context = CanvasRenderingContext2D::create(*this, document().inQuirksMode());
+ m_context = CanvasRenderingContext2D::create(*this, WTFMove(settings), document().inQuirksMode());
#if USE(IOSURFACE_CANVAS_BACKING_STORE)
// Need to make sure a RenderLayer and compositing layer get created for the Canvas.
@@ -379,7 +385,7 @@
return static_cast<CanvasRenderingContext2D*>(m_context.get());
}
-CanvasRenderingContext2D* HTMLCanvasElement::getContext2d(const String& type)
+CanvasRenderingContext2D* HTMLCanvasElement::getContext2d(const String& type, CanvasRenderingContext2DSettings&& settings)
{
ASSERT_UNUSED(HTMLCanvasElement::is2dType(type), type);
@@ -387,7 +393,7 @@
return nullptr;
if (!m_context)
- return createContext2d(type);
+ return createContext2d(type, WTFMove(settings));
return static_cast<CanvasRenderingContext2D*>(m_context.get());
}
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (276776 => 276777)
--- trunk/Source/WebCore/html/HTMLCanvasElement.h 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h 2021-04-29 16:09:17 UTC (rev 276777)
@@ -31,7 +31,6 @@
#include "CanvasBase.h"
#include "FloatRect.h"
#include "HTMLElement.h"
-#include "ImageBitmapRenderingContextSettings.h"
#include <memory>
#include <wtf/Forward.h>
@@ -53,6 +52,8 @@
class OffscreenCanvas;
class WebGLRenderingContextBase;
class GPUCanvasContext;
+struct CanvasRenderingContext2DSettings;
+struct ImageBitmapRenderingContextSettings;
struct UncachedString;
namespace DisplayList {
@@ -77,8 +78,8 @@
CanvasRenderingContext* getContext(const String&);
static bool is2dType(const String&);
- CanvasRenderingContext2D* createContext2d(const String& type);
- CanvasRenderingContext2D* getContext2d(const String&);
+ CanvasRenderingContext2D* createContext2d(const String&, CanvasRenderingContext2DSettings&&);
+ CanvasRenderingContext2D* getContext2d(const String&, CanvasRenderingContext2DSettings&&);
#if ENABLE(WEBGL)
using WebGLVersion = GraphicsContextGLWebGLVersion;
@@ -95,8 +96,8 @@
#endif
static bool isBitmapRendererType(const String&);
- ImageBitmapRenderingContext* createContextBitmapRenderer(const String&, ImageBitmapRenderingContextSettings&& = { });
- ImageBitmapRenderingContext* getContextBitmapRenderer(const String&, ImageBitmapRenderingContextSettings&& = { });
+ ImageBitmapRenderingContext* createContextBitmapRenderer(const String&, ImageBitmapRenderingContextSettings&&);
+ ImageBitmapRenderingContext* getContextBitmapRenderer(const String&, ImageBitmapRenderingContextSettings&&);
WEBCORE_EXPORT ExceptionOr<UncachedString> toDataURL(const String& mimeType, JSC::JSValue quality);
WEBCORE_EXPORT ExceptionOr<UncachedString> toDataURL(const String& mimeType);
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (276776 => 276777)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2021-04-29 16:09:17 UTC (rev 276777)
@@ -67,9 +67,9 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(CanvasRenderingContext2D);
-std::unique_ptr<CanvasRenderingContext2D> CanvasRenderingContext2D::create(CanvasBase& canvas, bool usesCSSCompatibilityParseMode)
+std::unique_ptr<CanvasRenderingContext2D> CanvasRenderingContext2D::create(CanvasBase& canvas, CanvasRenderingContext2DSettings&& settings, bool usesCSSCompatibilityParseMode)
{
- auto renderingContext = std::unique_ptr<CanvasRenderingContext2D>(new CanvasRenderingContext2D(canvas, usesCSSCompatibilityParseMode));
+ auto renderingContext = std::unique_ptr<CanvasRenderingContext2D>(new CanvasRenderingContext2D(canvas, WTFMove(settings), usesCSSCompatibilityParseMode));
InspectorInstrumentation::didCreateCanvasRenderingContext(*renderingContext);
@@ -76,8 +76,9 @@
return renderingContext;
}
-CanvasRenderingContext2D::CanvasRenderingContext2D(CanvasBase& canvas, bool usesCSSCompatibilityParseMode)
+CanvasRenderingContext2D::CanvasRenderingContext2D(CanvasBase& canvas, CanvasRenderingContext2DSettings&& settings, bool usesCSSCompatibilityParseMode)
: CanvasRenderingContext2DBase(canvas, usesCSSCompatibilityParseMode)
+ , m_settings { WTFMove(settings) }
{
}
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (276776 => 276777)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2021-04-29 16:09:17 UTC (rev 276777)
@@ -26,6 +26,7 @@
#pragma once
#include "CanvasRenderingContext2DBase.h"
+#include "CanvasRenderingContext2DSettings.h"
#include "HTMLCanvasElement.h"
#include <memory>
@@ -36,12 +37,14 @@
class CanvasRenderingContext2D final : public CanvasRenderingContext2DBase {
WTF_MAKE_ISO_ALLOCATED(CanvasRenderingContext2D);
public:
- static std::unique_ptr<CanvasRenderingContext2D> create(CanvasBase&, bool usesCSSCompatibilityParseMode);
+ static std::unique_ptr<CanvasRenderingContext2D> create(CanvasBase&, CanvasRenderingContext2DSettings&&, bool usesCSSCompatibilityParseMode);
virtual ~CanvasRenderingContext2D();
HTMLCanvasElement& canvas() const { return downcast<HTMLCanvasElement>(canvasBase()); }
+ const CanvasRenderingContext2DSettings& getContextAttributes() const { return m_settings; }
+
void drawFocusIfNeeded(Element&);
void drawFocusIfNeeded(Path2D&, Element&);
@@ -54,7 +57,7 @@
Ref<TextMetrics> measureText(const String& text);
private:
- CanvasRenderingContext2D(CanvasBase&, bool usesCSSCompatibilityParseMode);
+ CanvasRenderingContext2D(CanvasBase&, CanvasRenderingContext2DSettings&&, bool usesCSSCompatibilityParseMode);
bool is2d() const final { return true; }
const FontProxy* fontProxy() final;
@@ -65,6 +68,8 @@
void drawFocusIfNeededInternal(const Path&, Element&);
TextDirection toTextDirection(CanvasRenderingContext2DBase::Direction, const RenderStyle** computedStyle = nullptr) const;
+
+ CanvasRenderingContext2DSettings m_settings;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (276776 => 276777)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2021-04-29 16:04:18 UTC (rev 276776)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2021-04-29 16:09:17 UTC (rev 276777)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,6 +33,8 @@
// back-reference to the canvas
readonly attribute HTMLCanvasElement canvas;
+ CanvasRenderingContext2DSettings getContextAttributes();
+
// Non-standard legacy aliases (Compositing).
[ImplementedAs=setGlobalAlpha] undefined setAlpha(optional unrestricted float alpha = NaN);
[ImplementedAs=setGlobalCompositeOperation] undefined setCompositeOperation(optional DOMString compositeOperation);
Added: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DSettings.h (0 => 276777)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DSettings.h (rev 0)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DSettings.h 2021-04-29 16:09:17 UTC (rev 276777)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+struct CanvasRenderingContext2DSettings {
+ bool desynchronized { false };
+};
+
+} // namespace WebCore
Added: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DSettings.idl (0 => 276777)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DSettings.idl (rev 0)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DSettings.idl 2021-04-29 16:09:17 UTC (rev 276777)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2dsettings
+[
+ JSGenerateToJSObject,
+] dictionary CanvasRenderingContext2DSettings {
+ // FIXME: Add support for 'alpha'.
+ // boolean alpha = true;
+ boolean desynchronized = false;
+};