[webkit-changes] [WebKit/WebKit] d3d6e1: StyleProperties::fontValue needs to return emptySt...

Darin Adler noreply at github.com
Sun Nov 13 23:54:07 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d3d6e16bf1f0bab4f22043c2c8e326c9a51e315c
      https://github.com/WebKit/WebKit/commit/d3d6e16bf1f0bab4f22043c2c8e326c9a51e315c
  Author: Darin Adler <darin at apple.com>
  Date:   2022-11-13 (Sun, 13 Nov 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/fast/css/font-shorthand-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-shorthand-variant-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/system-fonts-serialization.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/font-shorthand-serialization-expected.txt
    M LayoutTests/platform/win/fast/css/font-shorthand-expected.txt
    A LayoutTests/platform/win/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention-expected.txt
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/StyleProperties.h
    M Source/WebCore/css/StylePropertyShorthand.h
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/style/StyleBuilderConverter.h
    M Source/WebCore/style/StyleBuilderCustom.h
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

  Log Message:
  -----------
  StyleProperties::fontValue needs to return emptyString in many more cases where font sub properties have unusual values
https://bugs.webkit.org/show_bug.cgi?id=247498
rdar://problem/102248342

Reviewed by Tim Nguyen and Sam Weinig.

To make the font serialization work correctly, had to change font shorthand parsing to set font
subproperties to initial values, not to the keyword "initial". To make system font serialization
work correctly, had to change font shorthand parsing to set the system font for all longhands,
not just a select few.

* LayoutTests/fast/css/font-shorthand-expected.txt: Rebased since we use initial values, not
values that are literally "initial", for the font subproperties set by the font shorthand.

* LayoutTests/TestExpectations: Removed expectations for tests that were already removed.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention.html:
Added.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-shorthand-variant-expected.txt:
Expect PASS.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/system-fonts-serialization.tentative-expected.txt:
Expect PASS.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/font-shorthand-serialization-expected.txt:
Rebased since we use initial values, not values that are literally "initial", for the font
subproperties set by the font shorthand.
* LayoutTests/platform/win/fast/css/font-shorthand-expected.txt: Ditto.

* LayoutTests/platform/win/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-prevention-expected.txt:
Added.

* Source/WebCore/css/CSSProperties.json: Removed the converter codegen property from
font-variant-caps, since the generator now handles it correctly.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::fontShorthandValue): Added checking for font-kerning, and removed the FIXME.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::valueID): Added.
(WebCore::StyleProperties::propertyAsValueID const): Changed to return a std::optional so
callers can tell a missing value from a non-valueID value; useful in more places.
(WebCore::StyleProperties::isSingleFontShorthand const): Deleted.
(WebCore::StyleProperties::fontValue const): Combined the CSS-wide keyword logic with the system
font keyword logic, and make sure we don't ever try to use either as an individual value in the
font shorthand. Added checking for the font subproperties that are reset by the font shorthand.
If any are set to non-initial values, then serialize as the empty string.
(WebCore::StyleProperties::fontSynthesisValue const): Removed valueID lambda since we can use the
function added above instead.
(WebCore::StyleProperties::getPropertyCSSValue const): Simplify a bit using the valueID function.

* Source/WebCore/css/StyleProperties.h: Changed return type of propertyAsValueID to std::optional.
Removed isSingleFontShorthand.

* Source/WebCore/css/StylePropertyShorthand.h: Added array for handling the font shorthand rules
for resetting font subproperties to their initial values, named
fontShorthandSubpropertiesResetToInitialValues. Used in two places. Maybe generate in future?

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeFont): Rewrote system font handling so it puts the system
font value into all font subproperties, not just a select few. Changed property resetting so
it resets properties to their initial values, not to the "initial" keyword.

* Source/WebCore/css/process-css-properties.py:
(GenerationContext): Generate code to apply the initial value when we encounter a system font.

* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertFontFeatureSettings): Handle system font.
(WebCore::Style::BuilderConverter::convertFontVariantCaps): Deleted. This is now generated.
(WebCore::Style::BuilderConverter::convertFontVariationSettings): Handle system font.
(WebCore::Style::BuilderConverter::convertFontPalette): Ditto.

* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueLineHeight): Handle system font.
(WebCore::Style::BuilderCustom::applyValueFontVariantLigatures): Ditto.
(WebCore::Style::BuilderCustom::applyValueFontVariantNumeric): Ditto.
(WebCore::Style::BuilderCustom::applyValueFontVariantEastAsian): Ditto.
(WebCore::Style::BuilderCustom::applyValueFontVariantAlternates): Ditto.
(WebCore::Style::BuilderCustom::applyValueFontSizeAdjust): Ditto.

* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::getPlatformEditorStateCommon const): Updated for change to propertyAsValueID.

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




More information about the webkit-changes mailing list