Source/WebCore/ChangeLog

 12018-11-29 Justin Michaud <justin_michaud@apple.com>
 2
 3 CSS Painting API should allow image values in inputProperties
 4 https://bugs.webkit.org/show_bug.cgi?id=192200
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Adds new TypedOMCSSImageValue wrapper. We rename all the existing ones so that the naming is consistent (CSSImageValue is already a thing).
 9 Finally, we let CanvasRenderingContext2DBase render these.
 10
 11 Tests: fast/css-custom-paint/arguments.html
 12 fast/css-custom-paint/image.html
 13
 14 * CMakeLists.txt:
 15 * DerivedSources.make:
 16 * Sources.txt:
 17 * WebCore.xcodeproj/project.pbxproj:
 18 * bindings/js/CallTracerTypes.h:
 19 * bindings/js/JSTypedOMCSSStyleValueCustom.cpp: Renamed from Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp.
 20 (WebCore::toJSNewlyCreated):
 21 (WebCore::toJS):
 22 * bindings/js/WebCoreBuiltinNames.h:
 23 * css/CSSComputedStyleDeclaration.cpp:
 24 (WebCore::ComputedStyleExtractor::customPropertyValue):
 25 * css/CSSCustomPropertyValue.cpp:
 26 (WebCore::CSSCustomPropertyValue::equals const):
 27 (WebCore::CSSCustomPropertyValue::customCSSText const):
 28 (WebCore::CSSCustomPropertyValue::tokens const):
 29 * css/CSSCustomPropertyValue.h:
 30 * css/CSSPaintImageValue.cpp:
 31 (WebCore::CSSPaintImageValue::image):
 32 * css/typedom/StylePropertyMapReadOnly.h:
 33 (WebCore::StylePropertyMapReadOnly::create):
 34 (WebCore::StylePropertyMapReadOnly::get const):
 35 (WebCore::StylePropertyMapReadOnly::StylePropertyMapReadOnly):
 36 * css/typedom/StylePropertyMapReadOnly.idl:
 37 * css/typedom/TypedOMCSSImageValue.h: Copied from Source/WebCore/css/typedom/CSSUnitValue.h.
 38 * css/typedom/TypedOMCSSImageValue.idl: Copied from Source/WebCore/css/typedom/CSSStyleValue.idl.
 39 * css/typedom/TypedOMCSSNumericValue.h: Renamed from Source/WebCore/css/typedom/CSSNumericValue.h.
 40 * css/typedom/TypedOMCSSNumericValue.idl: Renamed from Source/WebCore/css/typedom/CSSNumericValue.idl.
 41 * css/typedom/TypedOMCSSStyleValue.h: Renamed from Source/WebCore/css/typedom/CSSStyleValue.h.
 42 (WebCore::TypedOMCSSStyleValue::isImageValue):
 43 * css/typedom/TypedOMCSSStyleValue.idl: Renamed from Source/WebCore/css/typedom/CSSStyleValue.idl.
 44 * css/typedom/TypedOMCSSUnitValue.h: Renamed from Source/WebCore/css/typedom/CSSUnitValue.h.
 45 * css/typedom/TypedOMCSSUnitValue.idl: Renamed from Source/WebCore/css/typedom/CSSUnitValue.idl.
 46 * css/typedom/TypedOMCSSUnparsedValue.h: Renamed from Source/WebCore/css/typedom/CSSUnparsedValue.h.
 47 * css/typedom/TypedOMCSSUnparsedValue.idl: Renamed from Source/WebCore/css/typedom/CSSUnparsedValue.idl.
 48 * html/ImageBitmap.cpp:
 49 (WebCore::ImageBitmap::createPromise):
 50 * html/ImageBitmap.h:
 51 * html/canvas/CanvasDrawImage.idl:
 52 * html/canvas/CanvasFillStrokeStyles.idl:
 53 * html/canvas/CanvasRenderingContext.cpp:
 54 (WebCore::CanvasRenderingContext::checkOrigin):
 55 * html/canvas/CanvasRenderingContext.h:
 56 * html/canvas/CanvasRenderingContext2DBase.cpp:
 57 (WebCore::size):
 58 (WebCore::CanvasRenderingContext2DBase::drawImage):
 59 (WebCore::CanvasRenderingContext2DBase::createPattern):
 60 * html/canvas/CanvasRenderingContext2DBase.h:
 61 * inspector/InspectorCanvas.cpp:
 62 (WebCore::InspectorCanvas::buildAction):
 63 * page/WindowOrWorkerGlobalScope.idl:
 64 * platform/graphics/CustomPaintImage.cpp:
 65 (WebCore::CustomPaintImage::doCustomPaint):
 66
1672018-11-29 Ryosuke Niwa <rniwa@webkit.org>
268
369 Executing "insertunorderedlist" while selecting a contenteditable element inside a shadow dom hangs the browser

Source/WebCore/CMakeLists.txt

@@set(WebCore_NON_SVG_IDL_FILES
591591 css/StyleSheet.idl
592592 css/StyleSheetList.idl
593593
594  css/typedom/CSSNumericValue.idl
595  css/typedom/CSSStyleValue.idl
596  css/typedom/CSSUnitValue.idl
597  css/typedom/CSSUnparsedValue.idl
 594 css/typedom/TypedOMCSSImageValue.idl
 595 css/typedom/TypedOMCSSNumericValue.idl
 596 css/typedom/TypedOMCSSStyleValue.idl
 597 css/typedom/TypedOMCSSUnitValue.idl
 598 css/typedom/TypedOMCSSUnparsedValue.idl
598599 css/typedom/StylePropertyMapReadOnly.idl
599600
600601 css/WebKitCSSMatrix.idl

Source/WebCore/DerivedSources.make

@@JS_BINDING_IDLS = \
500500 $(WebCore)/css/StyleMedia.idl \
501501 $(WebCore)/css/StyleSheet.idl \
502502 $(WebCore)/css/StyleSheetList.idl \
503  $(WebCore)/css/typedom/CSSNumericValue.idl \
504  $(WebCore)/css/typedom/CSSStyleValue.idl \
505  $(WebCore)/css/typedom/CSSUnitValue.idl \
506  $(WebCore)/css/typedom/CSSUnparsedValue.idl \
507503 $(WebCore)/css/typedom/StylePropertyMapReadOnly.idl \
 504 $(WebCore)/css/typedom/TypedOMCSSImageValue.idl \
 505 $(WebCore)/css/typedom/TypedOMCSSNumericValue.idl \
 506 $(WebCore)/css/typedom/TypedOMCSSStyleValue.idl \
 507 $(WebCore)/css/typedom/TypedOMCSSUnitValue.idl \
 508 $(WebCore)/css/typedom/TypedOMCSSUnparsedValue.idl \
508509 $(WebCore)/css/WebKitCSSMatrix.idl \
509510 $(WebCore)/css/WebKitCSSViewportRule.idl \
510511 $(WebCore)/dom/AbortController.idl \

Source/WebCore/Sources.txt

@@bindings/js/JSBlobCustom.cpp
388388bindings/js/JSCSSRuleCustom.cpp
389389bindings/js/JSCSSRuleListCustom.cpp
390390bindings/js/JSCSSStyleDeclarationCustom.cpp
391 bindings/js/JSCSSStyleValueCustom.cpp
392391bindings/js/JSDOMConvertDate.cpp
393392bindings/js/JSDOMConvertNumbers.cpp
394393bindings/js/JSDOMConvertStrings.cpp

@@bindings/js/JSTextTrackCustom.cpp
478477bindings/js/JSTextTrackListCustom.cpp
479478bindings/js/JSTrackCustom.cpp
480479bindings/js/JSTreeWalkerCustom.cpp
 480bindings/js/JSTypedOMCSSStyleValueCustom.cpp
481481bindings/js/JSVideoTrackCustom.cpp
482482bindings/js/JSVideoTrackListCustom.cpp
483483bindings/js/JSWebAnimationCustom.cpp

@@JSBlobPropertyBag.cpp
25032503JSByteLengthQueuingStrategy.cpp
25042504JSCDATASection.cpp
25052505JSCSSFontFaceRule.cpp
 2506JSTypedOMCSSImageValue.cpp
 2507JSTypedOMCSSNumericValue.cpp
 2508JSTypedOMCSSStyleValue.cpp
 2509JSTypedOMCSSUnitValue.cpp
 2510JSTypedOMCSSUnparsedValue.cpp
25062511JSCSSImportRule.cpp
25072512JSCSSKeyframeRule.cpp
25082513JSCSSKeyframesRule.cpp
25092514JSCSSMediaRule.cpp
25102515JSCSSNamespaceRule.cpp
2511 JSCSSNumericValue.cpp
25122516JSCSSPaintCallback.cpp
25132517JSCSSPaintSize.cpp
2514 JSCSSStyleValue.cpp
2515 JSCSSUnitValue.cpp
2516 JSCSSUnparsedValue.cpp
25172518JSPaintWorkletGlobalScope.cpp
25182519JSWorklet.cpp
25192520JSWorkletGlobalScope.cpp

Source/WebCore/WebCore.xcodeproj/project.pbxproj

13681368 4B2708C70AF19EE40065127F /* Pasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B2708C50AF19EE40065127F /* Pasteboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
13691369 4B3043CD0AE0373B00A82647 /* Editor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043CB0AE0373B00A82647 /* Editor.h */; settings = {ATTRIBUTES = (Private, ); }; };
13701370 4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3480920EEF50D400AC1B41 /* ImageSourceCG.h */; };
 1371 4B438650219CD56100F8D3C5 /* TypedOMCSSImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B43864F219CD56100F8D3C5 /* TypedOMCSSImageValue.h */; };
13711372 4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5BDD9A21658A1500DD4262 /* CSSPaintCallback.h */; };
13721373 4B6B5CBD21640EFF00603817 /* DOMCSSPaintWorklet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B5CB82163EC0700603817 /* DOMCSSPaintWorklet.h */; settings = {ATTRIBUTES = (Private, ); }; };
13731374 4B6B5CC02164386400603817 /* PaintWorkletGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B5CBF2164386400603817 /* PaintWorkletGlobalScope.h */; };

13781379 4BAE95B10B2FA9CE00AED8A0 /* EditorDeleteAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
13791380 4BAFD0CB2190EBD600C0AB64 /* CSSPaintSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */; };
13801381 4BAFD0CF2190F9B500C0AB64 /* StylePropertyMapReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */; };
1381  4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */; };
1382  4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */; };
1383  4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */; };
1384  4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */; };
 1382 4BAFD0D62192146B00C0AB64 /* TypedOMCSSStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D52192146B00C0AB64 /* TypedOMCSSStyleValue.h */; };
 1383 4BAFD0D921921EA000C0AB64 /* TypedOMCSSUnparsedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D821921EA000C0AB64 /* TypedOMCSSUnparsedValue.h */; };
 1384 4BAFD0E0219220AB00C0AB64 /* TypedOMCSSNumericValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DF219220AB00C0AB64 /* TypedOMCSSNumericValue.h */; };
 1385 4BAFD0E1219242A000C0AB64 /* TypedOMCSSUnitValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DD2192209200C0AB64 /* TypedOMCSSUnitValue.h */; };
13851386 4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */; };
13861387 4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */; };
13871388 4BDA40012151B6F500FD6604 /* CSSRegisteredCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };

79567957 4B3043CB0AE0373B00A82647 /* Editor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Editor.h; sourceTree = "<group>"; };
79577958 4B3480910EEF50D400AC1B41 /* ImageSourceCGMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ImageSourceCGMac.mm; sourceTree = "<group>"; };
79587959 4B3480920EEF50D400AC1B41 /* ImageSourceCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageSourceCG.h; sourceTree = "<group>"; };
 7960 4B43864D219CD52D00F8D3C5 /* TypedOMCSSImageValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSImageValue.idl; sourceTree = "<group>"; };
 7961 4B43864F219CD56100F8D3C5 /* TypedOMCSSImageValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSImageValue.h; sourceTree = "<group>"; };
79597962 4B5BDD99216588E500DD4262 /* CSSPaintCallback.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSPaintCallback.idl; sourceTree = "<group>"; };
79607963 4B5BDD9A21658A1500DD4262 /* CSSPaintCallback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSPaintCallback.h; sourceTree = "<group>"; };
79617964 4B6B5CB62163DC1A00603817 /* DOMCSSPaintWorklet.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMCSSPaintWorklet.idl; sourceTree = "<group>"; };

79787981 4BAFD0CD2190EBE900C0AB64 /* CSSPaintSize.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSPaintSize.idl; sourceTree = "<group>"; };
79797982 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StylePropertyMapReadOnly.h; sourceTree = "<group>"; };
79807983 4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = StylePropertyMapReadOnly.idl; sourceTree = "<group>"; };
7981  4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSStyleValue.idl; sourceTree = "<group>"; };
7982  4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSStyleValue.h; sourceTree = "<group>"; };
7983  4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnparsedValue.idl; sourceTree = "<group>"; };
7984  4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSUnparsedValue.h; sourceTree = "<group>"; };
7985  4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSNumericValue.idl; sourceTree = "<group>"; };
7986  4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnitValue.idl; sourceTree = "<group>"; };
7987  4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = CSSUnitValue.h; sourceTree = "<group>"; };
7988  4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSNumericValue.h; sourceTree = "<group>"; };
7989  4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleValueCustom.cpp; sourceTree = "<group>"; };
 7984 4BAFD0D32192145600C0AB64 /* TypedOMCSSStyleValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSStyleValue.idl; sourceTree = "<group>"; };
 7985 4BAFD0D52192146B00C0AB64 /* TypedOMCSSStyleValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSStyleValue.h; sourceTree = "<group>"; };
 7986 4BAFD0D721921E7900C0AB64 /* TypedOMCSSUnparsedValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSUnparsedValue.idl; sourceTree = "<group>"; };
 7987 4BAFD0D821921EA000C0AB64 /* TypedOMCSSUnparsedValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSUnparsedValue.h; sourceTree = "<group>"; };
 7988 4BAFD0DB2192202200C0AB64 /* TypedOMCSSNumericValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSNumericValue.idl; sourceTree = "<group>"; };
 7989 4BAFD0DC2192204A00C0AB64 /* TypedOMCSSUnitValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSUnitValue.idl; sourceTree = "<group>"; };
 7990 4BAFD0DD2192209200C0AB64 /* TypedOMCSSUnitValue.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = TypedOMCSSUnitValue.h; sourceTree = "<group>"; };
 7991 4BAFD0DF219220AB00C0AB64 /* TypedOMCSSNumericValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSNumericValue.h; sourceTree = "<group>"; };
 7992 4BAFD0E22192604D00C0AB64 /* JSTypedOMCSSStyleValueCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSTypedOMCSSStyleValueCustom.cpp; sourceTree = "<group>"; };
79907993 4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSRegisterCustomProperty.idl; sourceTree = "<group>"; };
79917994 4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCSSRegisterCustomProperty.cpp; sourceTree = "<group>"; };
79927995 4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSCustomPropertyDescriptor.h; sourceTree = "<group>"; };

1824518248 4BAFD0DA21921EAD00C0AB64 /* typedom */ = {
1824618249 isa = PBXGroup;
1824718250 children = (
18248  4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */,
18249  4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */,
18250  4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */,
18251  4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */,
18252  4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */,
18253  4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */,
18254  4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */,
18255  4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */,
1825618251 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */,
1825718252 4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */,
 18253 4B43864F219CD56100F8D3C5 /* TypedOMCSSImageValue.h */,
 18254 4B43864D219CD52D00F8D3C5 /* TypedOMCSSImageValue.idl */,
 18255 4BAFD0DF219220AB00C0AB64 /* TypedOMCSSNumericValue.h */,
 18256 4BAFD0DB2192202200C0AB64 /* TypedOMCSSNumericValue.idl */,
 18257 4BAFD0D52192146B00C0AB64 /* TypedOMCSSStyleValue.h */,
 18258 4BAFD0D32192145600C0AB64 /* TypedOMCSSStyleValue.idl */,
 18259 4BAFD0DD2192209200C0AB64 /* TypedOMCSSUnitValue.h */,
 18260 4BAFD0DC2192204A00C0AB64 /* TypedOMCSSUnitValue.idl */,
 18261 4BAFD0D821921EA000C0AB64 /* TypedOMCSSUnparsedValue.h */,
 18262 4BAFD0D721921E7900C0AB64 /* TypedOMCSSUnparsedValue.idl */,
1825818263 );
1825918264 path = typedom;
1826018265 sourceTree = "<group>";

2044920454 9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */,
2045020455 BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
2045120456 AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */,
20452  4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */,
2045320457 BC20FB7E0C0E8E6C00D1447F /* JSDeprecatedCSSOMValueCustom.cpp */,
2045420458 49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
2045520459 ADDA94BF19686F8000453029 /* JSDocumentCustom.h */,

2050220506 070334E8145A1F35008D8D45 /* JSTrackCustom.cpp */,
2050320507 07846384145B1B8E00A58DF1 /* JSTrackCustom.h */,
2050420508 516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
 20509 4BAFD0E22192604D00C0AB64 /* JSTypedOMCSSStyleValueCustom.cpp */,
2050520510 BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */,
2050620511 BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */,
2050720512 715DA5D3201BB902002EF2B0 /* JSWebAnimationCustom.cpp */,

2836128366 A80E6D030A1989CA007FB8C5 /* CSSMediaRule.h in Headers */,
2836228367 314BE3A11B30F6B700141982 /* CSSNamedImageValue.h in Headers */,
2836328368 94E839511DFB2A0E007BC6A7 /* CSSNamespaceRule.h in Headers */,
28364  4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */,
2836528369 A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
2836628370 4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */,
2836728371 4B6E87692176D69200420E5E /* CSSPaintImageValue.h in Headers */,

2840328407 A80E6E0F0A19911C007FB8C5 /* CSSStyleDeclaration.h in Headers */,
2840428408 A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */,
2840528409 A8EA80070A19516E00A8EF5F /* CSSStyleSheet.h in Headers */,
28406  4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */,
2840728410 94DE5C921D83011D00164F2A /* CSSSupportsParser.h in Headers */,
2840828411 FC54D05716A7673100575E4D /* CSSSupportsRule.h in Headers */,
2840928412 BC80C9880CD294EE00A0B7B3 /* CSSTimingFunctionValue.h in Headers */,

2841328416 A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */,
2841428417 715AD7212050513F00D592DC /* CSSTransition.h in Headers */,
2841528418 371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */,
28416  4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */,
2841728419 DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */,
28418  4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */,
2841928420 BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */,
2842028421 A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */,
2842128422 6565815109D13043000E61D7 /* CSSValueKeywords.h in Headers */,

3161731618 854FE7390A2297BE0058D7AD /* TreeWalker.h in Headers */,
3161831619 C375D7FE16639519006184AB /* TypeAhead.h in Headers */,
3161931620 E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */,
 31621 4B438650219CD56100F8D3C5 /* TypedOMCSSImageValue.h in Headers */,
 31622 4BAFD0E0219220AB00C0AB64 /* TypedOMCSSNumericValue.h in Headers */,
 31623 4BAFD0D62192146B00C0AB64 /* TypedOMCSSStyleValue.h in Headers */,
 31624 4BAFD0E1219242A000C0AB64 /* TypedOMCSSUnitValue.h in Headers */,
 31625 4BAFD0D921921EA000C0AB64 /* TypedOMCSSUnparsedValue.h in Headers */,
3162031626 93309E1A099E64920056E581 /* TypingCommand.h in Headers */,
3162131627 85031B4E0A44EFC700F992E0 /* UIEvent.h in Headers */,
3162231628 83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */,

Source/WebCore/bindings/js/CallTracerTypes.h

3636#include "ImageBitmap.h"
3737#include "ImageData.h"
3838#include "Path2D.h"
 39#include "TypedOMCSSImageValue.h"
3940#include <JavaScriptCore/ArrayBuffer.h>
4041#include <JavaScriptCore/ArrayBufferView.h>
4142#include <JavaScriptCore/Float32Array.h>

@@typedef Variant<
9192 RefPtr<HTMLVideoElement>,
9293#endif
9394 RefPtr<ImageBitmap>,
 95#if ENABLE(CSS_PAINTING_API)
 96 RefPtr<TypedOMCSSImageValue>,
 97#endif
9498 RefPtr<ImageData>,
9599 RefPtr<Int32Array>,
96100 Vector<float>,

Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp

1 /*
2  * Copyright (C) 2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #include "config.h"
27 #include "JSCSSStyleValue.h"
28 
29 #if ENABLE(CSS_PAINTING_API)
30 
31 #include "JSCSSUnitValue.h"
32 #include "JSCSSUnparsedValue.h"
33 
34 namespace WebCore {
35 using namespace JSC;
36 
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));
43 
44  ASSERT_NOT_REACHED();
45  return createWrapper<CSSStyleValue>(globalObject, WTFMove(value));
46 }
47 
48 JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, CSSStyleValue& object)
49 {
50  return wrap(state, globalObject, object);
51 }
52 
53 } // namespace WebCore
54 
55 #endif

Source/WebCore/bindings/js/JSTypedOMCSSStyleValueCustom.cpp

 1/*
 2 * Copyright (C) 2018 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "JSTypedOMCSSStyleValue.h"
 28
 29#if ENABLE(CSS_PAINTING_API)
 30
 31#include "JSTypedOMCSSImageValue.h"
 32#include "JSTypedOMCSSUnitValue.h"
 33#include "JSTypedOMCSSUnparsedValue.h"
 34
 35namespace WebCore {
 36using namespace JSC;
 37
 38JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<TypedOMCSSStyleValue>&& value)
 39{
 40 if (value->isUnitValue())
 41 return createWrapper<TypedOMCSSUnitValue>(globalObject, WTFMove(value));
 42 if (value->isUnparsedValue())
 43 return createWrapper<TypedOMCSSUnparsedValue>(globalObject, WTFMove(value));
 44 if (value->isImageValue())
 45 return createWrapper<TypedOMCSSImageValue>(globalObject, WTFMove(value));
 46
 47 ASSERT_NOT_REACHED();
 48 return createWrapper<TypedOMCSSStyleValue>(globalObject, WTFMove(value));
 49}
 50
 51JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, TypedOMCSSStyleValue& object)
 52{
 53 return wrap(state, globalObject, object);
 54}
 55
 56} // namespace WebCore
 57
 58#endif

Source/WebCore/bindings/js/WebCoreBuiltinNames.h

@@namespace WebCore {
4949 macro(Credential) \
5050 macro(CredentialsContainer) \
5151 macro(CSSAnimation) \
 52 macro(CSSImageValue) \
5253 macro(CSSNumericValue) \
5354 macro(CSSPaintSize) \
5455 macro(CSSStyleValue) \

Source/WebCore/css/CSSComputedStyleDeclaration.cpp

@@RefPtr<CSSValue> ComputedStyleExtractor::customPropertyValue(const String& prope
26382638 if (!value)
26392639 return nullptr;
26402640
2641  auto visitor = WTF::makeVisitor([&](const Ref<CSSVariableReferenceValue>&) {
 2641 return WTF::switchOn(value->value(), [&](const Ref<CSSVariableReferenceValue>&) {
26422642 ASSERT_NOT_REACHED();
26432643 return RefPtr<CSSValue>();
26442644 }, [&](const CSSValueID&) {

@@RefPtr<CSSValue> ComputedStyleExtractor::customPropertyValue(const String& prope
26472647 return CSSCustomPropertyValue::create(*value);
26482648 }, [&](const Length& value) {
26492649 return zoomAdjustedPixelValueForLength(value, *style);
 2650 }, [&](const Ref<StyleImage>&) {
 2651 return CSSCustomPropertyValue::create(*value);
26502652 });
2651  return WTF::visit(visitor, value->value());
26522653}
26532654
26542655String ComputedStyleExtractor::customPropertyText(const String& propertyName)

Source/WebCore/css/CSSCustomPropertyValue.cpp

@@bool CSSCustomPropertyValue::equals(const CSSCustomPropertyValue& other) const
3333{
3434 if (m_name != other.m_name || m_value.index() != other.m_value.index())
3535 return false;
36  auto visitor = WTF::makeVisitor([&](const Ref<CSSVariableReferenceValue>& value) {
 36 return WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>& value) {
3737 return value.get() == WTF::get<Ref<CSSVariableReferenceValue>>(other.m_value).get();
3838 }, [&](const CSSValueID& value) {
3939 return value == WTF::get<CSSValueID>(other.m_value);

@@bool CSSCustomPropertyValue::equals(const CSSCustomPropertyValue& other) const
4141 return value.get() == WTF::get<Ref<CSSVariableData>>(other.m_value).get();
4242 }, [&](const Length& value) {
4343 return value == WTF::get<Length>(other.m_value);
 44 }, [&](const Ref<StyleImage>& value) {
 45 return value.get() == WTF::get<Ref<StyleImage>>(other.m_value).get();
4446 });
45  return WTF::visit(visitor, m_value);
4647}
4748
4849String CSSCustomPropertyValue::customCSSText() const

@@String CSSCustomPropertyValue::customCSSText() const
5051 if (!m_serialized) {
5152 m_serialized = true;
5253
53  auto visitor = WTF::makeVisitor([&](const Ref<CSSVariableReferenceValue>& value) {
 54 WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>& value) {
5455 m_stringValue = value->cssText();
5556 }, [&](const CSSValueID& value) {
5657 m_stringValue = getValueName(value);

@@String CSSCustomPropertyValue::customCSSText() const
5859 m_stringValue = value->tokenRange().serialize();
5960 }, [&](const Length& value) {
6061 m_stringValue = CSSPrimitiveValue::create(value.value(), CSSPrimitiveValue::CSS_PX)->cssText();
 62 }, [&](const Ref<StyleImage>& value) {
 63 m_stringValue = value->cssValue()->cssText();
6164 });
62  WTF::visit(visitor, m_value);
6365 }
6466 return m_stringValue;
6567}

@@Vector<CSSParserToken> CSSCustomPropertyValue::tokens() const
6870{
6971 Vector<CSSParserToken> result;
7072
71  auto visitor = WTF::makeVisitor([&](const Ref<CSSVariableReferenceValue>&) {
 73 WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>&) {
7274 ASSERT_NOT_REACHED();
7375 }, [&](const CSSValueID&) {
7476 // Do nothing

@@Vector<CSSParserToken> CSSCustomPropertyValue::tokens() const
7779 }, [&](const Length&) {
7880 CSSTokenizer tokenizer(cssText());
7981
 82 auto tokenizerRange = tokenizer.tokenRange();
 83 while (!tokenizerRange.atEnd())
 84 result.append(tokenizerRange.consume());
 85 }, [&](const Ref<StyleImage>&) {
 86 CSSTokenizer tokenizer(cssText());
 87
8088 auto tokenizerRange = tokenizer.tokenRange();
8189 while (!tokenizerRange.atEnd())
8290 result.append(tokenizerRange.consume());
8391 });
84  WTF::visit(visitor, m_value);
8592
8693 return result;
8794}

Source/WebCore/css/CSSCustomPropertyValue.h

2929#include "CSSValue.h"
3030#include "CSSVariableReferenceValue.h"
3131#include "Length.h"
 32#include "StyleImage.h"
3233#include <wtf/RefPtr.h>
3334#include <wtf/Variant.h>
3435#include <wtf/text/WTFString.h>

@@class RenderStyle;
4142
4243class CSSCustomPropertyValue final : public CSSValue {
4344public:
44  using VariantValue = Variant<Ref<CSSVariableReferenceValue>, CSSValueID, Ref<CSSVariableData>, Length>;
 45 using VariantValue = Variant<Ref<CSSVariableReferenceValue>, CSSValueID, Ref<CSSVariableData>, Length, Ref<StyleImage>>;
4546
4647 static Ref<CSSCustomPropertyValue> createUnresolved(const AtomicString& name, Ref<CSSVariableReferenceValue>&& value)
4748 {

@@public:
6970 return adoptRef(*new CSSCustomPropertyValue(name, { WTFMove(value) }));
7071 }
7172
 73 static Ref<CSSCustomPropertyValue> createSyntaxImage(const AtomicString& name, Ref<StyleImage>&& value)
 74 {
 75 return adoptRef(*new CSSCustomPropertyValue(name, { WTFMove(value) }));
 76 }
 77
7278 static Ref<CSSCustomPropertyValue> create(const CSSCustomPropertyValue& other)
7379 {
7480 return adoptRef(*new CSSCustomPropertyValue(other));

@@private:
111117 m_value = value.copyRef();
112118 }, [&](const Length& value) {
113119 m_value = value;
 120 }, [&](const Ref<StyleImage>& value) {
 121 m_value = value.copyRef();
114122 });
115123 WTF::visit(visitor, other.m_value);
116124 }

Source/WebCore/css/CSSPaintImageValue.cpp

@@RefPtr<Image> CSSPaintImageValue::image(RenderElement& renderElement, const Floa
6969 while (!localRange.atEnd() && localRange.peek() != CommaToken) {
7070 if (localRange.peek() == CommentToken)
7171 localRange.consume();
72  else
 72 else if (localRange.peek().getBlockType() == CSSParserToken::BlockStart) {
 73 localRange.peek().serialize(builder);
 74 builder.append(localRange.consumeBlock().serialize());
 75 builder.append(')');
 76 } else
7377 localRange.consume().serialize(builder);
7478 }
7579 if (!localRange.atEnd())

Source/WebCore/css/typedom/CSSNumericValue.h

1 /*
2  * Copyright (C) 2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #pragma once
27 
28 #if ENABLE(CSS_PAINTING_API)
29 
30 #include "CSSStyleValue.h"
31 
32 namespace WebCore {
33 
34 class CSSNumericValue : public CSSStyleValue {
35 protected:
36  CSSNumericValue() = default;
37 };
38 } // namespace WebCore
39 
40 #endif

Source/WebCore/css/typedom/CSSNumericValue.idl

1 /*
2 * Copyright (C) 2018 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
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 [
30  EnabledAtRuntime=CSSPaintingAPI,
31  Conditional=CSS_PAINTING_API,
32  Exposed=(Window,Worker,PaintWorklet),
33 ] interface CSSNumericValue : CSSStyleValue {
34 };

Source/WebCore/css/typedom/CSSStyleValue.h

1 /*
2  * Copyright (C) 2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #pragma once
27 
28 #if ENABLE(CSS_PAINTING_API)
29 
30 #include <wtf/RefCounted.h>
31 #include <wtf/text/WTFString.h>
32 
33 namespace WebCore {
34 
35 class CSSStyleValue : public RefCounted<CSSStyleValue> {
36 public:
37  virtual ~CSSStyleValue() = default;
38  virtual String toString() = 0;
39 
40  virtual bool isUnitValue() { return false; }
41  virtual bool isUnparsedValue() { return false; }
42 
43 protected:
44  CSSStyleValue() = default;
45 };
46 
47 } // namespace WebCore
48 
49 #endif

Source/WebCore/css/typedom/CSSStyleValue.idl

1 /*
2 * Copyright (C) 2018 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
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 [
30  CustomToJSObject,
31  EnabledAtRuntime=CSSPaintingAPI,
32  Conditional=CSS_PAINTING_API,
33  Exposed=(Window,Worker,PaintWorklet),
34  SkipVTableValidation,
35 ] interface CSSStyleValue {
36  stringifier;
37 };

Source/WebCore/css/typedom/CSSUnitValue.h

1 /*
2  * Copyright (C) 2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #pragma once
27 
28 #if ENABLE(CSS_PAINTING_API)
29 
30 #include "CSSNumericValue.h"
31 #include <wtf/RefCounted.h>
32 #include <wtf/text/StringConcatenateNumbers.h>
33 #include <wtf/text/WTFString.h>
34 
35 namespace WebCore {
36 
37 class CSSUnitValue final : public CSSNumericValue {
38 public:
39  static Ref<CSSUnitValue> create(double value, const String& unit)
40  {
41  return adoptRef(*new CSSUnitValue(value, unit));
42  }
43 
44  // FIXME: not correct.
45  String toString() final { return makeString((int) m_value, m_unit); }
46 
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)
56  {
57  }
58 
59  bool isUnitValue() final { return true; }
60 
61  double m_value;
62  String m_unit;
63 };
64 
65 } // namespace WebCore
66 
67 #endif

Source/WebCore/css/typedom/CSSUnitValue.idl

1 /*
2 * Copyright (C) 2018 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
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 [
30  EnabledAtRuntime=CSSPaintingAPI,
31  Conditional=CSS_PAINTING_API,
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 };

Source/WebCore/css/typedom/CSSUnparsedValue.h

1 /*
2  * Copyright (C) 2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #pragma once
27 
28 #if ENABLE(CSS_PAINTING_API)
29 
30 #include "CSSStyleValue.h"
31 #include <wtf/RefCounted.h>
32 #include <wtf/text/WTFString.h>
33 
34 namespace WebCore {
35 
36 class CSSUnparsedValue final : public CSSStyleValue {
37 public:
38  static Ref<CSSUnparsedValue> create(const String& serializedValue)
39  {
40  return adoptRef(*new CSSUnparsedValue(serializedValue));
41  }
42 
43  String toString() final { return m_serializedValue; }
44 
45 private:
46  explicit CSSUnparsedValue(const String& serializedValue)
47  : m_serializedValue(serializedValue)
48  {
49  }
50 
51  bool isUnparsedValue() final { return true; }
52 
53  String m_serializedValue;
54 };
55 
56 } // namespace WebCore
57 
58 #endif

Source/WebCore/css/typedom/CSSUnparsedValue.idl

1 /*
2 * Copyright (C) 2018 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
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.
30 [
31  EnabledAtRuntime=CSSPaintingAPI,
32  Conditional=CSS_PAINTING_API,
33  Exposed=(Window,Worker,PaintWorklet),
34  Constructor(USVString serializedValue),
35 ] interface CSSUnparsedValue : CSSStyleValue {
36 };

Source/WebCore/css/typedom/StylePropertyMapReadOnly.h

2727
2828#if ENABLE(CSS_PAINTING_API)
2929
30 #include "CSSStyleValue.h"
 30#include "TypedOMCSSStyleValue.h"
3131#include <wtf/HashMap.h>
3232#include <wtf/RefCounted.h>
3333#include <wtf/text/WTFString.h>

@@namespace WebCore {
3636
3737class StylePropertyMapReadOnly : public RefCounted<StylePropertyMapReadOnly> {
3838public:
39  static Ref<StylePropertyMapReadOnly> create(HashMap<String, Ref<CSSStyleValue>>&& map)
 39 static Ref<StylePropertyMapReadOnly> create(HashMap<String, Ref<TypedOMCSSStyleValue>>&& map)
4040 {
4141 return adoptRef(*new StylePropertyMapReadOnly(WTFMove(map)));
4242 }
4343
44  CSSStyleValue* get(String property) const { return m_map.get(property); }
 44 TypedOMCSSStyleValue* get(String property) const { return m_map.get(property); }
4545
4646private:
47  explicit StylePropertyMapReadOnly(HashMap<String, Ref<CSSStyleValue>>&& map)
 47 explicit StylePropertyMapReadOnly(HashMap<String, Ref<TypedOMCSSStyleValue>>&& map)
4848 : m_map(WTFMove(map))
4949 {
5050 }
5151
52  HashMap<String, Ref<CSSStyleValue>> m_map;
 52 HashMap<String, Ref<TypedOMCSSStyleValue>> m_map;
5353};
5454
5555} // namespace WebCore

Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl

3232 Exposed=(Window,Worker,PaintWorklet),
3333 ImplementationLacksVTable
3434] interface StylePropertyMapReadOnly {
35  // FIXME: should be (undefined or CSSStyleValue), not null
36  CSSStyleValue? get(USVString property);
 35 // FIXME: should be (undefined or TypedOMCSSStyleValue), not null
 36 TypedOMCSSStyleValue? get(USVString property);
3737};

Source/WebCore/css/typedom/TypedOMCSSImageValue.h

 1/*
 2 * Copyright (C) 2018 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(CSS_PAINTING_API)
 29
 30#include "CSSImageValue.h"
 31#include "ImageBitmap.h"
 32#include "RenderElement.h"
 33#include "TypedOMCSSStyleValue.h"
 34#include <wtf/RefCounted.h>
 35#include <wtf/text/StringConcatenateNumbers.h>
 36#include <wtf/text/WTFString.h>
 37
 38namespace WebCore {
 39
 40class TypedOMCSSImageValue final : public TypedOMCSSStyleValue {
 41public:
 42 static Ref<TypedOMCSSImageValue> create(CSSImageValue& cssValue, RenderElement& renderer)
 43 {
 44 return adoptRef(*new TypedOMCSSImageValue(cssValue, renderer));
 45 }
 46
 47 String toString() final { return m_cssValue->cssText(); }
 48
 49 CachedImage* image() { return m_cssValue->cachedImage(); }
 50 const RenderElement* renderer() const { return m_renderer.get(); }
 51
 52private:
 53 TypedOMCSSImageValue(CSSImageValue& cssValue, RenderElement& renderer)
 54 : m_cssValue(makeRef(cssValue))
 55 , m_renderer(makeWeakPtr(renderer))
 56 {
 57 }
 58
 59 bool isImageValue() final { return true; }
 60
 61 Ref<CSSImageValue> m_cssValue;
 62 WeakPtr<RenderElement> m_renderer;
 63};
 64
 65} // namespace WebCore
 66
 67#endif

Source/WebCore/css/typedom/TypedOMCSSImageValue.idl

 1/*
 2* Copyright (C) 2018 Apple Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions
 6* are met:
 7* 1. Redistributions of source code must retain the above copyright
 8* notice, this list of conditions and the following disclaimer.
 9* 2. Redistributions in binary form must reproduce the above copyright
 10* notice, this list of conditions and the following disclaimer in the
 11* documentation and/or other materials provided with the distribution.
 12*
 13* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24*/
 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[
 30 InterfaceName=CSSImageValue,
 31 EnabledAtRuntime=CSSPaintingAPI,
 32 Conditional=CSS_PAINTING_API,
 33 Exposed=(Window,Worker,PaintWorklet),
 34 JSGenerateToNativeObject,
 35] interface TypedOMCSSImageValue : TypedOMCSSStyleValue {
 36};

Source/WebCore/css/typedom/TypedOMCSSNumericValue.h

 1/*
 2 * Copyright (C) 2018 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(CSS_PAINTING_API)
 29
 30#include "TypedOMCSSStyleValue.h"
 31
 32namespace WebCore {
 33
 34class TypedOMCSSNumericValue : public TypedOMCSSStyleValue {
 35protected:
 36 TypedOMCSSNumericValue() = default;
 37};
 38} // namespace WebCore
 39
 40#endif

Source/WebCore/css/typedom/TypedOMCSSNumericValue.idl

 1/*
 2* Copyright (C) 2018 Apple Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions
 6* are met:
 7* 1. Redistributions of source code must retain the above copyright
 8* notice, this list of conditions and the following disclaimer.
 9* 2. Redistributions in binary form must reproduce the above copyright
 10* notice, this list of conditions and the following disclaimer in the
 11* documentation and/or other materials provided with the distribution.
 12*
 13* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24*/
 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[
 30 InterfaceName=CSSNumericValue,
 31 EnabledAtRuntime=CSSPaintingAPI,
 32 Conditional=CSS_PAINTING_API,
 33 Exposed=(Window,Worker,PaintWorklet),
 34] interface TypedOMCSSNumericValue : TypedOMCSSStyleValue {
 35};

Source/WebCore/css/typedom/TypedOMCSSStyleValue.h

 1/*
 2 * Copyright (C) 2018 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(CSS_PAINTING_API)
 29
 30#include "ScriptWrappable.h"
 31#include <wtf/RefCounted.h>
 32#include <wtf/text/WTFString.h>
 33
 34namespace WebCore {
 35
 36class TypedOMCSSStyleValue : public RefCounted<TypedOMCSSStyleValue>, public ScriptWrappable {
 37public:
 38 virtual ~TypedOMCSSStyleValue() = default;
 39 virtual String toString() = 0;
 40
 41 virtual bool isUnitValue() { return false; }
 42 virtual bool isUnparsedValue() { return false; }
 43 virtual bool isImageValue() { return false; }
 44
 45protected:
 46 TypedOMCSSStyleValue() = default;
 47};
 48
 49} // namespace WebCore
 50
 51#endif

Source/WebCore/css/typedom/TypedOMCSSStyleValue.idl

 1/*
 2* Copyright (C) 2018 Apple Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions
 6* are met:
 7* 1. Redistributions of source code must retain the above copyright
 8* notice, this list of conditions and the following disclaimer.
 9* 2. Redistributions in binary form must reproduce the above copyright
 10* notice, this list of conditions and the following disclaimer in the
 11* documentation and/or other materials provided with the distribution.
 12*
 13* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24*/
 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[
 30 InterfaceName=CSSStyleValue,
 31 CustomToJSObject,
 32 EnabledAtRuntime=CSSPaintingAPI,
 33 Conditional=CSS_PAINTING_API,
 34 Exposed=(Window,Worker,PaintWorklet),
 35 SkipVTableValidation,
 36] interface TypedOMCSSStyleValue {
 37 stringifier;
 38};

Source/WebCore/css/typedom/TypedOMCSSUnitValue.h

 1/*
 2 * Copyright (C) 2018 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(CSS_PAINTING_API)
 29
 30#include "TypedOMCSSNumericValue.h"
 31#include <wtf/RefCounted.h>
 32#include <wtf/text/StringConcatenateNumbers.h>
 33#include <wtf/text/WTFString.h>
 34
 35namespace WebCore {
 36
 37class TypedOMCSSUnitValue final : public TypedOMCSSNumericValue {
 38public:
 39 static Ref<TypedOMCSSUnitValue> create(double value, const String& unit)
 40 {
 41 return adoptRef(*new TypedOMCSSUnitValue(value, unit));
 42 }
 43
 44 // FIXME: not correct.
 45 String toString() final { return makeString((int) m_value, m_unit); }
 46
 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
 52private:
 53 TypedOMCSSUnitValue(double value, const String& unit)
 54 : m_value(value)
 55 , m_unit(unit)
 56 {
 57 }
 58
 59 bool isUnitValue() final { return true; }
 60
 61 double m_value;
 62 String m_unit;
 63};
 64
 65} // namespace WebCore
 66
 67#endif

Source/WebCore/css/typedom/TypedOMCSSUnitValue.idl

 1/*
 2* Copyright (C) 2018 Apple Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions
 6* are met:
 7* 1. Redistributions of source code must retain the above copyright
 8* notice, this list of conditions and the following disclaimer.
 9* 2. Redistributions in binary form must reproduce the above copyright
 10* notice, this list of conditions and the following disclaimer in the
 11* documentation and/or other materials provided with the distribution.
 12*
 13* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24*/
 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[
 30 InterfaceName=CSSUnitValue,
 31 EnabledAtRuntime=CSSPaintingAPI,
 32 Conditional=CSS_PAINTING_API,
 33 Exposed=(Window,Worker,PaintWorklet),
 34 Constructor(double value, USVString unit),
 35] interface TypedOMCSSUnitValue : TypedOMCSSNumericValue {
 36 attribute double value;
 37 readonly attribute USVString unit;
 38};

Source/WebCore/css/typedom/TypedOMCSSUnparsedValue.h

 1/*
 2 * Copyright (C) 2018 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(CSS_PAINTING_API)
 29
 30#include "TypedOMCSSStyleValue.h"
 31#include <wtf/RefCounted.h>
 32#include <wtf/text/WTFString.h>
 33
 34namespace WebCore {
 35
 36class TypedOMCSSUnparsedValue final : public TypedOMCSSStyleValue {
 37public:
 38 static Ref<TypedOMCSSUnparsedValue> create(const String& serializedValue)
 39 {
 40 return adoptRef(*new TypedOMCSSUnparsedValue(serializedValue));
 41 }
 42
 43 String toString() final { return m_serializedValue; }
 44
 45private:
 46 explicit TypedOMCSSUnparsedValue(const String& serializedValue)
 47 : m_serializedValue(serializedValue)
 48 {
 49 }
 50
 51 bool isUnparsedValue() final { return true; }
 52
 53 String m_serializedValue;
 54};
 55
 56} // namespace WebCore
 57
 58#endif

Source/WebCore/css/typedom/TypedOMCSSUnparsedValue.idl

 1/*
 2* Copyright (C) 2018 Apple Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions
 6* are met:
 7* 1. Redistributions of source code must retain the above copyright
 8* notice, this list of conditions and the following disclaimer.
 9* 2. Redistributions in binary form must reproduce the above copyright
 10* notice, this list of conditions and the following disclaimer in the
 11* documentation and/or other materials provided with the distribution.
 12*
 13* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24*/
 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.
 30[
 31 InterfaceName=CSSUnparsedValue,
 32 EnabledAtRuntime=CSSPaintingAPI,
 33 Conditional=CSS_PAINTING_API,
 34 Exposed=(Window,Worker,PaintWorklet),
 35 Constructor(USVString serializedValue),
 36] interface TypedOMCSSUnparsedValue : TypedOMCSSStyleValue {
 37};

Source/WebCore/html/ImageBitmap.cpp

4444#include "LayoutSize.h"
4545#include "RenderElement.h"
4646#include "SharedBuffer.h"
 47#include "TypedOMCSSImageValue.h"
4748#include <wtf/StdLibExtras.h>
4849
4950namespace WebCore {

@@void ImageBitmap::createPromise(ScriptExecutionContext& scriptExecutionContext,
448449}
449450#endif
450451
 452#if ENABLE(CSS_PAINTING_API)
 453void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<TypedOMCSSImageValue>&, ImageBitmapOptions&&, std::optional<IntRect>, ImageBitmap::Promise&& promise)
 454{
 455 promise.reject(InvalidStateError, "Not implemented");
 456}
 457#endif
 458
451459void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<ImageBitmap>& existingImageBitmap, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise)
452460{
453461 // 2. If image's [[Detached]] internal slot value is true, return a promise

Source/WebCore/html/ImageBitmap.h

@@class IntRect;
4444class IntSize;
4545class PendingImageBitmap;
4646class ScriptExecutionContext;
 47class TypedOMCSSImageValue;
4748class URL;
4849struct ImageBitmapOptions;
4950

@@public:
5657#endif
5758 RefPtr<HTMLCanvasElement>,
5859 RefPtr<ImageBitmap>,
 60#if ENABLE(CSS_PAINTING_API)
 61 RefPtr<TypedOMCSSImageValue>,
 62#endif
5963 RefPtr<Blob>,
6064 RefPtr<ImageData>
6165 >;

@@private:
99103 static void createPromise(ScriptExecutionContext&, RefPtr<ImageBitmap>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
100104 static void createPromise(ScriptExecutionContext&, RefPtr<Blob>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
101105 static void createPromise(ScriptExecutionContext&, RefPtr<ImageData>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
 106 static void createPromise(ScriptExecutionContext&, RefPtr<TypedOMCSSImageValue>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
102107 static void createFromBuffer(Ref<ArrayBuffer>&&, String mimeType, long long expectedContentLength, const URL&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
103108
104109 std::unique_ptr<ImageBuffer> m_bitmapData;

Source/WebCore/html/canvas/CanvasDrawImage.idl

2424 */
2525
2626// FIXME: This should include SVGImageElement and ImageBitmap.
27 #if defined(ENABLE_VIDEO) && ENABLE_VIDEO
 27#if defined(ENABLE_VIDEO) && ENABLE_VIDEO && defined(ENABLE_CSS_PAINTING_API) && ENABLE_CSS_PAINTING_API
 28typedef (HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or TypedOMCSSImageValue) CanvasImageSource;
 29#elif defined(ENABLE_VIDEO) && ENABLE_VIDEO
2830typedef (HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap) CanvasImageSource;
2931#else
3032typedef (HTMLImageElement or HTMLCanvasElement or ImageBitmap) CanvasImageSource;

Source/WebCore/html/canvas/CanvasFillStrokeStyles.idl

2424 */
2525
2626// FIXME: This should include SVGImageElement and ImageBitmap.
27 #if defined(ENABLE_VIDEO) && ENABLE_VIDEO
 27#if defined(ENABLE_VIDEO) && ENABLE_VIDEO && defined(ENABLE_CSS_PAINTING_API) && ENABLE_CSS_PAINTING_API
 28typedef (HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or TypedOMCSSImageValue) CanvasImageSource;
 29#elif defined(ENABLE_VIDEO) && ENABLE_VIDEO
2830typedef (HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap) CanvasImageSource;
2931#else
3032typedef (HTMLImageElement or HTMLCanvasElement or ImageBitmap) CanvasImageSource;

Source/WebCore/html/canvas/CanvasRenderingContext.cpp

@@void CanvasRenderingContext::checkOrigin(const URL& url)
144144 m_canvas.setOriginTainted();
145145}
146146
 147void CanvasRenderingContext::checkOrigin(const TypedOMCSSImageValue&)
 148{
 149 m_canvas.setOriginTainted();
 150}
 151
147152} // namespace WebCore

Source/WebCore/html/canvas/CanvasRenderingContext.h

@@class HTMLCanvasElement;
3838class HTMLImageElement;
3939class HTMLVideoElement;
4040class ImageBitmap;
 41class TypedOMCSSImageValue;
4142class URL;
4243class WebGLObject;
4344

@@protected:
8990 m_canvas.setOriginTainted();
9091 }
9192 void checkOrigin(const URL&);
 93 void checkOrigin(const TypedOMCSSImageValue&);
9294
9395 bool m_callTracingActive { false };
9496

Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp

6161#include "StyleResolver.h"
6262#include "TextMetrics.h"
6363#include "TextRun.h"
 64#include "TypedOMCSSImageValue.h"
6465#include <wtf/CheckedArithmetic.h>
6566#include <wtf/MathExtras.h>
6667#include <wtf/NeverDestroyed.h>

@@static inline FloatSize size(HTMLVideoElement& video)
14381439
14391440#endif
14401441
 1442#if ENABLE(CSS_PAINTING_API)
 1443static inline FloatSize size(TypedOMCSSImageValue& image)
 1444{
 1445 LayoutSize size;
 1446 if (auto* cachedImage = image.image())
 1447 size = cachedImage->imageSizeForRenderer(image.renderer(), 1.0f); // FIXME: Not sure about this, see fixme in size(HTMLImageElement&...)
 1448 return size;
 1449}
 1450#endif
 1451
14411452static inline FloatRect normalizeRect(const FloatRect& rect)
14421453{
14431454 return FloatRect(std::min(rect.x(), rect.maxX()),

@@ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(HTMLImageElement& imag
14861497}
14871498
14881499ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(HTMLImageElement& imageElement, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMode& blendMode)
 1500{
 1501 if (!imageElement.complete())
 1502 return { };
 1503 FloatRect imageRect = FloatRect(FloatPoint(), size(imageElement, ImageSizeType::BeforeDevicePixelRatio));
 1504
 1505 auto result = drawImage(imageElement.document(), imageElement.cachedImage(), imageElement.renderer(), imageRect, srcRect, dstRect, op, blendMode);
 1506
 1507 if (!result.hasException())
 1508 checkOrigin(&imageElement);
 1509 return result;
 1510}
 1511
 1512#if ENABLE(CSS_PAINTING_API)
 1513ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(TypedOMCSSImageValue& image, const FloatRect& srcRect, const FloatRect& dstRect)
 1514{
 1515 auto* renderer = image.renderer();
 1516 auto* cachedImage = image.image();
 1517 if (!renderer || !cachedImage)
 1518 return { };
 1519 FloatRect imageRect = FloatRect(FloatPoint(), size(image));
 1520
 1521 auto result = drawImage(renderer->document(), cachedImage, renderer, imageRect, srcRect, dstRect, state().globalComposite, state().globalBlend);
 1522
 1523 if (!result.hasException())
 1524 checkOrigin(image);
 1525 return result;
 1526}
 1527#endif
 1528
 1529ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(Document& document, CachedImage* cachedImage, const RenderObject* renderer, const FloatRect& imageRect, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMode& blendMode)
14891530{
14901531 if (!std::isfinite(dstRect.x()) || !std::isfinite(dstRect.y()) || !std::isfinite(dstRect.width()) || !std::isfinite(dstRect.height())
14911532 || !std::isfinite(srcRect.x()) || !std::isfinite(srcRect.y()) || !std::isfinite(srcRect.width()) || !std::isfinite(srcRect.height()))

@@ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(HTMLImageElement& imag
14941535 if (!dstRect.width() || !dstRect.height())
14951536 return { };
14961537
1497  if (!imageElement.complete())
1498  return { };
1499 
15001538 FloatRect normalizedSrcRect = normalizeRect(srcRect);
15011539 FloatRect normalizedDstRect = normalizeRect(dstRect);
15021540
1503  FloatRect imageRect = FloatRect(FloatPoint(), size(imageElement, ImageSizeType::BeforeDevicePixelRatio));
15041541 if (!srcRect.width() || !srcRect.height())
15051542 return Exception { IndexSizeError };
15061543

@@ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(HTMLImageElement& imag
15241561 if (!state().hasInvertibleTransform)
15251562 return { };
15261563
1527  CachedImage* cachedImage = imageElement.cachedImage();
15281564 if (!cachedImage)
15291565 return { };
15301566
1531  RefPtr<Image> image = cachedImage->imageForRenderer(imageElement.renderer());
 1567 RefPtr<Image> image = cachedImage->imageForRenderer(renderer);
15321568 if (!image)
15331569 return { };
15341570

@@ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(HTMLImageElement& imag
15401576 }
15411577
15421578 if (image->isBitmapImage())
1543  downcast<BitmapImage>(*image).updateFromSettings(imageElement.document().settings());
 1579 downcast<BitmapImage>(*image).updateFromSettings(document.settings());
15441580
15451581 if (rectContainsCanvas(normalizedDstRect)) {
15461582 c->drawImage(*image, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode));

@@ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(HTMLImageElement& imag
15601596 if (image->isSVGImage())
15611597 image->setImageObserver(observer);
15621598
1563  checkOrigin(&imageElement);
1564 
15651599 return { };
15661600}
15671601

@@ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2DBase::createPattern(I
19842018 return Exception { TypeError };
19852019}
19862020
 2021#if ENABLE(CSS_PAINTING_API)
 2022ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2DBase::createPattern(TypedOMCSSImageValue&, bool, bool)
 2023{
 2024 // FIXME: Implement.
 2025 return Exception { TypeError };
 2026}
 2027#endif
 2028
19872029void CanvasRenderingContext2DBase::didDrawEntireCanvas()
19882030{
19892031 didDraw(FloatRect(FloatPoint::zero(), canvasBase().size()), CanvasDidDrawApplyClip);

Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h

5050
5151namespace WebCore {
5252
 53class TypedOMCSSImageValue;
 54class CachedImage;
5355class CanvasBase;
5456class CanvasGradient;
5557class CanvasPattern;

@@class ImageBitmap;
6264class ImageData;
6365class Path2D;
6466class RenderStyle;
 67class RenderObject;
6568class TextMetrics;
6669
6770struct DOMMatrix2DInit;
6871
69 #if ENABLE(VIDEO)
 72#if ENABLE(VIDEO) && ENABLE(CSS_PAINTING_API)
 73using CanvasImageSource = Variant<RefPtr<HTMLImageElement>, RefPtr<HTMLVideoElement>, RefPtr<HTMLCanvasElement>, RefPtr<ImageBitmap>, RefPtr<TypedOMCSSImageValue>>;
 74#elif ENABLE(VIDEO)
7075using CanvasImageSource = Variant<RefPtr<HTMLImageElement>, RefPtr<HTMLVideoElement>, RefPtr<HTMLCanvasElement>, RefPtr<ImageBitmap>>;
7176#else
7277using CanvasImageSource = Variant<RefPtr<HTMLImageElement>, RefPtr<HTMLCanvasElement>, RefPtr<ImageBitmap>>;

@@protected:
321326 ExceptionOr<RefPtr<CanvasPattern>> createPattern(HTMLVideoElement&, bool repeatX, bool repeatY);
322327#endif
323328 ExceptionOr<RefPtr<CanvasPattern>> createPattern(ImageBitmap&, bool repeatX, bool repeatY);
 329#if ENABLE(CSS_PAINTING_API)
 330 ExceptionOr<RefPtr<CanvasPattern>> createPattern(TypedOMCSSImageValue&, bool repeatX, bool repeatY);
 331#endif
324332
325333 ExceptionOr<void> drawImage(HTMLImageElement&, const FloatRect& srcRect, const FloatRect& dstRect);
326334 ExceptionOr<void> drawImage(HTMLImageElement&, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&);
327335 ExceptionOr<void> drawImage(HTMLCanvasElement&, const FloatRect& srcRect, const FloatRect& dstRect);
 336 ExceptionOr<void> drawImage(Document&, CachedImage*, const RenderObject*, const FloatRect& imageRect, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&);
328337#if ENABLE(VIDEO)
329338 ExceptionOr<void> drawImage(HTMLVideoElement&, const FloatRect& srcRect, const FloatRect& dstRect);
 339#endif
 340#if ENABLE(CSS_PAINTING_API)
 341 ExceptionOr<void> drawImage(TypedOMCSSImageValue&, const FloatRect& srcRect, const FloatRect& dstRect);
330342#endif
331343 ExceptionOr<void> drawImage(ImageBitmap&, const FloatRect& srcRect, const FloatRect& dstRect);
332344

Source/WebCore/inspector/InspectorCanvas.cpp

@@Ref<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildAction(const String& name,
619619 [&] (const RefPtr<HTMLImageElement>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::Image); },
620620#if ENABLE(VIDEO)
621621 [&] (const RefPtr<HTMLVideoElement>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::Image); },
 622#endif
 623#if ENABLE(CSS_PAINTING_API)
 624 [&] (const RefPtr<TypedOMCSSImageValue>&) { /* FIXME implement. */ },
622625#endif
623626 [&] (const RefPtr<ImageBitmap>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::ImageBitmap); },
624627 [&] (const RefPtr<ImageData>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::ImageData); },

Source/WebCore/page/WindowOrWorkerGlobalScope.idl

2525 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626 */
2727
28 #if defined(ENABLE_VIDEO) && ENABLE_VIDEO
 28#if defined(ENABLE_VIDEO) && ENABLE_VIDEO && defined(ENABLE_CSS_PAINTING_API) && ENABLE_CSS_PAINTING_API
 29typedef (HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or TypedOMCSSImageValue) CanvasImageSource;
 30#elif defined(ENABLE_VIDEO) && ENABLE_VIDEO
2931typedef (HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap) CanvasImageSource;
3032#else
3133typedef (HTMLImageElement or HTMLCanvasElement or ImageBitmap) CanvasImageSource;

Source/WebCore/platform/graphics/CustomPaintImage.cpp

2929#if ENABLE(CSS_PAINTING_API)
3030
3131#include "CSSComputedStyleDeclaration.h"
 32#include "CSSImageValue.h"
3233#include "CSSPrimitiveValue.h"
3334#include "CSSPropertyParser.h"
34 #include "CSSUnitValue.h"
35 #include "CSSUnparsedValue.h"
3635#include "CustomPaintCanvas.h"
3736#include "GraphicsContext.h"
3837#include "ImageBitmap.h"

4039#include "JSCSSPaintCallback.h"
4140#include "PaintRenderingContext2D.h"
4241#include "RenderElement.h"
 42#include "TypedOMCSSImageValue.h"
 43#include "TypedOMCSSUnitValue.h"
 44#include "TypedOMCSSUnparsedValue.h"
4345#include <JavaScriptCore/ConstructData.h>
4446
4547namespace WebCore {

@@ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, co
8284 return ImageDrawResult::DidNothing;
8385 auto context = contextOrException.releaseReturnValue();
8486
85  HashMap<String, Ref<CSSStyleValue>> propertyValues;
 87 HashMap<String, Ref<TypedOMCSSStyleValue>> propertyValues;
8688 ComputedStyleExtractor extractor(m_element->element());
8789
8890 for (auto& name : m_inputProperties) {

@@ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, co
9799 }
98100
99101 if (!value) {
100  propertyValues.add(name, CSSUnparsedValue::create(emptyString()));
 102 propertyValues.add(name, TypedOMCSSUnparsedValue::create(emptyString()));
101103 continue;
102104 }
103105
104106 // FIXME: Properly reify all length values.
105107 if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).primitiveType() == CSSPrimitiveValue::CSS_PX)
106  propertyValues.add(name, CSSUnitValue::create(downcast<CSSPrimitiveValue>(*value).doubleValue(), "px"));
 108 propertyValues.add(name, TypedOMCSSUnitValue::create(downcast<CSSPrimitiveValue>(*value).doubleValue(), "px"));
 109 else if (is<CSSImageValue>(*value))
 110 propertyValues.add(name, TypedOMCSSImageValue::create(downcast<CSSImageValue>(*value), *m_element));
107111 else
108  propertyValues.add(name, CSSUnparsedValue::create(value->cssText()));
 112 propertyValues.add(name, TypedOMCSSUnparsedValue::create(value->cssText()));
109113 }
110114
111115 auto size = CSSPaintSize::create(destSize.width(), destSize.height());

Source/WebCore/platform/graphics/gpu/GPUSwapChain.h

2727
2828#if ENABLE(WEBGPU)
2929
 30#include "GPUTexture.h"
3031#include <wtf/RefPtr.h>
3132#include <wtf/RetainPtr.h>
3233

@@OBJC_CLASS CAMetalLayer;
3536namespace WebCore {
3637
3738class GPUDevice;
38 class GPUTexture;
3939
4040enum class GPUTextureFormatEnum;
4141

LayoutTests/ChangeLog

 12018-11-29 Justin Michaud <justin_michaud@apple.com>
 2
 3 CSS Painting API should allow image values in inputProperties
 4 https://bugs.webkit.org/show_bug.cgi?id=192200
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/css-custom-paint/arguments-expected.html: Added.
 9 * fast/css-custom-paint/arguments.html: Added.
 10 * fast/css-custom-paint/image-expected.html: Added.
 11 * fast/css-custom-paint/image.html: Added.
 12 * fast/css-custom-paint/resources/test-image.png: Added.
 13
1142018-11-29 Ryosuke Niwa <rniwa@webkit.org>
215
316 Executing "insertunorderedlist" while selecting a contenteditable element inside a shadow dom hangs the browser

LayoutTests/fast/css-custom-paint/arguments-expected.html

 1<!DOCTYPE html>
 2<style>
 3 .paint {
 4 width: 150px;
 5 height: 150px;
 6 }
 7</style>
 8
 9<body>
 10 <div class="paint" style="background: green;"></div>
 11</body>

LayoutTests/fast/css-custom-paint/arguments.html

 1<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
 2<meta name="author" title="Justin Michaud" href="mailto:justin_michaud@webkit.org">
 3<meta name="assert" content="Test that paint worklets parse arguments correctly">
 4<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
 5<script src="resources/testharness.js"></script>
 6
 7<script id="code" type="text/worklet">
 8class MyPaint {
 9 static get inputArguments() { return Array(5).fill('*') }
 10 paint(ctx, geom, props, args) {
 11 // Note: This does not pass on Chrome. Chrome seems to strip the whitespace.
 12 const expected = [" a", " url(\"\")", " (d)", "e", " f"];
 13 for (const i of expected.keys()) {
 14 assert_equals(args[i].toString(), expected[i]);
 15 }
 16 ctx.fillStyle = "green";
 17 ctx.fillRect(0, 0, geom.width, geom.height);
 18 }
 19}
 20registerPaint('my-paint', MyPaint);
 21</script>
 22
 23<script type="text/javascript">
 24importWorklet(CSS.paintWorklet, document.getElementById('code').textContent);
 25</script>
 26
 27<style>
 28 .paint {
 29 width: 150px;
 30 height: 150px;
 31 background: paint(my-paint, a, url(''), (d),e, f);
 32 }
 33</style>
 34
 35<body>
 36 <div class="paint"></div>
 37</body>

LayoutTests/fast/css-custom-paint/image-expected.html

 1<!DOCTYPE html>
 2<style>
 3 #paint {
 4 width: 150px;
 5 height: 150px;
 6 border: none;
 7 background: url('resources/test-image.png');
 8 background-size: 150px 150px;
 9 }
 10</style>
 11
 12<body>
 13 <div id="paint"></div>
 14 <div style="width: 10px; height: 200px; position: absolute; top: 0; left: 2px; background: black"></div>
 15 <div style="width: 10px; height: 200px; position: absolute; top: 0; left: 155px; background: black"></div>
 16 <div style="width: 10px; height: 200px; position: absolute; top: 0; left: 80px; background: black"></div>
 17 <div style="width: 200px; height: 10px; position: absolute; top: 2px; left: 0; background: black"></div>
 18 <div style="width: 200px; height: 10px; position: absolute; top: 155px; left: 0; background: black"></div>
 19 <div style="width: 200px; height: 10px; position: absolute; top: 30px; left: 0; background: black"></div>
 20 <div style="width: 200px; height: 10px; position: absolute; top: 120px; left: 0; background: black"></div>
 21</body>

LayoutTests/fast/css-custom-paint/image.html

 1<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] -->
 2<meta name="author" title="Justin Michaud" href="mailto:justin_michaud@webkit.org">
 3<meta name="assert" content="Test that paint worklets do not crash if the constructor throws">
 4<link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
 5<script src="resources/testharness.js"></script>
 6
 7<script id="code" type="text/worklet">
 8 class MyPaint {
 9 static get inputProperties() { return ['border-image-source']; }
 10 paint(ctx, geom, properties) {
 11 ctx.drawImage(properties.get('border-image-source'), 0, 0, geom.width, geom.height);
 12 }
 13 }
 14 registerPaint('my-paint', MyPaint);
 15</script>
 16
 17<script type="text/javascript">
 18 importWorklet(CSS.paintWorklet, document.getElementById('code').textContent);
 19</script>
 20
 21<style>
 22 #paint {
 23 width: 150px;
 24 height: 150px;
 25 border: 0px solid black;
 26 border-image-source: url('resources/test-image.png');
 27 background: paint(my-paint);
 28 }
 29</style>
 30
 31<body>
 32 <div id="paint"></div>
 33 <div style="width: 10px; height: 200px; position: absolute; top: 0; left: 2px; background: black"></div>
 34 <div style="width: 10px; height: 200px; position: absolute; top: 0; left: 155px; background: black"></div>
 35 <div style="width: 10px; height: 200px; position: absolute; top: 0; left: 80px; background: black"></div>
 36 <div style="width: 200px; height: 10px; position: absolute; top: 2px; left: 0; background: black"></div>
 37 <div style="width: 200px; height: 10px; position: absolute; top: 155px; left: 0; background: black"></div>
 38 <div style="width: 200px; height: 10px; position: absolute; top: 30px; left: 0; background: black"></div>
 39 <div style="width: 200px; height: 10px; position: absolute; top: 120px; left: 0; background: black"></div>
 40</body>

LayoutTests/fast/css-custom-paint/resources/test-image.png


Added