Changeset 236273 in webkit


Ignore:
Timestamp:
Sep 20, 2018 11:57:56 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Implement CSS Custom Properties and Values Skeleton
https://bugs.webkit.org/show_bug.cgi?id=189694

Patch by Justin Michaud <Justin Michaud> 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:
Location:
trunk
Files:
9 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r236272 r236273  
     12018-09-20  Justin Michaud  <justin_michaud@apple.com>
     2
     3        Implement CSS Custom Properties and Values Skeleton
     4        https://bugs.webkit.org/show_bug.cgi?id=189694
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add test to check that the CSS.registerProperty method exists.
     9
     10        * css-custom-properties-api/registerProperty-expected.txt: Added.
     11        * css-custom-properties-api/registerProperty.html: Added.
     12        * platform/ios-wk1/TestExpectations:
     13        * platform/mac-wk1/TestExpectations:
     14
    1152018-09-20  Dawei Fenton  <realdawei@apple.com>
    216
  • trunk/LayoutTests/platform/ios-wk1/TestExpectations

    r235985 r236273  
    19741974
    19751975webkit.org/b/189594 imported/w3c/web-platform-tests/css/css-animations/pending-style-changes-001.html [ Pass Failure ]
     1976
     1977# Not supported on WK1
     1978css-custom-properties-api [ Skip ]
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r236162 r236273  
    620620
    621621webkit.org/b/188070 imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.html [ Pass Failure ]
     622
     623# Not supported on WK1
     624css-custom-properties-api [ Skip ]
  • trunk/Source/WebCore/CMakeLists.txt

    r236147 r236273  
    526526    css/CSSSupportsRule.idl
    527527    css/CSSUnknownRule.idl
     528    css/DOMCSSCustomPropertyDescriptor.idl
     529    css/DOMCSSNamespace.idl
     530    css/DOMCSSRegisterCustomProperty.idl
    528531    css/DOMMatrix.idl
    529532    css/DOMMatrix2DInit.idl
     
    536539    css/DeprecatedCSSOMValue.idl
    537540    css/DeprecatedCSSOMValueList.idl
    538     css/DOMCSSNamespace.idl
    539541    css/ElementCSSInlineStyle.idl
    540542    css/FontFace.idl
  • trunk/Source/WebCore/ChangeLog

    r236266 r236273  
     12018-09-20  Justin Michaud  <justin_michaud@apple.com>
     2
     3        Implement CSS Custom Properties and Values Skeleton
     4        https://bugs.webkit.org/show_bug.cgi?id=189694
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add feature flag, CSS.registerProperty binding and registered property set in Document.h
     9        for the css custom properties and values api.
     10
     11        Test: css-properties-values-api/registerProperty.html
     12
     13        * CMakeLists.txt:
     14        * DerivedSources.make:
     15        * Sources.txt:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * css/CSSRegisteredCustomProperty.h: Added.
     18        * css/DOMCSSCustomPropertyDescriptor.h: Added.
     19        * css/DOMCSSCustomPropertyDescriptor.idl: Added.
     20        * css/DOMCSSNamespace.h:
     21        * css/DOMCSSRegisterCustomProperty.cpp: Added.
     22        (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
     23        (WebCore::DOMCSSRegisterCustomProperty::from):
     24        (WebCore::DOMCSSRegisterCustomProperty::supplementName):
     25        * css/DOMCSSRegisterCustomProperty.h: Added.
     26        * css/DOMCSSRegisterCustomProperty.idl: Added.
     27        * css/parser/CSSParserContext.cpp:
     28        * dom/Document.cpp:
     29        (WebCore::Document::registerCSSProperty):
     30        * dom/Document.h:
     31        * features.json:
     32        * page/RuntimeEnabledFeatures.h:
     33        (WebCore::RuntimeEnabledFeatures::setCSSCustomPropertiesAndValuesEnabled):
     34        (WebCore::RuntimeEnabledFeatures::cssCustomPropertiesAndValuesEnabled const):
     35
    1362018-09-20  Justin Michaud  <justin_michaud@apple.com>
    237
  • trunk/Source/WebCore/DerivedSources.make

    r236147 r236273  
    452452        $(WebCore)/css/DeprecatedCSSOMValue.idl \
    453453    $(WebCore)/css/DeprecatedCSSOMValueList.idl \
     454    $(WebCore)/css/DOMCSSCustomPropertyDescriptor.idl \
    454455    $(WebCore)/css/DOMCSSNamespace.idl \
     456    $(WebCore)/css/DOMCSSRegisterCustomProperty.idl \
    455457    $(WebCore)/css/ElementCSSInlineStyle.idl \
    456458    $(WebCore)/css/FontFace.idl \
  • trunk/Source/WebCore/Sources.txt

    r236147 r236273  
    621621css/CSSVariableReferenceValue.cpp
    622622css/DOMCSSNamespace.cpp
     623css/DOMCSSRegisterCustomProperty.cpp
    623624css/DOMMatrix.cpp
    624625css/DOMMatrixReadOnly.cpp
     
    25142515JSDOMApplicationCache.cpp
    25152516JSDOMCSSNamespace.cpp
     2517JSDOMCSSRegisterCustomProperty.cpp
     2518JSDOMCSSCustomPropertyDescriptor.cpp
    25162519JSDOMCache.cpp
    25172520JSDOMCacheStorage.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r236147 r236273  
    13451345                4B6FA6F40C39E48C00087011 /* SmartReplace.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6FA6F20C39E48C00087011 /* SmartReplace.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13461346                4BAE95B10B2FA9CE00AED8A0 /* EditorDeleteAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1347                4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */; };
     1348                4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */; };
     1349                4BDA40012151B6F500FD6604 /* CSSRegisteredCustomProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13471350                4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13481351                4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959240A39DACC00220FE5 /* MediaQuery.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    78417844                4B6FA6F60C39E4A100087011 /* SmartReplaceCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmartReplaceCF.cpp; sourceTree = "<group>"; };
    78427845                4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorDeleteAction.h; sourceTree = "<group>"; };
     7846                4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSRegisterCustomProperty.idl; sourceTree = "<group>"; };
     7847                4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCSSRegisterCustomProperty.cpp; sourceTree = "<group>"; };
     7848                4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSCustomPropertyDescriptor.h; sourceTree = "<group>"; };
     7849                4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSRegisterCustomProperty.h; sourceTree = "<group>"; };
     7850                4BDA3FFA2151B6F300FD6604 /* DOMCSSCustomPropertyDescriptor.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSCustomPropertyDescriptor.idl; sourceTree = "<group>"; };
     7851                4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSRegisteredCustomProperty.h; sourceTree = "<group>"; };
    78437852                4E19591F0A39DABA00220FE5 /* MediaFeatureNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaFeatureNames.cpp; sourceTree = "<group>"; };
    78447853                4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaFeatureNames.h; sourceTree = "<group>"; };
     
    2395223961                                2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */,
    2395323962                                AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */,
     23963                                CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */,
    2395423964                                CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */,
    23955                                 CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */,
    2395623965                                526724F21CB2FDF60075974D /* TextTrackRepresentationCocoa.h */,
    2395723966                                526724F11CB2FDF60075974D /* TextTrackRepresentationCocoa.mm */,
     
    2473124740                        isa = PBXGroup;
    2473224741                        children = (
     24742                                417F7AED2139BF6500FBA7EC /* MediaSessionManagerCocoa.h */,
    2473324743                                417F7AEA2139BF6400FBA7EC /* MediaSessionManagerCocoa.mm */,
    24734                                 417F7AED2139BF6500FBA7EC /* MediaSessionManagerCocoa.h */,
    2473524744                                417F7AEB2139BF6400FBA7EC /* WebAudioBufferList.cpp */,
    2473624745                                417F7AEC2139BF6500FBA7EC /* WebAudioBufferList.h */,
     
    2567825687                                BC5A12DD0DC0414800C9AFAD /* CSSReflectValue.cpp */,
    2567925688                                BC5A12DE0DC0414800C9AFAD /* CSSReflectValue.h */,
     25689                                4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */,
    2568025690                                BC7D8FF11BD1A47900FFE540 /* CSSRevertValue.cpp */,
    2568125691                                BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */,
     
    2574725757                                4A4F48A716B0DFC000EDBB29 /* DocumentRuleSets.cpp */,
    2574825758                                4A4F48A816B0DFC000EDBB29 /* DocumentRuleSets.h */,
     25759                                4BDA3FF82151B6F200FD6604 /* DOMCSSCustomPropertyDescriptor.h */,
     25760                                4BDA3FFA2151B6F300FD6604 /* DOMCSSCustomPropertyDescriptor.idl */,
    2574925761                                FD677735195CAB200072E0D3 /* DOMCSSNamespace.cpp */,
    2575025762                                FC9A0F72164094CF003D6B8D /* DOMCSSNamespace.h */,
    2575125763                                FC9A0F73164094CF003D6B8D /* DOMCSSNamespace.idl */,
     25764                                4BDA3FF72151B6F100FD6604 /* DOMCSSRegisterCustomProperty.cpp */,
     25765                                4BDA3FF92151B6F300FD6604 /* DOMCSSRegisterCustomProperty.h */,
     25766                                4BDA3FF52151B6F000FD6604 /* DOMCSSRegisterCustomProperty.idl */,
    2575225767                                836ACEC41ECA6654004BD012 /* DOMMatrix.cpp */,
    2575325768                                836ACEC51ECA6654004BD012 /* DOMMatrix.h */,
     
    2767227687                                9362640B0DE1137D009D5A00 /* CSSReflectionDirection.h in Headers */,
    2767327688                                BC5A12E00DC0414800C9AFAD /* CSSReflectValue.h in Headers */,
     27689                                4BDA40012151B6F500FD6604 /* CSSRegisteredCustomProperty.h in Headers */,
    2767427690                                BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */,
    2767527691                                A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */,
     
    2783127847                                41FABD2D1F4DFE4A006A6C97 /* DOMCacheEngine.h in Headers */,
    2783227848                                41380C291F3436AC00155FDA /* DOMCacheStorage.h in Headers */,
     27849                                4BDA3FFE2151B6F500FD6604 /* DOMCSSCustomPropertyDescriptor.h in Headers */,
    2783327850                                FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */,
     27851                                4BDA3FFF2151B6F500FD6604 /* DOMCSSRegisterCustomProperty.h in Headers */,
    2783427852                                7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
    2783527853                                BC60D6E90D28D83400B9918F /* DOMException.h in Headers */,
     
    2947329491                                2D9BF7081DBFBB24007A7D99 /* MediaEncryptedEventInit.h in Headers */,
    2947429492                                41B28B151F8501D300FB52AC /* MediaEndpointConfiguration.h in Headers */,
     29493                                CDC48AC92149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h in Headers */,
    2947529494                                E44613AD0CD6331000FADA75 /* MediaError.h in Headers */,
    2947629495                                4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */,
     
    3028730306                                517A53291F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.h in Headers */,
    3028830307                                51F175691F3EBC8300C74950 /* ServiceWorkerRegistrationOptions.h in Headers */,
    30289                                 CDC48AC92149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h in Headers */,
    3029030308                                51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */,
    3029130309                                4112B5431F9F9CA000E67875 /* ServiceWorkerThreadProxy.h in Headers */,
  • trunk/Source/WebCore/css/DOMCSSNamespace.h

    r208321 r236273  
    3030#pragma once
    3131
     32#include "Supplementable.h"
     33
    3234#include <wtf/Forward.h>
    3335#include <wtf/RefCounted.h>
     
    3739class Document;
    3840
    39 class DOMCSSNamespace final : public RefCounted<DOMCSSNamespace> {
     41class DOMCSSNamespace final : public RefCounted<DOMCSSNamespace>, public Supplementable<DOMCSSNamespace> {
    4042public:
    4143    static bool supports(Document&, const String& property, const String& value);
  • trunk/Source/WebCore/css/parser/CSSParserContext.cpp

    r234215 r236273  
    2727#include "CSSParserContext.h"
    2828
     29#include "Document.h"
     30#include "Page.h"
     31#include "Settings.h"
    2932#include <wtf/NeverDestroyed.h>
    3033
  • trunk/Source/WebCore/dom/Document.cpp

    r235943 r236273  
    82178217}
    82188218
     8219bool Document::registerCSSProperty(CSSRegisteredCustomProperty&& prop)
     8220{
     8221    return m_CSSRegisteredPropertySet.add(prop.name, std::make_unique<CSSRegisteredCustomProperty>(WTFMove(prop))).isNewEntry;
     8222}
     8223
    82198224} // namespace WebCore
  • trunk/Source/WebCore/dom/Document.h

    r235830 r236273  
    2828#pragma once
    2929
     30#include "CSSRegisteredCustomProperty.h"
    3031#include "Color.h"
    3132#include "ContainerNode.h"
     
    14921493    bool hasMainArticleElement() const { return !!m_mainArticleElement; }
    14931494
     1495    bool registerCSSProperty(CSSRegisteredCustomProperty&&);
     1496
    14941497    void setAsRunningUserScripts() { m_isRunningUserScripts = true; }
    14951498    bool isRunningUserScripts() const { return m_isRunningUserScripts; }
     
    20242027    std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture;
    20252028
     2029    HashMap<String, std::unique_ptr<CSSRegisteredCustomProperty>> m_CSSRegisteredPropertySet;
     2030
    20262031    bool m_isRunningUserScripts { false };
    20272032};
  • trunk/Source/WebCore/features.json

    r235489 r236273  
    4949        "category": "css",
    5050        "description": "Allows content to specify colors outside of the sRGB Color Space."
     51    },
     52    {
     53        "name": "CSS Custom Properties And Values",
     54        "status": {
     55            "status": "Under Development"
     56        },
     57        "url": "https://drafts.css-houdini.org/css-properties-values-api/",
     58        "webkit-url": "https://bugs.webkit.org/show_bug.cgi?id=189692",
     59        "keywords": ["CSSCustomPropertiesAndValues", "custom properties", "css"],
     60        "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."
    5161    },
    5262    {
  • trunk/Source/WebCore/page/RuntimeEnabledFeatures.h

    r235683 r236273  
    286286    bool webAPIStatisticsEnabled() const { return m_webAPIStatisticsEnabled; }
    287287
     288    void setCSSCustomPropertiesAndValuesEnabled(bool isEnabled) { m_CSSCustomPropertiesAndValuesEnabled = isEnabled; }
     289    bool cssCustomPropertiesAndValuesEnabled() const { return m_CSSCustomPropertiesAndValuesEnabled; }
     290
    288291    WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
    289292
     
    431434    bool m_webAPIStatisticsEnabled { false };
    432435
     436    bool m_CSSCustomPropertiesAndValuesEnabled { false };
     437
    433438    friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
    434439};
  • trunk/Source/WebKit/ChangeLog

    r236270 r236273  
     12018-09-20  Justin Michaud  <justin_michaud@apple.com>
     2
     3        Implement CSS Custom Properties and Values Skeleton
     4        https://bugs.webkit.org/show_bug.cgi?id=189694
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add feature flag for CSS custom properties and values api
     9
     10        * Shared/WebPreferences.yaml:
     11        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     12        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
     13
    1142018-09-19  Dean Jackson  <dino@apple.com>
    215
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r236270 r236273  
    13511351  webcoreBinding: RuntimeEnabledFeatures
    13521352  category: internal
     1353
     1354CSSCustomPropertiesAndValuesEnabled:
     1355  type: bool
     1356  defaultValue: false
     1357  humanReadableName: "CSS Custom Properties and Values API"
     1358  humanReadableDescription: "Enable CSS Custom Properties and Values API"
     1359  webcoreBinding: RuntimeEnabledFeatures
     1360  category: experimental
  • trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp

    r235683 r236273  
    254254        RuntimeEnabledFeatures::sharedFeatures().setWebAPIStatisticsEnabled(enabled);
    255255
     256    if (preference == "CSSCustomPropertiesAndValuesEnabled")
     257        RuntimeEnabledFeatures::sharedFeatures().setCSSCustomPropertiesAndValuesEnabled(enabled);
     258
    256259    // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
    257260#define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
Note: See TracChangeset for help on using the changeset viewer.