Changeset 237981 in webkit
- Timestamp:
- Nov 7, 2018 9:29:59 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
- 13 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r237978 r237981 1 2018-11-07 Justin Michaud <justin_michaud@apple.com> 2 3 CSS Painting API should pass size, arguments and input properties to paint callback 4 https://bugs.webkit.org/show_bug.cgi?id=191309 5 6 Reviewed by Chris Dumez. 7 8 * fast/css-custom-paint/properties-expected.html: Added. 9 * fast/css-custom-paint/properties.html: Added. 10 * fast/css-custom-paint/worklet.html: 11 1 12 2018-11-07 Zalan Bujtas <zalan@apple.com> 2 13 -
trunk/LayoutTests/fast/css-custom-paint/worklet.html
r237766 r237981 18 18 class MyPaint { 19 19 paint(ctx, geom, properties) { 20 console.log("Hello from paint callback!"); 21 assert_greater_than(eval("devicePixelRatio"), 0); 22 assert_throws({'name': 'ReferenceError'}, function () { eval("window"); }); 23 24 const promise = new Promise((resolve, reject) => { console.log("In promise"); resolve() }); 25 promise.then(() => console.log("Promise was resolved")); 26 20 27 for (var i = 0; i < 6; i++){ 21 28 for (var j = 0; j < 6; j++){ … … 25 32 } 26 33 } 27 console.log("Hello from paint callback!");28 assert_greater_than(eval("devicePixelRatio"), 0);29 assert_throws({'name': 'ReferenceError'}, function () { eval("window"); });30 31 const promise = new Promise((resolve, reject) => { console.log("In promise"); resolve() });32 promise.then(() => console.log("Promise was resolved"));33 34 } 34 35 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/typedom.tentative-expected.txt
r237697 r237981 1 CONSOLE MESSAGE: line 34 0: ReferenceError: Can't find variable: CSSUnparsedValue1 CONSOLE MESSAGE: line 349: TypeError: CSS.px is not a function. (In 'CSS.px(15)', 'CSS.px' is undefined) 2 2 3 Harness Error (FAIL), message = ReferenceError: Can't find variable: CSSUnparsedValue3 Harness Error (FAIL), message = TypeError: CSS.px is not a function. (In 'CSS.px(15)', 'CSS.px' is undefined) 4 4 5 5 FAIL Computed * is reified as CSSUnparsedValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined) … … 9 9 FAIL Computed <image> [url] is reified as CSSImageValue The given initial value does not parse for the given syntax. 10 10 FAIL Computed <integer> is reified as CSSUnitValue The given initial value does not parse for the given syntax. 11 FAIL Computed <length-percentage> [%] is reified as CSSUnitValue Can't find variable: CSSUnitValue12 FAIL Computed <length-percentage> [px] is reified as CSSUnitValue Can't find variable: CSSUnitValue11 FAIL Computed <length-percentage> [%] is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined) 12 FAIL Computed <length-percentage> [px] is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined) 13 13 FAIL Computed <length-percentage> [px + %] is reified as CSSMathSum Can't find variable: CSSMathSum 14 FAIL Computed <length> is reified as CSSUnitValue Can't find variable: CSSUnitValue14 FAIL Computed <length> is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined) 15 15 FAIL Computed <number> is reified as CSSUnitValue The given initial value does not parse for the given syntax. 16 FAIL Computed <percentage> is reified as CSSUnitValue Can't find variable: CSSUnitValue16 FAIL Computed <percentage> is reified as CSSUnitValue target.computedStyleMap is not a function. (In 'target.computedStyleMap()', 'target.computedStyleMap' is undefined) 17 17 FAIL Computed <resolution> is reified as CSSUnitValue The given initial value does not parse for the given syntax. 18 18 FAIL Computed <time> is reified as CSSUnitValue The given initial value does not parse for the given syntax. -
trunk/Source/WebCore/CMakeLists.txt
r237912 r237981 70 70 "${WEBCORE_DIR}/css" 71 71 "${WEBCORE_DIR}/css/parser" 72 "${WEBCORE_DIR}/css/typedom" 72 73 "${WEBCORE_DIR}/cssjit" 73 74 "${WEBCORE_DIR}/dom" … … 198 199 bindings/js 199 200 201 css/typedom 202 200 203 html/canvas 201 204 html/shadow … … 547 550 css/CSSNamespaceRule.idl 548 551 css/CSSPaintCallback.idl 552 css/CSSPaintSize.idl 549 553 css/CSSPageRule.idl 550 554 css/CSSRule.idl … … 578 582 css/StyleSheet.idl 579 583 css/StyleSheetList.idl 584 585 css/typedom/CSSNumericValue.idl 586 css/typedom/CSSStyleValue.idl 587 css/typedom/CSSUnitValue.idl 588 css/typedom/CSSUnparsedValue.idl 589 css/typedom/StylePropertyMapReadOnly.idl 590 580 591 css/WebKitCSSMatrix.idl 581 592 css/WebKitCSSViewportRule.idl -
trunk/Source/WebCore/ChangeLog
r237980 r237981 1 2018-11-07 Justin Michaud <justin_michaud@apple.com> 2 3 CSS Painting API should pass size, arguments and input properties to paint callback 4 https://bugs.webkit.org/show_bug.cgi?id=191309 5 6 Reviewed by Chris Dumez. 7 8 Call paint() callback with input properties and arguments. This patch adds a stub for 9 the CSS Typed OM StylePropertyMapReadOnly, and passes all the arguments as strings without 10 any syntax checking to the paint callback. 11 12 Test: fast/css-custom-paint/properties.html 13 14 * CMakeLists.txt: 15 * DerivedSources.make: 16 * Sources.txt: 17 * WebCore.xcodeproj/project.pbxproj: 18 * bindings/js/JSCSSStyleValueCustom.cpp: Copied from Source/WebCore/css/CSSPaintCallback.h. 19 (WebCore::toJSNewlyCreated): 20 (WebCore::toJS): 21 * bindings/js/WebCoreBuiltinNames.h: 22 * css/CSSPaintCallback.h: 23 * css/CSSPaintCallback.idl: 24 * css/CSSPaintImageValue.cpp: 25 (WebCore::CSSPaintImageValue::image): 26 * css/CSSPaintImageValue.h: 27 * css/CSSPaintSize.h: Copied from Source/WebCore/css/CSSPaintCallback.h. 28 (WebCore::CSSPaintSize::create): 29 (WebCore::CSSPaintSize::width const): 30 (WebCore::CSSPaintSize::height const): 31 (WebCore::CSSPaintSize::CSSPaintSize): 32 * css/CSSPaintSize.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. 33 * css/parser/CSSPropertyParserHelpers.cpp: 34 (WebCore::CSSPropertyParserHelpers::consumeCustomPaint): 35 * css/typedom/CSSNumericValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. 36 * css/typedom/CSSNumericValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. 37 * css/typedom/CSSStyleValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. 38 (WebCore::CSSStyleValue::isUnitValue): 39 (WebCore::CSSStyleValue::isUnparsedValue): 40 * css/typedom/CSSStyleValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. 41 * css/typedom/CSSUnitValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. 42 * css/typedom/CSSUnitValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. 43 * css/typedom/CSSUnparsedValue.h: Copied from Source/WebCore/css/CSSPaintCallback.h. 44 * css/typedom/CSSUnparsedValue.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. 45 * css/typedom/StylePropertyMapReadOnly.h: Copied from Source/WebCore/css/CSSPaintCallback.h. 46 (WebCore::StylePropertyMapReadOnly::create): 47 (WebCore::StylePropertyMapReadOnly::get): 48 (WebCore::StylePropertyMapReadOnly::StylePropertyMapReadOnly): 49 * css/typedom/StylePropertyMapReadOnly.idl: Copied from Source/WebCore/css/CSSPaintCallback.idl. 50 * platform/graphics/CustomPaintImage.cpp: 51 (WebCore::CustomPaintImage::CustomPaintImage): 52 (WebCore::CustomPaintImage::doCustomPaint): 53 * platform/graphics/CustomPaintImage.h: 54 1 55 2018-11-07 Brent Fulgham <bfulgham@apple.com> 2 56 -
trunk/Source/WebCore/DerivedSources.make
r237912 r237981 69 69 $(WebCore)/crypto/parameters \ 70 70 $(WebCore)/css \ 71 $(WebCore)/css/typedom \ 71 72 $(WebCore)/dom \ 72 73 $(WebCore)/editing \ … … 460 461 $(WebCore)/css/CSSPageRule.idl \ 461 462 $(WebCore)/css/CSSPaintCallback.idl \ 463 $(WebCore)/css/CSSPaintSize.idl \ 462 464 $(WebCore)/css/CSSRule.idl \ 463 465 $(WebCore)/css/CSSRuleList.idl \ … … 490 492 $(WebCore)/css/StyleSheet.idl \ 491 493 $(WebCore)/css/StyleSheetList.idl \ 494 $(WebCore)/css/typedom/CSSNumericValue.idl \ 495 $(WebCore)/css/typedom/CSSStyleValue.idl \ 496 $(WebCore)/css/typedom/CSSUnitValue.idl \ 497 $(WebCore)/css/typedom/CSSUnparsedValue.idl \ 498 $(WebCore)/css/typedom/StylePropertyMapReadOnly.idl \ 492 499 $(WebCore)/css/WebKitCSSMatrix.idl \ 493 500 $(WebCore)/css/WebKitCSSViewportRule.idl \ … … 1500 1507 $(WebCore)/animation \ 1501 1508 $(WebCore)/css \ 1509 $(WebCore)/css/typedom \ 1502 1510 $(WebCore)/crypto \ 1503 1511 $(WebCore)/dom \ -
trunk/Source/WebCore/Sources.txt
r237976 r237981 380 380 bindings/js/JSCSSRuleListCustom.cpp 381 381 bindings/js/JSCSSStyleDeclarationCustom.cpp 382 bindings/js/JSCSSStyleValueCustom.cpp 382 383 bindings/js/JSDOMConvertDate.cpp 383 384 bindings/js/JSDOMConvertNumbers.cpp … … 2490 2491 JSCSSMediaRule.cpp 2491 2492 JSCSSNamespaceRule.cpp 2493 JSCSSNumericValue.cpp 2492 2494 JSCSSPaintCallback.cpp 2495 JSCSSPaintSize.cpp 2496 JSCSSStyleValue.cpp 2497 JSCSSUnitValue.cpp 2498 JSCSSUnparsedValue.cpp 2493 2499 JSPaintWorkletGlobalScope.cpp 2494 2500 JSWorklet.cpp … … 3159 3165 JSStringCallback.cpp 3160 3166 JSStyleMedia.cpp 3167 JSStylePropertyMapReadOnly.cpp 3161 3168 JSStyleSheet.cpp 3162 3169 JSStyleSheetList.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r237976 r237981 1360 1360 4B7F9C522183B5E5001CEBA0 /* WorkletConsoleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B7F9C512183B5E5001CEBA0 /* WorkletConsoleClient.h */; }; 1361 1361 4BAE95B10B2FA9CE00AED8A0 /* EditorDeleteAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1362 4BAFD0CB2190EBD600C0AB64 /* CSSPaintSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */; }; 1363 4BAFD0CF2190F9B500C0AB64 /* StylePropertyMapReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */; }; 1364 4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */; }; 1365 4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */; }; 1366 4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */; }; 1367 4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */; }; 1362 1368 4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */; }; 1363 1369 4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */; }; … … 7926 7932 4B7F9C542183B634001CEBA0 /* WorkletConsoleClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WorkletConsoleClient.cpp; sourceTree = "<group>"; }; 7927 7933 4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorDeleteAction.h; sourceTree = "<group>"; }; 7934 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSPaintSize.h; sourceTree = "<group>"; }; 7935 4BAFD0CD2190EBE900C0AB64 /* CSSPaintSize.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSPaintSize.idl; sourceTree = "<group>"; }; 7936 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StylePropertyMapReadOnly.h; sourceTree = "<group>"; }; 7937 4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = StylePropertyMapReadOnly.idl; sourceTree = "<group>"; }; 7938 4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSStyleValue.idl; sourceTree = "<group>"; }; 7939 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSStyleValue.h; sourceTree = "<group>"; }; 7940 4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnparsedValue.idl; sourceTree = "<group>"; }; 7941 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSUnparsedValue.h; sourceTree = "<group>"; }; 7942 4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSNumericValue.idl; sourceTree = "<group>"; }; 7943 4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnitValue.idl; sourceTree = "<group>"; }; 7944 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = CSSUnitValue.h; sourceTree = "<group>"; }; 7945 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSNumericValue.h; sourceTree = "<group>"; }; 7946 4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleValueCustom.cpp; sourceTree = "<group>"; }; 7928 7947 4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSRegisterCustomProperty.idl; sourceTree = "<group>"; }; 7929 7948 4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCSSRegisterCustomProperty.cpp; sourceTree = "<group>"; }; … … 18089 18108 sourceTree = "<group>"; 18090 18109 }; 18110 4BAFD0DA21921EAD00C0AB64 /* typedom */ = { 18111 isa = PBXGroup; 18112 children = ( 18113 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */, 18114 4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */, 18115 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */, 18116 4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */, 18117 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */, 18118 4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */, 18119 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */, 18120 4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */, 18121 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */, 18122 4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */, 18123 ); 18124 path = typedom; 18125 sourceTree = "<group>"; 18126 }; 18091 18127 4BDEA318217EBB880052DFCD /* worklets */ = { 18092 18128 isa = PBXGroup; … … 20265 20301 BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */, 20266 20302 AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */, 20303 4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */, 20267 20304 BC20FB7E0C0E8E6C00D1447F /* JSDeprecatedCSSOMValueCustom.cpp */, 20268 20305 49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */, … … 26071 26108 children = ( 26072 26109 946D37271D6CB2250077084F /* parser */, 26110 4BAFD0DA21921EAD00C0AB64 /* typedom */, 26073 26111 FBD6AF8415EF21D4008B7110 /* BasicShapeFunctions.cpp */, 26074 26112 FBD6AF8515EF21D4008B7110 /* BasicShapeFunctions.h */, … … 26177 26215 4B6E876B2176D8A100420E5E /* CSSPaintImageValue.cpp */, 26178 26216 4B6E87682176D69200420E5E /* CSSPaintImageValue.h */, 26217 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */, 26218 4BAFD0CD2190EBE900C0AB64 /* CSSPaintSize.idl */, 26179 26219 9418278C1D8CAE9500492764 /* CSSPendingSubstitutionValue.cpp */, 26180 26220 9418278D1D8CAE9500492764 /* CSSPendingSubstitutionValue.h */, … … 28172 28212 314BE3A11B30F6B700141982 /* CSSNamedImageValue.h in Headers */, 28173 28213 94E839511DFB2A0E007BC6A7 /* CSSNamespaceRule.h in Headers */, 28214 4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */, 28174 28215 A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */, 28175 28216 4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */, 28176 28217 4B6E87692176D69200420E5E /* CSSPaintImageValue.h in Headers */, 28218 4BAFD0CB2190EBD600C0AB64 /* CSSPaintSize.h in Headers */, 28177 28219 946D372E1D6CB2940077084F /* CSSParser.h in Headers */, 28178 28220 E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */, … … 28212 28254 A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */, 28213 28255 A8EA80070A19516E00A8EF5F /* CSSStyleSheet.h in Headers */, 28256 4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */, 28214 28257 94DE5C921D83011D00164F2A /* CSSSupportsParser.h in Headers */, 28215 28258 FC54D05716A7673100575E4D /* CSSSupportsRule.h in Headers */, … … 28221 28264 715AD7212050513F00D592DC /* CSSTransition.h in Headers */, 28222 28265 371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */, 28266 4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */, 28223 28267 DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */, 28268 4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */, 28224 28269 BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */, 28225 28270 A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */, … … 30998 31043 E4DACE6A1D12E10B0075980F /* StylePendingResources.h in Headers */, 30999 31044 A80E6DFC0A199067007FB8C5 /* StyleProperties.h in Headers */, 31045 4BAFD0CF2190F9B500C0AB64 /* StylePropertyMapReadOnly.h in Headers */, 31000 31046 E1B25107152A0BB00069B779 /* StylePropertyShorthand.h in Headers */, 31001 31047 83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */, -
trunk/Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp
r237980 r237981 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "JSCSSStyleValue.h" 27 28 28 29 #if ENABLE(CSS_PAINTING_API) 29 30 30 #include "ActiveDOMCallback.h" 31 #include "CallbackResult.h" 32 #include <wtf/RefCounted.h> 31 #include "JSCSSUnitValue.h" 32 #include "JSCSSUnparsedValue.h" 33 33 34 34 namespace WebCore { 35 class PaintRenderingContext2D;35 using namespace JSC; 36 36 37 class CSSPaintCallback : public RefCounted<CSSPaintCallback>, public ActiveDOMCallback { 38 public: 39 using ActiveDOMCallback::ActiveDOMCallback; 37 JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<CSSStyleValue>&& value) 38 { 39 if (value->isUnitValue()) 40 return createWrapper<CSSUnitValue>(globalObject, WTFMove(value)); 41 if (value->isUnparsedValue()) 42 return createWrapper<CSSUnparsedValue>(globalObject, WTFMove(value)); 40 43 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0; 44 ASSERT_NOT_REACHED(); 45 return createWrapper<CSSStyleValue>(globalObject, WTFMove(value)); 46 } 42 47 43 virtual ~CSSPaintCallback()44 45 }46 } ;48 JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, CSSStyleValue& object) 49 { 50 return wrap(state, globalObject, object); 51 } 47 52 48 53 } // namespace WebCore 54 49 55 #endif -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r237912 r237981 50 50 macro(CredentialsContainer) \ 51 51 macro(CSSAnimation) \ 52 macro(CSSNumericValue) \ 53 macro(CSSPaintSize) \ 54 macro(CSSStyleValue) \ 52 55 macro(CSSTransition) \ 56 macro(CSSUnitValue) \ 57 macro(CSSUnparsedValue) \ 53 58 macro(CustomElementRegistry) \ 54 59 macro(Database) \ … … 162 167 macro(SpectreGadget) \ 163 168 macro(StaticRange) \ 169 macro(StylePropertyMapReadOnly) \ 164 170 macro(VRDisplay) \ 165 171 macro(VRDisplayCapabilities) \ -
trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp
r234586 r237981 41 41 #include <JavaScriptCore/ExceptionHelpers.h> 42 42 #include <JavaScriptCore/GCActivityCallback.h> 43 #include <JavaScriptCore/JSCInlines.h> 43 44 #include <JavaScriptCore/JSLock.h> 44 45 #include <JavaScriptCore/PromiseDeferredTimer.h> -
trunk/Source/WebCore/css/CSSPaintCallback.h
r237344 r237981 29 29 30 30 #include "ActiveDOMCallback.h" 31 #include "CSSPaintSize.h" 31 32 #include "CallbackResult.h" 33 #include "StylePropertyMapReadOnly.h" 32 34 #include <wtf/RefCounted.h> 33 35 … … 39 41 using ActiveDOMCallback::ActiveDOMCallback; 40 42 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D& ) = 0;43 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&, CSSPaintSize&, StylePropertyMapReadOnly&, const Vector<String>&) = 0; 42 44 43 45 virtual ~CSSPaintCallback() -
trunk/Source/WebCore/css/CSSPaintCallback.idl
r237344 r237981 27 27 EnabledAtRuntime=CSSPaintingAPI, 28 28 Conditional=CSS_PAINTING_API, 29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context );29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context, CSSPaintSize size, StylePropertyMapReadOnly styleMap, sequence<USVString> arguments); -
trunk/Source/WebCore/css/CSSPaintImageValue.cpp
r237766 r237981 30 30 #if ENABLE(CSS_PAINTING_API) 31 31 32 #include "CSSVariableData.h" 32 33 #include "CustomPaintImage.h" 33 34 #include "PaintWorkletGlobalScope.h" … … 59 60 if (!registration) 60 61 return nullptr; 61 return CustomPaintImage::create(*registration, size); 62 63 // FIXME: Check if argument list matches syntax. 64 Vector<String> arguments; 65 CSSParserTokenRange localRange(m_arguments->tokenRange()); 66 67 while (!localRange.atEnd()) { 68 StringBuilder builder; 69 while (!localRange.atEnd() && localRange.peek() != CommaToken) { 70 if (localRange.peek() == CommentToken) 71 localRange.consume(); 72 else 73 localRange.consume().serialize(builder); 74 } 75 if (!localRange.atEnd()) 76 localRange.consume(); // comma token 77 arguments.append(builder.toString()); 78 } 79 80 return CustomPaintImage::create(*registration, size, renderElement, arguments); 62 81 } 63 82 -
trunk/Source/WebCore/css/CSSPaintImageValue.h
r237276 r237981 32 32 33 33 namespace WebCore { 34 class CSSVariableData; 34 35 35 36 class CSSPaintImageValue final : public CSSImageGeneratorValue { 36 37 public: 37 static Ref<CSSPaintImageValue> create(const String& name )38 static Ref<CSSPaintImageValue> create(const String& name, Ref<CSSVariableData>&& arguments) 38 39 { 39 return adoptRef(*new CSSPaintImageValue(name ));40 return adoptRef(*new CSSPaintImageValue(name, WTFMove(arguments))); 40 41 } 41 42 … … 54 55 55 56 private: 56 CSSPaintImageValue(const String& name )57 CSSPaintImageValue(const String& name, Ref<CSSVariableData>&& arguments) 57 58 : CSSImageGeneratorValue(PaintImageClass) 58 59 , m_name(name) 60 , m_arguments(WTFMove(arguments)) 59 61 { 60 62 } 61 63 62 64 const String m_name; 65 Ref<CSSVariableData> m_arguments; 63 66 }; 64 67 -
trunk/Source/WebCore/css/CSSPaintSize.h
r237980 r237981 28 28 #if ENABLE(CSS_PAINTING_API) 29 29 30 #include "ActiveDOMCallback.h"31 #include "CallbackResult.h"32 30 #include <wtf/RefCounted.h> 31 #include <wtf/RefPtr.h> 33 32 34 33 namespace WebCore { 35 class PaintRenderingContext2D;36 34 37 class CSSPaint Callback : public RefCounted<CSSPaintCallback>, public ActiveDOMCallback{35 class CSSPaintSize : public RefCounted<CSSPaintSize> { 38 36 public: 39 using ActiveDOMCallback::ActiveDOMCallback; 37 static Ref<CSSPaintSize> create(double width, double height) 38 { 39 return adoptRef(*new CSSPaintSize(width, height)); 40 } 40 41 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0; 42 double width() const { return m_width; } 43 double height() const { return m_height; } 42 44 43 virtual ~CSSPaintCallback() 45 private: 46 CSSPaintSize(double width, double height) 47 : m_width(width) 48 , m_height(height) 44 49 { 45 50 } 51 52 double m_width; 53 double m_height; 46 54 }; 47 55 48 56 } // namespace WebCore 57 49 58 #endif -
trunk/Source/WebCore/css/CSSPaintSize.idl
r237980 r237981 27 27 EnabledAtRuntime=CSSPaintingAPI, 28 28 Conditional=CSS_PAINTING_API, 29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context); 29 Exposed=PaintWorklet, 30 ImplementationLacksVTable, 31 ] interface CSSPaintSize { 32 readonly attribute double width; 33 readonly attribute double height; 34 }; -
trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
r237402 r237981 1296 1296 auto name = args.consumeIncludingWhitespace().value().toString(); 1297 1297 1298 // FIXME: should parse arguments. 1298 if (!args.atEnd() && args.peek() != CommaToken) 1299 return nullptr; 1300 if (!args.atEnd()) 1301 args.consume(); 1302 1303 auto argumentList = CSSVariableData::create(args); 1304 1299 1305 while (!args.atEnd()) 1300 1306 args.consume(); 1301 1307 1302 return CSSPaintImageValue::create(name );1308 return CSSPaintImageValue::create(name, WTFMove(argumentList)); 1303 1309 } 1304 1310 #endif -
trunk/Source/WebCore/css/typedom/CSSNumericValue.h
r237980 r237981 28 28 #if ENABLE(CSS_PAINTING_API) 29 29 30 #include "ActiveDOMCallback.h" 31 #include "CallbackResult.h" 32 #include <wtf/RefCounted.h> 30 #include "CSSStyleValue.h" 33 31 34 32 namespace WebCore { 35 class PaintRenderingContext2D;36 33 37 class CSSPaintCallback : public RefCounted<CSSPaintCallback>, public ActiveDOMCallback { 38 public: 39 using ActiveDOMCallback::ActiveDOMCallback; 34 class CSSNumericValue : public CSSStyleValue { 35 protected: 36 CSSNumericValue() = default; 37 }; 38 } // namespace WebCore 40 39 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0;42 43 virtual ~CSSPaintCallback()44 {45 }46 };47 48 } // namespace WebCore49 40 #endif -
trunk/Source/WebCore/css/typedom/CSSNumericValue.idl
r237980 r237981 24 24 */ 25 25 26 // FIXME: Implement this properly, according to the Typed OM spec. 27 // This is just a stub for the CSS painting API for now. Once the Typed OM 28 // is going to be implemented, please change the runtime flag. 26 29 [ 27 30 EnabledAtRuntime=CSSPaintingAPI, 28 31 Conditional=CSS_PAINTING_API, 29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context); 32 Exposed=(Window,Worker,PaintWorklet), 33 ] interface CSSNumericValue : CSSStyleValue { 34 }; -
trunk/Source/WebCore/css/typedom/CSSStyleValue.h
r237980 r237981 28 28 #if ENABLE(CSS_PAINTING_API) 29 29 30 #include "ActiveDOMCallback.h"31 #include "CallbackResult.h"32 30 #include <wtf/RefCounted.h> 31 #include <wtf/text/WTFString.h> 33 32 34 33 namespace WebCore { 35 class PaintRenderingContext2D;36 34 37 class CSS PaintCallback : public RefCounted<CSSPaintCallback>, public ActiveDOMCallback{35 class CSSStyleValue : public RefCounted<CSSStyleValue> { 38 36 public: 39 using ActiveDOMCallback::ActiveDOMCallback; 37 virtual ~CSSStyleValue() = default; 38 virtual String toString() = 0; 40 39 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0; 40 virtual bool isUnitValue() { return false; } 41 virtual bool isUnparsedValue() { return false; } 42 42 43 virtual ~CSSPaintCallback() 44 { 45 } 43 protected: 44 CSSStyleValue() = default; 46 45 }; 47 46 48 47 } // namespace WebCore 48 49 49 #endif -
trunk/Source/WebCore/css/typedom/CSSStyleValue.idl
r237980 r237981 24 24 */ 25 25 26 // FIXME: Implement this properly, according to the Typed OM spec. 27 // This is just a stub for the CSS painting API for now. Once the Typed OM 28 // is going to be implemented, please change the runtime flag. 26 29 [ 30 CustomToJSObject, 27 31 EnabledAtRuntime=CSSPaintingAPI, 28 32 Conditional=CSS_PAINTING_API, 29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context); 33 Exposed=(Window,Worker,PaintWorklet), 34 SkipVTableValidation, 35 ] interface CSSStyleValue { 36 stringifier; 37 }; -
trunk/Source/WebCore/css/typedom/CSSUnitValue.h
r237980 r237981 28 28 #if ENABLE(CSS_PAINTING_API) 29 29 30 #include "ActiveDOMCallback.h" 31 #include "CallbackResult.h" 30 #include "CSSNumericValue.h" 32 31 #include <wtf/RefCounted.h> 32 #include <wtf/text/StringConcatenateNumbers.h> 33 #include <wtf/text/WTFString.h> 33 34 34 35 namespace WebCore { 35 class PaintRenderingContext2D;36 36 37 class CSS PaintCallback : public RefCounted<CSSPaintCallback>, public ActiveDOMCallback{37 class CSSUnitValue final : public CSSNumericValue { 38 38 public: 39 using ActiveDOMCallback::ActiveDOMCallback; 39 static Ref<CSSUnitValue> create(double value, const String& unit) 40 { 41 return adoptRef(*new CSSUnitValue(value, unit)); 42 } 40 43 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0; 44 // FIXME: not correct. 45 String toString() final { return makeString((int) m_value, m_unit); } 42 46 43 virtual ~CSSPaintCallback() 47 double value() const { return m_value; } 48 void setValue(double value) { m_value = value; } 49 const String& unit() const { return m_unit; } 50 void setUnit(const String& unit) { m_unit = unit; } 51 52 private: 53 CSSUnitValue(double value, const String& unit) 54 : m_value(value) 55 , m_unit(unit) 44 56 { 45 57 } 58 59 bool isUnitValue() final { return true; } 60 61 double m_value; 62 String m_unit; 46 63 }; 47 64 48 65 } // namespace WebCore 66 49 67 #endif -
trunk/Source/WebCore/css/typedom/CSSUnitValue.idl
r237980 r237981 24 24 */ 25 25 26 // FIXME: Implement this properly, according to the Typed OM spec. 27 // This is just a stub for the CSS painting API for now. Once the Typed OM 28 // is going to be implemented, please change the runtime flag. 26 29 [ 27 30 EnabledAtRuntime=CSSPaintingAPI, 28 31 Conditional=CSS_PAINTING_API, 29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context); 32 Exposed=(Window,Worker,PaintWorklet), 33 Constructor(double value, USVString unit), 34 ] interface CSSUnitValue : CSSNumericValue { 35 attribute double value; 36 readonly attribute USVString unit; 37 }; -
trunk/Source/WebCore/css/typedom/CSSUnparsedValue.h
r237980 r237981 28 28 #if ENABLE(CSS_PAINTING_API) 29 29 30 #include "ActiveDOMCallback.h" 31 #include "CallbackResult.h" 30 #include "CSSStyleValue.h" 32 31 #include <wtf/RefCounted.h> 32 #include <wtf/text/WTFString.h> 33 33 34 34 namespace WebCore { 35 class PaintRenderingContext2D;36 35 37 class CSS PaintCallback : public RefCounted<CSSPaintCallback>, public ActiveDOMCallback{36 class CSSUnparsedValue final : public CSSStyleValue { 38 37 public: 39 using ActiveDOMCallback::ActiveDOMCallback; 38 static Ref<CSSUnparsedValue> create(const String& serializedValue) 39 { 40 return adoptRef(*new CSSUnparsedValue(serializedValue)); 41 } 40 42 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0;43 String toString() final { return m_serializedValue; } 42 44 43 virtual ~CSSPaintCallback() 45 private: 46 explicit CSSUnparsedValue(const String& serializedValue) 47 : m_serializedValue(serializedValue) 44 48 { 45 49 } 50 51 bool isUnparsedValue() final { return true; } 52 53 String m_serializedValue; 46 54 }; 47 55 48 56 } // namespace WebCore 57 49 58 #endif -
trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl
r237980 r237981 24 24 */ 25 25 26 // FIXME: Implement this properly, according to the Typed OM spec. 27 // This is just a stub for the CSS painting API for now. Once the Typed OM 28 // is going to be implemented, please change the runtime flag. 29 // FIXME: wrong constructor. 26 30 [ 27 31 EnabledAtRuntime=CSSPaintingAPI, 28 32 Conditional=CSS_PAINTING_API, 29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context); 33 Exposed=(Window,Worker,PaintWorklet), 34 Constructor(USVString serializedValue), 35 ] interface CSSUnparsedValue : CSSStyleValue { 36 }; -
trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h
r237980 r237981 28 28 #if ENABLE(CSS_PAINTING_API) 29 29 30 #include " ActiveDOMCallback.h"31 #include "CallbackResult.h"30 #include "CSSStyleValue.h" 31 #include <wtf/HashMap.h> 32 32 #include <wtf/RefCounted.h> 33 #include <wtf/text/WTFString.h> 33 34 34 35 namespace WebCore { 35 class PaintRenderingContext2D;36 36 37 class CSSPaintCallback : public RefCounted<CSSPaintCallback>, public ActiveDOMCallback{37 class StylePropertyMapReadOnly : public RefCounted<StylePropertyMapReadOnly> { 38 38 public: 39 using ActiveDOMCallback::ActiveDOMCallback; 39 static Ref<StylePropertyMapReadOnly> create(HashMap<String, Ref<CSSStyleValue>>&& map) 40 { 41 return adoptRef(*new StylePropertyMapReadOnly(WTFMove(map))); 42 } 40 43 41 virtual CallbackResult<void> handleEvent(PaintRenderingContext2D&) = 0;44 CSSStyleValue* get(String property) const { return m_map.get(property); } 42 45 43 virtual ~CSSPaintCallback() 46 private: 47 explicit StylePropertyMapReadOnly(HashMap<String, Ref<CSSStyleValue>>&& map) 48 : m_map(WTFMove(map)) 44 49 { 45 50 } 51 52 HashMap<String, Ref<CSSStyleValue>> m_map; 46 53 }; 47 54 48 55 } // namespace WebCore 56 49 57 #endif -
trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl
r237980 r237981 24 24 */ 25 25 26 // FIXME: Implement this properly, according to the Typed OM spec. 27 // This is just a stub for the CSS painting API for now. Once the Typed OM 28 // is going to be implemented, please change the runtime flag. 26 29 [ 27 30 EnabledAtRuntime=CSSPaintingAPI, 28 31 Conditional=CSS_PAINTING_API, 29 ] callback CSSPaintCallback = void (PaintRenderingContext2D context); 32 Exposed=(Window,Worker,PaintWorklet), 33 ImplementationLacksVTable 34 ] interface StylePropertyMapReadOnly { 35 // FIXME: should be (undefined or CSSStyleValue), not null 36 CSSStyleValue? get(USVString property); 37 }; -
trunk/Source/WebCore/platform/graphics/CustomPaintImage.cpp
r237766 r237981 29 29 #if ENABLE(CSS_PAINTING_API) 30 30 31 #include "CSSComputedStyleDeclaration.h" 32 #include "CSSPrimitiveValue.h" 33 #include "CSSPropertyParser.h" 34 #include "CSSUnitValue.h" 35 #include "CSSUnparsedValue.h" 31 36 #include "CustomPaintCanvas.h" 32 37 #include "GraphicsContext.h" … … 35 40 #include "JSCSSPaintCallback.h" 36 41 #include "PaintRenderingContext2D.h" 42 #include "RenderElement.h" 37 43 38 44 namespace WebCore { 39 45 40 CustomPaintImage::CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size )46 CustomPaintImage::CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size, RenderElement& element, const Vector<String>& arguments) 41 47 : m_paintCallback(definition.paintCallback.get()) 48 , m_inputProperties(definition.inputProperties) 49 , m_element(makeWeakPtr(element)) 50 , m_arguments(arguments) 42 51 { 43 52 setContainerSize(size); … … 48 57 ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, const FloatSize& destSize) 49 58 { 59 if (!m_element || !m_element->element()) 60 return ImageDrawResult::DidNothing; 61 62 ASSERT(!m_element->needsLayout()); 63 ASSERT(!m_element->element()->document().needsStyleRecalc()); 64 50 65 JSCSSPaintCallback& callback = static_cast<JSCSSPaintCallback&>(m_paintCallback.get()); 51 66 auto* scriptExecutionContext = callback.scriptExecutionContext(); … … 60 75 auto context = contextOrException.releaseReturnValue(); 61 76 62 auto result = m_paintCallback->handleEvent(*context); 77 HashMap<String, Ref<CSSStyleValue>> propertyValues; 78 ComputedStyleExtractor extractor(m_element->element()); 79 80 for (auto& name : m_inputProperties) { 81 RefPtr<CSSValue> value; 82 if (isCustomPropertyName(name)) 83 value = extractor.customPropertyValue(name); 84 else { 85 CSSPropertyID propertyID = cssPropertyID(name); 86 if (!propertyID) 87 return ImageDrawResult::DidNothing; 88 value = extractor.propertyValue(propertyID, DoNotUpdateLayout); 89 } 90 91 if (!value) { 92 propertyValues.add(name, CSSUnparsedValue::create(emptyString())); 93 continue; 94 } 95 96 // FIXME: Properly reify all length values. 97 if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).primitiveType() == CSSPrimitiveValue::CSS_PX) 98 propertyValues.add(name, CSSUnitValue::create(downcast<CSSPrimitiveValue>(*value).doubleValue(), "px")); 99 else 100 propertyValues.add(name, CSSUnparsedValue::create(value->cssText())); 101 } 102 103 auto size = CSSPaintSize::create(destSize.width(), destSize.height()); 104 auto propertyMap = StylePropertyMapReadOnly::create(WTFMove(propertyValues)); 105 106 auto result = m_paintCallback->handleEvent(*context, size, propertyMap, m_arguments); 63 107 if (result.type() != CallbackResultType::Success) 64 108 return ImageDrawResult::DidNothing; -
trunk/Source/WebCore/platform/graphics/CustomPaintImage.h
r237766 r237981 30 30 #include "GeneratedImage.h" 31 31 #include "PaintWorkletGlobalScope.h" 32 #include <wtf/WeakPtr.h> 32 33 33 34 namespace WebCore { 34 35 35 36 class ImageBuffer; 37 class RenderElement; 36 38 37 39 class CustomPaintImage final : public GeneratedImage { 38 40 public: 39 static Ref<CustomPaintImage> create(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size )41 static Ref<CustomPaintImage> create(const PaintWorkletGlobalScope::PaintDefinition& definition, const FloatSize& size, RenderElement& element, const Vector<String>& arguments) 40 42 { 41 return adoptRef(*new CustomPaintImage(definition, size ));43 return adoptRef(*new CustomPaintImage(definition, size, element, arguments)); 42 44 } 43 45 … … 46 48 47 49 private: 48 CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition&, const FloatSize& );50 CustomPaintImage(const PaintWorkletGlobalScope::PaintDefinition&, const FloatSize&, RenderElement&, const Vector<String>& arguments); 49 51 50 52 ImageDrawResult doCustomPaint(GraphicsContext&, const FloatSize&); … … 54 56 55 57 Ref<CSSPaintCallback> m_paintCallback; 58 Vector<String> m_inputProperties; 59 WeakPtr<RenderElement> m_element; 60 Vector<String> m_arguments; 56 61 }; 57 62
Note: See TracChangeset
for help on using the changeset viewer.