Branch: refs/heads/SavedInitialBranch Home: https://github.com/WebKit/WebKit Commit: 9feb3a2e339991ff3229d3d397ac5f6a93817ce3 https://github.com/WebKit/WebKit/commit/9feb3a2e339991ff3229d3d397ac5f6a93817ce3 Author: Darin Adler <da...@apple.com> Date: 2022-12-17 (Sat, 17 Dec 2022)
Changed paths: M Source/WebCore/css/CSSPrimitiveValue.cpp M Source/WebCore/css/CSSPrimitiveValue.h M Source/WebCore/css/CSSProperties.json M Source/WebCore/css/CSSValue.cpp M Source/WebCore/css/CSSValue.h M Source/WebCore/css/CSSValuePool.cpp M Source/WebCore/css/CSSValuePool.h M Source/WebCore/css/ComputedStyleExtractor.cpp M Source/WebCore/css/DeprecatedCSSOMValue.cpp M Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp M Source/WebCore/css/PropertySetCSSStyleDeclaration.h M Source/WebCore/css/StyleProperties.cpp M Source/WebCore/css/StyleProperties.h M Source/WebCore/css/parser/CSSPropertyParser.cpp M Source/WebCore/css/parser/CSSPropertyParser.h M Source/WebCore/editing/EditingStyle.cpp M Source/WebCore/editing/mac/EditorMac.mm M Source/WebCore/style/StyleBuilder.cpp Log Message: ----------- Shorthands are still using "initial" for longhands that are set implicitly https://bugs.webkit.org/show_bug.cgi?id=248913 rdar://problem/103092939 Reviewed by NOBODY (OOPS!). This removes all the remaining cases that use "initial" for longhands, moving to initial values. Also, as a result we need to start serializing some properties based on checking if longhands have their initial values, not just use the implicit flag. That's because in the case of layered shorthands, we can no longer use the implicit flag; there is nothing that stores those in the layers. Before the special implicit initial value was used to work around that. It's a good direction to have done that for layered shorthands and for border, since we plan to do that universally; in another change soon we will finish the job. * LayoutTests/cssom/cssvalue-comparison-expected.txt: Updated. * LayoutTests/cssom/cssvalue-comparison.html: Reworked test so it no longer depends on reading back shorthands, since that gives false negatives. * LayoutTests/editing/pasteboard/copy-paste-inserts-clearing-div-expected.txt: Updated for progression where we use the background shorthand, not background-color. * LayoutTests/fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: Updated. * LayoutTests/fast/backgrounds/background-shorthand-after-set-backgroundSize.html: Updated for progression where we serialize as just border-box instead of border-box border-box. * LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt: Updated. * LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html: Updated for progressions where we omit values that are set without specifying them explicitly. Also updated one case that expected "initial" but not gets the initial value instead. * LayoutTests/fast/css/background-clip-text-expected.txt: Updated. * LayoutTests/fast/css/background-clip-text.html: Updated for progression where we get the initial value "border-box" instead of "initial". * LayoutTests/fast/css/background-position-serialize-expected.txt: Updated for progression where we serialize background shorthand instead of background-image and background-position longhands. * LayoutTests/fast/css/border-shorthand-initialize-longhands-expected.txt: Updated. * LayoutTests/fast/css/border-shorthand-initialize-longhands.html: Expect initial values instead of the keyword. * LayoutTests/fast/css/cssText-shorthand-expected.txt: Updated. * LayoutTests/fast/css/cssText-shorthand.html: Removed most of what is tested here since this test was mostly imported into Web Platform Tests long ago. All that remains are WebKit-specific bits. * LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt: Updated. * LayoutTests/fast/css/font-shorthand-from-longhands.html: Expect correct behavior from font shorthand where it will not serialize unless all the longhands are set. * LayoutTests/fast/css/getPropertyValue-border.html: Expect initial value instead of the initial keyword. * LayoutTests/fast/css/longhand-overrides-shorthand-prefixing.html: Expect initial values to be omitted from the animation shorthand. * LayoutTests/fast/css/parsing-text-emphasis-expected.txt: Updated. * LayoutTests/fast/css/parsing-text-emphasis.html: Expect initial value instead of the keyword. * LayoutTests/fast/css/remove-shorthand-expected.txt: Updated for various shorthands which now are handled correctly, such as adding border-image, handling the background shorthand, and more. * LayoutTests/fast/css/shorthand-mismatched-list-crash-expected.txt: Updated. * LayoutTests/fast/css/shorthand-mismatched-list-crash.html: Expect initial values to be omitted from the -webkit-transition shorthand. * LayoutTests/fast/css/transform-inline-style-expected.txt: Updated since we now don't serialize the defaults ease and 0s. * LayoutTests/fast/css/transform-inline-style-remove-expected.txt: Ditto. * LayoutTests/fast/dom/background-shorthand-csstext-expected.txt: Updated. * LayoutTests/fast/dom/background-shorthand-csstext.html: Updated test so we can see the results rather than just that there was a failure. Updated expectations since we no longer serialize none and scroll, which are the initial values. * LayoutTests/fast/masking/parsing-mask-expected.txt: Updated. * LayoutTests/fast/masking/parsing-mask.html: Updated many expectations to no longer expect the initial values that can be omitted from shorthands to be included. * LayoutTests/fast/masking/parsing-webkit-mask-expected.txt: Updated. * LayoutTests/fast/masking/parsing-webkit-mask.html: Updated many expectations to no longer expect the initial values that can be omitted from shorthands to be included. * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/style-src/inline-style-allowed-while-cloning-objects.sub-expected.txt: Expect more tests to pass. * LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-valid.html: Expect either 0s or none for animation shorthand when everything is set to the default, since animation-duration is the first longhand. Allow initial values to be omitted in the layered test case at the end of this test. * LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-shorthand-expected.txt: Expect more tests to pass. * LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-position-valid.html: Expect center to be omitted when it can be without changing the meaning. * LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-valid.sub-expected.txt: Updated. * LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-valid.sub.html: Expect to correctly not serialize none for the mask-reference since it's the initial value, and some other cases here that had incorrect expectations. * LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/parsing/column-rule-shorthand-expected.txt: Expect more tests to pass. * LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText-expected.txt: Expect more tests to pass. * LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText.html: Updated expectations to expect a single space before "!important". The specification explicitly calls for a single space, not two spaces. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/border-shorthand-serialization-expected.txt: Expect one more test to pass. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt: Expect one more test to pass. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt: Updated. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values.html: Added an exceptions list so all the cases where "center" must be omitted for minimal serialization. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt: Updated. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values.html: Corrected expectations. This test was expecting incorrect behavior for some tricky cases, particularly because the border shorthand now sets border-image. * LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-valid.sub-expected.txt: Expect more tests to pass. * Source/WebCore/css/CSSPrimitiveValue.cpp: Removed the ImplicitInitialValueTag constructor. * Source/WebCore/css/CSSPrimitiveValue.h: Removed isInitialValue, isImplicitInitialValue, isInheritValue, isUnsetValue, isRevertValue, and isRevertLayerValue. These were not important functions because it's straightforward to check for any of these values since they all have CSSValueID constants. Also, the isInitialValue function was ambiguous. It checks for the initial keyword, not for an initial value. Someone added an isInitialValue function to the CSSOffsetRotateValue class with the same name but the other meaning! Also removed the ImplicitInitialValueTag constructor. * Source/WebCore/css/CSSProperties.json: Added the border-image longhands to the border shorthand, because the border shorthand sets all these properties to initial values. Also sort the offset shorthand longhands in the order from the specification. * Source/WebCore/css/CSSValue.cpp: (WebCore::CSSValue::treatAsInheritedValue const): Deleted. (WebCore::CSSValue::treatAsInitialValue const): Check the identifier directly for initial and unset rather than calling helper functions. (WebCore::CSSValue::isInitialValue const): Deleted. (WebCore::CSSValue::isImplicitInitialValue const): Deleted. (WebCore::CSSValue::isInheritValue const): Use isValueID. (WebCore::CSSValue::isUnsetValue const): Deleted. (WebCore::CSSValue::isRevertValue const): Use isValueID. (WebCore::CSSValue::isRevertLayerValue const): Deleted. * Source/WebCore/css/CSSValue.h: Removed isImplicitInitialValue, isInitialValue, isUnsetValue, isRevertLayerValue, and treatAsInheritedValue. * Source/WebCore/css/CSSValuePool.cpp: (WebCore::StaticCSSValuePool::StaticCSSValuePool): Removed m_implicitInitialValue. * Source/WebCore/css/CSSValuePool.h: Removed m_implicitInitialValue and createImplicitInitialValue. * Source/WebCore/css/ComputedStyleExtractor.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Tweaked comment style. * Source/WebCore/css/DeprecatedCSSOMValue.cpp: (WebCore::DeprecatedCSSOMValue::cssValueType const): Tweaked coding style. (WebCore::DeprecatedCSSOMComplexValue::cssValueType const): Use identifiers directly instead of helper functions. * Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp: Moved an include here from the header. * Source/WebCore/css/PropertySetCSSStyleDeclaration.h: Removed some includes and replaced them with forward declarations. * Source/WebCore/css/StyleProperties.cpp: (WebCore::StyleProperties::commonShorthandChecks const): Removed isImplicitInitialValue check. Add a check that all longhands are present, resolving a FIXME. (WebCore::StyleProperties::getPropertyValue const): Change CSSPropertyBorderSpacing to use getShorthandValue instead of its own function. Also added a FIXME. (WebCore::StyleProperties::borderSpacingValue const): Deleted. (WebCore::StyleProperties::offsetValue const): Removed unneeded checks for missing longhands since commonShorthandChecks takes care of checking that now. (WebCore::StyleProperties::get2Values const): Rewrote more simply, removing the isInitialValue checks since commonShorthandChecks takes care of that now. Also use makeString instead of StringBuilder since we can and it's more efficient. (WebCore::StyleProperties::get4Values const): Rewrote more simply, removing the isInherited and isInitialValue checks since commonShorthandChecks takes care of that now. Also use makeString instead of StringBuilder since we can and it's more efficient. (WebCore::isValueID): Added. (WebCore::isPair): Added. (WebCore::StyleProperties::getLayeredShorthandValue const): Rewrote this to use initial values instead of relying on implicit flags to know what to not serialize. Added a few rules that were not present in the old version that are now needed for round tripping and obeying the rules about omitting values that can be without changing the meaning. Also removed null check since commonShorthandChecks takes care of that now. (WebCore::StyleProperties::getGridTemplateValue const): Removed unneeded null checks since commonShorthandChecks takes care of that now. (WebCore::StyleProperties::getGridAreaShorthandValue const): Merged two calls to StringBuilder::append into a single one. (WebCore::StyleProperties::getShorthandValue const): Improved the idiom of checking implicit values for slightly better efficiency. Also added a FIXME about omitting values that are equal to the initial value. (WebCore::StyleProperties::getCommonValue const): Removed isImplicitInitialValue check and null checks that are no longer needed since commonShorthandChecks takes care of that now. (WebCore::StyleProperties::getAlignmentShorthandValue const): Check isNull instead of isEmpty for efficiency, since a null string is what getCommonValue returns. (WebCore::StyleProperties::borderImagePropertyValue const): Removed remnant of the old CSS-wide keyword code that got left behind, the commonWideValueText function. Added code to serialize as "none" when everything has the implicit flag set. Removed null check that is no longer needed since commonShorthandChecks takes care of that now. Use a more efficient idiom for checking for implicit properties. (WebCore::StyleProperties::borderRadiusShorthandValue const): Removed unneeded null checks since commonShorthandChecks takes care of that now. (WebCore::StyleProperties::borderPropertyValue const): Rewrote for simplicitly. Now checks for initial values instead of depending on the implicit flag. Also use makeString instead of StringBuilder. (WebCore::StyleProperties::hasAllInitialValues const): Added. Not used yet, but will be when we do the next fix to border shorthand serialization. (WebCore::canUseShorthandForLonghand): Allow use of the CSSPropertyBackground shorthand, which works well now getLayeredShorthandValue omits initial values. (WebCore::StyleProperties::asTextInternal const): Removed isImplicitInitialValue check. * Source/WebCore/css/StyleProperties.h: Added hasAllInitialValues. * Source/WebCore/css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::addProperty): Removed isImplicitInitialValue check. (WebCore::CSSPropertyParser::addExpandedProperty): Renamed from addExpandedPropertyForValue and added an implicit flag. (WebCore::CSSPropertyParser::addExpandedPropertyWithImplicitDefault): Added. (WebCore::CSSPropertyParser::parseValueStart): Updated for addExpandedProperty name change. (WebCore::CSSPropertyParser::consumeCSSWideKeyword): Ditto. (WebCore::initialValueForLonghand): Added. (WebCore::initialCSSValueForLonghand): Added. (WebCore::isInitialValueForLonghand): Added. (WebCore::initialValueTextForLonghand): Added. (WebCore::CSSPropertyParser::consumeShorthandGreedily): Renamed local variables for clarity. Use initialCSSValueForLonghand for implicit defaults rather than the implicit initial value. (WebCore::CSSPropertyParser::consumeBorderShorthand): Renamed from consumeBorder. Do the calls to addExpandedPropertyWithImplicitDefault here instead of in the caller, continuing to treat the defaults as implicit values. (WebCore::CSSPropertyParser::consumeAnimationShorthand): Use initialCSSValueForLonghand instead of ComputedStyleExtractor::addValueForAnimationPropertyToList. (WebCore::CSSPropertyParser::consumeBackgroundShorthand): Removed local variable "implicit" that was always false. Use initialCSSValueForLonghand for implicit defaults rather than implicit initial value. (WebCore::CSSPropertyParser::parseShorthand): Use consumeBorderShorthand. For CSSPropertyBorder itself, also set all the border-image longhands to their initial values. * Source/WebCore/css/parser/CSSPropertyParser.h: Updated the addExpandedProperty functions. Also added isInitialValueForLonghand and initialValueTextForLonghand, exported by the parser but used by the serialization code. May find another home for these later. * Source/WebCore/style/StyleBuilder.cpp: (WebCore::Style::Builder::applyProperty): Refactored to eliminate use of the isInheritValue, isInitialValue, isUnsetValue, isRevertValue, and isRevertLayerValue functions. This eliminated the need for customPropertyValueID. _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes