Title: [237243] trunk
Revision
237243
Author
commit-qu...@webkit.org
Date
2018-10-17 19:47:00 -0700 (Wed, 17 Oct 2018)

Log Message

Parse paint() and store paint callbacks for CSS Painting API
https://bugs.webkit.org/show_bug.cgi?id=190657

Patch by Justin Michaud <justin_mich...@apple.com> on 2018-10-17
Reviewed by Dean Jackson.

Source/WebCore:

Implement support for parsing paint() images in css, and store CSS paint callback objects in the paint definition map.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCSSPaintWorkletGlobalScopeCustom.cpp:
(WebCore::JSCSSPaintWorkletGlobalScope::visitAdditionalChildren):
(WebCore::JSCSSPaintWorkletGlobalScope::registerPaint):
* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::image):
(WebCore::CSSImageGeneratorValue::isFixedSize const):
(WebCore::CSSImageGeneratorValue::fixedSize):
(WebCore::CSSImageGeneratorValue::isPending const):
(WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
(WebCore::CSSImageGeneratorValue::loadSubimages):
* css/CSSPaintImageValue.cpp: Added.
(WebCore::CSSPaintImageValue::customCSSText const):
* css/CSSPaintImageValue.h: Added.
* css/CSSPaintWorkletGlobalScope.h:
* css/CSSPaintWorkletGlobalScope.idl:
* css/CSSValue.cpp:
(WebCore::CSSValue::equals const):
(WebCore::CSSValue::cssText const):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isPaintImageValue const):
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomPaint):
(WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
(WebCore::CSSPropertyParserHelpers::isGeneratedImage):
* platform/mediastream/mac/RealtimeVideoUtilities.h:

LayoutTests:

* fast/css-custom-paint/basic-expected.txt:
* fast/css-custom-paint/basic.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237242 => 237243)


--- trunk/LayoutTests/ChangeLog	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/LayoutTests/ChangeLog	2018-10-18 02:47:00 UTC (rev 237243)
@@ -1,3 +1,13 @@
+2018-10-17  Justin Michaud  <justin_mich...@apple.com>
+
+        Parse paint() and store paint callbacks for CSS Painting API
+        https://bugs.webkit.org/show_bug.cgi?id=190657
+
+        Reviewed by Dean Jackson.
+
+        * fast/css-custom-paint/basic-expected.txt:
+        * fast/css-custom-paint/basic.html:
+
 2018-10-17  Justin Fan  <justin_...@apple.com>
 
         [WebGPU] Implement WebGPU bindings up through WebGPUDevice creation

Modified: trunk/LayoutTests/fast/css-custom-paint/basic-expected.txt (237242 => 237243)


--- trunk/LayoutTests/fast/css-custom-paint/basic-expected.txt	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/LayoutTests/fast/css-custom-paint/basic-expected.txt	2018-10-18 02:47:00 UTC (rev 237243)
@@ -5,4 +5,5 @@
 PASS test that registerPaint runs with contextOptions 
 PASS test that registerPaint runs with predefined class 
 PASS test that registerPaint accepts only a string and a class constructor 
+PASS test that test div has paint() value 
 

Modified: trunk/LayoutTests/fast/css-custom-paint/basic.html (237242 => 237243)


--- trunk/LayoutTests/fast/css-custom-paint/basic.html	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/LayoutTests/fast/css-custom-paint/basic.html	2018-10-18 02:47:00 UTC (rev 237243)
@@ -4,6 +4,17 @@
 <link rel="help" content="https://drafts.css-houdini.org/css-paint-api-1/">
 <script src=""
 <script src=""
+
+<style>
+  #paint {
+    background-image: paint(my-paint);
+    width: 50px;
+    height: 50px;
+  }
+</style>
+
+<div id="paint"></div>
+
 <script>
 test(function() {
   CSS.paintWorkletGlobalScope.registerPaint('test1', class {
@@ -51,4 +62,8 @@
   assert_throws(new TypeError(), () => CSS.paintWorkletGlobalScope.registerPaint('', 5));
 }, 'test that registerPaint accepts only a string and a class constructor');
 
+test(function() {
+  assert_equals(getComputedStyle(paint).getPropertyValue("background-image"), "paint(my-paint)");
+}, 'test that test div has paint() value');
+
 </script>

Modified: trunk/Source/WebCore/ChangeLog (237242 => 237243)


--- trunk/Source/WebCore/ChangeLog	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/ChangeLog	2018-10-18 02:47:00 UTC (rev 237243)
@@ -1,3 +1,42 @@
+2018-10-17  Justin Michaud  <justin_mich...@apple.com>
+
+        Parse paint() and store paint callbacks for CSS Painting API
+        https://bugs.webkit.org/show_bug.cgi?id=190657
+
+        Reviewed by Dean Jackson.
+
+        Implement support for parsing paint() images in css, and store CSS paint callback objects in the paint definition map.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSCSSPaintWorkletGlobalScopeCustom.cpp:
+        (WebCore::JSCSSPaintWorkletGlobalScope::visitAdditionalChildren):
+        (WebCore::JSCSSPaintWorkletGlobalScope::registerPaint):
+        * css/CSSImageGeneratorValue.cpp:
+        (WebCore::CSSImageGeneratorValue::image):
+        (WebCore::CSSImageGeneratorValue::isFixedSize const):
+        (WebCore::CSSImageGeneratorValue::fixedSize):
+        (WebCore::CSSImageGeneratorValue::isPending const):
+        (WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
+        (WebCore::CSSImageGeneratorValue::loadSubimages):
+        * css/CSSPaintImageValue.cpp: Added.
+        (WebCore::CSSPaintImageValue::customCSSText const):
+        * css/CSSPaintImageValue.h: Added.
+        * css/CSSPaintWorkletGlobalScope.h:
+        * css/CSSPaintWorkletGlobalScope.idl:
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::equals const):
+        (WebCore::CSSValue::cssText const):
+        (WebCore::CSSValue::destroy):
+        * css/CSSValue.h:
+        (WebCore::CSSValue::isPaintImageValue const):
+        * css/CSSValueKeywords.in:
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::consumeCustomPaint):
+        (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
+        (WebCore::CSSPropertyParserHelpers::isGeneratedImage):
+        * platform/mediastream/mac/RealtimeVideoUtilities.h:
+
 2018-10-17  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream] Consolidate all image conversion and resizing into one class

Modified: trunk/Source/WebCore/Sources.txt (237242 => 237243)


--- trunk/Source/WebCore/Sources.txt	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/Sources.txt	2018-10-18 02:47:00 UTC (rev 237243)
@@ -609,6 +609,7 @@
 css/CSSNamedImageValue.cpp
 css/CSSNamespaceRule.cpp
 css/CSSPageRule.cpp
+css/CSSPaintImageValue.cpp
 css/CSSPaintWorkletGlobalScope.cpp
 css/CSSPendingSubstitutionValue.cpp
 css/CSSPrimitiveValue.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237242 => 237243)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-18 02:47:00 UTC (rev 237243)
@@ -1350,6 +1350,7 @@
 		4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5BDD9A21658A1500DD4262 /* CSSPaintCallback.h */; };
 		4B6B5CBD21640EFF00603817 /* DOMCSSPaintWorklet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B5CB82163EC0700603817 /* DOMCSSPaintWorklet.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4B6B5CC02164386400603817 /* CSSPaintWorkletGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B5CBF2164386400603817 /* CSSPaintWorkletGlobalScope.h */; };
+		4B6E87692176D69200420E5E /* CSSPaintImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6E87682176D69200420E5E /* CSSPaintImageValue.h */; };
 		4B6FA6F40C39E48C00087011 /* SmartReplace.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6FA6F20C39E48C00087011 /* SmartReplace.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4BAE95B10B2FA9CE00AED8A0 /* EditorDeleteAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */; };
@@ -7888,6 +7889,8 @@
 		4B6B5CBF2164386400603817 /* CSSPaintWorkletGlobalScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSPaintWorkletGlobalScope.h; sourceTree = "<group>"; };
 		4B6B5CC1216439CF00603817 /* CSSPaintWorkletGlobalScope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPaintWorkletGlobalScope.cpp; sourceTree = "<group>"; };
 		4B6B5CC321643A8E00603817 /* CSSPaintWorkletGlobalScope.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSPaintWorkletGlobalScope.idl; sourceTree = "<group>"; };
+		4B6E87682176D69200420E5E /* CSSPaintImageValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSPaintImageValue.h; sourceTree = "<group>"; };
+		4B6E876B2176D8A100420E5E /* CSSPaintImageValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPaintImageValue.cpp; sourceTree = "<group>"; };
 		4B6FA6F20C39E48C00087011 /* SmartReplace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmartReplace.h; sourceTree = "<group>"; };
 		4B6FA6F60C39E4A100087011 /* SmartReplaceCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmartReplaceCF.cpp; sourceTree = "<group>"; };
 		4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorDeleteAction.h; sourceTree = "<group>"; };
@@ -25990,6 +25993,8 @@
 				85C56CA60AA89D5F00D95755 /* CSSPageRule.idl */,
 				4B5BDD9A21658A1500DD4262 /* CSSPaintCallback.h */,
 				4B5BDD99216588E500DD4262 /* CSSPaintCallback.idl */,
+				4B6E876B2176D8A100420E5E /* CSSPaintImageValue.cpp */,
+				4B6E87682176D69200420E5E /* CSSPaintImageValue.h */,
 				4B6B5CC1216439CF00603817 /* CSSPaintWorkletGlobalScope.cpp */,
 				4B6B5CBF2164386400603817 /* CSSPaintWorkletGlobalScope.h */,
 				4B6B5CC321643A8E00603817 /* CSSPaintWorkletGlobalScope.idl */,
@@ -27992,6 +27997,7 @@
 				94E839511DFB2A0E007BC6A7 /* CSSNamespaceRule.h in Headers */,
 				A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
 				4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */,
+				4B6E87692176D69200420E5E /* CSSPaintImageValue.h in Headers */,
 				4B6B5CC02164386400603817 /* CSSPaintWorkletGlobalScope.h in Headers */,
 				946D372E1D6CB2940077084F /* CSSParser.h in Headers */,
 				E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSCSSPaintWorkletGlobalScopeCustom.cpp (237242 => 237243)


--- trunk/Source/WebCore/bindings/js/JSCSSPaintWorkletGlobalScopeCustom.cpp	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/bindings/js/JSCSSPaintWorkletGlobalScopeCustom.cpp	2018-10-18 02:47:00 UTC (rev 237243)
@@ -44,6 +44,12 @@
     return jsUndefined();
 }
 
+void JSCSSPaintWorkletGlobalScope::visitAdditionalChildren(JSC::SlotVisitor& visitor)
+{
+    for (auto& registered : wrapped().paintDefinitionMap().values())
+        registered->paintCallback->visitJSFunction(visitor);
+}
+
 // https://drafts.css-houdini.org/css-paint-api/#registering-custom-paint
 JSValue JSCSSPaintWorkletGlobalScope::registerPaint(ExecState& state)
 {
@@ -115,18 +121,11 @@
     RefPtr<JSCSSPaintCallback> paint = convert<IDLCallbackFunction<JSCSSPaintCallback>>(state, paintValue, *globalObject());
     RETURN_IF_EXCEPTION(scope, JSValue());
 
-    auto paintDefinition = std::unique_ptr<PaintDefinition>(new PaintDefinition { name });
+    auto paintDefinition = std::unique_ptr<PaintDefinition>(new PaintDefinition { name, paint.releaseNonNull(), inputProperties, inputArguments });
     paintDefinitionMap.add(name, WTFMove(paintDefinition));
 
     // FIXME: construct documentDefinition (step 22).
 
-    // FIXME: This is for testing only.
-    paint->handleEvent();
-    RETURN_IF_EXCEPTION(scope, JSValue());
-
-    UNUSED_PARAM(inputProperties);
-    UNUSED_PARAM(inputArguments);
-
     return jsUndefined();
 }
 

Modified: trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp (237242 => 237243)


--- trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp	2018-10-18 02:47:00 UTC (rev 237243)
@@ -150,6 +150,10 @@
         return downcast<CSSRadialGradientValue>(*this).image(renderer, size);
     case ConicGradientClass:
         return downcast<CSSConicGradientValue>(*this).image(renderer, size);
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        return nullptr;
+#endif
     default:
         ASSERT_NOT_REACHED();
     }
@@ -173,6 +177,10 @@
         return downcast<CSSRadialGradientValue>(*this).isFixedSize();
     case ConicGradientClass:
         return downcast<CSSConicGradientValue>(*this).isFixedSize();
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        return false;
+#endif
     default:
         ASSERT_NOT_REACHED();
     }
@@ -194,6 +202,10 @@
         return downcast<CSSRadialGradientValue>(*this).fixedSize(renderer);
     case ConicGradientClass:
         return downcast<CSSConicGradientValue>(*this).fixedSize(renderer);
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        return FloatSize();
+#endif
     default:
         ASSERT_NOT_REACHED();
     }
@@ -217,6 +229,10 @@
         return downcast<CSSRadialGradientValue>(*this).isPending();
     case ConicGradientClass:
         return downcast<CSSConicGradientValue>(*this).isPending();
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        return false;
+#endif
     default:
         ASSERT_NOT_REACHED();
     }
@@ -240,6 +256,10 @@
         return downcast<CSSRadialGradientValue>(*this).knownToBeOpaque(renderer);
     case ConicGradientClass:
         return downcast<CSSConicGradientValue>(*this).knownToBeOpaque(renderer);
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        return false;
+#endif
     default:
         ASSERT_NOT_REACHED();
     }
@@ -267,6 +287,10 @@
     case ConicGradientClass:
         downcast<CSSConicGradientValue>(*this).loadSubimages(cachedResourceLoader, options);
         break;
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        break;
+#endif
     default:
         ASSERT_NOT_REACHED();
     }

Added: trunk/Source/WebCore/css/CSSPaintImageValue.cpp (0 => 237243)


--- trunk/Source/WebCore/css/CSSPaintImageValue.cpp	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSPaintImageValue.cpp	2018-10-18 02:47:00 UTC (rev 237243)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSPaintImageValue.h"
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+String CSSPaintImageValue::customCSSText() const
+{
+    StringBuilder result;
+    result.appendLiteral("paint(");
+    result.append(m_name);
+    // FIXME: print args.
+    result.append(')');
+    return result.toString();
+}
+
+} // namespace WebCore
+
+#endif

Added: trunk/Source/WebCore/css/CSSPaintImageValue.h (0 => 237243)


--- trunk/Source/WebCore/css/CSSPaintImageValue.h	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSPaintImageValue.h	2018-10-18 02:47:00 UTC (rev 237243)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(CSS_PAINTING_API)
+
+#include "CSSImageGeneratorValue.h"
+
+namespace WebCore {
+
+class CSSPaintImageValue final : public CSSImageGeneratorValue {
+public:
+    static Ref<CSSPaintImageValue> create(const String& name)
+    {
+        return adoptRef(*new CSSPaintImageValue(name));
+    }
+
+    bool equals(const CSSPaintImageValue& other) const { return m_name == other.m_name; }
+
+    String customCSSText() const;
+
+private:
+    CSSPaintImageValue(const String& name)
+        : CSSImageGeneratorValue(PaintImageClass)
+        , m_name(name)
+    {
+    }
+
+    const String m_name;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSPaintImageValue, isPaintImageValue())
+
+#endif

Modified: trunk/Source/WebCore/css/CSSPaintWorkletGlobalScope.h (237242 => 237243)


--- trunk/Source/WebCore/css/CSSPaintWorkletGlobalScope.h	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/css/CSSPaintWorkletGlobalScope.h	2018-10-18 02:47:00 UTC (rev 237243)
@@ -27,6 +27,7 @@
 
 #if ENABLE(CSS_PAINTING_API)
 
+#include "CSSPaintCallback.h"
 #include "ExceptionOr.h"
 #include <wtf/HashMap.h>
 #include <wtf/RefCounted.h>
@@ -49,6 +50,9 @@
 
     struct PaintDefinition {
         const AtomicString name;
+        const Ref<CSSPaintCallback> paintCallback;
+        const Vector<String> inputProperties;
+        const Vector<String> inputArguments;
     };
 
     HashMap<String, std::unique_ptr<PaintDefinition>>& paintDefinitionMap() { return m_paintDefinitionMap; }

Modified: trunk/Source/WebCore/css/CSSPaintWorkletGlobalScope.idl (237242 => 237243)


--- trunk/Source/WebCore/css/CSSPaintWorkletGlobalScope.idl	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/css/CSSPaintWorkletGlobalScope.idl	2018-10-18 02:47:00 UTC (rev 237243)
@@ -27,6 +27,7 @@
     EnabledAtRuntime=CSSPaintingAPI,
     Conditional=CSS_PAINTING_API,
     ImplementationLacksVTable,
+    JSCustomMarkFunction,
     JSGenerateToNativeObject
 ] interface CSSPaintWorkletGlobalScope {
     [Custom, MayThrowException] void registerPaint(DOMString name, Function paintCtor);

Modified: trunk/Source/WebCore/css/CSSValue.cpp (237242 => 237243)


--- trunk/Source/WebCore/css/CSSValue.cpp	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/css/CSSValue.cpp	2018-10-18 02:47:00 UTC (rev 237243)
@@ -52,6 +52,7 @@
 #include "CSSInitialValue.h"
 #include "CSSLineBoxContainValue.h"
 #include "CSSNamedImageValue.h"
+#include "CSSPaintImageValue.h"
 #include "CSSPendingSubstitutionValue.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSProperty.h"
@@ -151,6 +152,10 @@
             return compareCSSValues<CSSCursorImageValue>(*this, other);
         case FilterImageClass:
             return compareCSSValues<CSSFilterImageValue>(*this, other);
+#if ENABLE(CSS_PAINTING_API)
+        case PaintImageClass:
+            return compareCSSValues<CSSPaintImageValue>(*this, other);
+#endif
         case FontClass:
             return compareCSSValues<CSSFontValue>(*this, other);
         case FontFaceSrcClass:
@@ -247,6 +252,10 @@
         return downcast<CSSCursorImageValue>(*this).customCSSText();
     case FilterImageClass:
         return downcast<CSSFilterImageValue>(*this).customCSSText();
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        return downcast<CSSPaintImageValue>(*this).customCSSText();
+#endif
     case FontClass:
         return downcast<CSSFontValue>(*this).customCSSText();
     case FontFaceSrcClass:
@@ -432,6 +441,11 @@
     case FilterImageClass:
         delete downcast<CSSFilterImageValue>(this);
         return;
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        delete downcast<CSSPaintImageValue>(this);
+        return;
+#endif
     case CSSContentDistributionClass:
         delete downcast<CSSContentDistributionValue>(this);
         return;

Modified: trunk/Source/WebCore/css/CSSValue.h (237242 => 237243)


--- trunk/Source/WebCore/css/CSSValue.h	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/css/CSSValue.h	2018-10-18 02:47:00 UTC (rev 237243)
@@ -106,6 +106,9 @@
     bool isLineBoxContainValue() const { return m_classType == LineBoxContainClass; }
     bool isCalcValue() const {return m_classType == CalculationClass; }
     bool isFilterImageValue() const { return m_classType == FilterImageClass; }
+#if ENABLE(CSS_PAINTING_API)
+    bool isPaintImageValue() const { return m_classType == PaintImageClass; }
+#endif
     bool isContentDistributionValue() const { return m_classType == CSSContentDistributionClass; }
     bool isGridAutoRepeatValue() const { return m_classType == GridAutoRepeatClass; }
     bool isGridTemplateAreasValue() const { return m_classType == GridTemplateAreasClass; }
@@ -142,6 +145,9 @@
 
         // Image generator classes.
         CanvasClass,
+#if ENABLE(CSS_PAINTING_API)
+        PaintImageClass,
+#endif
         NamedImageClass,
         CrossfadeClass,
         FilterImageClass,

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (237242 => 237243)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2018-10-18 02:47:00 UTC (rev 237243)
@@ -1201,6 +1201,9 @@
 filter
 -webkit-filter
 dashboard-region
+#if defined(ENABLE_CSS_PAINTING_API) && ENABLE_CSS_PAINTING_API
+paint
+#endif
 
 // deprecated gradients
 from

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (237242 => 237243)


--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2018-10-18 02:47:00 UTC (rev 237243)
@@ -38,6 +38,7 @@
 #include "CSSImageSetValue.h"
 #include "CSSImageValue.h"
 #include "CSSNamedImageValue.h"
+#include "CSSPaintImageValue.h"
 #include "CSSParserIdioms.h"
 #include "CSSValuePool.h"
 #include "Pair.h"
@@ -1281,6 +1282,23 @@
     return CSSFilterImageValue::create(imageValue.releaseNonNull(), filterValue.releaseNonNull());
 }
 
+#if ENABLE(CSS_PAINTING_API)
+static RefPtr<CSSValue> consumeCustomPaint(CSSParserTokenRange& args)
+{
+    if (!RuntimeEnabledFeatures::sharedFeatures().cssPaintingAPIEnabled())
+        return nullptr;
+    if (args.peek().type() != IdentToken)
+        return nullptr;
+    auto name = args.consumeIncludingWhitespace().value().toString();
+
+    // FIXME: should parse arguments.
+    while (!args.atEnd())
+        args.consume();
+
+    return CSSPaintImageValue::create(name);
+}
+#endif
+
 static RefPtr<CSSValue> consumeGeneratedImage(CSSParserTokenRange& range, CSSParserContext context)
 {
     CSSValueID id = range.peek().functionId();
@@ -1317,6 +1335,10 @@
         result = consumeWebkitNamedImage(args);
     else if (id == CSSValueWebkitFilter || id == CSSValueFilter)
         result = consumeFilterImage(args, context);
+#if ENABLE(CSS_PAINTING_API)
+    else if (id == CSSValuePaint)
+        result = consumeCustomPaint(args);
+#endif
     if (!result || !args.atEnd())
         return nullptr;
     range = rangeCopy;
@@ -1371,6 +1393,9 @@
         || id == CSSValueCrossFade
         || id == CSSValueWebkitNamedImage
         || id == CSSValueWebkitFilter
+#if ENABLE(CSS_PAINTING_API)
+        || id == CSSValuePaint
+#endif
         || id == CSSValueFilter;
 }
     

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeVideoUtilities.h (237242 => 237243)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeVideoUtilities.h	2018-10-18 01:14:00 UTC (rev 237242)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeVideoUtilities.h	2018-10-18 02:47:00 UTC (rev 237243)
@@ -23,6 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#pragma once
+
 #include <CoreVideo/CoreVideo.h>
 
 namespace WebCore {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to