haikuwebkit/LayoutTests/fast/css/longhand-overrides-shorthan...

72 lines
3.7 KiB
HTML
Raw Permalink Normal View History

Make -webkit-transition-* and -webkit-animation-* properties be pure aliases of the unprefixed ones https://bugs.webkit.org/show_bug.cgi?id=160478 Reviewed by Dean Jackson. Source/WebCore: Remove the custom -webkit prefixed transition and animation properties, and just make them aliases of the unprefixed ones, as we do for transforms. -webkit-animation-trigger remains as the only prefixed-only animation property. This is mostly code deletion. Test: fast/css/longhand-overrides-shorthand-prefixing.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSProperty.h: (WebCore::prefixingVariantForPropertyId): Deleted. * css/CSSPropertyNames.in: * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationDelay): (WebCore::CSSToStyleMap::mapAnimationDirection): (WebCore::CSSToStyleMap::mapAnimationDuration): (WebCore::CSSToStyleMap::mapAnimationFillMode): (WebCore::CSSToStyleMap::mapAnimationIterationCount): (WebCore::CSSToStyleMap::mapAnimationName): (WebCore::CSSToStyleMap::mapAnimationPlayState): (WebCore::CSSToStyleMap::mapAnimationProperty): (WebCore::CSSToStyleMap::mapAnimationTimingFunction): * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal): (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal): * css/StyleProperties.cpp: (WebCore::StyleProperties::getPropertyValue): (WebCore::MutableStyleProperties::removeShorthandProperty): (WebCore::StyleProperties::asText): * css/StylePropertyShorthand.cpp: (WebCore::animationShorthandForParsing): * css/StylePropertyShorthand.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::styleForKeyframe): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseAnimationShorthand): (WebCore::CSSParser::parseTransitionShorthand): (WebCore::CSSParser::parseAnimationProperty): (WebCore::CSSParser::addPropertyWithPrefixingVariant): Deleted. * css/parser/CSSParser.h: * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlPanelElement::makeOpaque): (WebCore::MediaControlPanelElement::makeTransparent): LayoutTests: Updated results, and a new test to ensure that longhand properties override shorthand ones, with various combinations of prefixing. * fast/css/getComputedStyle/computed-style-expected.txt: * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * fast/css/longhand-overrides-shorthand-prefixing-expected.txt: Added. * fast/css/longhand-overrides-shorthand-prefixing.html: Added. * fast/css/prefixed-unprefixed-variant-style-declaration-expected.txt: * fast/css/prefixed-unprefixed-variant-style-declaration.html: * transitions/svg-transitions-expected.txt: * transitions/transitions-parsing-expected.txt: * transitions/transitions-parsing.html: Canonical link: https://commits.webkit.org/180012@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 15:50:17 +00:00
<script src="../../resources/js-test-pre.js"></script>
<body>
<script>
description("Test the prefixed or the unprefixed variant of a property allows reading from the CSS OM with both the prefixed and unprefixed variant.");
const PREFIX = "-webkit-";
function accessorForProperty(property)
{
var firstIndexToTranspose = property.indexOf(PREFIX) === 0 ? 2 : 1;
return property.split("-").map(function(component, index) {
if (index < firstIndexToTranspose)
return component;
return component.charAt(0).toUpperCase() + component.substr(1);
}).join("");
}
function testPropertyVariants(shorthandProperty, longhandProperty, initialShorthandValue, finalShorthandValue, longhandValue)
{
var shorthandAccessor = accessorForProperty(shorthandProperty);
var prefixedShorthandProperty = PREFIX + shorthandProperty;
var prefixedShorthandAccessor = accessorForProperty(prefixedShorthandProperty);
var longhandAccessor = accessorForProperty(shorthandProperty);
var prefixedLonghandProperty = PREFIX + longhandProperty;
var prefixedLonghandAccessor = accessorForProperty(prefixedLonghandProperty);
testProperty(shorthandProperty, shorthandProperty, longhandProperty, shorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
testProperty(shorthandProperty, shorthandProperty, longhandProperty, prefixedShorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
testProperty(prefixedShorthandProperty, shorthandProperty, longhandProperty, shorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
testProperty(prefixedShorthandProperty, shorthandProperty, longhandProperty, prefixedShorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
testProperty(shorthandProperty, shorthandProperty, prefixedLonghandProperty, shorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
testProperty(shorthandProperty, shorthandProperty, prefixedLonghandProperty, prefixedShorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
testProperty(prefixedShorthandProperty, shorthandProperty, prefixedLonghandProperty, shorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
testProperty(prefixedShorthandProperty, shorthandProperty, prefixedLonghandProperty, prefixedShorthandAccessor, initialShorthandValue, finalShorthandValue, longhandValue);
}
function testProperty(shorthandProperty, unprefixedShorthandProperty, longhandProperty, accessor, initialShorthandValue, finalShorthandValue, longhandValue)
{
function test(message, actual, expected) {
if (actual === expected)
testPassed(message);
else
testFailed(`expected ${message} to be "${expected}" but got "${actual}"`);
}
var element = document.body.appendChild(document.createElement("div"));
element.style.setProperty(shorthandProperty, initialShorthandValue);
element.style.setProperty(longhandProperty, longhandValue);
debug(`Setting "${shorthandProperty}" to "${initialShorthandValue}" then "${longhandProperty}" to "${longhandValue}" accessing "${accessor}"`);
var style = element.style;
test(`element.style.${accessorForProperty(shorthandProperty)}`, style[accessorForProperty(shorthandProperty)], finalShorthandValue);
test(`element.style.cssText`, element.style.cssText, `${unprefixedShorthandProperty}: ${finalShorthandValue};`, longhandValue);
element.remove();
debug("");
}
testPropertyVariants("animation", "animation-duration", "move 2s", "move 10s", "10s");
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>