haikuwebkit/LayoutTests/fast/dom/CSSStyleDeclaration
Sam Weinig e32526d787 Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior
https://bugs.webkit.org/show_bug.cgi?id=222518
<rdar://problem/75136887>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/css/cssom/cssstyledeclaration-properties-expected.txt:
Update test result now that it is passing.

Source/WebCore:

Re-implement proper (not using named-getters) support for the CSSStyleDeclaration bindings
using a new DelegateToSharedSyntheticAttribute extended atttribute which allows IDL attributes
to share a custom getter / setter implementation and delegate their implementation to it. When
using this functionality, the synthetic attribute's implementation is passed the original property
name so it can implement functionality based on it.

We use this for CSSStyleDeclaration by breaking the huge list of generated properties into
four groups, each with their own synthetic attribute. The groups are based on the different
transformation rules in the spec.

* bindings/js/JSDOMAttribute.h:
(WebCore::IDLAttribute::setPassingPropertyName):
(WebCore::IDLAttribute::getPassingPropertyName):
Add overloads of get/set that pass the property name to the provided function. These can't
be simple overloads of get/set as MSVC does not allow overloading with only a non-type
template parameters differentiating.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
Eagerly generate the any synthetic attributes before the rest of code generation,
matching the behavior of other synthetic constructions like map/set/stringifiers.

(GetAttributeGetterName):
(GetAttributeSetterName):
Add special cases to getter/setter name generation to forward to the generated
name of the synthetic attribute when delegating.

(GenerateImplementation):
Extract attribute function forward declaration genation into a new GenerateAttributeGetterAndSetterDeclaration
subroutine and use it for generation of both normal and synthetic attributes. Also adds
synthetic attributes to the list of attributes to generate function implementations for.

(GenerateAttributeGetterAndSetterDeclaration):
Extracted from GenerateImplementation. Adds extra condition to bail if DelegateToSharedSyntheticAttribute
is specified.

(GenerateAttributeGetterBodyDefinition):
Add support for the new CallWith=PropertyName extended attribute by adding a PropertyName
argument to the signature of getter body if it is present. Removes now unnecessary support
for the CSSProperty extended attribute.

(GenerateAttributeGetterTrampolineDefinition):
Switch function name from get to getPassingPropertyName if CallWith=PropertyName is specified.

(GenerateAttributeGetterDefinition):
Adds extra condition to bail if DelegateToSharedSyntheticAttribute is specified.

(GenerateAttributeSetterBodyDefinition):
Add support for the new CallWith=PropertyName extended attribute by adding a PropertyName
argument to the signature of getter body if it is present. Removes now unnecessary support
for the CSSProperty extended attribute.

(GenerateAttributeSetterTrampolineDefinition):
Switch function name from get to getPassingPropertyName if CallWith=PropertyName is specified.

(GenerateAttributeSetterDefinition):
Adds extra condition to bail if DelegateToSharedSyntheticAttribute is specified.

(GenerateCallWith):
Add support for the PropertyName value to CallWith.

(MakeSharedSyntheticAttribute):
Helper to generate the synthetic attribute from the base attribute with DelegateToSharedSyntheticAttribute
specefied. Maintains all existing extended attributes of the base attribute except
DelegateToSharedSyntheticAttribute is replaced with IsSharedSyntheticAttribute to avoid
infinite recursion.

(AddSharedSyntheticAttributesIfNeeded):
Helper to find all delegating attributes and generate / store the synthetic attributes.

(GetSharedSyntheticAttribute):
Helper to get the corresponding synthetic attribute given an attribute with
DelegateToSharedSyntheticAttribute specified on it.

* bindings/scripts/IDLAttributes.json:
Removes CSSProperty. Adds DelegateToSharedSyntheticAttribute. Adds PropertyName value to
CallWith and SetterCallWith.

* css/CSSStyleDeclaration.cpp:
(WebCore::lookupCSSPropertyFromIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForCamelCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForCamelCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForWebKitCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForWebKitCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForDashedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForDashedIDLAttribute):
(WebCore::CSSStyleDeclaration::propertyValueForEpubCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::setPropertyValueForEpubCasedIDLAttribute):
(WebCore::CSSStyleDeclaration::namedItem): Deleted.
(WebCore::CSSStyleDeclaration::setNamedItem): Deleted.
(WebCore::CSSStyleDeclaration::supportedPropertyNames const): Deleted.
* css/CSSStyleDeclaration.h:
Replace named-getter based implementation with helpers based on the definitions
in the CSSOM spec (plus one special set for 'epub' specializations we currently
maintain).

* css/CSSStyleDeclaration.idl:
Remove !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION sections now that
we can fully support ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION.

* css/makeprop.pl:
Remove !ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION sections now that
we can fully support ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION.
Replaces CSSProperty extended attributes with DelegateToSharedSyntheticAttribute and
CallWith=PropertyName, which together allow us to implement all the attributes with just
8 implementation functions.

* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/JSTestCSSProperty.cpp: Removed.
* bindings/scripts/test/JS/JSTestCSSProperty.h: Removed.
* bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.cpp: Added.
* bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.h: Added.
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestCSSProperty.idl: Removed.
* bindings/scripts/test/TestDelegateToSharedSyntheticAttribute.idl: Added.
Replace CSSProperty tests with DelegateToSharedSyntheticAttribute tests and update results
all around for new generation.

Source/WTF:

* wtf/PlatformEnable.h:
Remove ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION, as it is now the default and on everwhere.

LayoutTests:

* fast/css/style-enumerate-properties-expected.txt:
* fast/css/style-enumerate-properties.html:
* fast/dom/domListEnumeration-expected.txt:
* fast/dom/domListEnumeration.html:
Remove existing tests for iteration order, which is not standardized, and not consistent among
browsers. Adds a new one that checks invariants of the 4 groupings of properties which we currently
expect to hold, at least in our implementation.

* fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt:
* fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html:
Update now that the properties are proper attributes on the prototype.

* js/dom/put-override-should-not-use-ic.html:
Switch to using a DOMStringList as the object that overrides put, since CSSStyleDeclaration no longer does.

* transitions/transitions-parsing-expected.txt:
* transitions/transitions-parsing.html:
Remove Object.keys() aspect of the test, which is no longer meaningful since the
properties should no longer exist in the result set.


Canonical link: https://commits.webkit.org/236379@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-11 17:06:47 +00:00
..
access-longest-css-property-expected.txt
access-longest-css-property.html
css-computed-style-item-expected.txt
css-computed-style-item.html
css-properties-case-sensitive-expected.txt Source/WebCore: 2021-02-27 19:51:44 +00:00
css-properties-case-sensitive.html Source/WebCore: 2021-02-27 19:51:44 +00:00
css-style-item-expected.txt
css-style-item.html
cssstyledeclaration-properties-descriptor-expected.txt Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior 2021-04-11 17:06:47 +00:00
cssstyledeclaration-properties-descriptor.html Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior 2021-04-11 17:06:47 +00:00
empty-string-property-expected.txt
empty-string-property.html
transition-property-names-expected.txt
transition-property-names.html