Title: [273688] trunk/Source
Revision
273688
Author
wei...@apple.com
Date
2021-03-01 13:27:39 -0800 (Mon, 01 Mar 2021)

Log Message

Add alternate, non-named-getter based, implementation of CSSStyleDeclaration back into WebCore
https://bugs.webkit.org/show_bug.cgi?id=222517

Reviewed by Darin Adler.

Source/WebCore:

Re-lands change from r268564 but disabled behind a new ENABLE flag,
ENABLE(ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION).

Replace named getter/setter based implementation of access to CSSStyleDeclaration property values
with a generated partial interface that lists all the properties exactly.

To keep things consistent with existing behavior, in addition to the spec'd properties, we also
maintain additional properties for epub prefixed properties.

* CMakeLists.txt:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
Generate CSSStyleDeclaration+PropertyNames.idl and ensure it is compile together with the other
bindings.

* css/makeprop.pl:
Add generation of CSSStyleDeclaration+PropertyNames.idl from CSSProperties.json. Add checking
of the enable flag to ensure it is not compiled by default.

* bindings/scripts/CodeGeneratorJS.pm:
(ToMethodName):
Don't transform names that start with CSSOM to ensure property names are consistent.

(GenerateAttributeGetterBodyDefinition):
(GenerateAttributeSetterBodyDefinition):
* bindings/scripts/IDLAttributes.json:
Add initial support for the new CSSProperty extended attribute. Only the tests and
the disabled code in CSSStyleDeclaration+PropertyNames.idl currently use it.

* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/JSTestCSSProperty.cpp: Added.
* bindings/scripts/test/JS/JSTestCSSProperty.h: Added.
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestCSSProperty.idl: Added.
Add tests for the new CSSProperty extended attribute.

(WebCore::CSSComputedStyleDeclaration::setPropertyInternal):
* css/CSSComputedStyleDeclaration.h:
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
* css/PropertySetCSSStyleDeclaration.h:
Remove unused bool return value from getPropertyValueInternal (it goes from
ExceptionOr<bool> to ExceptionOr<void>) to simplify some callers that no longer
need to check the return value.

* css/CSSStyleDeclaration.cpp:
* css/CSSStyleDeclaration.h:
Extract out setPropertyValueInternal so it can be used by the bindings generator
for CSSProperty attributes.

* css/CSSStyleDeclaration.idl:
Move named getter/setter declarations and DefaultDefineOwnProperty inside of
enable flags checks so that when it is disabled, we don't use them.

Source/WTF:

* wtf/PlatformEnable.h:
Add new off by default ENABLE flag ENABLE(ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION) which indicates
that we should use the new attribute based implementation of property getter/setters of CSSStyleDeclaration.
Once we remove the compile time and binary size regressions, we can enable this and remove the macro.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (273687 => 273688)


--- trunk/Source/WTF/ChangeLog	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WTF/ChangeLog	2021-03-01 21:27:39 UTC (rev 273688)
@@ -1,5 +1,17 @@
 2021-03-01  Sam Weinig  <wei...@apple.com>
 
+        Add alternate, non-named-getter based, implementation of CSSStyleDeclaration back into WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=222517
+
+        Reviewed by Darin Adler.
+
+        * wtf/PlatformEnable.h:
+        Add new off by default ENABLE flag ENABLE(ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION) which indicates
+        that we should use the new attribute based implementation of property getter/setters of CSSStyleDeclaration.
+        Once we remove the compile time and binary size regressions, we can enable this and remove the macro.
+
+2021-03-01  Sam Weinig  <wei...@apple.com>
+
         Add experimental support for CSS Color 5 color-contrast()
         https://bugs.webkit.org/show_bug.cgi?id=222530
 

Modified: trunk/Source/WTF/wtf/PlatformEnable.h (273687 => 273688)


--- trunk/Source/WTF/wtf/PlatformEnable.h	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WTF/wtf/PlatformEnable.h	2021-03-01 21:27:39 UTC (rev 273688)
@@ -344,6 +344,10 @@
 #define ENABLE_LAYOUT_FORMATTING_CONTEXT 0
 #endif
 
+#if !defined(ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION)
+#define ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION 0
+#endif
+
 #if !defined(ENABLE_LETTERPRESS)
 #define ENABLE_LETTERPRESS 0
 #endif

Modified: trunk/Source/WebCore/CMakeLists.txt (273687 => 273688)


--- trunk/Source/WebCore/CMakeLists.txt	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-03-01 21:27:39 UTC (rev 273688)
@@ -1930,7 +1930,7 @@
 
 # Generate CSS property names
 add_custom_command(
-    OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/CSSProperties.json ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.h ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.gperf ${WebCore_DERIVED_SOURCES_DIR}/StyleBuilderGenerated.cpp ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.h ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.cpp
+    OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/CSSProperties.json ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.h ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.gperf ${WebCore_DERIVED_SOURCES_DIR}/StyleBuilderGenerated.cpp ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.h ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.cpp ${WebCore_DERIVED_SOURCES_DIR}/CSSStyleDeclaration+PropertyNames.idl
     MAIN_DEPENDENCY ${WEBCORE_DIR}/css/makeprop.pl
     DEPENDS ${WebCore_CSS_PROPERTY_NAMES}
     WORKING_DIRECTORY ${WebCore_DERIVED_SOURCES_DIR}
@@ -1940,6 +1940,7 @@
 list(APPEND WebCore_SOURCES ${WebCore_DERIVED_SOURCES_DIR}/CSSPropertyNames.cpp)
 list(APPEND WebCore_SOURCES ${WebCore_DERIVED_SOURCES_DIR}/StyleBuilderGenerated.cpp)
 list(APPEND WebCore_SOURCES ${WebCore_DERIVED_SOURCES_DIR}/StylePropertyShorthandFunctions.cpp)
+list(APPEND WebCore_IDL_FILES ${WebCore_DERIVED_SOURCES_DIR}/CSSStyleDeclaration+PropertyNames.idl)
 ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSParser.cpp CSSValueKeywords.h)
 
 # Generate CSS value keywords

Modified: trunk/Source/WebCore/ChangeLog (273687 => 273688)


--- trunk/Source/WebCore/ChangeLog	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/ChangeLog	2021-03-01 21:27:39 UTC (rev 273688)
@@ -1,3 +1,65 @@
+2021-03-01  Sam Weinig  <wei...@apple.com>
+
+        Add alternate, non-named-getter based, implementation of CSSStyleDeclaration back into WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=222517
+
+        Reviewed by Darin Adler.
+
+        Re-lands change from r268564 but disabled behind a new ENABLE flag, 
+        ENABLE(ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION).
+
+        Replace named getter/setter based implementation of access to CSSStyleDeclaration property values
+        with a generated partial interface that lists all the properties exactly.
+       
+        To keep things consistent with existing behavior, in addition to the spec'd properties, we also
+        maintain additional properties for epub prefixed properties.
+
+        * CMakeLists.txt:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        Generate CSSStyleDeclaration+PropertyNames.idl and ensure it is compile together with the other
+        bindings.
+
+        * css/makeprop.pl:
+        Add generation of CSSStyleDeclaration+PropertyNames.idl from CSSProperties.json. Add checking
+        of the enable flag to ensure it is not compiled by default.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (ToMethodName):
+        Don't transform names that start with CSSOM to ensure property names are consistent.
+
+        (GenerateAttributeGetterBodyDefinition):
+        (GenerateAttributeSetterBodyDefinition):
+        * bindings/scripts/IDLAttributes.json:
+        Add initial support for the new CSSProperty extended attribute. Only the tests and
+        the disabled code in CSSStyleDeclaration+PropertyNames.idl currently use it.
+
+        * bindings/scripts/test/BindingTestGlobalConstructors.idl:
+        * bindings/scripts/test/JS/JSTestCSSProperty.cpp: Added.
+        * bindings/scripts/test/JS/JSTestCSSProperty.h: Added.
+        * bindings/scripts/test/SupplementalDependencies.dep:
+        * bindings/scripts/test/TestCSSProperty.idl: Added.
+        Add tests for the new CSSProperty extended attribute.
+
+        (WebCore::CSSComputedStyleDeclaration::setPropertyInternal):
+        * css/CSSComputedStyleDeclaration.h:
+        * css/PropertySetCSSStyleDeclaration.cpp:
+        (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
+        (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
+        * css/PropertySetCSSStyleDeclaration.h:
+        Remove unused bool return value from getPropertyValueInternal (it goes from
+        ExceptionOr<bool> to ExceptionOr<void>) to simplify some callers that no longer
+        need to check the return value.
+
+        * css/CSSStyleDeclaration.cpp:
+        * css/CSSStyleDeclaration.h:
+        Extract out setPropertyValueInternal so it can be used by the bindings generator
+        for CSSProperty attributes.
+
+        * css/CSSStyleDeclaration.idl:
+        Move named getter/setter declarations and DefaultDefineOwnProperty inside of
+        enable flags checks so that when it is disabled, we don't use them.
+
 2021-03-01  Andres Gonzalez  <andresg...@apple.com>
 
         WebAccessibilityObjectWrapper method to retrieve related error message elements should return not-ignored accessibility elements.

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (273687 => 273688)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-03-01 21:27:39 UTC (rev 273688)
@@ -3,6 +3,7 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/ByteLengthQueuingStrategyBuiltins.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSPropertyNames.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSPropertyNames.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSStyleDeclaration+PropertyNames.idl
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSValueKeywords.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/CSSValueKeywords.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/ColorData.cpp
@@ -304,6 +305,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSRule.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSRuleList.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSRuleList.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration+PropertyNames.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration+PropertyNames.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleDeclaration.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSStyleRule.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (273687 => 273688)


--- trunk/Source/WebCore/DerivedSources.make	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/DerivedSources.make	2021-03-01 21:27:39 UTC (rev 273688)
@@ -1291,6 +1291,7 @@
     $(WebCore)/xml/XPathResult.idl \
     $(WebCore)/xml/XSLTProcessor.idl \
     InternalSettingsGenerated.idl \
+    CSSStyleDeclaration+PropertyNames.idl \
 #
 
 # --------
@@ -1390,6 +1391,7 @@
     StyleBuilderGenerated.cpp \
     StylePropertyShorthandFunctions.cpp \
     StylePropertyShorthandFunctions.h \
+    CSSStyleDeclaration+PropertyNames.idl \
     UserAgentStyleSheets.h \
     WebKitFontFamilyNames.cpp \
     WebKitFontFamilyNames.h \
@@ -1417,6 +1419,7 @@
     StyleBuilderGenerated.cpp \
     StylePropertyShorthandFunctions.cpp \
     StylePropertyShorthandFunctions.h \
+    CSSStyleDeclaration+PropertyNames.idl \
 #
 CSS_PROPERTY_NAME_FILES_PATTERNS = $(subst .,%,$(CSS_PROPERTY_NAME_FILES))
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (273687 => 273688)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-03-01 21:27:39 UTC (rev 273688)
@@ -3997,6 +3997,9 @@
 sub ToMethodName
 {
     my $param = shift;
+
+    return $param if $param =~ /^CSSOM/;
+
     my $ret = lcfirst($param);
     $ret =~ s/cSS/css/ if $ret =~ /^cSS/;
     $ret =~ s/dOM/dom/ if $ret =~ /^dOM/;
@@ -5330,6 +5333,13 @@
             AddToImplIncludes("JS" . $constructorType . ".h", $conditional);
             push(@$outputArray, "    return JS" . $constructorType . "::${constructorGetter}(JSC::getVM(&lexicalGlobalObject), thisObject.globalObject());\n");
         }
+    } elsif ($attribute->extendedAttributes->{CSSProperty}) {
+        $implIncludes{"CSSPropertyNames.h"} = 1;
+        my $propertyID = $attribute->extendedAttributes->{CSSProperty};
+
+        my $toJSExpression = NativeToJSValueUsingReferences($attribute, $interface, "impl.getPropertyValueInternal(CSSProperty${propertyID})", "*thisObject.globalObject()");
+        push(@$outputArray, "    auto& impl = thisObject.wrapped();\n");
+        push(@$outputArray, "    RELEASE_AND_RETURN(throwScope, (${toJSExpression}));\n");
     } else {
         if ($attribute->extendedAttributes->{CachedAttribute}) {
             push(@$outputArray, "    if (JSValue cachedValue = thisObject.m_" . $attribute->name . ".get())\n");
@@ -5474,6 +5484,21 @@
         push(@$outputArray, "    vm.heap.writeBarrier(&thisObject, value);\n");
         push(@$outputArray, "    ensureStillAliveHere(value);\n\n");
         push(@$outputArray, "    return true;\n");
+    } elsif ($attribute->extendedAttributes->{CSSProperty}) {
+        $implIncludes{"CSSPropertyNames.h"} = 1;
+
+        my $propertyID = $attribute->extendedAttributes->{CSSProperty};
+
+        my $exceptionThrower = GetAttributeExceptionThrower($interface, $attribute);
+        my $toNativeExpression = JSValueToNative($interface, $attribute, "value", $attribute->extendedAttributes->{Conditional}, "&lexicalGlobalObject", "lexicalGlobalObject", "thisObject", "*thisObject.globalObject()", $exceptionThrower);
+
+        push(@$outputArray, "    auto& impl = thisObject.wrapped();\n");
+        push(@$outputArray, "    auto nativeValue = ${toNativeExpression};\n");
+        push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, false);\n");
+        push(@$outputArray, "    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {\n");
+        push(@$outputArray, "        return impl.setPropertyValueInternal(CSSProperty${propertyID}, WTFMove(nativeValue));\n");
+        push(@$outputArray, "    });\n");
+        push(@$outputArray, "    return true;\n");
     } elsif ($isConstructor) {
         my $constructorType = $attribute->type->name;
         $constructorType =~ s/Constructor$//;

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (273687 => 273688)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-03-01 21:27:39 UTC (rev 273688)
@@ -38,6 +38,10 @@
                 "url": "https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions"
             }
         },
+        "CSSProperty": {
+            "contextsAllowed": ["attribute"],
+            "values": ["*"]
+        },
         "CachedAttribute": {
             "contextsAllowed": ["attribute"]
         },

Modified: trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl (273687 => 273688)


--- trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl	2021-03-01 21:27:39 UTC (rev 273688)
@@ -1,6 +1,7 @@
 partial interface TestGlobalObject {
     attribute TestCEReactionsConstructor TestCEReactions;
     attribute TestCEReactionsStringifierConstructor TestCEReactionsStringifier;
+    attribute TestCSSPropertyConstructor TestCSSProperty;
     attribute TestCallTracerConstructor TestCallTracer;
     [Conditional=TEST_CONDITIONAL] attribute TestCallbackInterfaceConstructor TestCallbackInterface;
     attribute TestClassWithJSBuiltinConstructorConstructor TestClassWithJSBuiltinConstructor;

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCSSProperty.cpp (0 => 273688)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCSSProperty.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCSSProperty.cpp	2021-03-01 21:27:39 UTC (rev 273688)
@@ -0,0 +1,298 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSTestCSSProperty.h"
+
+#include "ActiveDOMObject.h"
+#include "CSSPropertyNames.h"
+#include "CustomElementReactionQueue.h"
+#include "DOMIsoSubspaces.h"
+#include "JSDOMAttribute.h"
+#include "JSDOMBinding.h"
+#include "JSDOMConstructorNotConstructable.h"
+#include "JSDOMConvertStrings.h"
+#include "JSDOMExceptionHandling.h"
+#include "JSDOMWrapperCache.h"
+#include "ScriptExecutionContext.h"
+#include "WebCoreJSClientData.h"
+#include <_javascript_Core/FunctionPrototype.h>
+#include <_javascript_Core/HeapAnalyzer.h>
+#include <_javascript_Core/JSCInlines.h>
+#include <_javascript_Core/JSDestructibleObjectHeapCellType.h>
+#include <_javascript_Core/SlotVisitorMacros.h>
+#include <_javascript_Core/SubspaceInlines.h>
+#include <wtf/GetPtr.h>
+#include <wtf/PointerPreparations.h>
+#include <wtf/URL.h>
+
+
+namespace WebCore {
+using namespace JSC;
+
+// Attributes
+
+static JSC_DECLARE_CUSTOM_GETTER(jsTestCSSPropertyConstructor);
+static JSC_DECLARE_CUSTOM_GETTER(jsTestCSSProperty_property);
+static JSC_DECLARE_CUSTOM_SETTER(setJSTestCSSProperty_property);
+
+class JSTestCSSPropertyPrototype final : public JSC::JSNonFinalObject {
+public:
+    using Base = JSC::JSNonFinalObject;
+    static JSTestCSSPropertyPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSTestCSSPropertyPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestCSSPropertyPrototype>(vm.heap)) JSTestCSSPropertyPrototype(vm, globalObject, structure);
+        ptr->finishCreation(vm);
+        return ptr;
+    }
+
+    DECLARE_INFO;
+    template<typename CellType, JSC::SubspaceAccess>
+    static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
+    {
+        STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestCSSPropertyPrototype, Base);
+        return &vm.plainObjectSpace;
+    }
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+private:
+    JSTestCSSPropertyPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+        : JSC::JSNonFinalObject(vm, structure)
+    {
+    }
+
+    void finishCreation(JSC::VM&);
+};
+STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestCSSPropertyPrototype, JSTestCSSPropertyPrototype::Base);
+
+using JSTestCSSPropertyDOMConstructor = JSDOMConstructorNotConstructable<JSTestCSSProperty>;
+
+template<> JSValue JSTestCSSPropertyDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.functionPrototype();
+}
+
+template<> void JSTestCSSPropertyDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    putDirect(vm, vm.propertyNames->prototype, JSTestCSSProperty::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
+    putDirect(vm, vm.propertyNames->name, jsNontrivialString(vm, "TestCSSProperty"_s), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
+    putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
+}
+
+template<> const ClassInfo JSTestCSSPropertyDOMConstructor::s_info = { "TestCSSProperty", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCSSPropertyDOMConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestCSSPropertyPrototypeTableValues[] =
+{
+    { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCSSPropertyConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+    { "property", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCSSProperty_property), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCSSProperty_property) } },
+};
+
+const ClassInfo JSTestCSSPropertyPrototype::s_info = { "TestCSSProperty", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCSSPropertyPrototype) };
+
+void JSTestCSSPropertyPrototype::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    reifyStaticProperties(vm, JSTestCSSProperty::info(), JSTestCSSPropertyPrototypeTableValues, *this);
+    JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
+}
+
+const ClassInfo JSTestCSSProperty::s_info = { "TestCSSProperty", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCSSProperty) };
+
+JSTestCSSProperty::JSTestCSSProperty(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestCSSProperty>&& impl)
+    : JSDOMWrapper<TestCSSProperty>(structure, globalObject, WTFMove(impl))
+{
+}
+
+void JSTestCSSProperty::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(vm, info()));
+
+    static_assert(!std::is_base_of<ActiveDOMObject, TestCSSProperty>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
+
+}
+
+JSObject* JSTestCSSProperty::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return JSTestCSSPropertyPrototype::create(vm, &globalObject, JSTestCSSPropertyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
+}
+
+JSObject* JSTestCSSProperty::prototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return getDOMPrototype<JSTestCSSProperty>(vm, globalObject);
+}
+
+JSValue JSTestCSSProperty::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSTestCSSPropertyDOMConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+void JSTestCSSProperty::destroy(JSC::JSCell* cell)
+{
+    JSTestCSSProperty* thisObject = static_cast<JSTestCSSProperty*>(cell);
+    thisObject->JSTestCSSProperty::~JSTestCSSProperty();
+}
+
+template<> inline JSTestCSSProperty* IDLAttribute<JSTestCSSProperty>::cast(JSGlobalObject& lexicalGlobalObject, EncodedJSValue thisValue)
+{
+    return jsDynamicCast<JSTestCSSProperty*>(JSC::getVM(&lexicalGlobalObject), JSValue::decode(thisValue));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestCSSPropertyConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    VM& vm = JSC::getVM(lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* prototype = jsDynamicCast<JSTestCSSPropertyPrototype*>(vm, JSValue::decode(thisValue));
+    if (UNLIKELY(!prototype))
+        return throwVMTypeError(lexicalGlobalObject, throwScope);
+    return JSValue::encode(JSTestCSSProperty::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject()));
+}
+
+static inline JSValue jsTestCSSProperty_propertyGetter(JSGlobalObject& lexicalGlobalObject, JSTestCSSProperty& thisObject)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    RELEASE_AND_RETURN(throwScope, (toJS<IDLLegacyNullToEmptyStringAdaptor<IDLUSVString>>(lexicalGlobalObject, throwScope, impl.getPropertyValueInternal(CSSPropertyPropertyName))));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestCSSProperty_property, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    return IDLAttribute<JSTestCSSProperty>::get<jsTestCSSProperty_propertyGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, "property");
+}
+
+static inline bool setJSTestCSSProperty_propertySetter(JSGlobalObject& lexicalGlobalObject, JSTestCSSProperty& thisObject, JSValue value)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    CustomElementReactionStack customElementReactionStack(lexicalGlobalObject);
+    auto& impl = thisObject.wrapped();
+    auto nativeValue = convert<IDLLegacyNullToEmptyStringAdaptor<IDLUSVString>>(lexicalGlobalObject, value);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {
+        return impl.setPropertyValueInternal(CSSPropertyPropertyName, WTFMove(nativeValue));
+    });
+    return true;
+}
+
+JSC_DEFINE_CUSTOM_SETTER(setJSTestCSSProperty_property, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
+{
+    return IDLAttribute<JSTestCSSProperty>::set<setJSTestCSSProperty_propertySetter>(*lexicalGlobalObject, thisValue, encodedValue, "property");
+}
+
+JSC::IsoSubspace* JSTestCSSProperty::subspaceForImpl(JSC::VM& vm)
+{
+    auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
+    auto& spaces = clientData.subspaces();
+    if (auto* space = spaces.m_subspaceForTestCSSProperty.get())
+        return space;
+    static_assert(std::is_base_of_v<JSC::JSDestructibleObject, JSTestCSSProperty> || !JSTestCSSProperty::needsDestruction);
+    if constexpr (std::is_base_of_v<JSC::JSDestructibleObject, JSTestCSSProperty>)
+        spaces.m_subspaceForTestCSSProperty = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), JSTestCSSProperty);
+    else
+        spaces.m_subspaceForTestCSSProperty = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.cellHeapCellType.get(), JSTestCSSProperty);
+    auto* space = spaces.m_subspaceForTestCSSProperty.get();
+IGNORE_WARNINGS_BEGIN("unreachable-code")
+IGNORE_WARNINGS_BEGIN("tautological-compare")
+    void (*myVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSTestCSSProperty::visitOutputConstraints;
+    void (*jsCellVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSC::JSCell::visitOutputConstraints;
+    if (myVisitOutputConstraint != jsCellVisitOutputConstraint)
+        clientData.outputConstraintSpaces().append(space);
+IGNORE_WARNINGS_END
+IGNORE_WARNINGS_END
+    return space;
+}
+
+void JSTestCSSProperty::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
+{
+    auto* thisObject = jsCast<JSTestCSSProperty*>(cell);
+    analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped());
+    if (thisObject->scriptExecutionContext())
+        analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
+    Base::analyzeHeap(cell, analyzer);
+}
+
+bool JSTestCSSPropertyOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason)
+{
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(visitor);
+    UNUSED_PARAM(reason);
+    return false;
+}
+
+void JSTestCSSPropertyOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+    auto* jsTestCSSProperty = static_cast<JSTestCSSProperty*>(handle.slot()->asCell());
+    auto& world = *static_cast<DOMWrapperWorld*>(context);
+    uncacheWrapper(world, &jsTestCSSProperty->wrapped(), jsTestCSSProperty);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7TestCSSProperty@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore15TestCSSPropertyE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<TestCSSProperty>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+    const void* actualVTablePointer = getVTablePointer(impl.ptr());
+#if PLATFORM(WIN)
+    void* expectedVTablePointer = __identifier("??_7TestCSSProperty@WebCore@@6B@");
+#else
+    void* expectedVTablePointer = &_ZTVN7WebCore15TestCSSPropertyE[2];
+#endif
+
+    // If this fails TestCSSProperty does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
+    static_assert(std::is_polymorphic<TestCSSProperty>::value, "TestCSSProperty is not polymorphic");
+
+    // If you hit this assertion you either have a use after free bug, or
+    // TestCSSProperty has subclasses. If TestCSSProperty has subclasses that get passed
+    // to toJS() we currently require TestCSSProperty you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
+    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+    return createWrapper<TestCSSProperty>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TestCSSProperty& impl)
+{
+    return wrap(lexicalGlobalObject, globalObject, impl);
+}
+
+TestCSSProperty* JSTestCSSProperty::toWrapped(JSC::VM& vm, JSC::JSValue value)
+{
+    if (auto* wrapper = jsDynamicCast<JSTestCSSProperty*>(vm, value))
+        return &wrapper->wrapped();
+    return nullptr;
+}
+
+}

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCSSProperty.h (0 => 273688)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCSSProperty.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCSSProperty.h	2021-03-01 21:27:39 UTC (rev 273688)
@@ -0,0 +1,93 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#include "JSDOMWrapper.h"
+#include "TestCSSProperty.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSTestCSSProperty : public JSDOMWrapper<TestCSSProperty> {
+public:
+    using Base = JSDOMWrapper<TestCSSProperty>;
+    static JSTestCSSProperty* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestCSSProperty>&& impl)
+    {
+        JSTestCSSProperty* ptr = new (NotNull, JSC::allocateCell<JSTestCSSProperty>(globalObject->vm().heap)) JSTestCSSProperty(structure, *globalObject, WTFMove(impl));
+        ptr->finishCreation(globalObject->vm());
+        return ptr;
+    }
+
+    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
+    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
+    static TestCSSProperty* toWrapped(JSC::VM&, JSC::JSValue);
+    static void destroy(JSC::JSCell*);
+
+    DECLARE_INFO;
+
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info(), JSC::NonArray);
+    }
+
+    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    template<typename, JSC::SubspaceAccess mode> static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
+    {
+        if constexpr (mode == JSC::SubspaceAccess::Concurrently)
+            return nullptr;
+        return subspaceForImpl(vm);
+    }
+    static JSC::IsoSubspace* subspaceForImpl(JSC::VM& vm);
+    static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
+protected:
+    JSTestCSSProperty(JSC::Structure*, JSDOMGlobalObject&, Ref<TestCSSProperty>&&);
+
+    void finishCreation(JSC::VM&);
+};
+
+class JSTestCSSPropertyOwner final : public JSC::WeakHandleOwner {
+public:
+    bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final;
+    void finalize(JSC::Handle<JSC::Unknown>, void* context) final;
+};
+
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestCSSProperty*)
+{
+    static NeverDestroyed<JSTestCSSPropertyOwner> owner;
+    return &owner.get();
+}
+
+inline void* wrapperKey(TestCSSProperty* wrappableObject)
+{
+    return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, TestCSSProperty&);
+inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TestCSSProperty* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<TestCSSProperty>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<TestCSSProperty>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+template<> struct JSDOMWrapperConverterTraits<TestCSSProperty> {
+    using WrapperClass = JSTestCSSProperty;
+    using ToWrappedReturnType = TestCSSProperty*;
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (273687 => 273688)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2021-03-01 21:27:39 UTC (rev 273688)
@@ -37,6 +37,7 @@
 #include "JSTest.h"
 #include "JSTestCEReactions.h"
 #include "JSTestCEReactionsStringifier.h"
+#include "JSTestCSSProperty.h"
 #include "JSTestCallTracer.h"
 #include "JSTestClassWithJSBuiltinConstructor.h"
 #include "JSTestDOMJIT.h"
@@ -165,6 +166,8 @@
 static JSC_DECLARE_CUSTOM_SETTER(setJSTestGlobalObject_TestCEReactionsConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestCEReactionsStringifierConstructor);
 static JSC_DECLARE_CUSTOM_SETTER(setJSTestGlobalObject_TestCEReactionsStringifierConstructor);
+static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestCSSPropertyConstructor);
+static JSC_DECLARE_CUSTOM_SETTER(setJSTestGlobalObject_TestCSSPropertyConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestCallTracerConstructor);
 static JSC_DECLARE_CUSTOM_SETTER(setJSTestGlobalObject_TestCallTracerConstructor);
 #if ENABLE(TEST_CONDITIONAL)
@@ -294,13 +297,13 @@
 
 /* Hash table */
 
-static const struct CompactHashIndex JSTestGlobalObjectTableIndex[267] = {
+static const struct CompactHashIndex JSTestGlobalObjectTableIndex[268] = {
     { -1, -1 },
-    { 39, -1 },
+    { 40, -1 },
     { -1, -1 },
     { 0, -1 },
     { 4, -1 },
-    { 43, -1 },
+    { 44, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -308,7 +311,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 52, -1 },
+    { 53, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -316,7 +319,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 61, -1 },
+    { 62, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -330,14 +333,14 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 33, -1 },
+    { 34, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 64, -1 },
-    { 12, 260 },
+    { 5, 267 },
+    { 13, 260 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -345,11 +348,11 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 37, -1 },
-    { 18, 257 },
-    { 6, -1 },
+    { 38, -1 },
+    { 19, 257 },
+    { 7, -1 },
     { -1, -1 },
-    { 44, -1 },
+    { 45, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -358,7 +361,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 35, -1 },
+    { 36, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -365,13 +368,13 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 20, 265 },
+    { 21, 265 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 5, -1 },
+    { 6, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -379,8 +382,8 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 28, -1 },
-    { 54, -1 },
+    { 29, -1 },
+    { 55, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -387,19 +390,19 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 9, 256 },
+    { 10, 256 },
     { -1, -1 },
-    { 56, -1 },
-    { 17, -1 },
+    { 57, -1 },
+    { 18, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 16, -1 },
+    { 17, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 34, -1 },
+    { 35, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -407,14 +410,14 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 22, -1 },
+    { 23, -1 },
     { -1, -1 },
     { 2, -1 },
-    { 36, -1 },
+    { 37, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 19, -1 },
+    { 20, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -427,15 +430,15 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 26, -1 },
+    { 27, -1 },
     { -1, -1 },
-    { 41, -1 },
+    { 42, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 51, -1 },
+    { 52, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -443,10 +446,10 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 46, -1 },
+    { 47, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 10, -1 },
+    { 11, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -453,12 +456,12 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 62, -1 },
+    { 63, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 25, -1 },
-    { 30, -1 },
+    { 26, -1 },
+    { 31, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -468,9 +471,9 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 14, 259 },
+    { 15, 259 },
     { -1, -1 },
-    { 57, -1 },
+    { 58, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -479,11 +482,11 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 32, 266 },
+    { 33, 266 },
     { -1, -1 },
-    { 15, -1 },
+    { 16, -1 },
     { -1, -1 },
-    { 60, -1 },
+    { 61, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -502,11 +505,11 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 45, -1 },
+    { 46, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 11, -1 },
+    { 12, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -515,19 +518,19 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 55, -1 },
+    { 56, -1 },
     { -1, -1 },
     { 1, -1 },
     { -1, -1 },
-    { 8, -1 },
+    { 9, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 47, 263 },
-    { 7, 262 },
+    { 48, 263 },
+    { 8, 262 },
     { -1, -1 },
-    { 58, -1 },
+    { 59, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -534,34 +537,35 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 13, -1 },
+    { 14, -1 },
     { -1, -1 },
-    { 23, -1 },
+    { 24, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 29, -1 },
+    { 30, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { 3, -1 },
-    { 49, -1 },
-    { -1, -1 },
     { 50, -1 },
     { -1, -1 },
+    { 51, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 21, 258 },
-    { 24, 264 },
-    { 27, 261 },
-    { 31, -1 },
-    { 38, -1 },
-    { 40, -1 },
-    { 42, -1 },
-    { 48, -1 },
-    { 53, -1 },
-    { 59, -1 },
-    { 63, -1 },
+    { -1, -1 },
+    { 22, 258 },
+    { 25, 264 },
+    { 28, 261 },
+    { 32, -1 },
+    { 39, -1 },
+    { 41, -1 },
+    { 43, -1 },
+    { 49, -1 },
+    { 54, -1 },
+    { 60, -1 },
+    { 64, -1 },
+    { 65, -1 },
 };
 
 
@@ -576,6 +580,7 @@
 #endif
     { "TestCEReactions", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestCEReactionsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObject_TestCEReactionsConstructor) } },
     { "TestCEReactionsStringifier", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestCEReactionsStringifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObject_TestCEReactionsStringifierConstructor) } },
+    { "TestCSSProperty", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestCSSPropertyConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObject_TestCSSPropertyConstructor) } },
     { "TestCallTracer", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestCallTracerConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObject_TestCallTracerConstructor) } },
 #if ENABLE(TEST_CONDITIONAL)
     { "TestCallbackInterface", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestCallbackInterfaceConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObject_TestCallbackInterfaceConstructor) } },
@@ -650,7 +655,7 @@
     { "regularOperation", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestGlobalObjectInstanceFunction_regularOperation), (intptr_t) (1) } },
 };
 
-static const HashTable JSTestGlobalObjectTable = { 65, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
+static const HashTable JSTestGlobalObjectTable = { 66, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
 /* Hash table for constructor */
 
 static const HashTableValue JSTestGlobalObjectConstructorTableValues[] =
@@ -967,6 +972,29 @@
     return IDLAttribute<JSTestGlobalObject>::set<setJSTestGlobalObject_TestCEReactionsStringifierConstructorSetter>(*lexicalGlobalObject, thisValue, encodedValue, "TestCEReactionsStringifier");
 }
 
+static inline JSValue jsTestGlobalObject_TestCSSPropertyConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject)
+{
+    UNUSED_PARAM(lexicalGlobalObject);
+    return JSTestCSSProperty::getConstructor(JSC::getVM(&lexicalGlobalObject), thisObject.globalObject());
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestGlobalObject_TestCSSPropertyConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    return IDLAttribute<JSTestGlobalObject>::get<jsTestGlobalObject_TestCSSPropertyConstructorGetter>(*lexicalGlobalObject, thisValue, "TestCSSProperty");
+}
+
+static inline bool setJSTestGlobalObject_TestCSSPropertyConstructorSetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject, JSValue value)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    // Shadowing a built-in constructor.
+    return thisObject.putDirect(vm, Identifier::fromString(vm, reinterpret_cast<const LChar*>("TestCSSProperty"), strlen("TestCSSProperty")), value);
+}
+
+JSC_DEFINE_CUSTOM_SETTER(setJSTestGlobalObject_TestCSSPropertyConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
+{
+    return IDLAttribute<JSTestGlobalObject>::set<setJSTestGlobalObject_TestCSSPropertyConstructorSetter>(*lexicalGlobalObject, thisValue, encodedValue, "TestCSSProperty");
+}
+
 static inline JSValue jsTestGlobalObject_TestCallTracerConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject)
 {
     UNUSED_PARAM(lexicalGlobalObject);

Modified: trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep (273687 => 273688)


--- trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep	2021-03-01 21:27:39 UTC (rev 273688)
@@ -24,6 +24,9 @@
 JSTestCEReactionsStringifier.h: 
 DOMTestCEReactionsStringifier.h: 
 WebDOMTestCEReactionsStringifier.h: 
+JSTestCSSProperty.h: 
+DOMTestCSSProperty.h: 
+WebDOMTestCSSProperty.h: 
 JSTestCallTracer.h: 
 DOMTestCallTracer.h: 
 WebDOMTestCallTracer.h: 

Added: trunk/Source/WebCore/bindings/scripts/test/TestCSSProperty.idl (0 => 273688)


--- trunk/Source/WebCore/bindings/scripts/test/TestCSSProperty.idl	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestCSSProperty.idl	2021-03-01 21:27:39 UTC (rev 273688)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+typedef USVString CSSOMString;
+
+[
+    Exposed=TestGlobalObject
+] interface TestCSSProperty {
+    [CEReactions, CSSProperty=PropertyName] attribute [LegacyNullToEmptyString] CSSOMString property;
+};

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (273687 => 273688)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-03-01 21:27:39 UTC (rev 273688)
@@ -4278,7 +4278,7 @@
     return getPropertyValue(propertyID);
 }
 
-ExceptionOr<bool> CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool)
+ExceptionOr<void> CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool)
 {
     return Exception { NoModificationAllowedError };
 }

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h (273687 => 273688)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2021-03-01 21:27:39 UTC (rev 273688)
@@ -133,7 +133,7 @@
     ExceptionOr<void> setCssText(const String&) final;
     RefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) final;
     String getPropertyValueInternal(CSSPropertyID) final;
-    ExceptionOr<bool> setPropertyInternal(CSSPropertyID, const String& value, bool important) final;
+    ExceptionOr<void> setPropertyInternal(CSSPropertyID, const String& value, bool important) final;
     Ref<MutableStyleProperties> copyProperties() const final;
 
     RefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID, EUpdateLayout = UpdateLayout) const;

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.cpp (273687 => 273688)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.cpp	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.cpp	2021-03-01 21:27:39 UTC (rev 273688)
@@ -212,11 +212,27 @@
     return propertyIDFromJavaScriptCSSPropertyName(propertyName, nullptr);
 }
 
+ExceptionOr<void> CSSStyleDeclaration::setPropertyValueInternal(CSSPropertyID propertyID, String value)
+{
+    bool important = false;
+    if (DeprecatedGlobalSettings::shouldRespectPriorityInCSSAttributeSetters()) {
+        auto importantIndex = value.findIgnoringASCIICase("!important");
+        if (importantIndex && importantIndex != notFound) {
+            important = true;
+            value = value.left(importantIndex - 1);
+        }
+    }
+
+    return setPropertyInternal(propertyID, WTFMove(value), important);
+}
+
 const Settings* CSSStyleDeclaration::settings() const
 {
     return parentElement() ? &parentElement()->document().settings() : nullptr;
 }
 
+#if !ENABLE(ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION)
+
 Optional<Variant<String, double>> CSSStyleDeclaration::namedItem(const AtomString& propertyName)
 {
     // FIXME: This is going to return incorrect results for css properties disabled by Settings if settings() returns nullptr.
@@ -227,7 +243,7 @@
     if (auto value = getPropertyCSSValueInternal(propertyID))
         return Variant<String, double> { value->cssText() };
 
-    // If the property is a shorthand property (such as "padding"), it can only be accessed using getPropertyValue.
+    // If the property is a shorthand property (such as "padding"), it can only be accessed using getPropertyValueInternal.
     return Variant<String, double> { getPropertyValueInternal(propertyID) };
 }
 
@@ -241,21 +257,7 @@
     }
 
     propertySupported = true;
-
-    bool important = false;
-    if (DeprecatedGlobalSettings::shouldRespectPriorityInCSSAttributeSetters()) {
-        auto importantIndex = value.findIgnoringASCIICase("!important");
-        if (importantIndex && importantIndex != notFound) {
-            important = true;
-            value = value.left(importantIndex - 1);
-        }
-    }
-
-    auto setPropertyInternalResult = setPropertyInternal(propertyID, value, important);
-    if (setPropertyInternalResult.hasException())
-        return setPropertyInternalResult.releaseException();
-
-    return { };
+    return setPropertyValueInternal(propertyID, WTFMove(value));
 }
 
 Vector<AtomString> CSSStyleDeclaration::supportedPropertyNames() const
@@ -283,6 +285,7 @@
 
     return result;
 }
+#endif
 
 String CSSStyleDeclaration::cssFloat()
 {
@@ -291,10 +294,7 @@
 
 ExceptionOr<void> CSSStyleDeclaration::setCssFloat(const String& value)
 {
-    auto result = setPropertyInternal(CSSPropertyFloat, value, false /* important */);
-    if (result.hasException())
-        return result.releaseException();
-    return { };
+    return setPropertyInternal(CSSPropertyFloat, value, false /* important */);
 }
 
 }

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (273687 => 273688)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.h	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h	2021-03-01 21:27:39 UTC (rev 273688)
@@ -66,7 +66,8 @@
     // The CSSValue returned by this function should not be exposed to the web as it may be used by multiple documents at the same time.
     virtual RefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) = 0;
     virtual String getPropertyValueInternal(CSSPropertyID) = 0;
-    virtual ExceptionOr<bool> setPropertyInternal(CSSPropertyID, const String& value, bool important) = 0;
+    virtual ExceptionOr<void> setPropertyInternal(CSSPropertyID, const String& value, bool important) = 0;
+    ExceptionOr<void> setPropertyValueInternal(CSSPropertyID, String);
 
     virtual Ref<MutableStyleProperties> copyProperties() const = 0;
 
@@ -74,12 +75,16 @@
 
     virtual const Settings* settings() const;
 
-    // Bindings support.
+#if !ENABLE(ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION)
+    // Named-item based implementation support.
     Optional<Variant<String, double>> namedItem(const AtomString&);
     ExceptionOr<void> setNamedItem(const AtomString& name, String value, bool& propertySupported);
     Vector<AtomString> supportedPropertyNames() const;
+#endif
 
+    // FIXME: This needs to pass in a Settings& to work correctly.
     static CSSPropertyID getCSSPropertyIDFromJavaScriptPropertyName(const AtomString&);
+
 protected:
     CSSStyleDeclaration() = default;
 };

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.idl (273687 => 273688)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.idl	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.idl	2021-03-01 21:27:39 UTC (rev 273688)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2021 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Samuel Weinig <sam.wei...@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -20,38 +20,38 @@
 
 [
     ExportMacro=WEBCORE_EXPORT,
-    DefaultDefineOwnProperty,
     GenerateIsReachable,
     JSCustomHeader,
     JSCustomMarkFunction,
     SkipVTableValidation,
-    Exposed=Window
+    Exposed=Window,
+#if !defined(ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION) || !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION
+    DefaultDefineOwnProperty
+#endif
 ] interface CSSStyleDeclaration {
+    // FIXME: These attributes and functions should use CSSOMString not DOMString.
+
     [CEReactions] attribute DOMString cssText;
-
-    DOMString getPropertyValue(DOMString propertyName);
-
-    [CEReactions, MayThrowException] DOMString removeProperty(DOMString propertyName);
-    DOMString? getPropertyPriority(DOMString propertyName);
-
-    [CEReactions, MayThrowException] undefined setProperty(DOMString propertyName, [LegacyNullToEmptyString] DOMString value, optional [LegacyNullToEmptyString] DOMString priority = "");
-
     readonly attribute unsigned long length;
     getter DOMString item(unsigned long index);
+    DOMString getPropertyValue(DOMString property);
+    // FIXME: The return value of 'getPropertyPriority' should not be nullable.
+    DOMString? getPropertyPriority(DOMString property);
+    [CEReactions, MayThrowException] undefined setProperty(DOMString property, [LegacyNullToEmptyString] DOMString value, optional [LegacyNullToEmptyString] DOMString priority = "");
+    [CEReactions, MayThrowException] DOMString removeProperty(DOMString property);
     readonly attribute CSSRule? parentRule;
-
     [CEReactions] attribute [LegacyNullToEmptyString] DOMString cssFloat;
 
+    // Non-standard.
     DOMString? getPropertyShorthand(optional DOMString propertyName);
     boolean isPropertyImplicit(optional DOMString propertyName);
+    DeprecatedCSSOMValue? getPropertyCSSValue(DOMString propertyName);
 
+#if !defined(ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION) || !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION
     // Use named getters/setters for all support CSS property names. The spec says
     // these should be normal attributes, but there are too many combinations with
-    // prefixes for this to be practical. If we remove legacy aliases, we should
-    // reconsider this decision.
+    // prefixes for this to be practical with current code generation.
     getter (DOMString or double) (DOMString name);
     [CEReactions, CallNamedSetterOnlyForSupportedProperties] setter undefined (DOMString name, [LegacyNullToEmptyString] DOMString value);
-
-    // This method is deprecated, and we would like to drop support for it someday
-    DeprecatedCSSOMValue? getPropertyCSSValue(DOMString propertyName);
+#endif
 };

Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (273687 => 273688)


--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp	2021-03-01 21:27:39 UTC (rev 273688)
@@ -308,22 +308,22 @@
     if (!relatedValue.isEmpty())
         return relatedValue;
     
-    return String();
+    return { };
 }
 
-ExceptionOr<bool> PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important)
+ExceptionOr<void> PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important)
 { 
-    StyleAttributeMutationScope mutationScope(this);
+    StyleAttributeMutationScope mutationScope { this };
     if (!willMutate())
-        return false;
+        return { };
 
-    bool changed = m_propertySet->setProperty(propertyID, value, important, cssParserContext());
-
-    didMutate(changed ? PropertyChanged : NoChanges);
-
-    if (changed)
+    if (m_propertySet->setProperty(propertyID, value, important, cssParserContext())) {
+        didMutate(PropertyChanged);
         mutationScope.enqueueMutationRecord();
-    return changed;
+    } else
+        didMutate(NoChanges);
+        
+    return { };
 }
 
 RefPtr<DeprecatedCSSOMValue> PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM(CSSValue* internalValue)

Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h (273687 => 273688)


--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h	2021-03-01 21:27:39 UTC (rev 273688)
@@ -79,7 +79,7 @@
     ExceptionOr<void> setCssText(const String&) final;
     RefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) final;
     String getPropertyValueInternal(CSSPropertyID) final;
-    ExceptionOr<bool> setPropertyInternal(CSSPropertyID, const String& value, bool important) final;
+    ExceptionOr<void> setPropertyInternal(CSSPropertyID, const String& value, bool important) final;
     
     Ref<MutableStyleProperties> copyProperties() const final;
 

Modified: trunk/Source/WebCore/css/makeprop.pl (273687 => 273688)


--- trunk/Source/WebCore/css/makeprop.pl	2021-03-01 21:24:23 UTC (rev 273687)
+++ trunk/Source/WebCore/css/makeprop.pl	2021-03-01 21:27:39 UTC (rev 273688)
@@ -1358,3 +1358,155 @@
     $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf";
 }
 system("\"$gperf\" --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf --output-file=CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?";
+
+# Generate CSSStyleDeclaration+PropertyNames.idl
+
+# https://drafts.csswg.org/cssom/#css-property-to-idl-attribute
+sub cssPropertyToIDLAttribute($$$)
+{
+    my $property = shift;
+    my $lowercaseFirst = shift;
+    my $uppercaseFirst = shift;
+
+    my $output = "";
+    my $uppercaseNext = $uppercaseFirst;
+
+    if ($lowercaseFirst) {
+        $property = substr($property, 1);
+    }
+
+    foreach my $character (split //, $property) {
+        if ($character eq "-") {
+            $uppercaseNext = 1;
+        } elsif ($uppercaseNext) {
+            $uppercaseNext = 0;
+            $output .= uc $character;
+        } else {
+            $output .= $character;
+        }
+    }
+
+    return $output;
+}
+
+my %namesAndAliasesToName;
+foreach my $name (@names) {
+    if (grep { $_ eq $name } @internalProprerties) {
+        next;
+    }
+    $namesAndAliasesToName{$name} = $name;
+    for my $alias (@{$nameToAliases{$name}}) {
+        $namesAndAliasesToName{$alias} = $name;
+    }
+}
+my @namesAndAliases = sort keys(%namesAndAliasesToName);
+
+open CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL, ">", "CSSStyleDeclaration+PropertyNames.idl" or die "Could not open CSSStyleDeclaration+PropertyNames.idl for writing\n";
+print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
+// This file is automatically generated from $inputFile by the makeprop.pl script. Do not edit it.
+
+typedef USVString CSSOMString;
+
+partial interface CSSStyleDeclaration {
+
+#if defined(ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION) && ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION
+
+EOF
+
+print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
+    // For each CSS property property that is a supported CSS property, the following
+    // partial interface applies where camel-cased attribute is obtained by running the
+    // CSS property to IDL attribute algorithm for property.
+    // Example: font-size -> element.style.fontSize
+    // Example: -webkit-transform -> element.style.WebkitTransform
+    // [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _camel_cased_attribute;
+EOF
+
+foreach my $nameOrAlias (@namesAndAliases) {
+    my $camelCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 0, 0);
+    my $name = $namesAndAliasesToName{$nameOrAlias};
+    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
+
+    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
+    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
+    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
+    my $extendedAttributes = join(", ", @extendedAttributeValues);
+
+    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${camelCasedAttributeName};\n";
+}
+
+print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
+
+    // For each CSS property property that is a supported CSS property and that begins
+    // with the string -webkit-, the following partial interface applies where webkit-cased
+    // attribute is obtained by running the CSS property to IDL attribute algorithm for
+    // property, with the lowercase first flag set.
+    // Example: -webkit-transform -> element.style.webkitTransform
+    // [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _webkit_cased_attribute;
+EOF
+
+foreach my $nameOrAlias (grep { $_ =~ /^\-webkit\-/ } @namesAndAliases) {
+    my $webkitCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 1, 0);
+    my $name = $namesAndAliasesToName{$nameOrAlias};
+    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
+
+    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
+    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
+    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
+    my $extendedAttributes = join(", ", @extendedAttributeValues);
+
+    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${webkitCasedAttributeName};\n";
+}
+
+print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
+
+    // For each CSS property property that is a supported CSS property, except for
+    // properties that have no "-" (U+002D) in the property name, the following partial
+    // interface applies where dashed attribute is property.
+    // Example: font-size -> element.style['font-size']
+    // Example: -webkit-transform -> element.style.['-webkit-transform']
+    // [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _dashed_attribute;
+EOF
+foreach my $nameOrAlias (grep { $_ =~ /\-/ } @namesAndAliases) {
+    my $dashedAttributeName = $nameOrAlias;
+    my $name = $namesAndAliasesToName{$nameOrAlias};
+    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
+
+    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
+    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
+    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
+    my $extendedAttributes = join(", ", @extendedAttributeValues);
+
+    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${dashedAttributeName};\n";
+}
+
+# Everything below here is non-standard.
+
+print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
+
+    // Non-standard. Special case properties starting with -epub- like is done for
+    // -webkit-, where attribute is obtained by running the CSS property to IDL attribute
+    // algorithm for property, with the lowercase first flag set.
+    // Example: -epub-caption-side -> element.style.epubCaptionSide
+EOF
+foreach my $nameOrAlias (grep { $_ =~ /^\-epub\-/ } @namesAndAliases) {
+    my $epubCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 1, 0);
+    my $name = $namesAndAliasesToName{$nameOrAlias};
+    my $propertyId = $nameToId{$namesAndAliasesToName{$name}};
+
+    my @extendedAttributeValues = ("CSSProperty=${propertyId}");
+    push(@extendedAttributeValues, "EnabledBySetting=${settingsFlags{$name}}") if $settingsFlags{$name};
+    push(@extendedAttributeValues, "EnabledAtRuntime=${runtimeFlags{$name}}") if $runtimeFlags{$name};
+    my $extendedAttributes = join(", ", @extendedAttributeValues);
+
+    print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL "    [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString ${epubCasedAttributeName};\n";
+}
+
+print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF";
+
+#endif
+};
+
+EOF
+
+close CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to