Diff
Modified: trunk/LayoutTests/ChangeLog (237980 => 237981)
--- trunk/LayoutTests/ChangeLog 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/LayoutTests/ChangeLog 2018-11-08 05:29:59 UTC (rev 237981)
@@ -1,3 +1,14 @@
+2018-11-07 Justin Michaud <justin_mich...@apple.com>
+
+ CSS Painting API should pass size, arguments and input properties to paint callback
+ https://bugs.webkit.org/show_bug.cgi?id=191309
+
+ Reviewed by Chris Dumez.
+
+ * fast/css-custom-paint/properties-expected.html: Added.
+ * fast/css-custom-paint/properties.html: Added.
+ * fast/css-custom-paint/worklet.html:
+
2018-11-07 Zalan Bujtas <za...@apple.com>
Click and touch event listeners on the body don't work
Added: trunk/LayoutTests/fast/css-custom-paint/properties-expected.html (0 => 237981)
--- trunk/LayoutTests/fast/css-custom-paint/properties-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css-custom-paint/properties-expected.html 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,25 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
+
+<style>
+canvas {
+ display: block;
+}
+</style>
+
+<canvas id="paint" width="150px" height="150px" ></canvas>
+<canvas id="paint2" width="150px" height="150px" ></canvas>
+
+<script id="code">
+for (canvasID of ['paint', 'paint2']) {
+ var canvas = document.getElementById(canvasID);
+ var ctx = canvas.getContext('2d');
+
+ for (var i = 0; i < 6; i++){
+ for (var j = 0; j < 6; j++){
+ ctx.fillStyle = 'rgb(' + Math.floor(255 - 42.5 * i) + ',' +
+ Math.floor(255 - 42.5 * j) + ',0)';
+ ctx.fillRect(j * 25, i * 25, 25, 25);
+ }
+ }
+}
+</script>
Added: trunk/LayoutTests/fast/css-custom-paint/properties.html (0 => 237981)
--- trunk/LayoutTests/fast/css-custom-paint/properties.html (rev 0)
+++ trunk/LayoutTests/fast/css-custom-paint/properties.html 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,53 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
+<meta name="author" title="Justin Michaud" href=""
+<meta name="assert" content="Test paint worklet input properties and arguments">
+<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
+<script src=""
+
+<style>
+ .paint {
+ background-image: paint(my-paint,150px,helloworld1,helloworld2);
+ width: 150px;
+ height: 150px;
+ --my-prop:helloworld1;
+ --my-registered-prop:helloworld2;
+ }
+</style>
+
+<div class="paint"></div>
+<div class="paint"></div>
+
+<script id="code" type="text/worklet">
+class MyPaint {
+ static get inputProperties() { return ['height', '--my-prop', '--my-registered-prop', "--never-specified"]; }
+ static get inputArguments() { return ['*', '*', '*']; }
+ paint(ctx, geom, properties, args) {
+ assert_equals(properties.get('height').toString(), args[0].toString());
+ assert_equals(properties.get('height').value, 150);
+ assert_equals(properties.get('height').unit, 'px');
+ assert_equals(properties.get('--my-prop').toString(), args[1].toString());
+ assert_equals(properties.get('--my-registered-prop').toString(), args[2].toString());
+ assert_equals(properties.get('width'), null);
+ assert_equals(properties.get('--never-specified').toString(), '');
+
+ for (var i = 0; i < 6; i++){
+ for (var j = 0; j < 6; j++){
+ ctx.fillStyle = 'rgb(' + Math.floor(255 - 42.5 * i) + ',' +
+ Math.floor(255 - 42.5 * j) + ',0)';
+ ctx.fillRect(j * 25, i * 25, 25, 25);
+ }
+ }
+ }
+}
+registerPaint('my-paint', MyPaint);
+</script>
+
+<script>
+importWorklet(CSS.paintWorklet, document.getElementById('code').textContent);
+CSS.registerProperty({
+ name: '--my-registered-prop',
+ syntax: '*',
+ initialValue: 'initialValueProp',
+ inherits: false
+});
+</script>
Modified: trunk/LayoutTests/fast/css-custom-paint/worklet.html (237980 => 237981)
--- trunk/LayoutTests/fast/css-custom-paint/worklet.html 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/LayoutTests/fast/css-custom-paint/worklet.html 2018-11-08 05:29:59 UTC (rev 237981)
@@ -17,6 +17,13 @@
<script id="code" type="text/worklet">
class MyPaint {
paint(ctx, geom, properties) {
+ console.log("Hello from paint callback!");
+ assert_greater_than(eval("devicePixelRatio"), 0);
+ assert_throws({'name': 'ReferenceError'}, function () { eval("window"); });
+
+ const promise = new Promise((resolve, reject) => { console.log("In promise"); resolve() });
+ promise.then(() => console.log("Promise was resolved"));
+
for (var i = 0; i < 6; i++){
for (var j = 0; j < 6; j++){
ctx.fillStyle = 'rgb(' + Math.floor(255 - 42.5 * i) + ',' +
@@ -24,12 +31,6 @@
ctx.fillRect(j * 25, i * 25, 25, 25);
}
}
- console.log("Hello from paint callback!");
- assert_greater_than(eval("devicePixelRatio"), 0);
- assert_throws({'name': 'ReferenceError'}, function () { eval("window"); });
-
- const promise = new Promise((resolve, reject) => { console.log("In promise"); resolve() });
- promise.then(() => console.log("Promise was resolved"));
}
}
console.log("Hello from paint worklet!");
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/typedom.tentative-expected.txt (237980 => 237981)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/typedom.tentative-expected.txt 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/typedom.tentative-expected.txt 2018-11-08 05:29:59 UTC (rev 237981)
@@ -1,6 +1,6 @@
-CONSOLE MESSAGE: line 340: ReferenceError: Can't find variable: CSSUnparsedValue
+CONSOLE MESSAGE: line 349: TypeError: CSS.px is not a function. (In 'CSS.px(15)', 'CSS.px' is undefined)
-Harness Error (FAIL), message = ReferenceError: Can't find variable: CSSUnparsedValue
+Harness Error (FAIL), message = TypeError: CSS.px is not a function. (In 'CSS.px(15)', 'CSS.px' is undefined)
FAIL Computed * is reified as CSSUnparsedValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined)
FAIL Computed <angle> is reified as CSSUnitValue The given initial value does not parse for the given syntax.
@@ -8,12 +8,12 @@
FAIL Computed <custom-ident> is reified as CSSKeywordValue The given initial value does not parse for the given syntax.
FAIL Computed <image> [url] is reified as CSSImageValue The given initial value does not parse for the given syntax.
FAIL Computed <integer> is reified as CSSUnitValue The given initial value does not parse for the given syntax.
-FAIL Computed <length-percentage> [%] is reified as CSSUnitValue Can't find variable: CSSUnitValue
-FAIL Computed <length-percentage> [px] is reified as CSSUnitValue Can't find variable: CSSUnitValue
+FAIL Computed <length-percentage> [%] is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined)
+FAIL Computed <length-percentage> [px] is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined)
FAIL Computed <length-percentage> [px + %] is reified as CSSMathSum Can't find variable: CSSMathSum
-FAIL Computed <length> is reified as CSSUnitValue Can't find variable: CSSUnitValue
+FAIL Computed <length> is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined)
FAIL Computed <number> is reified as CSSUnitValue The given initial value does not parse for the given syntax.
-FAIL Computed <percentage> is reified as CSSUnitValue Can't find variable: CSSUnitValue
+FAIL Computed <percentage> is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined)
FAIL Computed <resolution> is reified as CSSUnitValue The given initial value does not parse for the given syntax.
FAIL Computed <time> is reified as CSSUnitValue The given initial value does not parse for the given syntax.
FAIL Computed <url> is reified as CSSStyleValue The given initial value does not parse for the given syntax.
Modified: trunk/Source/WebCore/CMakeLists.txt (237980 => 237981)
--- trunk/Source/WebCore/CMakeLists.txt 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/CMakeLists.txt 2018-11-08 05:29:59 UTC (rev 237981)
@@ -69,6 +69,7 @@
"${WEBCORE_DIR}/crypto/parameters"
"${WEBCORE_DIR}/css"
"${WEBCORE_DIR}/css/parser"
+ "${WEBCORE_DIR}/css/typedom"
"${WEBCORE_DIR}/cssjit"
"${WEBCORE_DIR}/dom"
"${WEBCORE_DIR}/dom/default"
@@ -197,6 +198,8 @@
bindings/js
+ css/typedom
+
html/canvas
html/shadow
html/track
@@ -546,6 +549,7 @@
css/CSSMediaRule.idl
css/CSSNamespaceRule.idl
css/CSSPaintCallback.idl
+ css/CSSPaintSize.idl
css/CSSPageRule.idl
css/CSSRule.idl
css/CSSRuleList.idl
@@ -577,6 +581,13 @@
css/StyleMedia.idl
css/StyleSheet.idl
css/StyleSheetList.idl
+
+ css/typedom/CSSNumericValue.idl
+ css/typedom/CSSStyleValue.idl
+ css/typedom/CSSUnitValue.idl
+ css/typedom/CSSUnparsedValue.idl
+ css/typedom/StylePropertyMapReadOnly.idl
+
css/WebKitCSSMatrix.idl
css/WebKitCSSViewportRule.idl
Modified: trunk/Source/WebCore/ChangeLog (237980 => 237981)
--- trunk/Source/WebCore/ChangeLog 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/ChangeLog 2018-11-08 05:29:59 UTC (rev 237981)
@@ -1,3 +1,57 @@
+2018-11-07 Justin Michaud <justin_mich...@apple.com>
+
+ CSS Painting API should pass size, arguments and input properties to paint callback
+ https://bugs.webkit.org/show_bug.cgi?id=191309
+
+ Reviewed by Chris Dumez.
+
+ Call paint() callback with input properties and arguments. This patch adds a stub for
+ the CSS Typed OM StylePropertyMapReadOnly, and passes all the arguments as strings without
+ any syntax checking to the paint callback.
+
+ Test: fast/css-custom-paint/properties.html
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSCSSStyleValueCustom.cpp: Copied from Source/WebCore/css/CSSPaintCallback.h.
+ (WebCore::toJSNewlyCreated):
+ (WebCore::toJS):
+ * bindings/js/WebCoreBuiltinNames.h:
+ * css/CSSPaintCallback.h:
+ * css/CSSPaintCallback.idl:
+ * css/CSSPaintImageValue.cpp:
+ (WebCore::CSSPaintImageValue::image):
+ * css/CSSPaintImageValue.h:
+ * css/CSSPaintSize.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
+ (WebCore::CSSPaintSize::create):
+ (WebCore::CSSPaintSize::width const):
+ (WebCore::CSSPaintSize::height const):
+ (WebCore::CSSPaintSize::CSSPaintSize):
+ * css/CSSPaintSize.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
+ * css/parser/CSSPropertyParserHelpers.cpp:
+ (WebCore::CSSPropertyParserHelpers::consumeCustomPaint):
+ * css/typedom/CSSNumericValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
+ * css/typedom/CSSNumericValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
+ * css/typedom/CSSStyleValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
+ (WebCore::CSSStyleValue::isUnitValue):
+ (WebCore::CSSStyleValue::isUnparsedValue):
+ * css/typedom/CSSStyleValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
+ * css/typedom/CSSUnitValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
+ * css/typedom/CSSUnitValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
+ * css/typedom/CSSUnparsedValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
+ * css/typedom/CSSUnparsedValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
+ * css/typedom/StylePropertyMapReadOnly.h: Copied from Source/WebCore/css/CSSPaintCallback.h.
+ (WebCore::StylePropertyMapReadOnly::create):
+ (WebCore::StylePropertyMapReadOnly::get):
+ (WebCore::StylePropertyMapReadOnly::StylePropertyMapReadOnly):
+ * css/typedom/StylePropertyMapReadOnly.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl.
+ * platform/graphics/CustomPaintImage.cpp:
+ (WebCore::CustomPaintImage::CustomPaintImage):
+ (WebCore::CustomPaintImage::doCustomPaint):
+ * platform/graphics/CustomPaintImage.h:
+
2018-11-07 Brent Fulgham <bfulg...@apple.com>
Provide better Font fallbacks for DirectX backend
Modified: trunk/Source/WebCore/DerivedSources.make (237980 => 237981)
--- trunk/Source/WebCore/DerivedSources.make 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/DerivedSources.make 2018-11-08 05:29:59 UTC (rev 237981)
@@ -68,6 +68,7 @@
$(WebCore)/crypto/keys \
$(WebCore)/crypto/parameters \
$(WebCore)/css \
+ $(WebCore)/css/typedom \
$(WebCore)/dom \
$(WebCore)/editing \
$(WebCore)/fileapi \
@@ -459,6 +460,7 @@
$(WebCore)/css/CSSNamespaceRule.idl \
$(WebCore)/css/CSSPageRule.idl \
$(WebCore)/css/CSSPaintCallback.idl \
+ $(WebCore)/css/CSSPaintSize.idl \
$(WebCore)/css/CSSRule.idl \
$(WebCore)/css/CSSRuleList.idl \
$(WebCore)/css/CSSStyleDeclaration.idl \
@@ -489,6 +491,11 @@
$(WebCore)/css/StyleMedia.idl \
$(WebCore)/css/StyleSheet.idl \
$(WebCore)/css/StyleSheetList.idl \
+ $(WebCore)/css/typedom/CSSNumericValue.idl \
+ $(WebCore)/css/typedom/CSSStyleValue.idl \
+ $(WebCore)/css/typedom/CSSUnitValue.idl \
+ $(WebCore)/css/typedom/CSSUnparsedValue.idl \
+ $(WebCore)/css/typedom/StylePropertyMapReadOnly.idl \
$(WebCore)/css/WebKitCSSMatrix.idl \
$(WebCore)/css/WebKitCSSViewportRule.idl \
$(WebCore)/dom/AbortController.idl \
@@ -1499,6 +1506,7 @@
$(WebCore)/accessibility \
$(WebCore)/animation \
$(WebCore)/css \
+ $(WebCore)/css/typedom \
$(WebCore)/crypto \
$(WebCore)/dom \
$(WebCore)/fileapi \
Modified: trunk/Source/WebCore/Sources.txt (237980 => 237981)
--- trunk/Source/WebCore/Sources.txt 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/Sources.txt 2018-11-08 05:29:59 UTC (rev 237981)
@@ -379,6 +379,7 @@
bindings/js/JSCSSRuleCustom.cpp
bindings/js/JSCSSRuleListCustom.cpp
bindings/js/JSCSSStyleDeclarationCustom.cpp
+bindings/js/JSCSSStyleValueCustom.cpp
bindings/js/JSDOMConvertDate.cpp
bindings/js/JSDOMConvertNumbers.cpp
bindings/js/JSDOMConvertStrings.cpp
@@ -2489,7 +2490,12 @@
JSCSSKeyframesRule.cpp
JSCSSMediaRule.cpp
JSCSSNamespaceRule.cpp
+JSCSSNumericValue.cpp
JSCSSPaintCallback.cpp
+JSCSSPaintSize.cpp
+JSCSSStyleValue.cpp
+JSCSSUnitValue.cpp
+JSCSSUnparsedValue.cpp
JSPaintWorkletGlobalScope.cpp
JSWorklet.cpp
JSWorkletGlobalScope.cpp
@@ -3158,6 +3164,7 @@
JSStorageEvent.cpp
JSStringCallback.cpp
JSStyleMedia.cpp
+JSStylePropertyMapReadOnly.cpp
JSStyleSheet.cpp
JSStyleSheetList.cpp
JSSubtleCrypto.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237980 => 237981)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-11-08 05:29:59 UTC (rev 237981)
@@ -1359,6 +1359,12 @@
4B7AE4932177B56F00C59959 /* CustomPaintImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B7AE4922177B56F00C59959 /* CustomPaintImage.h */; };
4B7F9C522183B5E5001CEBA0 /* WorkletConsoleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B7F9C512183B5E5001CEBA0 /* WorkletConsoleClient.h */; };
4BAE95B10B2FA9CE00AED8A0 /* EditorDeleteAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 4BAFD0CB2190EBD600C0AB64 /* CSSPaintSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */; };
+ 4BAFD0CF2190F9B500C0AB64 /* StylePropertyMapReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */; };
+ 4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */; };
+ 4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */; };
+ 4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */; };
+ 4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */; };
4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */; };
4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */; };
4BDA40012151B6F500FD6604 /* CSSRegisteredCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7925,6 +7931,19 @@
4B7F9C512183B5E5001CEBA0 /* WorkletConsoleClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WorkletConsoleClient.h; sourceTree = "<group>"; };
4B7F9C542183B634001CEBA0 /* WorkletConsoleClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WorkletConsoleClient.cpp; sourceTree = "<group>"; };
4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorDeleteAction.h; sourceTree = "<group>"; };
+ 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSPaintSize.h; sourceTree = "<group>"; };
+ 4BAFD0CD2190EBE900C0AB64 /* CSSPaintSize.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSPaintSize.idl; sourceTree = "<group>"; };
+ 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StylePropertyMapReadOnly.h; sourceTree = "<group>"; };
+ 4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = StylePropertyMapReadOnly.idl; sourceTree = "<group>"; };
+ 4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSStyleValue.idl; sourceTree = "<group>"; };
+ 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSStyleValue.h; sourceTree = "<group>"; };
+ 4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnparsedValue.idl; sourceTree = "<group>"; };
+ 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSUnparsedValue.h; sourceTree = "<group>"; };
+ 4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSNumericValue.idl; sourceTree = "<group>"; };
+ 4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnitValue.idl; sourceTree = "<group>"; };
+ 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = CSSUnitValue.h; sourceTree = "<group>"; };
+ 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSNumericValue.h; sourceTree = "<group>"; };
+ 4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleValueCustom.cpp; sourceTree = "<group>"; };
4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSRegisterCustomProperty.idl; sourceTree = "<group>"; };
4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCSSRegisterCustomProperty.cpp; sourceTree = "<group>"; };
4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSCustomPropertyDescriptor.h; sourceTree = "<group>"; };
@@ -18088,6 +18107,23 @@
path = animation;
sourceTree = "<group>";
};
+ 4BAFD0DA21921EAD00C0AB64 /* typedom */ = {
+ isa = PBXGroup;
+ children = (
+ 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */,
+ 4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */,
+ 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */,
+ 4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */,
+ 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */,
+ 4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */,
+ 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */,
+ 4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */,
+ 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */,
+ 4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */,
+ );
+ path = typedom;
+ sourceTree = "<group>";
+ };
4BDEA318217EBB880052DFCD /* worklets */ = {
isa = PBXGroup;
children = (
@@ -20264,6 +20300,7 @@
9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */,
BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */,
+ 4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */,
BC20FB7E0C0E8E6C00D1447F /* JSDeprecatedCSSOMValueCustom.cpp */,
49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
ADDA94BF19686F8000453029 /* JSDocumentCustom.h */,
@@ -26070,6 +26107,7 @@
isa = PBXGroup;
children = (
946D37271D6CB2250077084F /* parser */,
+ 4BAFD0DA21921EAD00C0AB64 /* typedom */,
FBD6AF8415EF21D4008B7110 /* BasicShapeFunctions.cpp */,
FBD6AF8515EF21D4008B7110 /* BasicShapeFunctions.h */,
A80E6CDA0A1989CA007FB8C5 /* Counter.h */,
@@ -26176,6 +26214,8 @@
4B5BDD99216588E500DD4262 /* CSSPaintCallback.idl */,
4B6E876B2176D8A100420E5E /* CSSPaintImageValue.cpp */,
4B6E87682176D69200420E5E /* CSSPaintImageValue.h */,
+ 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */,
+ 4BAFD0CD2190EBE900C0AB64 /* CSSPaintSize.idl */,
9418278C1D8CAE9500492764 /* CSSPendingSubstitutionValue.cpp */,
9418278D1D8CAE9500492764 /* CSSPendingSubstitutionValue.h */,
A80E6CDB0A1989CA007FB8C5 /* CSSPrimitiveValue.cpp */,
@@ -28171,9 +28211,11 @@
A80E6D030A1989CA007FB8C5 /* CSSMediaRule.h in Headers */,
314BE3A11B30F6B700141982 /* CSSNamedImageValue.h in Headers */,
94E839511DFB2A0E007BC6A7 /* CSSNamespaceRule.h in Headers */,
+ 4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */,
A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */,
4B6E87692176D69200420E5E /* CSSPaintImageValue.h in Headers */,
+ 4BAFD0CB2190EBD600C0AB64 /* CSSPaintSize.h in Headers */,
946D372E1D6CB2940077084F /* CSSParser.h in Headers */,
E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */,
949C77011D6E1D9800C0DE4F /* CSSParserFastPaths.h in Headers */,
@@ -28211,6 +28253,7 @@
A80E6E0F0A19911C007FB8C5 /* CSSStyleDeclaration.h in Headers */,
A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */,
A8EA80070A19516E00A8EF5F /* CSSStyleSheet.h in Headers */,
+ 4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */,
94DE5C921D83011D00164F2A /* CSSSupportsParser.h in Headers */,
FC54D05716A7673100575E4D /* CSSSupportsRule.h in Headers */,
BC80C9880CD294EE00A0B7B3 /* CSSTimingFunctionValue.h in Headers */,
@@ -28220,7 +28263,9 @@
A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */,
715AD7212050513F00D592DC /* CSSTransition.h in Headers */,
371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */,
+ 4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */,
DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */,
+ 4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */,
BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */,
A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */,
6565815109D13043000E61D7 /* CSSValueKeywords.h in Headers */,
@@ -30997,6 +31042,7 @@
BC5EB74E0E81E06700B25965 /* StyleMultiColData.h in Headers */,
E4DACE6A1D12E10B0075980F /* StylePendingResources.h in Headers */,
A80E6DFC0A199067007FB8C5 /* StyleProperties.h in Headers */,
+ 4BAFD0CF2190F9B500C0AB64 /* StylePropertyMapReadOnly.h in Headers */,
E1B25107152A0BB00069B779 /* StylePropertyShorthand.h in Headers */,
83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */,
BC2272E40E82EE9B00E7F975 /* StyleRareInheritedData.h in Headers */,
Copied: trunk/Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.h) (0 => 237981)
--- trunk/Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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.
+ */
+
+#include "config.h"
+#include "JSCSSStyleValue.h"
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include "JSCSSUnitValue.h"
+#include "JSCSSUnparsedValue.h"
+
+namespace WebCore {
+using namespace JSC;
+
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<CSSStyleValue>&& value)
+{
+ if (value->isUnitValue())
+ return createWrapper<CSSUnitValue>(globalObject, WTFMove(value));
+ if (value->isUnparsedValue())
+ return createWrapper<CSSUnparsedValue>(globalObject, WTFMove(value));
+
+ ASSERT_NOT_REACHED();
+ return createWrapper<CSSStyleValue>(globalObject, WTFMove(value));
+}
+
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, CSSStyleValue& object)
+{
+ return wrap(state, globalObject, object);
+}
+
+} // namespace WebCore
+
+#endif
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (237980 => 237981)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -49,7 +49,12 @@
macro(Credential) \
macro(CredentialsContainer) \
macro(CSSAnimation) \
+ macro(CSSNumericValue) \
+ macro(CSSPaintSize) \
+ macro(CSSStyleValue) \
macro(CSSTransition) \
+ macro(CSSUnitValue) \
+ macro(CSSUnparsedValue) \
macro(CustomElementRegistry) \
macro(Database) \
macro(DataTransferItem) \
@@ -161,6 +166,7 @@
macro(ShadowRoot) \
macro(SpectreGadget) \
macro(StaticRange) \
+ macro(StylePropertyMapReadOnly) \
macro(VRDisplay) \
macro(VRDisplayCapabilities) \
macro(VRDisplayEvent) \
Modified: trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp (237980 => 237981)
--- trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp 2018-11-08 05:29:59 UTC (rev 237981)
@@ -40,6 +40,7 @@
#include <_javascript_Core/Exception.h>
#include <_javascript_Core/ExceptionHelpers.h>
#include <_javascript_Core/GCActivityCallback.h>
+#include <_javascript_Core/JSCInlines.h>
#include <_javascript_Core/JSLock.h>
#include <_javascript_Core/PromiseDeferredTimer.h>
#include <_javascript_Core/StrongInlines.h>
Modified: trunk/Source/WebCore/css/CSSPaintCallback.h (237980 => 237981)
--- trunk/Source/WebCore/css/CSSPaintCallback.h 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/css/CSSPaintCallback.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -28,7 +28,9 @@
#if ENABLE(CSS_PAINTING_API)
#include "ActiveDOMCallback.h"
+#include "CSSPaintSize.h"
#include "CallbackResult.h"
+#include "StylePropertyMapReadOnly.h"
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -38,7 +40,7 @@
public:
using ActiveDOMCallback::ActiveDOMCallback;
- virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0;
+ virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&, CSSPaintSize&, StylePropertyMapReadOnly&, const Vector<String>&) = 0;
virtual ~CSSPaintCallback()
{
Modified: trunk/Source/WebCore/css/CSSPaintCallback.idl (237980 => 237981)
--- trunk/Source/WebCore/css/CSSPaintCallback.idl 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/css/CSSPaintCallback.idl 2018-11-08 05:29:59 UTC (rev 237981)
@@ -26,4 +26,4 @@
[
EnabledAtRuntime=CSSPaintingAPI,
Conditional=CSS_PAINTING_API,
-] callback CSSPaintCallback = void (PaintRenderingContext2D context);
+] callback CSSPaintCallback = void (PaintRenderingContext2D context, CSSPaintSize size, StylePropertyMapReadOnly styleMap, sequence<USVString> arguments);
Modified: trunk/Source/WebCore/css/CSSPaintImageValue.cpp (237980 => 237981)
--- trunk/Source/WebCore/css/CSSPaintImageValue.cpp 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/css/CSSPaintImageValue.cpp 2018-11-08 05:29:59 UTC (rev 237981)
@@ -29,6 +29,7 @@
#if ENABLE(CSS_PAINTING_API)
+#include "CSSVariableData.h"
#include "CustomPaintImage.h"
#include "PaintWorkletGlobalScope.h"
#include "RenderElement.h"
@@ -58,7 +59,25 @@
if (!registration)
return nullptr;
- return CustomPaintImage::create(*registration, size);
+
+ // FIXME: Check if argument list matches syntax.
+ Vector<String> arguments;
+ CSSParserTokenRange localRange(m_arguments->tokenRange());
+
+ while (!localRange.atEnd()) {
+ StringBuilder builder;
+ while (!localRange.atEnd() && localRange.peek() != CommaToken) {
+ if (localRange.peek() == CommentToken)
+ localRange.consume();
+ else
+ localRange.consume().serialize(builder);
+ }
+ if (!localRange.atEnd())
+ localRange.consume(); // comma token
+ arguments.append(builder.toString());
+ }
+
+ return CustomPaintImage::create(*registration, size, renderElement, arguments);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSPaintImageValue.h (237980 => 237981)
--- trunk/Source/WebCore/css/CSSPaintImageValue.h 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/css/CSSPaintImageValue.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -31,12 +31,13 @@
#include "CSSImageGeneratorValue.h"
namespace WebCore {
+class CSSVariableData;
class CSSPaintImageValue final : public CSSImageGeneratorValue {
public:
- static Ref<CSSPaintImageValue> create(const String& name)
+ static Ref<CSSPaintImageValue> create(const String& name, Ref<CSSVariableData>&& arguments)
{
- return adoptRef(*new CSSPaintImageValue(name));
+ return adoptRef(*new CSSPaintImageValue(name, WTFMove(arguments)));
}
RefPtr<Image> image(RenderElement&, const FloatSize&);
@@ -53,13 +54,15 @@
void loadSubimages(CachedResourceLoader&, const ResourceLoaderOptions&) { }
private:
- CSSPaintImageValue(const String& name)
+ CSSPaintImageValue(const String& name, Ref<CSSVariableData>&& arguments)
: CSSImageGeneratorValue(PaintImageClass)
, m_name(name)
+ , m_arguments(WTFMove(arguments))
{
}
const String m_name;
+ Ref<CSSVariableData> m_arguments;
};
} // namespace WebCore
Copied: trunk/Source/WebCore/css/CSSPaintSize.h (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.h) (0 => 237981)
--- trunk/Source/WebCore/css/CSSPaintSize.h (rev 0)
+++ trunk/Source/WebCore/css/CSSPaintSize.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSPaintSize : public RefCounted<CSSPaintSize> {
+public:
+ static Ref<CSSPaintSize> create(double width, double height)
+ {
+ return adoptRef(*new CSSPaintSize(width, height));
+ }
+
+ double width() const { return m_width; }
+ double height() const { return m_height; }
+
+private:
+ CSSPaintSize(double width, double height)
+ : m_width(width)
+ , m_height(height)
+ {
+ }
+
+ double m_width;
+ double m_height;
+};
+
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/CSSPaintSize.idl (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.idl) (0 => 237981)
--- trunk/Source/WebCore/css/CSSPaintSize.idl (rev 0)
+++ trunk/Source/WebCore/css/CSSPaintSize.idl 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,34 @@
+/*
+* Copyright (C) 2018 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. ``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
+* 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.
+*/
+
+[
+ EnabledAtRuntime=CSSPaintingAPI,
+ Conditional=CSS_PAINTING_API,
+ Exposed=PaintWorklet,
+ ImplementationLacksVTable,
+] interface CSSPaintSize {
+ readonly attribute double width;
+ readonly attribute double height;
+};
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (237980 => 237981)
--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp 2018-11-08 05:29:59 UTC (rev 237981)
@@ -1295,11 +1295,17 @@
return nullptr;
auto name = args.consumeIncludingWhitespace().value().toString();
- // FIXME: should parse arguments.
+ if (!args.atEnd() && args.peek() != CommaToken)
+ return nullptr;
+ if (!args.atEnd())
+ args.consume();
+
+ auto argumentList = CSSVariableData::create(args);
+
while (!args.atEnd())
args.consume();
- return CSSPaintImageValue::create(name);
+ return CSSPaintImageValue::create(name, WTFMove(argumentList));
}
#endif
Copied: trunk/Source/WebCore/css/typedom/CSSNumericValue.h (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.h) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSNumericValue.h (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSNumericValue.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include "CSSStyleValue.h"
+
+namespace WebCore {
+
+class CSSNumericValue : public CSSStyleValue {
+protected:
+ CSSNumericValue() = default;
+};
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/typedom/CSSNumericValue.idl (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.idl) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSNumericValue.idl (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSNumericValue.idl 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,34 @@
+/*
+* Copyright (C) 2018 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. ``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
+* 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.
+*/
+
+// FIXME: Implement this properly, according to the Typed OM spec.
+// This is just a stub for the CSS painting API for now. Once the Typed OM
+// is going to be implemented, please change the runtime flag.
+[
+ EnabledAtRuntime=CSSPaintingAPI,
+ Conditional=CSS_PAINTING_API,
+ Exposed=(Window,Worker,PaintWorklet),
+] interface CSSNumericValue : CSSStyleValue {
+};
Copied: trunk/Source/WebCore/css/typedom/CSSStyleValue.h (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.h) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSStyleValue.h (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValue.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CSSStyleValue : public RefCounted<CSSStyleValue> {
+public:
+ virtual ~CSSStyleValue() = default;
+ virtual String toString() = 0;
+
+ virtual bool isUnitValue() { return false; }
+ virtual bool isUnparsedValue() { return false; }
+
+protected:
+ CSSStyleValue() = default;
+};
+
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/typedom/CSSStyleValue.idl (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.idl) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSStyleValue.idl (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValue.idl 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,37 @@
+/*
+* Copyright (C) 2018 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. ``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
+* 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.
+*/
+
+// FIXME: Implement this properly, according to the Typed OM spec.
+// This is just a stub for the CSS painting API for now. Once the Typed OM
+// is going to be implemented, please change the runtime flag.
+[
+ CustomToJSObject,
+ EnabledAtRuntime=CSSPaintingAPI,
+ Conditional=CSS_PAINTING_API,
+ Exposed=(Window,Worker,PaintWorklet),
+ SkipVTableValidation,
+] interface CSSStyleValue {
+ stringifier;
+};
Copied: trunk/Source/WebCore/css/typedom/CSSUnitValue.h (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.h) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSUnitValue.h (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSUnitValue.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include "CSSNumericValue.h"
+#include <wtf/RefCounted.h>
+#include <wtf/text/StringConcatenateNumbers.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CSSUnitValue final : public CSSNumericValue {
+public:
+ static Ref<CSSUnitValue> create(double value, const String& unit)
+ {
+ return adoptRef(*new CSSUnitValue(value, unit));
+ }
+
+ // FIXME: not correct.
+ String toString() final { return makeString((int) m_value, m_unit); }
+
+ double value() const { return m_value; }
+ void setValue(double value) { m_value = value; }
+ const String& unit() const { return m_unit; }
+ void setUnit(const String& unit) { m_unit = unit; }
+
+private:
+ CSSUnitValue(double value, const String& unit)
+ : m_value(value)
+ , m_unit(unit)
+ {
+ }
+
+ bool isUnitValue() final { return true; }
+
+ double m_value;
+ String m_unit;
+};
+
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/typedom/CSSUnitValue.idl (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.idl) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSUnitValue.idl (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSUnitValue.idl 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,37 @@
+/*
+* Copyright (C) 2018 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. ``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
+* 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.
+*/
+
+// FIXME: Implement this properly, according to the Typed OM spec.
+// This is just a stub for the CSS painting API for now. Once the Typed OM
+// is going to be implemented, please change the runtime flag.
+[
+ EnabledAtRuntime=CSSPaintingAPI,
+ Conditional=CSS_PAINTING_API,
+ Exposed=(Window,Worker,PaintWorklet),
+ Constructor(double value, USVString unit),
+] interface CSSUnitValue : CSSNumericValue {
+ attribute double value;
+ readonly attribute USVString unit;
+};
Copied: trunk/Source/WebCore/css/typedom/CSSUnparsedValue.h (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.h) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSUnparsedValue.h (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSUnparsedValue.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include "CSSStyleValue.h"
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CSSUnparsedValue final : public CSSStyleValue {
+public:
+ static Ref<CSSUnparsedValue> create(const String& serializedValue)
+ {
+ return adoptRef(*new CSSUnparsedValue(serializedValue));
+ }
+
+ String toString() final { return m_serializedValue; }
+
+private:
+ explicit CSSUnparsedValue(const String& serializedValue)
+ : m_serializedValue(serializedValue)
+ {
+ }
+
+ bool isUnparsedValue() final { return true; }
+
+ String m_serializedValue;
+};
+
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.idl) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,36 @@
+/*
+* Copyright (C) 2018 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. ``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
+* 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.
+*/
+
+// FIXME: Implement this properly, according to the Typed OM spec.
+// This is just a stub for the CSS painting API for now. Once the Typed OM
+// is going to be implemented, please change the runtime flag.
+// FIXME: wrong constructor.
+[
+ EnabledAtRuntime=CSSPaintingAPI,
+ Conditional=CSS_PAINTING_API,
+ Exposed=(Window,Worker,PaintWorklet),
+ Constructor(USVString serializedValue),
+] interface CSSUnparsedValue : CSSStyleValue {
+};
Copied: trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.h) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h (rev 0)
+++ trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include "CSSStyleValue.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class StylePropertyMapReadOnly : public RefCounted<StylePropertyMapReadOnly> {
+public:
+ static Ref<StylePropertyMapReadOnly> create(HashMap<String, Ref<CSSStyleValue>>&& map)
+ {
+ return adoptRef(*new StylePropertyMapReadOnly(WTFMove(map)));
+ }
+
+ CSSStyleValue* get(String property) const { return m_map.get(property); }
+
+private:
+ explicit StylePropertyMapReadOnly(HashMap<String, Ref<CSSStyleValue>>&& map)
+ : m_map(WTFMove(map))
+ {
+ }
+
+ HashMap<String, Ref<CSSStyleValue>> m_map;
+};
+
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl (from rev 237980, trunk/Source/WebCore/css/CSSPaintCallback.idl) (0 => 237981)
--- trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl (rev 0)
+++ trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl 2018-11-08 05:29:59 UTC (rev 237981)
@@ -0,0 +1,37 @@
+/*
+* Copyright (C) 2018 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. ``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
+* 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.
+*/
+
+// FIXME: Implement this properly, according to the Typed OM spec.
+// This is just a stub for the CSS painting API for now. Once the Typed OM
+// is going to be implemented, please change the runtime flag.
+[
+ EnabledAtRuntime=CSSPaintingAPI,
+ Conditional=CSS_PAINTING_API,
+ Exposed=(Window,Worker,PaintWorklet),
+ ImplementationLacksVTable
+] interface StylePropertyMapReadOnly {
+ // FIXME: should be (undefined or CSSStyleValue), not null
+ CSSStyleValue? get(USVString property);
+};
Modified: trunk/Source/WebCore/platform/graphics/CustomPaintImage.cpp (237980 => 237981)
--- trunk/Source/WebCore/platform/graphics/CustomPaintImage.cpp 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/platform/graphics/CustomPaintImage.cpp 2018-11-08 05:29:59 UTC (rev 237981)
@@ -28,6 +28,11 @@
#if ENABLE(CSS_PAINTING_API)
+#include "CSSComputedStyleDeclaration.h"
+#include "CSSPrimitiveValue.h"
+#include "CSSPropertyParser.h"
+#include "CSSUnitValue.h"
+#include "CSSUnparsedValue.h"
#include "CustomPaintCanvas.h"
#include "GraphicsContext.h"
#include "ImageBitmap.h"
@@ -34,11 +39,15 @@
#include "ImageBuffer.h"
#include "JSCSSPaintCallback.h"
#include "PaintRenderingContext2D.h"
+#include "RenderElement.h"
namespace WebCore {
-CustomPaintImage::CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size)
+CustomPaintImage::CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size, RenderElement& element, const Vector<String>& arguments)
: m_paintCallback(definition.paintCallback.get())
+ , m_inputProperties(definition.inputProperties)
+ , m_element(makeWeakPtr(element))
+ , m_arguments(arguments)
{
setContainerSize(size);
}
@@ -47,6 +56,12 @@
ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, const FloatSize& destSize)
{
+ if (!m_element || !m_element->element())
+ return ImageDrawResult::DidNothing;
+
+ ASSERT(!m_element->needsLayout());
+ ASSERT(!m_element->element()->document().needsStyleRecalc());
+
JSCSSPaintCallback& callback = static_cast<JSCSSPaintCallback&>(m_paintCallback.get());
auto* scriptExecutionContext = callback.scriptExecutionContext();
if (!scriptExecutionContext)
@@ -59,7 +74,36 @@
return ImageDrawResult::DidNothing;
auto context = contextOrException.releaseReturnValue();
- auto result = m_paintCallback->handleEvent(*context);
+ HashMap<String, Ref<CSSStyleValue>> propertyValues;
+ ComputedStyleExtractor extractor(m_element->element());
+
+ for (auto& name : m_inputProperties) {
+ RefPtr<CSSValue> value;
+ if (isCustomPropertyName(name))
+ value = extractor.customPropertyValue(name);
+ else {
+ CSSPropertyID propertyID = cssPropertyID(name);
+ if (!propertyID)
+ return ImageDrawResult::DidNothing;
+ value = extractor.propertyValue(propertyID, DoNotUpdateLayout);
+ }
+
+ if (!value) {
+ propertyValues.add(name, CSSUnparsedValue::create(emptyString()));
+ continue;
+ }
+
+ // FIXME: Properly reify all length values.
+ if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).primitiveType() == CSSPrimitiveValue::CSS_PX)
+ propertyValues.add(name, CSSUnitValue::create(downcast<CSSPrimitiveValue>(*value).doubleValue(), "px"));
+ else
+ propertyValues.add(name, CSSUnparsedValue::create(value->cssText()));
+ }
+
+ auto size = CSSPaintSize::create(destSize.width(), destSize.height());
+ auto propertyMap = StylePropertyMapReadOnly::create(WTFMove(propertyValues));
+
+ auto result = m_paintCallback->handleEvent(*context, size, propertyMap, m_arguments);
if (result.type() != CallbackResultType::Success)
return ImageDrawResult::DidNothing;
Modified: trunk/Source/WebCore/platform/graphics/CustomPaintImage.h (237980 => 237981)
--- trunk/Source/WebCore/platform/graphics/CustomPaintImage.h 2018-11-08 05:15:02 UTC (rev 237980)
+++ trunk/Source/WebCore/platform/graphics/CustomPaintImage.h 2018-11-08 05:29:59 UTC (rev 237981)
@@ -29,16 +29,18 @@
#include "GeneratedImage.h"
#include "PaintWorkletGlobalScope.h"
+#include <wtf/WeakPtr.h>
namespace WebCore {
class ImageBuffer;
+class RenderElement;
class CustomPaintImage final : public GeneratedImage {
public:
- static Ref<CustomPaintImage> create(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size)
+ static Ref<CustomPaintImage> create(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size, RenderElement& element, const Vector<String>& arguments)
{
- return adoptRef(*new CustomPaintImage(definition, size));
+ return adoptRef(*new CustomPaintImage(definition, size, element, arguments));
}
virtual ~CustomPaintImage();
@@ -45,7 +47,7 @@
bool isCustomPaintImage() const override { return true; }
private:
- CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition&, const FloatSize&);
+ CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition&, const FloatSize&, RenderElement&, const Vector<String>& arguments);
ImageDrawResult doCustomPaint(GraphicsContext&, const FloatSize&);
@@ -53,6 +55,9 @@
void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode) final;
Ref<CSSPaintCallback> m_paintCallback;
+ Vector<String> m_inputProperties;
+ WeakPtr<RenderElement> m_element;
+ Vector<String> m_arguments;
};
}