LibWeb/CSS: Implement legacy name aliases for properties

When a property is a "legacy name alias", any time it is used in CSS or
via the CSSOM its aliased name is used instead.
(See https://drafts.csswg.org/css-cascade-5/#legacy-name-alias)

This means we only care about the alias when parsing a string as a
PropertyID - and we can just return the PropertyID it is an alias for.
No need for a distinct PropertyID for it, and no need for LibWeb to
care about it at all.

Previously, we had a bunch of these properties, which misused our code
for "logical aliases", some of which I've discovered were not even
fully implemented. But with this change, all that code can go away, and
making a legacy alias is just a case of putting it in the JSON. This
also shrinks `StyleProperties` as it doesn't need to contain data for
these aliases, and removes a whole load of `-webkit-*` spam from the
style inspector.
This commit is contained in:
Sam Atkins 2024-09-27 12:54:08 +01:00 committed by Sam Atkins
commit fdcece2e88
Notes: github-actions[bot] 2024-09-27 18:26:40 +00:00
6 changed files with 113 additions and 243 deletions

View file

@ -521,80 +521,6 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i
return PropertyID::Left;
case PropertyID::InsetInlineEnd:
return PropertyID::Right;
case PropertyID::WebkitAlignContent:
return PropertyID::AlignContent;
case PropertyID::WebkitAlignItems:
return PropertyID::AlignItems;
case PropertyID::WebkitAlignSelf:
return PropertyID::AlignSelf;
case PropertyID::WebkitAnimation:
return PropertyID::Animation;
case PropertyID::WebkitAnimationDelay:
return PropertyID::AnimationDelay;
case PropertyID::WebkitAnimationDirection:
return PropertyID::AnimationDirection;
case PropertyID::WebkitAnimationDuration:
return PropertyID::AnimationDuration;
case PropertyID::WebkitAnimationFillMode:
return PropertyID::AnimationFillMode;
case PropertyID::WebkitAnimationIterationCount:
return PropertyID::AnimationIterationCount;
case PropertyID::WebkitAnimationName:
return PropertyID::AnimationName;
case PropertyID::WebkitAnimationPlayState:
return PropertyID::AnimationPlayState;
case PropertyID::WebkitAnimationTimingFunction:
return PropertyID::AnimationTimingFunction;
case PropertyID::WebkitAppearance:
return PropertyID::Appearance;
case PropertyID::WebkitBackgroundClip:
return PropertyID::BackgroundClip;
case PropertyID::WebkitBackgroundOrigin:
return PropertyID::BackgroundOrigin;
case PropertyID::WebkitBorderBottomLeftRadius:
return PropertyID::BorderBottomLeftRadius;
case PropertyID::WebkitBorderBottomRightRadius:
return PropertyID::BorderBottomRightRadius;
case PropertyID::WebkitBorderRadius:
return PropertyID::BorderRadius;
case PropertyID::WebkitBorderTopLeftRadius:
return PropertyID::BorderTopLeftRadius;
case PropertyID::WebkitBorderTopRightRadius:
return PropertyID::BorderTopRightRadius;
case PropertyID::WebkitBoxShadow:
return PropertyID::BoxShadow;
case PropertyID::WebkitBoxSizing:
return PropertyID::BoxSizing;
case PropertyID::WebkitFlex:
return PropertyID::Flex;
case PropertyID::WebkitFlexBasis:
return PropertyID::FlexBasis;
case PropertyID::WebkitFlexDirection:
return PropertyID::FlexDirection;
case PropertyID::WebkitFlexFlow:
return PropertyID::FlexFlow;
case PropertyID::WebkitFlexWrap:
return PropertyID::FlexWrap;
case PropertyID::WebkitJustifyContent:
return PropertyID::JustifyContent;
case PropertyID::WebkitMask:
return PropertyID::Mask;
case PropertyID::WebkitOrder:
return PropertyID::Order;
case PropertyID::WebkitTransform:
return PropertyID::Transform;
case PropertyID::WebkitTransformOrigin:
return PropertyID::TransformOrigin;
case PropertyID::WebkitTransition:
return PropertyID::Transition;
case PropertyID::WebkitTransitionDelay:
return PropertyID::TransitionDelay;
case PropertyID::WebkitTransitionDuration:
return PropertyID::TransitionDuration;
case PropertyID::WebkitTransitionProperty:
return PropertyID::TransitionProperty;
case PropertyID::WebkitTransitionTimingFunction:
return PropertyID::TransitionTimingFunction;
default:
return {};
}