Diff
Modified: trunk/LayoutTests/ChangeLog (268956 => 268957)
--- trunk/LayoutTests/ChangeLog 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/LayoutTests/ChangeLog 2020-10-25 16:34:47 UTC (rev 268957)
@@ -1,3 +1,14 @@
+2020-10-25 Sam Weinig <[email protected]>
+
+ Remove support for 'pixel' and 'pos' CSSOM prefixes
+ https://bugs.webkit.org/show_bug.cgi?id=119712
+
+ Reviewed by Simon Fraser.
+
+ * fast/dom/CSSStyleDeclaration/css-properties-case-sensitive-expected.txt:
+ * fast/dom/CSSStyleDeclaration/css-properties-case-sensitive.html:
+ Update test to reflect removal of pos/pixel prefixes.
+
2020-10-24 Jer Noble <[email protected]>
[BigSur] Appending a new WebM init segment between Cluster elements throws an error
Modified: trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive-expected.txt (268956 => 268957)
--- trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive-expected.txt 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive-expected.txt 2020-10-25 16:34:47 UTC (rev 268957)
@@ -14,20 +14,6 @@
PASS element.style.CssZIndex is '1'
PASS element.style.CsszIndex is undefined.
PASS element.style.csszIndex is undefined.
-
-"pixel" prefix
-
-PASS element.style.pixelZIndex is 1
-PASS element.style.PixelZIndex is 1
-PASS element.style.pixelzIndex is undefined.
-PASS element.style.PixelzIndex is undefined.
-
-"pos" prefix
-
-PASS element.style.posZIndex is 1
-PASS element.style.PosZIndex is 1
-PASS element.style.poszIndex is undefined.
-PASS element.style.PoszIndex is undefined.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive.html (268956 => 268957)
--- trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive.html 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/LayoutTests/fast/dom/CSSStyleDeclaration/css-properties-case-sensitive.html 2020-10-25 16:34:47 UTC (rev 268957)
@@ -27,23 +27,6 @@
shouldBeUndefined("element.style.CsszIndex");
shouldBeUndefined("element.style.csszIndex");
-debug('');
-debug('"pixel" prefix');
-debug('');
-
-shouldBe("element.style.pixelZIndex", "1");
-shouldBe("element.style.PixelZIndex", "1");
-shouldBeUndefined("element.style.pixelzIndex");
-shouldBeUndefined("element.style.PixelzIndex");
-
-debug('');
-debug('"pos" prefix');
-debug('');
-
-shouldBe("element.style.posZIndex", "1");
-shouldBe("element.style.PosZIndex", "1");
-shouldBeUndefined("element.style.poszIndex");
-shouldBeUndefined("element.style.PoszIndex");
</script>
<script src=""
</body>
Modified: trunk/Source/WebCore/ChangeLog (268956 => 268957)
--- trunk/Source/WebCore/ChangeLog 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/Source/WebCore/ChangeLog 2020-10-25 16:34:47 UTC (rev 268957)
@@ -1,3 +1,23 @@
+2020-10-25 Sam Weinig <[email protected]>
+
+ Remove support for 'pixel' and 'pos' CSSOM prefixes
+ https://bugs.webkit.org/show_bug.cgi?id=119712
+
+ Reviewed by Simon Fraser.
+
+ Remove support for pixel/pos prefixed properties of CSSStyleDeclaration which
+ are no longer supported by any other browser.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateAttributeGetterBodyDefinition):
+ (GenerateAttributeSetterBodyDefinition):
+ * css/CSSStyleDeclaration.cpp:
+ (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName):
+ (WebCore::CSSStyleDeclaration::getPropertyValueInternalForPosOrPixelPrefixed): Deleted.
+ (WebCore::CSSStyleDeclaration::setPropertyValueInternalForPosOrPixelPrefixed): Deleted.
+ * css/CSSStyleDeclaration.h:
+ * css/makeprop.pl:
+
2020-10-24 Simon Fraser <[email protected]>
[LFC Display] Implement background image painting
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (268956 => 268957)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2020-10-25 16:34:47 UTC (rev 268957)
@@ -5283,8 +5283,7 @@
$implIncludes{"CSSPropertyNames.h"} = 1;
my $propertyID = $attribute->extendedAttributes->{CSSProperty};
- my $getterName = $attribute->type->isUnion ? "getPropertyValueInternalForPosOrPixelPrefixed" : "getPropertyValueInternal";
-
+ my $getterName = "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");
@@ -5437,8 +5436,8 @@
my $propertyID = $attribute->extendedAttributes->{CSSProperty};
- my $setterName = $attribute->type->isUnion ? "setPropertyValueInternalForPosOrPixelPrefixed" : "setPropertyValueInternal";
-
+ my $setterName = "setPropertyValueInternal";
+
my $exceptionThrower = GetAttributeExceptionThrower($interface, $attribute);
my $toNativeExpression = JSValueToNative($interface, $attribute, "value", $attribute->extendedAttributes->{Conditional}, "&lexicalGlobalObject", "lexicalGlobalObject", "thisObject", "*thisObject.globalObject()", $exceptionThrower);
Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.cpp (268956 => 268957)
--- trunk/Source/WebCore/css/CSSStyleDeclaration.cpp 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.cpp 2020-10-25 16:34:47 UTC (rev 268957)
@@ -34,8 +34,6 @@
#include "Settings.h"
#include "StyledElement.h"
#include <wtf/IsoMallocInlines.h>
-#include <wtf/Optional.h>
-#include <wtf/Variant.h>
namespace WebCore {
@@ -47,13 +45,10 @@
None,
Epub,
CSS,
- Pixel,
- Pos,
WebKit
};
-template<size_t prefixCStringLength>
-static inline bool matchesCSSPropertyNamePrefix(const StringImpl& propertyName, const char (&prefix)[prefixCStringLength])
+template<size_t prefixCStringLength> static inline bool matchesCSSPropertyNamePrefix(const StringImpl& propertyName, const char (&prefix)[prefixCStringLength])
{
size_t prefixLength = prefixCStringLength - 1;
@@ -98,12 +93,6 @@
if (matchesCSSPropertyNamePrefix(propertyName, "epub"))
return PropertyNamePrefix::Epub;
break;
- case 'p':
- if (matchesCSSPropertyNamePrefix(propertyName, "pos"))
- return PropertyNamePrefix::Pos;
- if (matchesCSSPropertyNamePrefix(propertyName, "pixel"))
- return PropertyNamePrefix::Pixel;
- break;
case 'w':
if (matchesCSSPropertyNamePrefix(propertyName, "webkit"))
return PropertyNamePrefix::WebKit;
@@ -136,31 +125,24 @@
*buffer++ = '-';
}
-struct CSSPropertyInfo {
- CSSPropertyID propertyID;
- bool hadPixelOrPosPrefix;
-};
-
-static CSSPropertyInfo parseJavaScriptCSSPropertyName(const AtomString& propertyName)
+static CSSPropertyID parseJavaScriptCSSPropertyName(const AtomString& propertyName)
{
- using CSSPropertyInfoMap = HashMap<String, CSSPropertyInfo>;
- static NeverDestroyed<CSSPropertyInfoMap> propertyInfoCache;
+ using CSSPropertyIDMap = HashMap<String, CSSPropertyID>;
+ static NeverDestroyed<CSSPropertyIDMap> propertyIDCache;
- CSSPropertyInfo propertyInfo = { CSSPropertyInvalid, false };
+ CSSPropertyID propertyID = CSSPropertyInvalid;
auto* propertyNameString = propertyName.impl();
if (!propertyNameString)
- return propertyInfo;
+ return propertyID;
unsigned length = propertyNameString->length();
if (!length)
- return propertyInfo;
+ return propertyID;
- propertyInfo = propertyInfoCache.get().get(propertyNameString);
- if (propertyInfo.propertyID)
- return propertyInfo;
+ propertyID = propertyIDCache.get().get(propertyNameString);
+ if (propertyID)
+ return propertyID;
- bool hadPixelOrPosPrefix = false;
-
constexpr size_t bufferSize = maxCSSPropertyNameLength + 1;
char buffer[bufferSize];
char* bufferPtr = buffer;
@@ -167,25 +149,17 @@
const char* name = bufferPtr;
unsigned i = 0;
- // Prefixes CSS, Pixel, Pos are ignored.
- // Prefixes Apple, KHTML and Webkit are transposed to "-webkit-".
- // The prefix "Epub" becomes "-epub-".
+ // Prefix CSS is ignored.
+ // Prefix Webkit becomes "-webkit-".
+ // Prefix Epub becomes "-epub-".
switch (propertyNamePrefix(*propertyNameString)) {
case PropertyNamePrefix::None:
if (isASCIIUpper((*propertyNameString)[0]))
- return propertyInfo;
+ return propertyID;
break;
case PropertyNamePrefix::CSS:
i += 3;
break;
- case PropertyNamePrefix::Pixel:
- i += 5;
- hadPixelOrPosPrefix = true;
- break;
- case PropertyNamePrefix::Pos:
- i += 3;
- hadPixelOrPosPrefix = true;
- break;
case PropertyNamePrefix::Epub:
writeEpubPrefix(bufferPtr);
i += 4;
@@ -203,17 +177,17 @@
size_t bufferSizeLeft = stringEnd - bufferPtr;
size_t propertySizeLeft = length - i;
if (propertySizeLeft > bufferSizeLeft)
- return propertyInfo;
+ return propertyID;
for (; i < length; ++i) {
UChar c = (*propertyNameString)[i];
if (!c || !isASCII(c))
- return propertyInfo; // illegal character
+ return propertyID; // illegal character
if (isASCIIUpper(c)) {
size_t bufferSizeLeft = stringEnd - bufferPtr;
size_t propertySizeLeft = length - i + 1;
if (propertySizeLeft > bufferSizeLeft)
- return propertyInfo;
+ return propertyID;
*bufferPtr++ = '-';
*bufferPtr++ = toASCIILowerUnchecked(c);
} else
@@ -229,22 +203,19 @@
#endif
auto* hashTableEntry = findProperty(name, outputLength);
- if (auto propertyID = hashTableEntry ? hashTableEntry->id : 0) {
- auto id = static_cast<CSSPropertyID>(propertyID);
- propertyInfo.hadPixelOrPosPrefix = hadPixelOrPosPrefix;
- propertyInfo.propertyID = id;
- propertyInfoCache.get().add(propertyNameString, propertyInfo);
+ if (auto id = hashTableEntry ? hashTableEntry->id : 0) {
+ propertyID = static_cast<CSSPropertyID>(id);
+ propertyIDCache.get().add(propertyNameString, propertyID);
}
- return propertyInfo;
+ return propertyID;
}
-static CSSPropertyInfo propertyInfoFromJavaScriptCSSPropertyName(const AtomString& propertyName, const Settings* settings)
+static CSSPropertyID propertyIDFromJavaScriptCSSPropertyName(const AtomString& propertyName, const Settings* settings)
{
- auto propertyInfo = parseJavaScriptCSSPropertyName(propertyName);
- auto id = propertyInfo.propertyID;
+ auto id = parseJavaScriptCSSPropertyName(propertyName);
if (!isEnabledCSSProperty(id) || !isCSSPropertyEnabledBySettings(id, settings))
- return { CSSPropertyInvalid, false };
- return propertyInfo;
+ return CSSPropertyInvalid;
+ return id;
}
}
@@ -267,36 +238,9 @@
return { };
}
-Variant<double, String> CSSStyleDeclaration::getPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID propertyID)
-{
- 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);
- }
-
- return value->cssText();
-}
-
-ExceptionOr<void> CSSStyleDeclaration::setPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID propertyID, Variant<double, String> value)
-{
- auto stringValue = WTF::switchOn(value, [&] (const auto& input) {
- return makeString(input, "px");
- });
-
- return setPropertyValueInternal(propertyID, WTFMove(stringValue));
-}
-
CSSPropertyID CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName(const AtomString& propertyName)
{
- return propertyInfoFromJavaScriptCSSPropertyName(propertyName, nullptr).propertyID;
+ return propertyIDFromJavaScriptCSSPropertyName(propertyName, nullptr);
}
String CSSStyleDeclaration::cssFloat()
Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (268956 => 268957)
--- trunk/Source/WebCore/css/CSSStyleDeclaration.h 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h 2020-10-25 16:34:47 UTC (rev 268957)
@@ -73,8 +73,6 @@
virtual CSSStyleSheet* parentStyleSheet() const { return nullptr; }
ExceptionOr<void> setPropertyValueInternal(CSSPropertyID, String);
- Variant<double, String> getPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID);
- ExceptionOr<void> setPropertyValueInternalForPosOrPixelPrefixed(CSSPropertyID, Variant<double, String>);
static CSSPropertyID getCSSPropertyIDFromJavaScriptPropertyName(const AtomString&);
Modified: trunk/Source/WebCore/css/makeprop.pl (268956 => 268957)
--- trunk/Source/WebCore/css/makeprop.pl 2020-10-25 06:20:47 UTC (rev 268956)
+++ trunk/Source/WebCore/css/makeprop.pl 2020-10-25 16:34:47 UTC (rev 268957)
@@ -1502,10 +1502,10 @@
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
+ // Non-standard. Adds an additional variant of all properties not starting with -webkit- or -epub-
+ // that is the property name prefixed by css and Css.
+ // Example top -> element.style.cssTop
+ // Example top -> element.style.CssTop
EOF
foreach my $nameOrAlias (grep { $_ !~ /^\-webkit\-|^\-epub\-/ } @namesAndAliases) {
my $camelCasedAttributeName = cssPropertyToIDLAttribute($nameOrAlias, 0, 1);
@@ -1519,10 +1519,6 @@
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";