WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-217623-20201015101005.patch (text/plain), 41.84 KB, created by
Sam Weinig
on 2020-10-15 10:10:05 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sam Weinig
Created:
2020-10-15 10:10:05 PDT
Size:
41.84 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 268505) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,22 @@ >+2020-10-13 Sam Weinig <weinig@apple.com> >+ >+ CSSStyleDeclaration breaks JS spec (properties not showing up in Object.getOwnPropertyNames) >+ https://bugs.webkit.org/show_bug.cgi?id=217623 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ [WIP] >+ >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (GenerateAttributeGetterBodyDefinition): >+ (GenerateAttributeSetterBodyDefinition): >+ * bindings/scripts/IDLAttributes.json: >+ * css/CSSStyleDeclaration.idl: >+ * css/makeprop.pl: >+ (cssPropertyToIDLAttribute): >+ > 2020-10-14 Chris Dumez <cdumez@apple.com> > > Vectorize downmixing in AudioBus::createByMixingToMono() >Index: Source/WebCore/CMakeLists.txt >=================================================================== >--- Source/WebCore/CMakeLists.txt (revision 268505) >+++ Source/WebCore/CMakeLists.txt (working copy) >@@ -1879,7 +1879,7 @@ list(APPEND WebCore_SOURCES ${WebCore_DE > > # 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} >@@ -1889,6 +1889,7 @@ add_custom_command( > 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 >Index: Source/WebCore/DerivedSources-output.xcfilelist >=================================================================== >--- Source/WebCore/DerivedSources-output.xcfilelist (revision 268505) >+++ Source/WebCore/DerivedSources-output.xcfilelist (working copy) >@@ -3,6 +3,7 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/Web > $(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 >@@ -290,6 +291,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/Web > $(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 >Index: Source/WebCore/DerivedSources.make >=================================================================== >--- Source/WebCore/DerivedSources.make (revision 268505) >+++ Source/WebCore/DerivedSources.make (working copy) >@@ -1327,6 +1327,7 @@ JS_BINDING_IDLS = \ > $(WebCore)/xml/XPathResult.idl \ > $(WebCore)/xml/XSLTProcessor.idl \ > InternalSettingsGenerated.idl \ >+ CSSStyleDeclaration+PropertyNames.idl \ > # > > # -------- >@@ -1418,6 +1419,7 @@ all : \ > StyleBuilderGenerated.cpp \ > StylePropertyShorthandFunctions.cpp \ > StylePropertyShorthandFunctions.h \ >+ CSSStyleDeclaration+PropertyNames.idl \ > UserAgentStyleSheets.h \ > WebKitFontFamilyNames.cpp \ > WebKitFontFamilyNames.h \ >@@ -1445,6 +1447,7 @@ CSS_PROPERTY_NAME_FILES = \ > StyleBuilderGenerated.cpp \ > StylePropertyShorthandFunctions.cpp \ > StylePropertyShorthandFunctions.h \ >+ CSSStyleDeclaration+PropertyNames.idl \ > # > CSS_PROPERTY_NAME_FILES_PATTERNS = $(subst .,%,$(CSS_PROPERTY_NAME_FILES)) > >Index: Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >=================================================================== >--- Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (revision 268505) >+++ Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (working copy) >@@ -1187,15 +1187,12 @@ sub GenerateInvokeNamedPropertySetter > push(@$outputArray, $indent . "auto nativeValue = ${nativeValue};\n"); > push(@$outputArray, $indent . "RETURN_IF_EXCEPTION(throwScope, true);\n"); > >- push(@$outputArray, $indent . "bool isPropertySupported = true;\n") if $namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}; >- > my $namedSetterFunctionName = $namedSetterOperation->name || "setNamedItem"; > my $nativeValuePassExpression = PassArgumentExpression("nativeValue", $argument); > > my @arguments = (); > push(@arguments, "propertyNameToString(propertyName)"); > push(@arguments, $nativeValuePassExpression); >- push(@arguments, "isPropertySupported") if $namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}; > > my $functionString = "thisObject->wrapped().${namedSetterFunctionName}(" . join(", ", @arguments) . ")"; > push(@$outputArray, $indent . "invokeFunctorPropagatingExceptionIfNecessary(*lexicalGlobalObject, throwScope, [&] { return ${functionString}; });\n"); >@@ -1250,10 +1247,6 @@ sub GeneratePut > } > > GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . " ", $interface, $namedSetterOperation, "value"); >- if ($namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}) { >- push(@$outputArray, $additionalIndent . " if (!isPropertySupported)\n"); >- push(@$outputArray, $additionalIndent . " return JSObject::put(thisObject, lexicalGlobalObject, propertyName, value, putPropertySlot);\n"); >- } > push(@$outputArray, $additionalIndent . " return true;\n"); > > if (!$legacyOverrideBuiltins) { >@@ -1286,7 +1279,7 @@ sub GeneratePutByIndex > my $indexedSetterOperation = GetIndexedSetterOperation($interface); > > my $legacyOverrideBuiltins = $codeGenerator->InheritsExtendedAttribute($interface, "LegacyOverrideBuiltIns"); >- my $ellidesCallsToBase = ($namedSetterOperation && $legacyOverrideBuiltins) && !$interface->extendedAttributes->{Plugin} && !$namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}; >+ my $ellidesCallsToBase = ($namedSetterOperation && $legacyOverrideBuiltins) && !$interface->extendedAttributes->{Plugin}; > > push(@$outputArray, "bool ${className}::putByIndex(JSCell* cell, JSGlobalObject* lexicalGlobalObject, unsigned index, JSValue value, bool" . (!$ellidesCallsToBase ? " shouldThrow" : "") . ")\n"); > push(@$outputArray, "{\n"); >@@ -1328,10 +1321,6 @@ sub GeneratePutByIndex > } > > GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . " ", $interface, $namedSetterOperation, "value"); >- if ($namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}) { >- push(@$outputArray, $additionalIndent . " if (!isPropertySupported)\n"); >- push(@$outputArray, $additionalIndent . " return JSObject::putByIndex(cell, lexicalGlobalObject, index, value, shouldThrow);\n"); >- } > push(@$outputArray, $additionalIndent . " return true;\n"); > > if (!$legacyOverrideBuiltins) { >@@ -1475,10 +1464,7 @@ sub GenerateDefineOwnProperty > > # 2.2.2. Invoke the named property setter with P and Desc.[[Value]]. > GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . " ", $interface, $namedSetterOperation, "propertyDescriptor.value()"); >- if ($namedSetterOperation->extendedAttributes->{CallNamedSetterOnlyForSupportedProperties}) { >- push(@$outputArray, $additionalIndent . " if (!isPropertySupported)\n"); >- push(@$outputArray, $additionalIndent . " return JSObject::defineOwnProperty(object, lexicalGlobalObject, propertyName, propertyDescriptor, shouldThrow);\n"); >- } >+ > # 2.2.3. Return true. > push(@$outputArray, $additionalIndent . " return true;\n"); > } >@@ -1853,7 +1839,7 @@ sub MangleAttributeOrFunctionName > > $name =~ s/-/_dash_/g; > >- return $name; >+ return $name =~ /^_/ ? $name : '_' . $name; > } > > sub GetAttributeGetterName >@@ -1861,9 +1847,9 @@ sub GetAttributeGetterName > my ($interface, $className, $attribute) = @_; > > return GetJSBuiltinFunctionName($className, $attribute) if IsJSBuiltin($interface, $attribute); >- return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) if $attribute->isStatic; >- return $codeGenerator->WK_lcfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) . "Constructor" if $codeGenerator->IsConstructorType($attribute->type); >- return $codeGenerator->WK_lcfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)); >+ return $codeGenerator->WK_lcfirst($className) . "Constructor" . MangleAttributeOrFunctionName($attribute->name) if $attribute->isStatic; >+ return $codeGenerator->WK_lcfirst($className) . MangleAttributeOrFunctionName($attribute->name) . "Constructor" if $codeGenerator->IsConstructorType($attribute->type); >+ return $codeGenerator->WK_lcfirst($className) . MangleAttributeOrFunctionName($attribute->name); > } > > sub GetAttributeSetterName >@@ -1871,9 +1857,9 @@ sub GetAttributeSetterName > my ($interface, $className, $attribute) = @_; > > return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute)) if IsJSBuiltin($interface, $attribute); >- return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) if $attribute->isStatic; >- return "set" . $codeGenerator->WK_ucfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) . "Constructor" if $codeGenerator->IsConstructorType($attribute->type); >- return "set" . $codeGenerator->WK_ucfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)); >+ return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . MangleAttributeOrFunctionName($attribute->name) if $attribute->isStatic; >+ return "set" . $codeGenerator->WK_ucfirst($className) . MangleAttributeOrFunctionName($attribute->name) . "Constructor" if $codeGenerator->IsConstructorType($attribute->type); >+ return "set" . $codeGenerator->WK_ucfirst($className) . MangleAttributeOrFunctionName($attribute->name); > } > > sub GetFunctionName >@@ -1886,7 +1872,7 @@ sub GetFunctionName > $functionName = "SymbolIterator" if $functionName eq "[Symbol.Iterator]"; > > my $kind = $operation->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $operation) ? "Instance" : "Prototype"); >- return $codeGenerator->WK_lcfirst($className) . $kind . "Function" . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($functionName)); >+ return $codeGenerator->WK_lcfirst($className) . $kind . "Function" . $codeGenerator->WK_ucfirst($functionName); > } > > sub GetFullyQualifiedImplementationCallName >@@ -2204,8 +2190,6 @@ sub InstanceOverridesDefineOwnProperty > { > my $interface = shift; > >- return 0 if $interface->extendedAttributes->{DefaultDefineOwnProperty}; >- > return $interface->extendedAttributes->{CustomDefineOwnProperty} > || GetIndexedSetterOperation($interface) > || GetNamedSetterOperation($interface); >@@ -3979,6 +3963,9 @@ sub GetSkipVTableValidationForInterface > 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/; >@@ -5322,6 +5309,15 @@ sub GenerateAttributeGetterBodyDefinitio > 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 $getterName = $attribute->type->isUnion ? "getPropertyValueInternalForPosOrPixelPrefixed" : "getPropertyValueInternal"; >+ >+ my $toJSExpression = NativeToJSValueUsingReferences($attribute, $interface, "impl.${getterName}(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"); >@@ -5466,6 +5462,23 @@ sub GenerateAttributeSetterBodyDefinitio > 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 $setterName = $attribute->type->isUnion ? "setPropertyValueInternalForPosOrPixelPrefixed" : "setPropertyValueInternal"; >+ >+ 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.${setterName}(CSSProperty${propertyID}, WTFMove(nativeValue));\n"); >+ push(@$outputArray, " });\n"); >+ push(@$outputArray, " return true;\n"); > } elsif ($isConstructor) { > my $constructorType = $attribute->type->name; > $constructorType =~ s/Constructor$//; >Index: Source/WebCore/bindings/scripts/IDLAttributes.json >=================================================================== >--- Source/WebCore/bindings/scripts/IDLAttributes.json (revision 268505) >+++ Source/WebCore/bindings/scripts/IDLAttributes.json (working copy) >@@ -39,6 +39,10 @@ > "url": "https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions" > } > }, >+ "CSSProperty": { >+ "contextsAllowed": ["attribute"], >+ "values": ["*"] >+ }, > "CachedAttribute": { > "contextsAllowed": ["attribute"] > }, >@@ -49,9 +53,6 @@ > "CallbackThisObject": { > "contextsAllowed": ["callback-function", "operation"] > }, >- "CallNamedSetterOnlyForSupportedProperties": { >- "contextsAllowed": ["operation"] >- }, > "CallWith": { > "contextsAllowed": ["attribute", "operation"], > "values": ["Document", "ExecState", "ScriptExecutionContext", "GlobalObject", "ActiveWindow", "FirstWindow", "ResponsibleDocument", "World"], >@@ -157,9 +158,6 @@ > "Default": { > "contextsAllowed": ["operation"] > }, >- "DefaultDefineOwnProperty": { >- "contextsAllowed": ["interface"] >- }, > "DisabledByQuirk": { > "contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant", "dictionary-member", "includes"], > "values": ["*"], >Index: Source/WebCore/css/CSSStyleDeclaration.cpp >=================================================================== >--- Source/WebCore/css/CSSStyleDeclaration.cpp (revision 268505) >+++ Source/WebCore/css/CSSStyleDeclaration.cpp (working copy) >@@ -268,48 +268,8 @@ static CSSPropertyInfo propertyInfoFromJ > > } > >-CSSPropertyID CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName(const AtomString& propertyName) >-{ >- return propertyInfoFromJavaScriptCSSPropertyName(propertyName, nullptr).propertyID; >-} >- >-Optional<Variant<String, double>> CSSStyleDeclaration::namedItem(const AtomString& propertyName) >+ExceptionOr<void> CSSStyleDeclaration::setPropertyValueInternal(CSSPropertyID propertyID, String value) > { >- auto* settings = parentElement() ? &parentElement()->document().settings() : nullptr; >- auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings); >- if (!propertyInfo.propertyID) >- return WTF::nullopt; >- >- auto value = getPropertyCSSValueInternal(propertyInfo.propertyID); >- if (!value) { >- // If the property is a shorthand property (such as "padding"), it can only be accessed using getPropertyValue. >- return Variant<String, double> { getPropertyValueInternal(propertyInfo.propertyID) }; >- } >- >- if (propertyInfo.hadPixelOrPosPrefix && is<CSSPrimitiveValue>(*value)) { >- // Call this version of the getter so that, e.g., pixelTop returns top as a number >- // in pixel units and posTop should does the same _if_ this is a positioned element. >- // FIXME: If not a positioned element, MSIE documentation says posTop should return 0; this rule is not implemented. >- return Variant<String, double> { downcast<CSSPrimitiveValue>(*value).floatValue(CSSUnitType::CSS_PX) }; >- } >- >- return Variant<String, double> { value->cssText() }; >-} >- >-ExceptionOr<void> CSSStyleDeclaration::setNamedItem(const AtomString& propertyName, String value, bool& propertySupported) >-{ >- auto* settings = parentElement() ? &parentElement()->document().settings() : nullptr; >- auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings); >- if (!propertyInfo.propertyID) { >- propertySupported = false; >- return { }; >- } >- >- propertySupported = true; >- >- if (propertyInfo.hadPixelOrPosPrefix) >- value.append("px"); >- > bool important = false; > if (DeprecatedGlobalSettings::shouldRespectPriorityInCSSAttributeSetters()) { > auto importantIndex = value.findIgnoringASCIICase("!important"); >@@ -319,38 +279,43 @@ ExceptionOr<void> CSSStyleDeclaration::s > } > } > >- auto setPropertyInternalResult = setPropertyInternal(propertyInfo.propertyID, value, important); >+ auto setPropertyInternalResult = setPropertyInternal(propertyID, value, important); > if (setPropertyInternalResult.hasException()) > return setPropertyInternalResult.releaseException(); > > return { }; > } > >-Vector<AtomString> CSSStyleDeclaration::supportedPropertyNames() const >+Variant<double, String> CSSStyleDeclaration::getPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID propertyID) > { >- static unsigned numNames = 0; >- static const AtomString* const cssPropertyNames = [] { >- String names[numCSSProperties]; >- for (int i = 0; i < numCSSProperties; ++i) { >- CSSPropertyID id = static_cast<CSSPropertyID>(firstCSSProperty + i); >- // FIXME: Should take account for flags in settings(). >- if (isEnabledCSSProperty(id)) >- names[numNames++] = getJSPropertyName(id); >- } >- std::sort(&names[0], &names[numNames], WTF::codePointCompareLessThan); >- auto* identifiers = new AtomString[numNames]; >- for (unsigned i = 0; i < numNames; ++i) >- identifiers[i] = names[i]; >- return identifiers; >- }(); >+ auto value = getPropertyCSSValueInternal(propertyID); >+ if (!value) { >+ // If the property is a shorthand property (such as "padding"), it can only be accessed using getPropertyValue. >+ return getPropertyValueInternal(propertyID); >+ } >+ >+ if (is<CSSPrimitiveValue>(*value)) { >+ // Call this version of the getter so that, e.g., pixelTop returns top as a number >+ // in pixel units and posTop should does the same _if_ this is a positioned element. >+ // FIXME: If not a positioned element, MSIE documentation says posTop should return 0; this rule is not implemented. >+ return downcast<CSSPrimitiveValue>(*value).floatValue(CSSUnitType::CSS_PX); >+ } > >- Vector<AtomString> result; >- result.reserveInitialCapacity(numNames); >+ return value->cssText(); >+} > >- for (unsigned i = 0; i < numNames; ++i) >- result.uncheckedAppend(cssPropertyNames[i]); >+ExceptionOr<void> CSSStyleDeclaration::setPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID propertyID, Variant<double, String> value) >+{ >+ String stringValue = WTF::switchOn(value, [&] (const auto& input) { >+ return makeString(string, "px"); >+ }); > >- return result; >+ return setPropertyValueInternal(propertyID, WTFMove(stringValue)); >+} >+ >+CSSPropertyID CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName(const AtomString& propertyName) >+{ >+ return propertyInfoFromJavaScriptCSSPropertyName(propertyName, nullptr).propertyID; > } > > String CSSStyleDeclaration::cssFloat() >Index: Source/WebCore/css/CSSStyleDeclaration.h >=================================================================== >--- Source/WebCore/css/CSSStyleDeclaration.h (revision 268505) >+++ Source/WebCore/css/CSSStyleDeclaration.h (working copy) >@@ -66,18 +66,18 @@ public: > // 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<bool> setPropertyInternal(CSSPropertyID, String value, bool important) = 0; > > virtual Ref<MutableStyleProperties> copyProperties() const = 0; > > virtual CSSStyleSheet* parentStyleSheet() const { return nullptr; } > >- // Bindings support. >- Optional<Variant<String, double>> namedItem(const AtomString&); >- ExceptionOr<void> setNamedItem(const AtomString& name, String value, bool& propertySupported); >- Vector<AtomString> supportedPropertyNames() const; >+ ExceptionOr<void> setPropertyValueInternal(CSSPropertyID, String); >+ Variant<double, String> getPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID); >+ ExceptionOr<void> setPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID, Variant<double, String>); > > static CSSPropertyID getCSSPropertyIDFromJavaScriptPropertyName(const AtomString&); >+ > protected: > CSSStyleDeclaration() = default; > }; >Index: Source/WebCore/css/CSSStyleDeclaration.idl >=================================================================== >--- Source/WebCore/css/CSSStyleDeclaration.idl (revision 268505) >+++ Source/WebCore/css/CSSStyleDeclaration.idl (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. >+ * Copyright (C) 2006, 2007, 2009, 2020 Apple Inc. All rights reserved. > * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> > * > * This library is free software; you can redistribute it and/or >@@ -18,40 +18,29 @@ > * Boston, MA 02110-1301, USA. > */ > >+typedef USVString CSSOMString; >+ > [ > ExportMacro=WEBCORE_EXPORT, >- DefaultDefineOwnProperty, > GenerateIsReachable, > JSCustomHeader, > JSCustomMarkFunction, > SkipVTableValidation, > Exposed=Window > ] interface CSSStyleDeclaration { >- [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 = ""); >- >+ [CEReactions] attribute CSSOMString cssText; > readonly attribute unsigned long length; >- getter DOMString item(unsigned long index); >+ getter CSSOMString item(unsigned long index); >+ CSSOMString getPropertyValue(CSSOMString property); >+ // FIXME: The return value of 'getPropertyPriority' should not be nullable. >+ CSSOMString? getPropertyPriority(CSSOMString property); >+ [CEReactions, MayThrowException] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, optional [LegacyNullToEmptyString] CSSOMString priority = ""); >+ [CEReactions, MayThrowException] CSSOMString removeProperty(CSSOMString property); > readonly attribute CSSRule? parentRule; >+ [CEReactions] attribute [LegacyNullToEmptyString] CSSOMString cssFloat; > >- [CEReactions] attribute [LegacyNullToEmptyString] DOMString cssFloat; >- >+ // Non-standard. > DOMString? getPropertyShorthand(optional DOMString propertyName); > boolean isPropertyImplicit(optional DOMString propertyName); >- >- // 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. >- 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); > }; >Index: Source/WebCore/css/makeprop.pl >=================================================================== >--- Source/WebCore/css/makeprop.pl (revision 268505) >+++ Source/WebCore/css/makeprop.pl (working copy) >@@ -1358,3 +1358,175 @@ if (not $gperf) { > $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 { >+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"; >+ >+ // Non-standard. Add special cases for all properties not starting with -webkit- or -epub- >+ // that puts an new prefix of css, Css, pos, Pos, pixel and Pixel on each. >+ // Example top -> element.style.posTop >+ // Example top -> element.style.PixelTop >+EOF >+foreach my $nameOrAlias (grep { $_ !~ /^\-webkit\-|^\-epub\-/ } @namesAndAliases) { >+ my $camelCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 0, 1); >+ 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 css${camelCasedAttributeName};\n" unless $camelCasedAttributeName eq "Float"; >+ print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL " [CEReactions, ${extendedAttributes}] attribute [LegacyNullToEmptyString] CSSOMString Css${camelCasedAttributeName};\n" unless $camelCasedAttributeName eq "Float"; >+ print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL " [CEReactions, ${extendedAttributes}] attribute (double or [LegacyNullToEmptyString] CSSOMString) pos${camelCasedAttributeName};\n"; >+ print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL " [CEReactions, ${extendedAttributes}] attribute (double or [LegacyNullToEmptyString] CSSOMString) Pos${camelCasedAttributeName};\n"; >+ print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL " [CEReactions, ${extendedAttributes}] attribute (double or [LegacyNullToEmptyString] CSSOMString) pixel${camelCasedAttributeName};\n"; >+ print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL " [CEReactions, ${extendedAttributes}] attribute (double or [LegacyNullToEmptyString] CSSOMString) Pixel${camelCasedAttributeName};\n"; >+} >+ >+print CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL << "EOF"; >+}; >+EOF >+ >+close CSS_STYLE_DECLARATION_PROPERTY_NAMES_IDL; >Index: LayoutTests/fast/css/style-enumerate-properties.html >=================================================================== >--- LayoutTests/fast/css/style-enumerate-properties.html (revision 268494) >+++ LayoutTests/fast/css/style-enumerate-properties.html (working copy) >@@ -23,33 +23,6 @@ > shouldBeFalse("'bogus-random-String' in document.body.style"); > shouldBeTrue("'cssText' in document.body.style"); > shouldBeTrue("'getPropertyCSSValue' in document.body.style"); >- >- // Test CSS property order. >- var started; >- var cssPropertyCount = 0; >- var previous; >- var seenFilter; >- for (var p in document.body.style) { >- if (p === "alignmentBaseline") >- started = true; >- if (!started) >- continue; >- if (p === "filter") >- seenFilter = true; >- if (previous && previous >= p) { >- testFailed("Invalid CSS-mapped property order: '" + p + "' after '" + previous + "'"); >- break; >- } >- if (++cssPropertyCount <= 400) >- previous = p; >- else { >- if (seenFilter) >- testPassed("The CSS property order is correct"); >- else >- testFailed("The 'filter' property was not enumerated"); >- break; >- } >- } > </script> > <script src="../../resources/js-test-post.js"></script> > </body> >Index: LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html >=================================================================== >--- LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html (revision 268494) >+++ LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html (working copy) >@@ -5,8 +5,9 @@ > <script> > description("This tests the descriptor of CSSStyleDeclaration properties."); > >- var descriptor = Object.getOwnPropertyDescriptor(document.body.style, 'color'); >- shouldBeTrue("descriptor['writable']"); >+ var descriptor = Object.getOwnPropertyDescriptor(document.body.style.__proto__, 'color'); >+ shouldBeType("descriptor['get']", "Function"); >+ shouldBeType("descriptor['set']", "Function"); > shouldBeTrue("descriptor['enumerable']"); > shouldBeTrue("descriptor['configurable']"); > </script> >Index: LayoutTests/js/dom/put-override-should-not-use-ic.html >=================================================================== >--- LayoutTests/js/dom/put-override-should-not-use-ic.html (revision 268494) >+++ LayoutTests/js/dom/put-override-should-not-use-ic.html (working copy) >@@ -8,10 +8,10 @@ > <script> > test(function() { > function transitioned() { >- style = document.createElement('p').style; >+ dataset = document.createElement('p').dataset; > for(var i = 0; i < 20; i++) >- style['p'+i] = i; >- return style; >+ dataset['p'+i] = i; >+ return dataset; > } > > function putter(o) { >Index: LayoutTests/transitions/transitions-parsing.html >=================================================================== >--- LayoutTests/transitions/transitions-parsing.html (revision 268494) >+++ LayoutTests/transitions/transitions-parsing.html (working copy) >@@ -30,8 +30,6 @@ shouldBe("computedStyle.transitionProper > shouldBe("computedStyle.webkitTransitionProperty", "'all'"); > > style.transitionProperty = "none"; >-shouldNotBe("Object.keys(style).indexOf('transitionProperty')", "-1"); >-shouldBe("Object.keys(style).indexOf('webkitTransitionProperty')", "-1"); > shouldBe("style.transitionProperty", "'none'"); > shouldBe("computedStyle.transitionProperty", "'none'"); > shouldBe("style.webkitTransitionProperty", "'none'"); >@@ -176,8 +174,6 @@ shouldBe("computedStyle.transitionDurati > shouldBe("computedStyle.webkitTransitionDuration", "'0s'"); > > style.transitionDuration = "0s"; >-shouldNotBe("Object.keys(style).indexOf('transitionDuration')", "-1"); >-shouldBe("Object.keys(style).indexOf('webkitTransitionDuration')", "-1"); > shouldBe("style.transitionDuration", "'0s'"); > shouldBe("computedStyle.transitionDuration", "'0s'"); > shouldBe("style.webkitTransitionDuration", "'0s'"); >@@ -256,8 +252,6 @@ shouldBe("computedStyle.transitionTiming > shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'"); > > style.transitionTimingFunction = "linear"; >-shouldNotBe("Object.keys(style).indexOf('transitionTimingFunction')", "-1"); >-shouldBe("Object.keys(style).indexOf('webkitTransitionTimingFunction')", "-1"); > shouldBe("style.transitionTimingFunction", "'linear'"); > shouldBe("computedStyle.transitionTimingFunction", "'linear'"); > shouldBe("style.webkitTransitionTimingFunction", "'linear'"); >@@ -485,8 +479,6 @@ shouldBe("computedStyle.transitionDelay" > shouldBe("computedStyle.webkitTransitionDelay", "'0s'"); > > style.transitionDelay = "0s"; >-shouldNotBe("Object.keys(style).indexOf('transitionDelay')", "-1"); >-shouldBe("Object.keys(style).indexOf('webkitTransitionDelay')", "-1"); > shouldBe("style.transitionDelay", "'0s'"); > shouldBe("computedStyle.transitionDelay", "'0s'"); > shouldBe("style.webkitTransitionDelay", "'0s'"); >@@ -565,8 +557,6 @@ shouldBe("computedStyle.transition", "'a > shouldBe("computedStyle.webkitTransition", "'all 0s ease 0s'"); > > style.transition = "none"; >-shouldNotBe("Object.keys(style).indexOf('transition')", "-1"); >-shouldBe("Object.keys(style).indexOf('webkitTransition')", "-1"); > shouldBe("style.transition", "'none'"); > shouldBe("computedStyle.transition", "'none 0s ease 0s'"); > shouldBe("style.webkitTransition", "'none'");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-feeder
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 217623
:
411289
|
411292
|
411293
|
411340
|
411349
|
411363
|
411395
|
411449
|
411453
|
411454
|
411475
|
411481
|
411509