Branch: refs/heads/eng/Some-CSS-tweaks-and-minor-improvements
  Home:   https://github.com/WebKit/WebKit
  Commit: 51fd05c62b9225e616bee80ddb58899a340e3ff2
      
https://github.com/WebKit/WebKit/commit/51fd05c62b9225e616bee80ddb58899a340e3ff2
  Author: Darin Adler <da...@apple.com>
  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.


  Commit: 4b55896fa04b3753cbd9af4fd1e30fbf85519d25
      
https://github.com/WebKit/WebKit/commit/4b55896fa04b3753cbd9af4fd1e30fbf85519d25
  Author: Darin Adler <da...@apple.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/css/BasicShapeFunctions.cpp
    M Source/WebCore/css/CSSBackgroundRepeatValue.cpp
    M Source/WebCore/css/CSSBasicShapes.cpp
    M Source/WebCore/css/CSSComputedStyleDeclaration.cpp
    M Source/WebCore/css/CSSComputedStyleDeclaration.h
    M Source/WebCore/css/CSSContentDistributionValue.cpp
    M Source/WebCore/css/CSSContentDistributionValue.h
    M Source/WebCore/css/CSSCounterStyleDescriptors.cpp
    M Source/WebCore/css/CSSCounterStyleRule.cpp
    M Source/WebCore/css/CSSCounterStyleRule.h
    M Source/WebCore/css/CSSFontFace.cpp
    M Source/WebCore/css/CSSFontSelector.cpp
    M Source/WebCore/css/CSSFontVariantLigaturesParser.h
    M Source/WebCore/css/CSSFontVariantNumericParser.h
    M Source/WebCore/css/CSSGridTemplateAreasValue.cpp
    M Source/WebCore/css/CSSGridTemplateAreasValue.h
    M Source/WebCore/css/CSSOffsetRotateValue.cpp
    M Source/WebCore/css/CSSPrimitiveValue.cpp
    M Source/WebCore/css/CSSPrimitiveValue.h
    M Source/WebCore/css/CSSProperty.cpp
    M Source/WebCore/css/CSSProperty.h
    M Source/WebCore/css/CSSStyleDeclaration.h
    M Source/WebCore/css/CSSToStyleMap.cpp
    M Source/WebCore/css/CSSToStyleMap.h
    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/ComputedStyleExtractor.h
    M Source/WebCore/css/DOMMatrixReadOnly.cpp
    M Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h
    M Source/WebCore/css/DeprecatedCSSOMValue.cpp
    M Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
    M Source/WebCore/css/PropertySetCSSStyleDeclaration.h
    M Source/WebCore/css/Rect.h
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/StyleProperties.h
    M Source/WebCore/css/StylePropertyShorthand.h
    M Source/WebCore/css/StyleRule.cpp
    M Source/WebCore/css/TransformFunctions.cpp
    M Source/WebCore/css/calc/CSSCalcExpressionNode.h
    M Source/WebCore/css/calc/CSSCalcValue.cpp
    M Source/WebCore/css/calc/CSSCalcValue.h
    M Source/WebCore/css/parser/CSSParser.cpp
    M Source/WebCore/css/parser/CSSParserFastPaths.cpp
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/css/parser/CSSParserImpl.h
    M Source/WebCore/css/parser/CSSParserMode.h
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.h
    M Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/css/typedom/CSSStyleValueFactory.cpp
    M Source/WebCore/css/typedom/DeclaredStylePropertyMap.cpp
    M Source/WebCore/css/typedom/InlineStylePropertyMap.cpp
    M Source/WebCore/dom/StyledElement.cpp
    M Source/WebCore/dom/StyledElement.h
    M Source/WebCore/editing/ApplyStyleCommand.cpp
    M Source/WebCore/editing/EditingStyle.cpp
    M Source/WebCore/editing/Editor.cpp
    M Source/WebCore/editing/cocoa/HTMLConverter.mm
    M Source/WebCore/editing/mac/EditorMac.mm
    M Source/WebCore/editing/markup.cpp
    M Source/WebCore/html/HTMLElement.cpp
    M Source/WebCore/html/HTMLTableElement.cpp
    M Source/WebCore/html/HTMLTextFormControlElement.cpp
    M Source/WebCore/html/canvas/CanvasStyle.cpp
    M Source/WebCore/html/shadow/MediaControlTextTrackContainerElement.cpp
    M Source/WebCore/inspector/InspectorOverlay.cpp
    M Source/WebCore/platform/animation/TimingFunction.cpp
    M Source/WebCore/rendering/style/StyleGradientImage.cpp
    M Source/WebCore/style/PropertyCascade.cpp
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleBuilderConverter.h
    M Source/WebCore/style/StyleResolver.cpp
    M Source/WebCore/svg/SVGFontFaceElement.cpp
    M Source/WebKitLegacy/mac/WebView/WebView.mm
    M Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp

  Log Message:
  -----------
  start


Compare: https://github.com/WebKit/WebKit/compare/51fd05c62b92%5E...4b55896fa04b
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to