Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 03224cfdf4540d4f80ef3c9394815a6fc9ed50b6
https://github.com/WebKit/WebKit/commit/03224cfdf4540d4f80ef3c9394815a6fc9ed50b6
Author: Darin Adler <[email protected]>
Date: 2023-01-10 (Tue, 10 Jan 2023)
Changed paths:
M
LayoutTests/editing/deleting/paste-with-transparent-background-color-expected.txt
M
LayoutTests/editing/deleting/paste-with-transparent-background-color-live-range-expected.txt
M
LayoutTests/editing/pasteboard/copy-paste-inserts-clearing-div-expected.txt
M
LayoutTests/fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt
M
LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt
M LayoutTests/fast/css/background-clip-text-expected.txt
M LayoutTests/fast/css/background-position-serialize-expected.txt
M LayoutTests/fast/css/border-shorthand-initialize-longhands-expected.txt
M LayoutTests/fast/css/longhand-overrides-shorthand-prefixing-expected.txt
M LayoutTests/fast/css/parsing-text-emphasis-expected.txt
M LayoutTests/fast/css/remove-shorthand-expected.txt
M LayoutTests/fast/css/shorthand-mismatched-list-crash-expected.txt
M LayoutTests/fast/css/transform-inline-style-expected.txt
M LayoutTests/fast/css/transform-inline-style-remove-expected.txt
M LayoutTests/fast/dom/background-shorthand-csstext-expected.txt
M LayoutTests/fast/masking/parsing-mask-expected.txt
M LayoutTests/fast/masking/parsing-webkit-mask-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/content-security-policy/style-src/inline-style-allowed-while-cloning-objects.sub-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-shorthand-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-position-valid-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-valid.sub-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/parsing/column-rule-shorthand-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/cssom/border-shorthand-serialization-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt
M
LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-valid.sub-expected.txt
M Source/WebCore/css/CSSProperties.json
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
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 Sam Weinig and Oriol Brufau.
This removes all the remaining cases that use "initial" for longhands, moving
to initial values
instead, but keeping the initial value placeholder for performance reasons. We
now serialize
properties based on checking if longhands have their initial values, and are
not relying on 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. We plan to rely on
values and not the
implicit flag universally; in another change soon we will finish the job.
I have additional removal and tidying, including renaming
createImplicitInitialValue since it
is now a placeholder that represents initial values without having to allocate
the memory for
them, rather than a special "implicit" value. But since this is already a large
change, holding
those changes for followup.
*
LayoutTests/editing/deleting/paste-with-transparent-background-color-expected.txt:
*
LayoutTests/editing/deleting/paste-with-transparent-background-color-live-range-expected.txt:
Updated for change where we end up putting in a "background-image: none". This
is a regression,
but not an important one, and improving this to instead emit "background:
transparent" or
"background: none" will probably involve improving the editing code rather than
the CSS code.
* 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:
*
LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt:
* LayoutTests/fast/css/background-clip-text-expected.txt:
Expect more tests to pass.
* LayoutTests/fast/css/background-position-serialize-expected.txt: Progression
where we serialize
background shorthand instead of background-image and background-position
longhands.
* LayoutTests/fast/css/border-shorthand-initialize-longhands-expected.txt:
* LayoutTests/fast/css/longhand-overrides-shorthand-prefixing-expected.txt:
* LayoutTests/fast/css/parsing-text-emphasis-expected.txt:
Expect more tests to pass.
* LayoutTests/fast/css/remove-shorthand-expected.txt: Expect various shorthands
to be handled
correctly, such as adding border-image, handling the background shorthand, and
others.
* LayoutTests/fast/css/shorthand-mismatched-list-crash-expected.txt:
Expect test to pass.
* LayoutTests/fast/css/transform-inline-style-expected.txt: Don't expect
initial values "ease" and
"0s" to be serialized.
* LayoutTests/fast/css/transform-inline-style-remove-expected.txt: Ditto, also
initial values
"none" and "running".
* LayoutTests/fast/dom/background-shorthand-csstext-expected.txt:
* LayoutTests/fast/masking/parsing-mask-expected.txt:
* LayoutTests/fast/masking/parsing-webkit-mask-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/content-security-policy/style-src/inline-style-allowed-while-cloning-objects.sub-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-shorthand-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-position-valid-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-valid.sub-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/parsing/column-rule-shorthand-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom/border-shorthand-serialization-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt:
*
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/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/StyleProperties.cpp:
(WebCore::textExpandingInitialValuePlaceholder): Added.
(WebCore::valueIDExpandingInitialValuePlaceholder): Added.
(WebCore::StyleProperties::getPropertyValue const): Added a call to
textExpandingInitialValuePlaceholder
so we expand the shorthand rather than serializing "initial". Removed the
borderSpacingValue function
and use the get2Values function instead for border-spacing. If border-image
shorthand values don't all
have their initial values, then do not serialize the border shorthand. Use
getPropertyValue instead of
getPropertyCSSValue and cssText so we get the additional initial value
placeholder logic.
(WebCore::StyleProperties::propertyAsColor const): Use
textExpandingInitialValuePlaceholder.
(WebCore::StyleProperties::propertyAsValueID const): Use
valueIDExpandingInitialValuePlaceholder.
(WebCore::StyleProperties::borderSpacingValue const): Deleted.
(WebCore::StyleProperties::fontValue const): Use
textExpandingInitialValuePlaceholder.
(WebCore::StyleProperties::fontVariantValue const): Check
isImplicitInitialValue since that's a second
way the value normal could be specified.
(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::LayerValues::LayerValues): Added.
(WebCore::LayerValues::set): Added.
(WebCore::LayerValues::skip): Added.
(WebCore::LayerValues::valueID const): Added.
(WebCore::LayerValues::valueIDIncludingCustomIdent const): Added.
(WebCore::LayerValues::equalValueIDs const): Added.
(WebCore::LayerValues::isValueID const): Added.
(WebCore::LayerValues::isPair const): Added.
(WebCore::LayerValues::serialize const): Added.
(WebCore::StyleProperties::getLayeredShorthandValue const): Rewrote this to use
initial values
instead of relying on implicit flags to know what to not serialize. Added
various rules that were
not present in the old version that are now needed for round tripping and
omitting any value that
can be without changing the meaning. The LayerValues class above is part of
this rewrite.
(WebCore::StyleProperties::getShorthandValue const): Use getPropertyValue
instead of
getPropertyCSSValue and cssText so we get the additional initial value
placeholder logic.
(WebCore::StyleProperties::getCommonValue const): Ditto.
(WebCore::StyleProperties::borderImagePropertyValue const): Serialize as "none"
when everything
has the implicit flag set.
(WebCore::StyleProperties::borderPropertyValue const): Rewrote for simplicitly.
Now checks for
initial values instead of depending on the implicit flag, using string
comparisons since that's
the easiest way to build on getCommonValue. Also use makeString instead of
StringBuilder.
(WebCore::StyleProperties::pageBreakValue const): Use nameString for slightly
better efficiency.
(WebCore::StyleProperties::webkitColumnBreakValue const): Ditto.
(WebCore::StyleProperties::hasAllInitialValues const): Added.
(WebCore::canUseShorthandForLonghand): Allow use of the CSSPropertyBackground
shorthand,
which did not work well before getLayeredShorthandValue omitted initial values.
(WebCore::StyleProperties::asTextInternal const): Removed now-incorrect
handling of
isImplicitInitialValue and use textExpandingInitialValuePlaceholder.
* Source/WebCore/css/StyleProperties.h: Added hasAllInitialValues. Removed
borderSpacingValue.
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::addProperty): Merged addProperty and
addPropertyWithImplicitDefault
into a single function, which can take nullptr and replace it with the initial
value placeholder.
(WebCore::CSSPropertyParser::addExpandedProperty): Renamed from
addExpandedPropertyForValue,
changed to take nullptr like addProperty now does, and added an implicit flag.
(WebCore::CSSPropertyParser::parseValueStart): Updated for addProperty and
addExpandedProperty
changes.
(WebCore::CSSPropertyParser::consumeCSSWideKeyword): Ditto.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor): Ditto.
(WebCore::CSSPropertyParser::parseFontFaceDescriptor): Ditto.
(WebCore::CSSPropertyParser::parsePropertyDescriptor): Ditto.
(WebCore::CSSPropertyParser::parseFontPaletteValuesDescriptor): Ditto.
(WebCore::CSSPropertyParser::consumeFontVariantShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeColumns): Ditto.
(WebCore::initialValueForLonghand): Added.
(WebCore::initialCSSValueForAnimationLonghand): Added.
(WebCore::isNumber): Added.
(WebCore::pairValue): Added.
(WebCore::quadValue): Added.
(WebCore::isValueIDPair): Added.
(WebCore::isNumericQuad): Added.
(WebCore::isInitialValueForLonghand): Added.
(WebCore::initialValueTextForLonghand): Added.
(WebCore::initialValueIDForLonghand): Added.
(WebCore::CSSPropertyParser::consumeShorthandGreedily): Updated for addProperty
changes.
(WebCore::CSSPropertyParser::consumeBorderShorthand): Renamed from
consumeBorder. Do the calls
to addExpandedProperty here instead of in the caller. Updated for addProperty
changes.
(WebCore::CSSPropertyParser::consumeBorderImage): Udpated for addProperty
changes. This removed
the need to create value objects since we now use the initial value placeholder.
(WebCore::CSSPropertyParser::consumeAnimationShorthand): Use
initialCSSValueForAnimationLonghand
instead of ComputedStyleExtractor::addValueForAnimationPropertyToList. Updated
for addProperty
changes.
(WebCore::CSSPropertyParser::consumeBackgroundShorthand): Removed local
variable "implicit"
that was always false. Updated for addProperty changes.
(WebCore::CSSPropertyParser::consumeOverscrollBehaviorShorthand): Updated for
addProperty changes.
(WebCore::CSSPropertyParser::consumeContainerShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeContainIntrinsicSizeShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeTransformOrigin): Ditto.
(WebCore::CSSPropertyParser::consumeOffset): Ditto.
(WebCore::CSSPropertyParser::consumeListStyleShorthand): Ditto.
(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 addProperty and
addExpandedProperty
functions. Replaced consumeBorder with consumeBorderShorthand. Added
isInitialValueForLonghand,
initialValueTextForLonghand, and intialValueIDForLonghand, exported by the
parser but used by the
serialization code.
Canonical link: https://commits.webkit.org/258767@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes