Changeset 238872 in webkit


Ignore:
Timestamp:
Dec 4, 2018 12:25:02 PM (5 years ago)
Author:
Justin Michaud
Message:

CSS Painting API should allow image values in inputProperties
https://bugs.webkit.org/show_bug.cgi?id=192200

Reviewed by Dean Jackson.

Source/WebCore:

Adds new TypedOMCSSImageValue wrapper. We rename all the existing ones so that the naming is consistent (CSSImageValue is already a thing).
Finally, we let CanvasRenderingContext2DBase render these.

Tests: fast/css-custom-paint/arguments.html

fast/css-custom-paint/image.html

  • CMakeLists.txt:
  • DerivedSources.make:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/CallTracerTypes.h:
  • bindings/js/JSTypedOMCSSStyleValueCustom.cpp: Renamed from Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp.

(WebCore::toJSNewlyCreated):
(WebCore::toJS):

  • bindings/js/WebCoreBuiltinNames.h:
  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::customPropertyValue):

  • css/CSSCustomPropertyValue.cpp:

(WebCore::CSSCustomPropertyValue::equals const):
(WebCore::CSSCustomPropertyValue::customCSSText const):
(WebCore::CSSCustomPropertyValue::tokens const):

  • css/CSSCustomPropertyValue.h:
  • css/CSSPaintImageValue.cpp:

(WebCore::CSSPaintImageValue::image):

  • css/typedom/StylePropertyMapReadOnly.h:

(WebCore::StylePropertyMapReadOnly::create):
(WebCore::StylePropertyMapReadOnly::get const):
(WebCore::StylePropertyMapReadOnly::StylePropertyMapReadOnly):

  • css/typedom/StylePropertyMapReadOnly.idl:
  • css/typedom/TypedOMCSSImageValue.h: Copied from Source/WebCore/css/typedom/CSSUnitValue.h.
  • css/typedom/TypedOMCSSImageValue.idl: Copied from Source/WebCore/css/typedom/CSSStyleValue.idl.
  • css/typedom/TypedOMCSSNumericValue.h: Renamed from Source/WebCore/css/typedom/CSSNumericValue.h.
  • css/typedom/TypedOMCSSNumericValue.idl: Renamed from Source/WebCore/css/typedom/CSSNumericValue.idl.
  • css/typedom/TypedOMCSSStyleValue.h: Renamed from Source/WebCore/css/typedom/CSSStyleValue.h.

(WebCore::TypedOMCSSStyleValue::isImageValue):

  • css/typedom/TypedOMCSSStyleValue.idl: Renamed from Source/WebCore/css/typedom/CSSStyleValue.idl.
  • css/typedom/TypedOMCSSUnitValue.h: Renamed from Source/WebCore/css/typedom/CSSUnitValue.h.
  • css/typedom/TypedOMCSSUnitValue.idl: Renamed from Source/WebCore/css/typedom/CSSUnitValue.idl.
  • css/typedom/TypedOMCSSUnparsedValue.h: Renamed from Source/WebCore/css/typedom/CSSUnparsedValue.h.
  • css/typedom/TypedOMCSSUnparsedValue.idl: Renamed from Source/WebCore/css/typedom/CSSUnparsedValue.idl.
  • html/ImageBitmap.cpp:

(WebCore::ImageBitmap::createPromise):

  • html/ImageBitmap.h:
  • html/canvas/CanvasDrawImage.idl:
  • html/canvas/CanvasFillStrokeStyles.idl:
  • html/canvas/CanvasRenderingContext.cpp:

(WebCore::CanvasRenderingContext::checkOrigin):

  • html/canvas/CanvasRenderingContext.h:
  • html/canvas/CanvasRenderingContext2DBase.cpp:

(WebCore::size):
(WebCore::CanvasRenderingContext2DBase::drawImage):
(WebCore::CanvasRenderingContext2DBase::createPattern):

  • html/canvas/CanvasRenderingContext2DBase.h:
  • inspector/InspectorCanvas.cpp:

(WebCore::InspectorCanvas::buildAction):

  • page/WindowOrWorkerGlobalScope.idl:
  • platform/graphics/CustomPaintImage.cpp:

(WebCore::CustomPaintImage::doCustomPaint):

LayoutTests:

  • fast/css-custom-paint/arguments-expected.html: Added.
  • fast/css-custom-paint/arguments.html: Added.
  • fast/css-custom-paint/image-expected.html: Added.
  • fast/css-custom-paint/image.html: Added.
  • fast/css-custom-paint/resources/test-image.png: Added.
Location:
trunk
Files:
5 added
26 edited
2 copied
9 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238860 r238872  
     12018-12-04  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 Dean Jackson.
     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-12-04  Ryan Haddad  <ryanhaddad@apple.com>
    215
  • trunk/Source/WebCore/CMakeLists.txt

    r238741 r238872  
    594594    css/StyleSheetList.idl
    595595
    596     css/typedom/CSSNumericValue.idl
    597     css/typedom/CSSStyleValue.idl
    598     css/typedom/CSSUnitValue.idl
    599     css/typedom/CSSUnparsedValue.idl
     596    css/typedom/TypedOMCSSImageValue.idl
     597    css/typedom/TypedOMCSSNumericValue.idl
     598    css/typedom/TypedOMCSSStyleValue.idl
     599    css/typedom/TypedOMCSSUnitValue.idl
     600    css/typedom/TypedOMCSSUnparsedValue.idl
    600601    css/typedom/StylePropertyMapReadOnly.idl
    601602
  • trunk/Source/WebCore/ChangeLog

    r238867 r238872  
     12018-12-04  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 Dean Jackson.
     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-12-04  Chris Dumez  <cdumez@apple.com>
    268
  • trunk/Source/WebCore/DerivedSources.make

    r238741 r238872  
    503503    $(WebCore)/css/StyleSheet.idl \
    504504    $(WebCore)/css/StyleSheetList.idl \
    505     $(WebCore)/css/typedom/CSSNumericValue.idl \
    506     $(WebCore)/css/typedom/CSSStyleValue.idl \
    507     $(WebCore)/css/typedom/CSSUnitValue.idl \
    508     $(WebCore)/css/typedom/CSSUnparsedValue.idl \
    509505    $(WebCore)/css/typedom/StylePropertyMapReadOnly.idl \
     506        $(WebCore)/css/typedom/TypedOMCSSImageValue.idl \
     507    $(WebCore)/css/typedom/TypedOMCSSNumericValue.idl \
     508    $(WebCore)/css/typedom/TypedOMCSSStyleValue.idl \
     509    $(WebCore)/css/typedom/TypedOMCSSUnitValue.idl \
     510    $(WebCore)/css/typedom/TypedOMCSSUnparsedValue.idl \
    510511    $(WebCore)/css/WebKitCSSMatrix.idl \
    511512    $(WebCore)/css/WebKitCSSViewportRule.idl \
  • trunk/Source/WebCore/Sources.txt

    r238771 r238872  
    389389bindings/js/JSCSSRuleListCustom.cpp
    390390bindings/js/JSCSSStyleDeclarationCustom.cpp
    391 bindings/js/JSCSSStyleValueCustom.cpp
    392391bindings/js/JSDOMConvertDate.cpp
    393392bindings/js/JSDOMConvertNumbers.cpp
     
    479478bindings/js/JSTrackCustom.cpp
    480479bindings/js/JSTreeWalkerCustom.cpp
     480bindings/js/JSTypedOMCSSStyleValueCustom.cpp
    481481bindings/js/JSVideoTrackCustom.cpp
    482482bindings/js/JSVideoTrackListCustom.cpp
     
    25022502JSCDATASection.cpp
    25032503JSCSSFontFaceRule.cpp
     2504JSTypedOMCSSImageValue.cpp
     2505JSTypedOMCSSNumericValue.cpp
     2506JSTypedOMCSSStyleValue.cpp
     2507JSTypedOMCSSUnitValue.cpp
     2508JSTypedOMCSSUnparsedValue.cpp
    25042509JSCSSImportRule.cpp
    25052510JSCSSKeyframeRule.cpp
     
    25072512JSCSSMediaRule.cpp
    25082513JSCSSNamespaceRule.cpp
    2509 JSCSSNumericValue.cpp
    25102514JSCSSPaintCallback.cpp
    25112515JSCSSPaintSize.cpp
    2512 JSCSSStyleValue.cpp
    2513 JSCSSUnitValue.cpp
    2514 JSCSSUnparsedValue.cpp
    25152516JSPaintWorkletGlobalScope.cpp
    25162517JSWorklet.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r238844 r238872  
    13681368                4B3043CD0AE0373B00A82647 /* Editor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043CB0AE0373B00A82647 /* Editor.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13691369                4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3480920EEF50D400AC1B41 /* ImageSourceCG.h */; };
     1370                4B438650219CD56100F8D3C5 /* TypedOMCSSImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B43864F219CD56100F8D3C5 /* TypedOMCSSImageValue.h */; };
    13701371                4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5BDD9A21658A1500DD4262 /* CSSPaintCallback.h */; };
    13711372                4B6B5CBD21640EFF00603817 /* DOMCSSPaintWorklet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B5CB82163EC0700603817 /* DOMCSSPaintWorklet.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    13781379                4BAFD0CB2190EBD600C0AB64 /* CSSPaintSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CA2190EBD600C0AB64 /* CSSPaintSize.h */; };
    13791380                4BAFD0CF2190F9B500C0AB64 /* StylePropertyMapReadOnly.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */; };
    1380                 4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */; };
    1381                 4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */; };
    1382                 4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */; };
    1383                 4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */; };
     1381                4BAFD0D62192146B00C0AB64 /* TypedOMCSSStyleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D52192146B00C0AB64 /* TypedOMCSSStyleValue.h */; };
     1382                4BAFD0D921921EA000C0AB64 /* TypedOMCSSUnparsedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0D821921EA000C0AB64 /* TypedOMCSSUnparsedValue.h */; };
     1383                4BAFD0E0219220AB00C0AB64 /* TypedOMCSSNumericValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DF219220AB00C0AB64 /* TypedOMCSSNumericValue.h */; };
     1384                4BAFD0E1219242A000C0AB64 /* TypedOMCSSUnitValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAFD0DD2192209200C0AB64 /* TypedOMCSSUnitValue.h */; };
    13841385                4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */; };
    13851386                4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */; };
     
    78847885                4B3480910EEF50D400AC1B41 /* ImageSourceCGMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ImageSourceCGMac.mm; sourceTree = "<group>"; };
    78857886                4B3480920EEF50D400AC1B41 /* ImageSourceCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageSourceCG.h; sourceTree = "<group>"; };
     7887                4B43864D219CD52D00F8D3C5 /* TypedOMCSSImageValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSImageValue.idl; sourceTree = "<group>"; };
     7888                4B43864F219CD56100F8D3C5 /* TypedOMCSSImageValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSImageValue.h; sourceTree = "<group>"; };
    78867889                4B5BDD99216588E500DD4262 /* CSSPaintCallback.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSPaintCallback.idl; sourceTree = "<group>"; };
    78877890                4B5BDD9A21658A1500DD4262 /* CSSPaintCallback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSPaintCallback.h; sourceTree = "<group>"; };
     
    79067909                4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StylePropertyMapReadOnly.h; sourceTree = "<group>"; };
    79077910                4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = StylePropertyMapReadOnly.idl; sourceTree = "<group>"; };
    7908                 4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSStyleValue.idl; sourceTree = "<group>"; };
    7909                 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSStyleValue.h; sourceTree = "<group>"; };
    7910                 4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnparsedValue.idl; sourceTree = "<group>"; };
    7911                 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSUnparsedValue.h; sourceTree = "<group>"; };
    7912                 4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSNumericValue.idl; sourceTree = "<group>"; };
    7913                 4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSUnitValue.idl; sourceTree = "<group>"; };
    7914                 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = CSSUnitValue.h; sourceTree = "<group>"; };
    7915                 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSNumericValue.h; sourceTree = "<group>"; };
    7916                 4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleValueCustom.cpp; sourceTree = "<group>"; };
     7911                4BAFD0D32192145600C0AB64 /* TypedOMCSSStyleValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSStyleValue.idl; sourceTree = "<group>"; };
     7912                4BAFD0D52192146B00C0AB64 /* TypedOMCSSStyleValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSStyleValue.h; sourceTree = "<group>"; };
     7913                4BAFD0D721921E7900C0AB64 /* TypedOMCSSUnparsedValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSUnparsedValue.idl; sourceTree = "<group>"; };
     7914                4BAFD0D821921EA000C0AB64 /* TypedOMCSSUnparsedValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSUnparsedValue.h; sourceTree = "<group>"; };
     7915                4BAFD0DB2192202200C0AB64 /* TypedOMCSSNumericValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSNumericValue.idl; sourceTree = "<group>"; };
     7916                4BAFD0DC2192204A00C0AB64 /* TypedOMCSSUnitValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypedOMCSSUnitValue.idl; sourceTree = "<group>"; };
     7917                4BAFD0DD2192209200C0AB64 /* TypedOMCSSUnitValue.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = TypedOMCSSUnitValue.h; sourceTree = "<group>"; };
     7918                4BAFD0DF219220AB00C0AB64 /* TypedOMCSSNumericValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypedOMCSSNumericValue.h; sourceTree = "<group>"; };
     7919                4BAFD0E22192604D00C0AB64 /* JSTypedOMCSSStyleValueCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSTypedOMCSSStyleValueCustom.cpp; sourceTree = "<group>"; };
    79177920                4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSRegisterCustomProperty.idl; sourceTree = "<group>"; };
    79187921                4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCSSRegisterCustomProperty.cpp; sourceTree = "<group>"; };
     
    1810818111                        isa = PBXGroup;
    1810918112                        children = (
    18110                                 4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */,
    18111                                 4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */,
    18112                                 4BAFD0D52192146B00C0AB64 /* CSSStyleValue.h */,
    18113                                 4BAFD0D32192145600C0AB64 /* CSSStyleValue.idl */,
    18114                                 4BAFD0DD2192209200C0AB64 /* CSSUnitValue.h */,
    18115                                 4BAFD0DC2192204A00C0AB64 /* CSSUnitValue.idl */,
    18116                                 4BAFD0D821921EA000C0AB64 /* CSSUnparsedValue.h */,
    18117                                 4BAFD0D721921E7900C0AB64 /* CSSUnparsedValue.idl */,
    1811818113                                4BAFD0CE2190F9B400C0AB64 /* StylePropertyMapReadOnly.h */,
    1811918114                                4BAFD0D02190F9C200C0AB64 /* StylePropertyMapReadOnly.idl */,
     18115                                4B43864F219CD56100F8D3C5 /* TypedOMCSSImageValue.h */,
     18116                                4B43864D219CD52D00F8D3C5 /* TypedOMCSSImageValue.idl */,
     18117                                4BAFD0DF219220AB00C0AB64 /* TypedOMCSSNumericValue.h */,
     18118                                4BAFD0DB2192202200C0AB64 /* TypedOMCSSNumericValue.idl */,
     18119                                4BAFD0D52192146B00C0AB64 /* TypedOMCSSStyleValue.h */,
     18120                                4BAFD0D32192145600C0AB64 /* TypedOMCSSStyleValue.idl */,
     18121                                4BAFD0DD2192209200C0AB64 /* TypedOMCSSUnitValue.h */,
     18122                                4BAFD0DC2192204A00C0AB64 /* TypedOMCSSUnitValue.idl */,
     18123                                4BAFD0D821921EA000C0AB64 /* TypedOMCSSUnparsedValue.h */,
     18124                                4BAFD0D721921E7900C0AB64 /* TypedOMCSSUnparsedValue.idl */,
    1812018125                        );
    1812118126                        path = typedom;
     
    2032420329                                BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
    2032520330                                AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */,
    20326                                 4BAFD0E22192604D00C0AB64 /* JSCSSStyleValueCustom.cpp */,
    2032720331                                BC20FB7E0C0E8E6C00D1447F /* JSDeprecatedCSSOMValueCustom.cpp */,
    2032820332                                49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
     
    2037720381                                07846384145B1B8E00A58DF1 /* JSTrackCustom.h */,
    2037820382                                516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
     20383                                4BAFD0E22192604D00C0AB64 /* JSTypedOMCSSStyleValueCustom.cpp */,
    2037920384                                BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */,
    2038020385                                BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */,
     
    2823728242                                314BE3A11B30F6B700141982 /* CSSNamedImageValue.h in Headers */,
    2823828243                                94E839511DFB2A0E007BC6A7 /* CSSNamespaceRule.h in Headers */,
    28239                                 4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */,
    2824028244                                A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
    2824128245                                4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */,
     
    2827928283                                A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */,
    2828028284                                A8EA80070A19516E00A8EF5F /* CSSStyleSheet.h in Headers */,
    28281                                 4BAFD0D62192146B00C0AB64 /* CSSStyleValue.h in Headers */,
    2828228285                                94DE5C921D83011D00164F2A /* CSSSupportsParser.h in Headers */,
    2828328286                                FC54D05716A7673100575E4D /* CSSSupportsRule.h in Headers */,
     
    2828928292                                715AD7212050513F00D592DC /* CSSTransition.h in Headers */,
    2829028293                                371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */,
    28291                                 4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */,
    2829228294                                DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */,
    28293                                 4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */,
    2829428295                                BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */,
    2829528296                                A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */,
     
    3149431495                                C375D7FE16639519006184AB /* TypeAhead.h in Headers */,
    3149531496                                E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */,
     31497                                4B438650219CD56100F8D3C5 /* TypedOMCSSImageValue.h in Headers */,
     31498                                4BAFD0E0219220AB00C0AB64 /* TypedOMCSSNumericValue.h in Headers */,
     31499                                4BAFD0D62192146B00C0AB64 /* TypedOMCSSStyleValue.h in Headers */,
     31500                                4BAFD0E1219242A000C0AB64 /* TypedOMCSSUnitValue.h in Headers */,
     31501                                4BAFD0D921921EA000C0AB64 /* TypedOMCSSUnparsedValue.h in Headers */,
    3149631502                                93309E1A099E64920056E581 /* TypingCommand.h in Headers */,
    3149731503                                85031B4E0A44EFC700F992E0 /* UIEvent.h in Headers */,
  • trunk/Source/WebCore/bindings/js/CallTracerTypes.h

    r228218 r238872  
    3737#include "ImageData.h"
    3838#include "Path2D.h"
     39#include "TypedOMCSSImageValue.h"
    3940#include <JavaScriptCore/ArrayBuffer.h>
    4041#include <JavaScriptCore/ArrayBufferView.h>
     
    9293#endif
    9394    RefPtr<ImageBitmap>,
     95#if ENABLE(CSS_PAINTING_API)
     96    RefPtr<TypedOMCSSImageValue>,
     97#endif
    9498    RefPtr<ImageData>,
    9599    RefPtr<Int32Array>,
  • trunk/Source/WebCore/bindings/js/JSTypedOMCSSStyleValueCustom.cpp

    r238871 r238872  
    2525
    2626#include "config.h"
    27 #include "JSCSSStyleValue.h"
     27#include "JSTypedOMCSSStyleValue.h"
    2828
    2929#if ENABLE(CSS_PAINTING_API)
    3030
    31 #include "JSCSSUnitValue.h"
    32 #include "JSCSSUnparsedValue.h"
     31#include "JSTypedOMCSSImageValue.h"
     32#include "JSTypedOMCSSUnitValue.h"
     33#include "JSTypedOMCSSUnparsedValue.h"
    3334
    3435namespace WebCore {
    3536using namespace JSC;
    3637
    37 JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<CSSStyleValue>&& value)
     38JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<TypedOMCSSStyleValue>&& value)
    3839{
    3940    if (value->isUnitValue())
    40         return createWrapper<CSSUnitValue>(globalObject, WTFMove(value));
     41        return createWrapper<TypedOMCSSUnitValue>(globalObject, WTFMove(value));
    4142    if (value->isUnparsedValue())
    42         return createWrapper<CSSUnparsedValue>(globalObject, WTFMove(value));
     43        return createWrapper<TypedOMCSSUnparsedValue>(globalObject, WTFMove(value));
     44    if (value->isImageValue())
     45        return createWrapper<TypedOMCSSImageValue>(globalObject, WTFMove(value));
    4346
    4447    ASSERT_NOT_REACHED();
    45     return createWrapper<CSSStyleValue>(globalObject, WTFMove(value));
     48    return createWrapper<TypedOMCSSStyleValue>(globalObject, WTFMove(value));
    4649}
    4750
    48 JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, CSSStyleValue& object)
     51JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, TypedOMCSSStyleValue& object)
    4952{
    5053    return wrap(state, globalObject, object);
  • trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h

    r238739 r238872  
    5959    macro(CredentialsContainer) \
    6060    macro(CSSAnimation) \
     61    macro(CSSImageValue) \
    6162    macro(CSSNumericValue) \
    6263    macro(CSSPaintSize) \
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r238262 r238872  
    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>();
     
    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
  • trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp

    r237697 r238872  
    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) {
     
    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
     
    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) {
     
    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;
     
    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&) {
     
    8183        while (!tokenizerRange.atEnd())
    8284            result.append(tokenizerRange.consume());
     85    }, [&](const Ref<StyleImage>&) {
     86        CSSTokenizer tokenizer(cssText());
     87
     88        auto tokenizerRange = tokenizer.tokenRange();
     89        while (!tokenizerRange.atEnd())
     90            result.append(tokenizerRange.consume());
    8391    });
    84     WTF::visit(visitor, m_value);
    8592
    8693    return result;
  • trunk/Source/WebCore/css/CSSCustomPropertyValue.h

    r237697 r238872  
    3030#include "CSSVariableReferenceValue.h"
    3131#include "Length.h"
     32#include "StyleImage.h"
    3233#include <wtf/RefPtr.h>
    3334#include <wtf/Variant.h>
     
    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)
     
    6667   
    6768    static Ref<CSSCustomPropertyValue> createSyntaxLength(const AtomicString& name, Length value)
     69    {
     70        return adoptRef(*new CSSCustomPropertyValue(name, { WTFMove(value) }));
     71    }
     72
     73    static Ref<CSSCustomPropertyValue> createSyntaxImage(const AtomicString& name, Ref<StyleImage>&& value)
    6874    {
    6975        return adoptRef(*new CSSCustomPropertyValue(name, { WTFMove(value) }));
     
    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);
  • trunk/Source/WebCore/css/CSSPaintImageValue.cpp

    r237981 r238872  
    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        }
  • trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h

    r237981 r238872  
    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>
     
    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
  • trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl

    r237981 r238872  
    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};
  • trunk/Source/WebCore/css/typedom/TypedOMCSSImageValue.h

    r238871 r238872  
    2828#if ENABLE(CSS_PAINTING_API)
    2929
    30 #include "CSSNumericValue.h"
     30#include "CSSImageValue.h"
     31#include "ImageBitmap.h"
     32#include "RenderElement.h"
     33#include "TypedOMCSSStyleValue.h"
    3134#include <wtf/RefCounted.h>
    3235#include <wtf/text/StringConcatenateNumbers.h>
     
    3538namespace WebCore {
    3639
    37 class CSSUnitValue final : public CSSNumericValue {
     40class TypedOMCSSImageValue final : public TypedOMCSSStyleValue {
    3841public:
    39     static Ref<CSSUnitValue> create(double value, const String& unit)
     42    static Ref<TypedOMCSSImageValue> create(CSSImageValue& cssValue, RenderElement& renderer)
    4043    {
    41         return adoptRef(*new CSSUnitValue(value, unit));
     44        return adoptRef(*new TypedOMCSSImageValue(cssValue, renderer));
    4245    }
    4346
    44     // FIXME: not correct.
    45     String toString() final { return makeString((int) m_value, m_unit); }
     47    String toString() final { return m_cssValue->cssText(); }
    4648
    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; }
     49    CachedImage* image() { return m_cssValue->cachedImage(); }
     50    const RenderElement* renderer() const { return m_renderer.get(); }
    5151
    5252private:
    53     CSSUnitValue(double value, const String& unit)
    54         : m_value(value)
    55         , m_unit(unit)
     53    TypedOMCSSImageValue(CSSImageValue& cssValue, RenderElement& renderer)
     54        : m_cssValue(makeRef(cssValue))
     55        , m_renderer(makeWeakPtr(renderer))
    5656    {
    5757    }
    5858
    59     bool isUnitValue() final { return true; }
     59    bool isImageValue() final { return true; }
    6060
    61     double m_value;
    62     String m_unit;
     61    Ref<CSSImageValue> m_cssValue;
     62    WeakPtr<RenderElement> m_renderer;
    6363};
    6464
  • trunk/Source/WebCore/css/typedom/TypedOMCSSImageValue.idl

    r238871 r238872  
    2828// is going to be implemented, please change the runtime flag.
    2929[
    30     CustomToJSObject,
     30    InterfaceName=CSSImageValue,
    3131    EnabledAtRuntime=CSSPaintingAPI,
    3232    Conditional=CSS_PAINTING_API,
    3333    Exposed=(Window,Worker,PaintWorklet),
    34     SkipVTableValidation,
    35 ] interface CSSStyleValue {
    36     stringifier;
     34    JSGenerateToNativeObject,
     35] interface TypedOMCSSImageValue : TypedOMCSSStyleValue {
    3736};
  • trunk/Source/WebCore/css/typedom/TypedOMCSSNumericValue.h

    r238871 r238872  
    2828#if ENABLE(CSS_PAINTING_API)
    2929
    30 #include "CSSStyleValue.h"
     30#include "TypedOMCSSStyleValue.h"
    3131
    3232namespace WebCore {
    3333
    34 class CSSNumericValue : public CSSStyleValue {
     34class TypedOMCSSNumericValue : public TypedOMCSSStyleValue {
    3535protected:
    36     CSSNumericValue() = default;
     36    TypedOMCSSNumericValue() = default;
    3737};
    3838} // namespace WebCore
  • trunk/Source/WebCore/css/typedom/TypedOMCSSNumericValue.idl

    r238871 r238872  
    2828// is going to be implemented, please change the runtime flag.
    2929[
     30    InterfaceName=CSSNumericValue,
    3031    EnabledAtRuntime=CSSPaintingAPI,
    3132    Conditional=CSS_PAINTING_API,
    3233    Exposed=(Window,Worker,PaintWorklet),
    33 ] interface CSSNumericValue : CSSStyleValue {
     34] interface TypedOMCSSNumericValue : TypedOMCSSStyleValue {
    3435};
  • trunk/Source/WebCore/css/typedom/TypedOMCSSStyleValue.h

    r238871 r238872  
    2828#if ENABLE(CSS_PAINTING_API)
    2929
     30#include "ScriptWrappable.h"
    3031#include <wtf/RefCounted.h>
    3132#include <wtf/text/WTFString.h>
     
    3334namespace WebCore {
    3435
    35 class CSSStyleValue : public RefCounted<CSSStyleValue> {
     36class TypedOMCSSStyleValue : public RefCounted<TypedOMCSSStyleValue>, public ScriptWrappable {
    3637public:
    37     virtual ~CSSStyleValue() = default;
     38    virtual ~TypedOMCSSStyleValue() = default;
    3839    virtual String toString() = 0;
    3940
    4041    virtual bool isUnitValue() { return false; }
    4142    virtual bool isUnparsedValue() { return false; }
     43    virtual bool isImageValue() { return false; }
    4244
    4345protected:
    44     CSSStyleValue() = default;
     46    TypedOMCSSStyleValue() = default;
    4547};
    4648
  • trunk/Source/WebCore/css/typedom/TypedOMCSSStyleValue.idl

    r238871 r238872  
    2828// is going to be implemented, please change the runtime flag.
    2929[
     30    InterfaceName=CSSStyleValue,
    3031    CustomToJSObject,
    3132    EnabledAtRuntime=CSSPaintingAPI,
     
    3334    Exposed=(Window,Worker,PaintWorklet),
    3435    SkipVTableValidation,
    35 ] interface CSSStyleValue {
     36] interface TypedOMCSSStyleValue {
    3637    stringifier;
    3738};
  • trunk/Source/WebCore/css/typedom/TypedOMCSSUnitValue.h

    r238871 r238872  
    2828#if ENABLE(CSS_PAINTING_API)
    2929
    30 #include "CSSNumericValue.h"
     30#include "TypedOMCSSNumericValue.h"
    3131#include <wtf/RefCounted.h>
    3232#include <wtf/text/StringConcatenateNumbers.h>
     
    3535namespace WebCore {
    3636
    37 class CSSUnitValue final : public CSSNumericValue {
     37class TypedOMCSSUnitValue final : public TypedOMCSSNumericValue {
    3838public:
    39     static Ref<CSSUnitValue> create(double value, const String& unit)
     39    static Ref<TypedOMCSSUnitValue> create(double value, const String& unit)
    4040    {
    41         return adoptRef(*new CSSUnitValue(value, unit));
     41        return adoptRef(*new TypedOMCSSUnitValue(value, unit));
    4242    }
    4343
     
    5151
    5252private:
    53     CSSUnitValue(double value, const String& unit)
     53    TypedOMCSSUnitValue(double value, const String& unit)
    5454        : m_value(value)
    5555        , m_unit(unit)
  • trunk/Source/WebCore/css/typedom/TypedOMCSSUnitValue.idl

    r238871 r238872  
    2828// is going to be implemented, please change the runtime flag.
    2929[
     30    InterfaceName=CSSUnitValue,
    3031    EnabledAtRuntime=CSSPaintingAPI,
    3132    Conditional=CSS_PAINTING_API,
    3233    Exposed=(Window,Worker,PaintWorklet),
    3334    Constructor(double value, USVString unit),
    34 ] interface CSSUnitValue : CSSNumericValue {
     35] interface TypedOMCSSUnitValue : TypedOMCSSNumericValue {
    3536    attribute double value;
    3637    readonly attribute USVString unit;
  • trunk/Source/WebCore/css/typedom/TypedOMCSSUnparsedValue.h

    r238871 r238872  
    2828#if ENABLE(CSS_PAINTING_API)
    2929
    30 #include "CSSStyleValue.h"
     30#include "TypedOMCSSStyleValue.h"
    3131#include <wtf/RefCounted.h>
    3232#include <wtf/text/WTFString.h>
     
    3434namespace WebCore {
    3535
    36 class CSSUnparsedValue final : public CSSStyleValue {
     36class TypedOMCSSUnparsedValue final : public TypedOMCSSStyleValue {
    3737public:
    38     static Ref<CSSUnparsedValue> create(const String& serializedValue)
     38    static Ref<TypedOMCSSUnparsedValue> create(const String& serializedValue)
    3939    {
    40         return adoptRef(*new CSSUnparsedValue(serializedValue));
     40        return adoptRef(*new TypedOMCSSUnparsedValue(serializedValue));
    4141    }
    4242
     
    4444
    4545private:
    46     explicit CSSUnparsedValue(const String& serializedValue)
     46    explicit TypedOMCSSUnparsedValue(const String& serializedValue)
    4747        : m_serializedValue(serializedValue)
    4848    {
  • trunk/Source/WebCore/css/typedom/TypedOMCSSUnparsedValue.idl

    r238871 r238872  
    2929// FIXME: wrong constructor.
    3030[
     31    InterfaceName=CSSUnparsedValue,
    3132    EnabledAtRuntime=CSSPaintingAPI,
    3233    Conditional=CSS_PAINTING_API,
    3334    Exposed=(Window,Worker,PaintWorklet),
    3435    Constructor(USVString serializedValue),
    35 ] interface CSSUnparsedValue : CSSStyleValue {
     36] interface TypedOMCSSUnparsedValue : TypedOMCSSStyleValue {
    3637};
  • trunk/Source/WebCore/html/ImageBitmap.cpp

    r231440 r238872  
    4545#include "RenderElement.h"
    4646#include "SharedBuffer.h"
     47#include "TypedOMCSSImageValue.h"
    4748#include <wtf/StdLibExtras.h>
    4849
     
    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{
  • trunk/Source/WebCore/html/ImageBitmap.h

    r238771 r238872  
    4545class PendingImageBitmap;
    4646class ScriptExecutionContext;
     47class TypedOMCSSImageValue;
    4748struct ImageBitmapOptions;
    4849
     
    5657        RefPtr<HTMLCanvasElement>,
    5758        RefPtr<ImageBitmap>,
     59#if ENABLE(CSS_PAINTING_API)
     60        RefPtr<TypedOMCSSImageValue>,
     61#endif
    5862        RefPtr<Blob>,
    5963        RefPtr<ImageData>
     
    99103    static void createPromise(ScriptExecutionContext&, RefPtr<Blob>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
    100104    static void createPromise(ScriptExecutionContext&, RefPtr<ImageData>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
     105    static void createPromise(ScriptExecutionContext&, RefPtr<TypedOMCSSImageValue>&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
    101106    static void createFromBuffer(Ref<ArrayBuffer>&&, String mimeType, long long expectedContentLength, const URL&, ImageBitmapOptions&&, std::optional<IntRect>, Promise&&);
    102107
  • trunk/Source/WebCore/html/canvas/CanvasDrawImage.idl

    r222986 r238872  
    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
  • trunk/Source/WebCore/html/canvas/CanvasFillStrokeStyles.idl

    r222986 r238872  
    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
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext.cpp

    r238771 r238872  
    145145}
    146146
     147void CanvasRenderingContext::checkOrigin(const TypedOMCSSImageValue&)
     148{
     149    m_canvas.setOriginTainted();
     150}
     151
    147152} // namespace WebCore
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h

    r238771 r238872  
    3939class HTMLVideoElement;
    4040class ImageBitmap;
     41class TypedOMCSSImageValue;
    4142class WebGLObject;
    4243
     
    8990    }
    9091    void checkOrigin(const URL&);
     92    void checkOrigin(const TypedOMCSSImageValue&);
    9193
    9294    bool m_callTracingActive { false };
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp

    r237344 r238872  
    6262#include "TextMetrics.h"
    6363#include "TextRun.h"
     64#include "TypedOMCSSImageValue.h"
    6465#include <wtf/CheckedArithmetic.h>
    6566#include <wtf/MathExtras.h>
     
    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{
     
    14881499ExceptionOr<void> CanvasRenderingContext2DBase::drawImage(HTMLImageElement& imageElement, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMode& blendMode)
    14891500{
     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)
     1530{
    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()))
     
    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 };
     
    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 { };
     
    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)) {
     
    15611597        image->setImageObserver(observer);
    15621598
    1563     checkOrigin(&imageElement);
    1564 
    15651599    return { };
    15661600}
     
    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{
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h

    r237344 r238872  
    5151namespace WebCore {
    5252
     53class TypedOMCSSImageValue;
     54class CachedImage;
    5355class CanvasBase;
    5456class CanvasGradient;
     
    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
     
    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);
  • trunk/Source/WebCore/inspector/InspectorCanvas.cpp

    r238199 r238872  
    621621            [&] (const RefPtr<HTMLVideoElement>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::Image); },
    622622#endif
     623#if ENABLE(CSS_PAINTING_API)
     624            [&] (const RefPtr<TypedOMCSSImageValue>&) { /* FIXME implement. */ },
     625#endif
    623626            [&] (const RefPtr<ImageBitmap>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::ImageBitmap); },
    624627            [&] (const RefPtr<ImageData>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::ImageData); },
  • trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl

    r237717 r238872  
    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
  • trunk/Source/WebCore/platform/graphics/CustomPaintImage.cpp

    r238839 r238872  
    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"
     
    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
     
    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
     
    98100
    99101        if (!value) {
    100             propertyValues.add(name, CSSUnparsedValue::create(emptyString()));
     102            propertyValues.add(name, TypedOMCSSUnparsedValue::create(emptyString()));
    101103            continue;
    102104        }
     
    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
  • trunk/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h

    r238760 r238872  
    2828#if ENABLE(WEBGPU)
    2929
     30#include "GPUTexture.h"
    3031#include <wtf/RefPtr.h>
    3132#include <wtf/RetainPtr.h>
     
    3839
    3940class GPUDevice;
    40 class GPUTexture;
    4141
    4242enum class GPUTextureFormatEnum;
Note: See TracChangeset for help on using the changeset viewer.