Implement CSS Custom Properties and Values Skeleton
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2018 18:57:56 +0000 (18:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2018 18:57:56 +0000 (18:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189694

Patch by Justin Michaud <justin_michaud@apple.com> on 2018-09-20
Reviewed by Simon Fraser.

Source/WebCore:

Add feature flag, CSS.registerProperty binding and registered property set in Document.h
for the css custom properties and values api.

Test: css-properties-values-api/registerProperty.html

* CMakeLists.txt:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSRegisteredCustomProperty.h: Added.
* css/DOMCSSCustomPropertyDescriptor.h: Added.
* css/DOMCSSCustomPropertyDescriptor.idl: Added.
* css/DOMCSSNamespace.h:
* css/DOMCSSRegisterCustomProperty.cpp: Added.
(WebCore::DOMCSSRegisterCustomProperty::registerProperty):
(WebCore::DOMCSSRegisterCustomProperty::from):
(WebCore::DOMCSSRegisterCustomProperty::supplementName):
* css/DOMCSSRegisterCustomProperty.h: Added.
* css/DOMCSSRegisterCustomProperty.idl: Added.
* css/parser/CSSParserContext.cpp:
* dom/Document.cpp:
(WebCore::Document::registerCSSProperty):
* dom/Document.h:
* features.json:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setCSSCustomPropertiesAndValuesEnabled):
(WebCore::RuntimeEnabledFeatures::cssCustomPropertiesAndValuesEnabled const):

Source/WebKit:

Add feature flag for CSS custom properties and values api

* Shared/WebPreferences.yaml:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):

LayoutTests:

Add test to check that the CSS.registerProperty method exists.

* css-custom-properties-api/registerProperty-expected.txt: Added.
* css-custom-properties-api/registerProperty.html: Added.
* platform/ios-wk1/TestExpectations:
* platform/mac-wk1/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236273 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
LayoutTests/ChangeLog
LayoutTests/css-custom-properties-api/registerProperty-expected.txt [new file with mode: 0644]
LayoutTests/css-custom-properties-api/registerProperty.html [new file with mode: 0644]
LayoutTests/platform/ios-wk1/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSRegisteredCustomProperty.h [new file with mode: 0644]
Source/WebCore/css/DOMCSSCustomPropertyDescriptor.h [new file with mode: 0644]
Source/WebCore/css/DOMCSSCustomPropertyDescriptor.idl [new file with mode: 0644]
Source/WebCore/css/DOMCSSNamespace.h
Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp [new file with mode: 0644]
Source/WebCore/css/DOMCSSRegisterCustomProperty.h [new file with mode: 0644]
Source/WebCore/css/DOMCSSRegisterCustomProperty.idl [new file with mode: 0644]
Source/WebCore/css/parser/CSSParserContext.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/features.json
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp

index a4fa5be..aaff346 100644 (file)
@@ -1,3 +1,17 @@
+2018-09-20  Justin Michaud  <justin_michaud@apple.com>
+
+        Implement CSS Custom Properties and Values Skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=189694
+
+        Reviewed by Simon Fraser.
+
+        Add test to check that the CSS.registerProperty method exists.
+
+        * css-custom-properties-api/registerProperty-expected.txt: Added.
+        * css-custom-properties-api/registerProperty.html: Added.
+        * platform/ios-wk1/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+
 2018-09-20  Dawei Fenton  <realdawei@apple.com>
 
         WebGL conformance: Failures and Timeouts in suite 2.0.0/conformance
 2018-09-20  Dawei Fenton  <realdawei@apple.com>
 
         WebGL conformance: Failures and Timeouts in suite 2.0.0/conformance
diff --git a/LayoutTests/css-custom-properties-api/registerProperty-expected.txt b/LayoutTests/css-custom-properties-api/registerProperty-expected.txt
new file mode 100644 (file)
index 0000000..cfcfece
--- /dev/null
@@ -0,0 +1,5 @@
+
+PASS registerProperty requires a Dictionary type 
+PASS registerProperty requires a name matching <custom-property-name> 
+PASS registerProperty only allows omitting initialValue is syntax is '*' 
+
diff --git a/LayoutTests/css-custom-properties-api/registerProperty.html b/LayoutTests/css-custom-properties-api/registerProperty.html
new file mode 100644 (file)
index 0000000..d6e4e5c
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSCustomPropertiesAndValuesEnabled=true ] -->
+<!-- https://chromium.googlesource.com/chromium/src/+/01ce431409e3a019858677626a983c55168da6dc/third_party/WebKit/LayoutTests/custom-properties/register-property.html -->
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+// Tests for error checking during property registration
+test(function() {
+    assert_throws(new TypeError(), () => CSS.registerProperty());
+    assert_throws(new TypeError(), () => CSS.registerProperty(undefined));
+    assert_throws(new TypeError(), () => CSS.registerProperty(true));
+    assert_throws(new TypeError(), () => CSS.registerProperty(2));
+    assert_throws(new TypeError(), () => CSS.registerProperty("css"));
+    assert_throws(new TypeError(), () => CSS.registerProperty(null));
+}, "registerProperty requires a Dictionary type");
+test(function() {
+    // Valid property names, shouldn't throw
+    CSS.registerProperty({name: '--name1', inherits: false});
+    CSS.registerProperty({name: '--name2, no need for escapes', inherits: false});
+    CSS.registerProperty({name: ['--name', 3], inherits: false});
+    // Invalid property names
+    assert_throws(new TypeError(), () => CSS.registerProperty({}));
+    assert_throws(new TypeError(), () => CSS.registerProperty({name: '--no-inherits'}));
+    //assert_throws(new SyntaxError(), () => CSS.registerProperty({name: 'no-leading-dash', inherits: false}));
+    //assert_throws(new SyntaxError(), () => CSS.registerProperty({name: '', inherits: false}));
+    //assert_throws(new SyntaxError(), () => CSS.registerProperty({name: '\\--name', inherits: false}));
+}, "registerProperty requires a name matching <custom-property-name>");
+test(function() {
+    CSS.registerProperty({name: '--syntax-test-1', inherits: false, syntax: '*'});
+    CSS.registerProperty({name: '--syntax-test-2', inherits: false, syntax: ' * '});
+    /*assert_throws(new SyntaxError(),
+        () => CSS.registerProperty({name: '--syntax-test-3', syntax: 'length'}));*/
+}, "registerProperty only allows omitting initialValue is syntax is '*'");
+</script>
index b66d873..28d7070 100644 (file)
@@ -1973,3 +1973,6 @@ http/wpt/webauthn/ [ Skip ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
 
 webkit.org/b/189594 imported/w3c/web-platform-tests/css/css-animations/pending-style-changes-001.html [ Pass Failure ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
 
 webkit.org/b/189594 imported/w3c/web-platform-tests/css/css-animations/pending-style-changes-001.html [ Pass Failure ]
+
+# Not supported on WK1
+css-custom-properties-api [ Skip ]
index 535b499..4020884 100644 (file)
@@ -619,3 +619,6 @@ webkit.org/b/189087 svg/animations/animate-end-attribute-numeric-precision.html
 webkit.org/b/189594 imported/w3c/web-platform-tests/css/css-animations/pending-style-changes-001.html [ Pass Failure ]
 
 webkit.org/b/188070 imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.html [ Pass Failure ]
 webkit.org/b/189594 imported/w3c/web-platform-tests/css/css-animations/pending-style-changes-001.html [ Pass Failure ]
 
 webkit.org/b/188070 imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.html [ Pass Failure ]
+
+# Not supported on WK1
+css-custom-properties-api [ Skip ]
index f7853e1..546fb78 100644 (file)
@@ -525,6 +525,9 @@ set(WebCore_NON_SVG_IDL_FILES
     css/CSSStyleSheet.idl
     css/CSSSupportsRule.idl
     css/CSSUnknownRule.idl
     css/CSSStyleSheet.idl
     css/CSSSupportsRule.idl
     css/CSSUnknownRule.idl
+    css/DOMCSSCustomPropertyDescriptor.idl
+    css/DOMCSSNamespace.idl
+    css/DOMCSSRegisterCustomProperty.idl
     css/DOMMatrix.idl
     css/DOMMatrix2DInit.idl
     css/DOMMatrixInit.idl
     css/DOMMatrix.idl
     css/DOMMatrix2DInit.idl
     css/DOMMatrixInit.idl
@@ -535,7 +538,6 @@ set(WebCore_NON_SVG_IDL_FILES
     css/DeprecatedCSSOMRect.idl
     css/DeprecatedCSSOMValue.idl
     css/DeprecatedCSSOMValueList.idl
     css/DeprecatedCSSOMRect.idl
     css/DeprecatedCSSOMValue.idl
     css/DeprecatedCSSOMValueList.idl
-    css/DOMCSSNamespace.idl
     css/ElementCSSInlineStyle.idl
     css/FontFace.idl
     css/FontFaceSet.idl
     css/ElementCSSInlineStyle.idl
     css/FontFace.idl
     css/FontFaceSet.idl
index 05af2c2..a9e43f9 100644 (file)
@@ -1,5 +1,40 @@
 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
 
 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
 
+        Implement CSS Custom Properties and Values Skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=189694
+
+        Reviewed by Simon Fraser.
+
+        Add feature flag, CSS.registerProperty binding and registered property set in Document.h
+        for the css custom properties and values api.
+
+        Test: css-properties-values-api/registerProperty.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSRegisteredCustomProperty.h: Added.
+        * css/DOMCSSCustomPropertyDescriptor.h: Added.
+        * css/DOMCSSCustomPropertyDescriptor.idl: Added.
+        * css/DOMCSSNamespace.h:
+        * css/DOMCSSRegisterCustomProperty.cpp: Added.
+        (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
+        (WebCore::DOMCSSRegisterCustomProperty::from):
+        (WebCore::DOMCSSRegisterCustomProperty::supplementName):
+        * css/DOMCSSRegisterCustomProperty.h: Added.
+        * css/DOMCSSRegisterCustomProperty.idl: Added.
+        * css/parser/CSSParserContext.cpp:
+        * dom/Document.cpp:
+        (WebCore::Document::registerCSSProperty):
+        * dom/Document.h:
+        * features.json:
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setCSSCustomPropertiesAndValuesEnabled):
+        (WebCore::RuntimeEnabledFeatures::cssCustomPropertiesAndValuesEnabled const):
+
+2018-09-20  Justin Michaud  <justin_michaud@apple.com>
+
         JS bindings generator should support EnabledAtRuntime for static methods
         https://bugs.webkit.org/show_bug.cgi?id=189729
 
         JS bindings generator should support EnabledAtRuntime for static methods
         https://bugs.webkit.org/show_bug.cgi?id=189729
 
index bb25ff9..d420d46 100644 (file)
@@ -451,7 +451,9 @@ JS_BINDING_IDLS = \
        $(WebCore)/css/DeprecatedCSSOMRect.idl \
        $(WebCore)/css/DeprecatedCSSOMValue.idl \
     $(WebCore)/css/DeprecatedCSSOMValueList.idl \
        $(WebCore)/css/DeprecatedCSSOMRect.idl \
        $(WebCore)/css/DeprecatedCSSOMValue.idl \
     $(WebCore)/css/DeprecatedCSSOMValueList.idl \
+    $(WebCore)/css/DOMCSSCustomPropertyDescriptor.idl \
     $(WebCore)/css/DOMCSSNamespace.idl \
     $(WebCore)/css/DOMCSSNamespace.idl \
+    $(WebCore)/css/DOMCSSRegisterCustomProperty.idl \
     $(WebCore)/css/ElementCSSInlineStyle.idl \
     $(WebCore)/css/FontFace.idl \
     $(WebCore)/css/FontFaceSet.idl \
     $(WebCore)/css/ElementCSSInlineStyle.idl \
     $(WebCore)/css/FontFace.idl \
     $(WebCore)/css/FontFaceSet.idl \
index 3062354..e2bcdf1 100644 (file)
@@ -620,6 +620,7 @@ css/CSSValuePool.cpp
 css/CSSVariableData.cpp
 css/CSSVariableReferenceValue.cpp
 css/DOMCSSNamespace.cpp
 css/CSSVariableData.cpp
 css/CSSVariableReferenceValue.cpp
 css/DOMCSSNamespace.cpp
+css/DOMCSSRegisterCustomProperty.cpp
 css/DOMMatrix.cpp
 css/DOMMatrixReadOnly.cpp
 css/DeprecatedCSSOMPrimitiveValue.cpp
 css/DOMMatrix.cpp
 css/DOMMatrixReadOnly.cpp
 css/DeprecatedCSSOMPrimitiveValue.cpp
@@ -2513,6 +2514,8 @@ JSDocumentTimeline.cpp
 JSDocumentTimelineOptions.cpp
 JSDOMApplicationCache.cpp
 JSDOMCSSNamespace.cpp
 JSDocumentTimelineOptions.cpp
 JSDOMApplicationCache.cpp
 JSDOMCSSNamespace.cpp
+JSDOMCSSRegisterCustomProperty.cpp
+JSDOMCSSCustomPropertyDescriptor.cpp
 JSDOMCache.cpp
 JSDOMCacheStorage.cpp
 JSDOMException.cpp
 JSDOMCache.cpp
 JSDOMCacheStorage.cpp
 JSDOMException.cpp
index 4e66e92..1563d22 100644 (file)
                4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3480920EEF50D400AC1B41 /* ImageSourceCG.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, ); }; };
                4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3480920EEF50D400AC1B41 /* ImageSourceCG.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 */; };
+               4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */; };
+               4BDA40012151B6F500FD6604 /* CSSRegisteredCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959240A39DACC00220FE5 /* MediaQuery.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959240A39DACC00220FE5 /* MediaQuery.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                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>"; };
                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>"; };
+               4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSRegisterCustomProperty.idl; sourceTree = "<group>"; };
+               4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCSSRegisterCustomProperty.cpp; sourceTree = "<group>"; };
+               4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSCustomPropertyDescriptor.h; sourceTree = "<group>"; };
+               4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSRegisterCustomProperty.h; sourceTree = "<group>"; };
+               4BDA3FFA2151B6F300FD6604 /* DOMCSSCustomPropertyDescriptor.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSCustomPropertyDescriptor.idl; sourceTree = "<group>"; };
+               4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSRegisteredCustomProperty.h; sourceTree = "<group>"; };
                4E19591F0A39DABA00220FE5 /* MediaFeatureNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaFeatureNames.cpp; sourceTree = "<group>"; };
                4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaFeatureNames.h; sourceTree = "<group>"; };
                4E1959230A39DACC00220FE5 /* MediaQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQuery.cpp; sourceTree = "<group>"; };
                4E19591F0A39DABA00220FE5 /* MediaFeatureNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaFeatureNames.cpp; sourceTree = "<group>"; };
                4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaFeatureNames.h; sourceTree = "<group>"; };
                4E1959230A39DACC00220FE5 /* MediaQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQuery.cpp; sourceTree = "<group>"; };
                                2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */,
                                2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */,
                                AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */,
                                2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */,
                                2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */,
                                AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */,
-                               CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */,
                                CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */,
                                CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */,
+                               CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */,
                                526724F21CB2FDF60075974D /* TextTrackRepresentationCocoa.h */,
                                526724F11CB2FDF60075974D /* TextTrackRepresentationCocoa.mm */,
                                2D3EF4441917915C00034184 /* WebActionDisablingCALayerDelegate.h */,
                                526724F21CB2FDF60075974D /* TextTrackRepresentationCocoa.h */,
                                526724F11CB2FDF60075974D /* TextTrackRepresentationCocoa.mm */,
                                2D3EF4441917915C00034184 /* WebActionDisablingCALayerDelegate.h */,
                CD669D651D232DF4004D1866 /* cocoa */ = {
                        isa = PBXGroup;
                        children = (
                CD669D651D232DF4004D1866 /* cocoa */ = {
                        isa = PBXGroup;
                        children = (
-                               417F7AEA2139BF6400FBA7EC /* MediaSessionManagerCocoa.mm */,
                                417F7AED2139BF6500FBA7EC /* MediaSessionManagerCocoa.h */,
                                417F7AED2139BF6500FBA7EC /* MediaSessionManagerCocoa.h */,
+                               417F7AEA2139BF6400FBA7EC /* MediaSessionManagerCocoa.mm */,
                                417F7AEB2139BF6400FBA7EC /* WebAudioBufferList.cpp */,
                                417F7AEC2139BF6500FBA7EC /* WebAudioBufferList.h */,
                        );
                                417F7AEB2139BF6400FBA7EC /* WebAudioBufferList.cpp */,
                                417F7AEC2139BF6500FBA7EC /* WebAudioBufferList.h */,
                        );
                                9362640A0DE1137D009D5A00 /* CSSReflectionDirection.h */,
                                BC5A12DD0DC0414800C9AFAD /* CSSReflectValue.cpp */,
                                BC5A12DE0DC0414800C9AFAD /* CSSReflectValue.h */,
                                9362640A0DE1137D009D5A00 /* CSSReflectionDirection.h */,
                                BC5A12DD0DC0414800C9AFAD /* CSSReflectValue.cpp */,
                                BC5A12DE0DC0414800C9AFAD /* CSSReflectValue.h */,
+                               4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */,
                                BC7D8FF11BD1A47900FFE540 /* CSSRevertValue.cpp */,
                                BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */,
                                A80E6CDC0A1989CA007FB8C5 /* CSSRule.cpp */,
                                BC7D8FF11BD1A47900FFE540 /* CSSRevertValue.cpp */,
                                BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */,
                                A80E6CDC0A1989CA007FB8C5 /* CSSRule.cpp */,
                                A8D0651C0A23C1FE005E7203 /* DeprecatedCSSOMValueList.idl */,
                                4A4F48A716B0DFC000EDBB29 /* DocumentRuleSets.cpp */,
                                4A4F48A816B0DFC000EDBB29 /* DocumentRuleSets.h */,
                                A8D0651C0A23C1FE005E7203 /* DeprecatedCSSOMValueList.idl */,
                                4A4F48A716B0DFC000EDBB29 /* DocumentRuleSets.cpp */,
                                4A4F48A816B0DFC000EDBB29 /* DocumentRuleSets.h */,
+                               4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */,
+                               4BDA3FFA2151B6F300FD6604 /* DOMCSSCustomPropertyDescriptor.idl */,
                                FD677735195CAB200072E0D3 /* DOMCSSNamespace.cpp */,
                                FC9A0F72164094CF003D6B8D /* DOMCSSNamespace.h */,
                                FC9A0F73164094CF003D6B8D /* DOMCSSNamespace.idl */,
                                FD677735195CAB200072E0D3 /* DOMCSSNamespace.cpp */,
                                FC9A0F72164094CF003D6B8D /* DOMCSSNamespace.h */,
                                FC9A0F73164094CF003D6B8D /* DOMCSSNamespace.idl */,
+                               4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */,
+                               4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */,
+                               4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */,
                                836ACEC41ECA6654004BD012 /* DOMMatrix.cpp */,
                                836ACEC51ECA6654004BD012 /* DOMMatrix.h */,
                                836ACEC61ECA6654004BD012 /* DOMMatrix.idl */,
                                836ACEC41ECA6654004BD012 /* DOMMatrix.cpp */,
                                836ACEC51ECA6654004BD012 /* DOMMatrix.h */,
                                836ACEC61ECA6654004BD012 /* DOMMatrix.idl */,
                                FE271F672082DBE500A952D4 /* CSSPtrTag.h in Headers */,
                                9362640B0DE1137D009D5A00 /* CSSReflectionDirection.h in Headers */,
                                BC5A12E00DC0414800C9AFAD /* CSSReflectValue.h in Headers */,
                                FE271F672082DBE500A952D4 /* CSSPtrTag.h in Headers */,
                                9362640B0DE1137D009D5A00 /* CSSReflectionDirection.h in Headers */,
                                BC5A12E00DC0414800C9AFAD /* CSSReflectValue.h in Headers */,
+                               4BDA40012151B6F500FD6604 /* CSSRegisteredCustomProperty.h in Headers */,
                                BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */,
                                A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */,
                                A80E6CF20A1989CA007FB8C5 /* CSSRuleList.h in Headers */,
                                BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */,
                                A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */,
                                A80E6CF20A1989CA007FB8C5 /* CSSRuleList.h in Headers */,
                                41380C271F3436AC00155FDA /* DOMCache.h in Headers */,
                                41FABD2D1F4DFE4A006A6C97 /* DOMCacheEngine.h in Headers */,
                                41380C291F3436AC00155FDA /* DOMCacheStorage.h in Headers */,
                                41380C271F3436AC00155FDA /* DOMCache.h in Headers */,
                                41FABD2D1F4DFE4A006A6C97 /* DOMCacheEngine.h in Headers */,
                                41380C291F3436AC00155FDA /* DOMCacheStorage.h in Headers */,
+                               4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */,
                                FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */,
                                FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */,
+                               4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */,
                                7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
                                BC60D6E90D28D83400B9918F /* DOMException.h in Headers */,
                                8399470C1F50B63E00E9D86B /* DOMFileSystem.h in Headers */,
                                7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
                                BC60D6E90D28D83400B9918F /* DOMException.h in Headers */,
                                8399470C1F50B63E00E9D86B /* DOMFileSystem.h in Headers */,
                                2D9BF7061DBFBB24007A7D99 /* MediaEncryptedEvent.h in Headers */,
                                2D9BF7081DBFBB24007A7D99 /* MediaEncryptedEventInit.h in Headers */,
                                41B28B151F8501D300FB52AC /* MediaEndpointConfiguration.h in Headers */,
                                2D9BF7061DBFBB24007A7D99 /* MediaEncryptedEvent.h in Headers */,
                                2D9BF7081DBFBB24007A7D99 /* MediaEncryptedEventInit.h in Headers */,
                                41B28B151F8501D300FB52AC /* MediaEndpointConfiguration.h in Headers */,
+                               CDC48AC92149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h in Headers */,
                                E44613AD0CD6331000FADA75 /* MediaError.h in Headers */,
                                4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */,
                                07A6D1EC1491137700051D0C /* MediaFragmentURIParser.h in Headers */,
                                E44613AD0CD6331000FADA75 /* MediaError.h in Headers */,
                                4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */,
                                07A6D1EC1491137700051D0C /* MediaFragmentURIParser.h in Headers */,
                                517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */,
                                517A53291F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.h in Headers */,
                                51F175691F3EBC8300C74950 /* ServiceWorkerRegistrationOptions.h in Headers */,
                                517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */,
                                517A53291F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.h in Headers */,
                                51F175691F3EBC8300C74950 /* ServiceWorkerRegistrationOptions.h in Headers */,
-                               CDC48AC92149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h in Headers */,
                                51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */,
                                4112B5431F9F9CA000E67875 /* ServiceWorkerThreadProxy.h in Headers */,
                                515E37F61FAA940200D7F22A /* ServiceWorkerTypes.h in Headers */,
                                51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */,
                                4112B5431F9F9CA000E67875 /* ServiceWorkerThreadProxy.h in Headers */,
                                515E37F61FAA940200D7F22A /* ServiceWorkerTypes.h in Headers */,
diff --git a/Source/WebCore/css/CSSRegisteredCustomProperty.h b/Source/WebCore/css/CSSRegisteredCustomProperty.h
new file mode 100644 (file)
index 0000000..b05e2af
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct CSSRegisteredCustomProperty {
+    const String name;
+    /* TODO syntax, inherits, initialValue */
+};
+
+}
diff --git a/Source/WebCore/css/DOMCSSCustomPropertyDescriptor.h b/Source/WebCore/css/DOMCSSCustomPropertyDescriptor.h
new file mode 100644 (file)
index 0000000..c4520c1
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct DOMCSSCustomPropertyDescriptor {
+    String name;
+    String syntax { "*" };
+    bool inherits;
+    String initialValue;
+};
+
+}
diff --git a/Source/WebCore/css/DOMCSSCustomPropertyDescriptor.idl b/Source/WebCore/css/DOMCSSCustomPropertyDescriptor.idl
new file mode 100644 (file)
index 0000000..f96aea5
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+* Copyright (C) 2018 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    JSGenerateToJSObject,
+    EnabledAtRuntime=CSSCustomPropertiesAndValues
+] dictionary DOMCSSCustomPropertyDescriptor {
+    required DOMString name;
+             DOMString syntax       = "*";
+    required boolean   inherits;
+             DOMString initialValue;
+};
index 3b2e387..8cd28a2 100644 (file)
@@ -29,6 +29,8 @@
 
 #pragma once
 
 
 #pragma once
 
+#include "Supplementable.h"
+
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 
@@ -36,7 +38,7 @@ namespace WebCore {
 
 class Document;
 
 
 class Document;
 
-class DOMCSSNamespace final : public RefCounted<DOMCSSNamespace> {
+class DOMCSSNamespace final : public RefCounted<DOMCSSNamespace>, public Supplementable<DOMCSSNamespace> {
 public:
     static bool supports(Document&, const String& property, const String& value);
     static bool supports(Document&, const String& conditionText);
 public:
     static bool supports(Document&, const String& property, const String& value);
     static bool supports(Document&, const String& conditionText);
diff --git a/Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp b/Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp
new file mode 100644 (file)
index 0000000..7cc532e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DOMCSSRegisterCustomProperty.h"
+
+#include "CSSRegisteredCustomProperty.h"
+#include "DOMCSSNamespace.h"
+#include "Document.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+void DOMCSSRegisterCustomProperty::registerProperty(Document& document, const DOMCSSCustomPropertyDescriptor& descriptor)
+{
+    CSSRegisteredCustomProperty property { descriptor.name };
+    if (!document.registerCSSProperty(WTFMove(property))) {
+        /* TODO throw JS exception */
+        return;
+    }
+}
+
+DOMCSSRegisterCustomProperty* DOMCSSRegisterCustomProperty::from(DOMCSSNamespace& css)
+{
+    auto* supplement = static_cast<DOMCSSRegisterCustomProperty*>(Supplement<DOMCSSNamespace>::from(&css, supplementName()));
+    if (!supplement) {
+        auto newSupplement = std::make_unique<DOMCSSRegisterCustomProperty>(css);
+        supplement = newSupplement.get();
+        provideTo(&css, supplementName(), WTFMove(newSupplement));
+    }
+    return supplement;
+}
+
+const char* DOMCSSRegisterCustomProperty::supplementName()
+{
+    return "DOMCSSRegisterCustomProperty";
+}
+
+}
diff --git a/Source/WebCore/css/DOMCSSRegisterCustomProperty.h b/Source/WebCore/css/DOMCSSRegisterCustomProperty.h
new file mode 100644 (file)
index 0000000..d93b1dc
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "DOMCSSCustomPropertyDescriptor.h"
+#include "Supplementable.h"
+
+namespace WebCore {
+
+class Document;
+class DOMCSSNamespace;
+
+class DOMCSSRegisterCustomProperty final : public Supplement<DOMCSSNamespace> {
+public:
+    explicit DOMCSSRegisterCustomProperty(DOMCSSNamespace&) { }
+
+    static void registerProperty(Document&, const DOMCSSCustomPropertyDescriptor&);
+
+private:
+    static DOMCSSRegisterCustomProperty* from(DOMCSSNamespace&);
+    static const char* supplementName();
+};
+
+}
diff --git a/Source/WebCore/css/DOMCSSRegisterCustomProperty.idl b/Source/WebCore/css/DOMCSSRegisterCustomProperty.idl
new file mode 100644 (file)
index 0000000..421696b
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+* Copyright (C) 2018 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    EnabledAtRuntime=CSSCustomPropertiesAndValues
+] partial interface DOMCSSNamespace {
+    [CallWith=Document] static void registerProperty(DOMCSSCustomPropertyDescriptor descriptor);
+};
index 2bb34a9..e3e7f9c 100644 (file)
@@ -26,6 +26,9 @@
 #include "config.h"
 #include "CSSParserContext.h"
 
 #include "config.h"
 #include "CSSParserContext.h"
 
+#include "Document.h"
+#include "Page.h"
+#include "Settings.h"
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
index 51f660e..b30ba1f 100644 (file)
@@ -8216,4 +8216,9 @@ String Document::signedPublicKeyAndChallengeString(unsigned keySizeIndex, const
     return page->chrome().client().signedPublicKeyAndChallengeString(keySizeIndex, challengeString, url);
 }
 
     return page->chrome().client().signedPublicKeyAndChallengeString(keySizeIndex, challengeString, url);
 }
 
+bool Document::registerCSSProperty(CSSRegisteredCustomProperty&& prop)
+{
+    return m_CSSRegisteredPropertySet.add(prop.name, std::make_unique<CSSRegisteredCustomProperty>(WTFMove(prop))).isNewEntry;
+}
+
 } // namespace WebCore
 } // namespace WebCore
index cd1a963..ffce474 100644 (file)
@@ -27,6 +27,7 @@
 
 #pragma once
 
 
 #pragma once
 
+#include "CSSRegisteredCustomProperty.h"
 #include "Color.h"
 #include "ContainerNode.h"
 #include "DisabledAdaptations.h"
 #include "Color.h"
 #include "ContainerNode.h"
 #include "DisabledAdaptations.h"
@@ -1491,6 +1492,8 @@ public:
     void updateMainArticleElementAfterLayout();
     bool hasMainArticleElement() const { return !!m_mainArticleElement; }
 
     void updateMainArticleElementAfterLayout();
     bool hasMainArticleElement() const { return !!m_mainArticleElement; }
 
+    bool registerCSSProperty(CSSRegisteredCustomProperty&&);
+
     void setAsRunningUserScripts() { m_isRunningUserScripts = true; }
     bool isRunningUserScripts() const { return m_isRunningUserScripts; }
 
     void setAsRunningUserScripts() { m_isRunningUserScripts = true; }
     bool isRunningUserScripts() const { return m_isRunningUserScripts; }
 
@@ -2023,6 +2026,8 @@ private:
     
     std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture;
 
     
     std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture;
 
+    HashMap<String, std::unique_ptr<CSSRegisteredCustomProperty>> m_CSSRegisteredPropertySet;
+
     bool m_isRunningUserScripts { false };
 };
 
     bool m_isRunningUserScripts { false };
 };
 
index 2ece761..c2ea39d 100644 (file)
         "description": "Allows content to specify colors outside of the sRGB Color Space."
     },
     {
         "description": "Allows content to specify colors outside of the sRGB Color Space."
     },
     {
+        "name": "CSS Custom Properties And Values",
+        "status": {
+            "status": "Under Development"
+        },
+        "url": "https://drafts.css-houdini.org/css-properties-values-api/",
+        "webkit-url": "https://bugs.webkit.org/show_bug.cgi?id=189692",
+        "keywords": ["CSSCustomPropertiesAndValues", "custom properties", "css"],
+        "description": "An API for registering new CSS properties. Properties registered using this API are provided with a parse syntax that defines a type, inheritance behaviour, and an initial value."
+    },
+    {
         "name": "CSS Font Display",
         "status": {
             "status": "In Development",
         "name": "CSS Font Display",
         "status": {
             "status": "In Development",
index 4770564..e163678 100644 (file)
@@ -285,6 +285,9 @@ public:
     void setWebAPIStatisticsEnabled(bool isEnabled) { m_webAPIStatisticsEnabled = isEnabled; }
     bool webAPIStatisticsEnabled() const { return m_webAPIStatisticsEnabled; }
 
     void setWebAPIStatisticsEnabled(bool isEnabled) { m_webAPIStatisticsEnabled = isEnabled; }
     bool webAPIStatisticsEnabled() const { return m_webAPIStatisticsEnabled; }
 
+    void setCSSCustomPropertiesAndValuesEnabled(bool isEnabled) { m_CSSCustomPropertiesAndValuesEnabled = isEnabled; }
+    bool cssCustomPropertiesAndValuesEnabled() const { return m_CSSCustomPropertiesAndValuesEnabled; }
+
     WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
 
 private:
     WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
 
 private:
@@ -430,6 +433,8 @@ private:
 
     bool m_webAPIStatisticsEnabled { false };
 
 
     bool m_webAPIStatisticsEnabled { false };
 
+    bool m_CSSCustomPropertiesAndValuesEnabled { false };
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 
index ee5b668..94c4c48 100644 (file)
@@ -1,3 +1,16 @@
+2018-09-20  Justin Michaud  <justin_michaud@apple.com>
+
+        Implement CSS Custom Properties and Values Skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=189694
+
+        Reviewed by Simon Fraser.
+
+        Add feature flag for CSS custom properties and values api
+
+        * Shared/WebPreferences.yaml:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+
 2018-09-19  Dean Jackson  <dino@apple.com>
 
         Temporarily move fullscreen back to experimental features
 2018-09-19  Dean Jackson  <dino@apple.com>
 
         Temporarily move fullscreen back to experimental features
index 66f6158..d3a8618 100644 (file)
@@ -1350,3 +1350,11 @@ WebAPIStatisticsEnabled:
   humanReadableDescription: "Enable Web API Statistics"
   webcoreBinding: RuntimeEnabledFeatures
   category: internal
   humanReadableDescription: "Enable Web API Statistics"
   webcoreBinding: RuntimeEnabledFeatures
   category: internal
+
+CSSCustomPropertiesAndValuesEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "CSS Custom Properties and Values API"
+  humanReadableDescription: "Enable CSS Custom Properties and Values API"
+  webcoreBinding: RuntimeEnabledFeatures
+  category: experimental
index 8d681fe..625ec12 100644 (file)
@@ -253,6 +253,9 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
     if (preference == "WebKitWebAPIStatisticsEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setWebAPIStatisticsEnabled(enabled);
 
     if (preference == "WebKitWebAPIStatisticsEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setWebAPIStatisticsEnabled(enabled);
 
+    if (preference == "CSSCustomPropertiesAndValuesEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setCSSCustomPropertiesAndValuesEnabled(enabled);
+
     // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
 #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
     macro(WebKitJavaEnabled, JavaEnabled, javaEnabled) \
     // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
 #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
     macro(WebKitJavaEnabled, JavaEnabled, javaEnabled) \