[webkit-changes] [WebKit/WebKit] 2e779d: Check against initial values instead of the implic...

Darin Adler noreply at github.com
Sun Jan 22 08:17:24 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2e779d5aabd5f1b5ca6c02e4c4e18230e65e0f50
      https://github.com/WebKit/WebKit/commit/2e779d5aabd5f1b5ca6c02e4c4e18230e65e0f50
  Author: Darin Adler <darin at apple.com>
  Date:   2023-01-22 (Sun, 22 Jan 2023)

  Changed paths:
    M LayoutTests/css3/flexbox/css-properties-expected.txt
    M LayoutTests/css3/flexbox/css-properties.html
    M LayoutTests/fast/css/getPropertyValue-columns-expected.txt
    M LayoutTests/fast/css/getPropertyValue-columns.html
    M LayoutTests/fast/css/parse-border-image-repeat-null-crash-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/negative-overflow-002-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-flow-valid.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/list-style-valid-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/parsing/column-rule-valid.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-ui/parsing/outline-valid-mandatory.html
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/motion/parsing/offset-parsing-valid.html
    M LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-flexbox/negative-overflow-002-expected.txt
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/StyleProperties.h
    M Source/WebCore/css/parser/CSSPropertyParser.cpp

  Log Message:
  -----------
  Check against initial values instead of the implicit flag when serializing
https://bugs.webkit.org/show_bug.cgi?id=250733
rdar://104353481

Reviewed by Tim Nguyen and Oriol Brufau.

* LayoutTests/css3/flexbox/css-properties-expected.txt: Updated.
* LayoutTests/css3/flexbox/css-properties.html: Updated to expect proper serialization of the
flex-flow shorthand, omitting unnecessary longhand values as per CSS serializing rules.

* LayoutTests/fast/css/getPropertyValue-columns-expected.txt: Updated.
* LayoutTests/fast/css/getPropertyValue-columns.html: Updated to expect "auto" for the columns
shorthand, omitting the second "auto" longhand value as per CSS serializing rules.

* LayoutTests/fast/css/parse-border-image-repeat-null-crash-expected.txt: Updated to expect
unnecessary "stretch" longhand value to be omitted from border-image shorthand serialization.

* LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/negative-overflow-002-expected.txt:
Updated failing test lines for changes to the flex-flow shorthand serialization.

* LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/parsing/flex-flow-valid.html:
Updated to expect serialization to omit unnceessary longhand values as per CSS serializing rules.
Specifically, expect "column" instead of "column nowrap".

* LayoutTests/imported/w3c/web-platform-tests/css/css-lists/parsing/list-style-valid-expected.txt:
Updated since more tests pass.

* LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/parsing/column-rule-valid.html:
Updated to expect serialization to omit unnceessary longhand values as per CSS serializing rules.
Specifically, expect "hidden" instead of "currentcolor hidden medium".

* LayoutTests/imported/w3c/web-platform-tests/css/css-ui/parsing/outline-valid-mandatory.html:
Updated to allow outline shorthand serialization to serialize outline-color when the value
is entirely default. It would be nice if the specification could be explicit about which longhand
should be serialized in cases like this, so we didn't have to have so many possible correct
alternatives, since differences can lead to interoperability problems.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt:
Updated since more tests pass.

* LayoutTests/imported/w3c/web-platform-tests/css/motion/parsing/offset-parsing-valid.html:
Updated to expect serialization to omit unnceessary longhand values as per CSS serializing rules.
Specifically, expect "none reverse" instead of "auto none reverse".

* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-flexbox/negative-overflow-002-expected.txt:
Updated failing test lines for changes to the flex-flow shorthand serialization.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::isAuto): Added for use by valueForOffsetShorthand.
(WebCore::valueForOffsetShorthand): Add logic so we leave out items to follow CSS serializing
rules. Soon we should change our strategy for this for computed style so we can share the
shorthand logic with specified style -- I have figured out an approach and will do it soon -- but
this is needed now to avoid regressions in test results due to improvements in specified style
serialization of the offset shorthand.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::getPropertyValue const): Moved flex, perspective-origin, and
transform-origin out of the list of shorthands use getShorthandValue, because their syntax does
not allow omitting just any longhand from the serialization, which is what that function does.
Use get2Values for place-content, place-items, and place-self instead of the old
getAlignmentShorthandValue function, matching our current parsing rules for all three. Stop using
getShorthandValue for the container shorthand, since container-type can be omitted, but
container-name cannot. Added serializing code for perspective-origin and transform-origin that
does not omit longhands.
(WebCore::StyleProperties::fontValue const): Added a check for calculated values for font-stretch
since we should not serialize the font shorthand if font-stretch is calculated. Spotted this
error by code inspection while thinking about correct handling of calculated values elsewhere.
(WebCore::StyleProperties::offsetValue const): Rewrote this to check values instead of checking
the implicit flag when deciding what to omit.
(WebCore::StyleProperties::getGridShorthandValue const): Deleted. This was unused.
(WebCore::StyleProperties::getShorthandValue const): Removed the separator argument, since there
is no caller that wants to omit longhands set to the initial value that also wants to use a
separator other than the space character. Use isInitialValueForLonghand instead of
isPropertyImplicit to decide which longhands to omit, and also serialize the first longhand if
all of them have initial values.
(WebCore::StyleProperties::getAlignmentShorthandValue const): Deleted. This was not correct
for any of the cases it was used for.
(WebCore::StyleProperties::borderImagePropertyValue const):  Use isInitialValueForLonghand instead
of isPropertyImplicit to decide which longhands to omit,

* Source/WebCore/css/StyleProperties.h: Removed getGridShorthandValue and
getAlignmentShorthandValue. Removed the separator argument to getShorthandValue.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeColumns): Removed now-unneeded workaround for shorthand
serialization; if both longhands are set to their defaults, we will still serialize as "auto".
(WebCore::initialValueForLonghand): Added initial values for lots more longhand properties.
Many of these are probably not needed. At one point I thought I needed more, and it seems OK to
have this list be more comprehensive than it needs to be.
(WebCore::isInitialValueForLonghand): Added logic for offset-rotate, which has an initial value
of "auto", but the parser turns that into a CSSOffsetRotateValue.
(WebCore::initialValueTextForLonghand): Added support for additional initial values that can
now be returned by initialValueForLonghand.

Canonical link: https://commits.webkit.org/259185@main




More information about the webkit-changes mailing list