[webkit-changes] [WebKit/WebKit] df1cf0: Omit "normal" values from font shorthand

Darin Adler noreply at github.com
Sun Oct 23 21:57:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: df1cf06ce2e2dca7e94c9b1f821a2a5ac63e8917
      https://github.com/WebKit/WebKit/commit/df1cf06ce2e2dca7e94c9b1f821a2a5ac63e8917
  Author: Darin Adler <darin at apple.com>
  Date:   2022-10-23 (Sun, 23 Oct 2022)

  Changed paths:
    M LayoutTests/fast/css/font-calculated-value-expected.txt
    M LayoutTests/fast/css/font-calculated-value.html
    M LayoutTests/fast/css/font-shorthand-expected.txt
    M LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt
    M LayoutTests/fast/css/font-shorthand-from-longhands.html
    M LayoutTests/fast/css/font-shorthand-mix-inherit-expected.txt
    M LayoutTests/fast/css/font-shorthand-mix-inherit.html
    M LayoutTests/fast/css/getComputedStyle/computed-style-font-expected.txt
    M LayoutTests/fast/css/getComputedStyle/computed-style-font.html
    M LayoutTests/fast/text/font-stretch-parse-expected.txt
    M LayoutTests/fast/text/font-stretch-parse.html
    M LayoutTests/fast/text/font-style-parse-expected.txt
    M LayoutTests/fast/text/font-style-parse.html
    M LayoutTests/fast/text/font-weight-parse-expected.txt
    M LayoutTests/fast/text/font-weight-parse.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-vs-shorthand-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-computed-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-valid-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt
    M LayoutTests/platform/gtk/fast/css/css2-system-fonts-expected.txt
    R LayoutTests/platform/gtk/fast/text/font-stretch-parse-expected.txt
    R LayoutTests/platform/gtk/fast/text/font-style-parse-expected.txt
    M LayoutTests/platform/ios/fast/css/css2-system-fonts-expected.txt
    R LayoutTests/platform/ios/fast/text/font-stretch-parse-expected.txt
    R LayoutTests/platform/ios/fast/text/font-style-parse-expected.txt
    M LayoutTests/platform/mac/fast/css/css2-system-fonts-expected.txt
    R LayoutTests/platform/mac/fast/text/font-stretch-parse-expected.txt
    R LayoutTests/platform/mac/fast/text/font-style-parse-expected.txt
    M LayoutTests/platform/wincairo/fast/css/css2-system-fonts-expected.txt
    M LayoutTests/platform/wpe/fast/css/css2-system-fonts-expected.txt
    R LayoutTests/platform/wpe/fast/text/font-stretch-parse-expected.txt
    R LayoutTests/platform/wpe/fast/text/font-style-parse-expected.txt
    M Source/WebCore/css/CSSFontValue.cpp
    M Source/WebCore/css/CSSFontValue.h
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/ComputedStyleExtractor.h
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

  Log Message:
  -----------
  Omit "normal" values from font shorthand
https://bugs.webkit.org/show_bug.cgi?id=246600
rdar://problem/101468196

Reviewed by Sam Weinig.

Also fixed some related problems I encountered while making sure we omit "normal":
- Don't assume which longhand "normal" is when parsing the font shorthand.
- Serialization of font weight now uses numbers consistently.
- The slash separating font size from line height now has spaces around it.

* LayoutTests/fast/css/font-calculated-value-expected.txt: Updated.
* LayoutTests/fast/css/font-calculated-value.html: Ditto.
* LayoutTests/fast/css/font-shorthand-expected.txt: Ditto.
* LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt: Ditto.
* LayoutTests/fast/css/font-shorthand-from-longhands.html: Ditto.
* LayoutTests/fast/css/font-shorthand-mix-inherit-expected.txt: Ditto.
* LayoutTests/fast/css/font-shorthand-mix-inherit.html: Ditto.
* LayoutTests/fast/css/getComputedStyle/computed-style-font-expected.txt: Ditto.
* LayoutTests/fast/css/getComputedStyle/computed-style-font.html: Ditto.
* LayoutTests/fast/text/font-stretch-parse-expected.txt: Ditto.
* LayoutTests/fast/text/font-stretch-parse.html: Ditto.
* LayoutTests/fast/text/font-style-parse-expected.txt: Ditto.
* LayoutTests/fast/text/font-style-parse.html: Ditto.
* LayoutTests/fast/text/font-weight-parse-expected.txt: Ditto.
* LayoutTests/fast/text/font-weight-parse.html: Ditto.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-palette-vs-shorthand-expected.txt:
Updated, still failing.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-computed-expected.txt:
Updated to expect a lot more to pass. Remaining failures seem to involve both calc() and some
peculiarities of how the test is written.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-valid-expected.txt:
Updated to expect a lot more to pass. Remaining failures need to be investigated, and seem to
have something to do with not serializing " / normal" even for specified styles.

* LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt:
Updated to expect one more pass.

* LayoutTests/platform/gtk/fast/css/css2-system-fonts-expected.txt: Updated.
* LayoutTests/platform/gtk/fast/text/font-stretch-parse-expected.txt: Removed.
* LayoutTests/platform/gtk/fast/text/font-style-parse-expected.txt: Removed.
* LayoutTests/platform/ios/fast/css/css2-system-fonts-expected.txt: Updated.
* LayoutTests/platform/ios/fast/text/font-stretch-parse-expected.txt: Removed.
* LayoutTests/platform/ios/fast/text/font-style-parse-expected.txt: Removed.
* LayoutTests/platform/mac/fast/text/font-stretch-parse-expected.txt: Removed.
* LayoutTests/platform/mac/fast/text/font-style-parse-expected.txt: Removed.
* LayoutTests/platform/wincairo/fast/css/css2-system-fonts-expected.txt: Updated.
* LayoutTests/platform/wpe/fast/css/css2-system-fonts-expected.txt: Updated.
* LayoutTests/platform/wpe/fast/text/font-stretch-parse-expected.txt: Removed.
* LayoutTests/platform/wpe/fast/text/font-style-parse-expected.txt: Removed.

* Source/WebCore/css/CSSFontValue.cpp:
(WebCore::CSSFontValue::customCSSText const): Use spaces around the slash when
adding line height. Also tweaked for brevity and to slightly increase efficiency.

* Source/WebCore/css/CSSFontValue.h: Removed unneeded includes.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::zoomAdjustedPixelValue): Made this local to this file.
(WebCore::zoomAdjustedPixelValueForLength): Ditto.
(WebCore::valueForReflection): Updated for name changes.
(WebCore::createPositionListForLayer): Ditto.
(WebCore::createSingleAxisPositionValueForLayer): Ditto.
(WebCore::positionOffsetValue): Ditto.
(WebCore::percentageOrZoomAdjustedValue): Ditto.
(WebCore::autoOrZoomAdjustedValue): Ditto.
(WebCore::computedTransform): Ditto.
(WebCore::computedTranslate): Ditto.
(WebCore::adjustLengthForZoom): Ditto.
(WebCore::specifiedValueForGridTrackBreadth): Ditto.
(WebCore::specifiedValueForGridTrackSize): Ditto.
(WebCore::valueForGridTrackList): Ditto.
(WebCore::valueForPosition): Ditto.
(WebCore::valueForContainIntrinsicSize): Ditto.
(WebCore::fillSizeToCSSValue): Ditto.
(WebCore::fontFamilyList): Renamed to take out the FromStyle suffix.
Since this is C++ and we have overloading, we don't need to name the
argument types when defining a function.
(WebCore::fontFamily): Ditto.
(WebCore::optionalLineHeight): Added. Returns nullptr instead of returning
"normal" as a CSSPrimitiveValue in the normal line height case.
(WebCore::lineHeight): Renamed to take out the FromStyle suffix.
(WebCore::fontSize): Ditto.
(WebCore::fontPalette): Ditto.
(WebCore::fontWeight): Kept only the "non-keyword" version of this function.
Renamed to take out the FromStyle suffix.
(WebCore::fontStretch): Dropped the "non-keyword" version of this function.
Renamed to take out the FromStyle suffix.
=(WebCore::fontStyle): Dropped the "non-keyword" version of this function.
Renamed to take out the FromStyle suffix.
(WebCore::fontSynthesis): Renamed to take out the FromStyle suffix.
(WebCore::fontSynthesisWeight): Ditto.
(WebCore::fontSynthesisStyle): Ditto.
(WebCore::fontSynthesisSmallCaps): Ditto.
(WebCore::zoomAdjustedPaddingOrMarginPixelValue): Updated for name changes.
(WebCore::fontShorthandValueForSelectionProperties): Leave variant set to
nullptr if it's FontVariantCaps::Normal, leave weight set to nullptr if it's
400, don't call fontWeightKeyword and alwys create a number for weight,
leave stretch set to nullptr if it's normal, leave style set to nullptr
if it's normal.
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Updated for
name changes.

* Source/WebCore/css/ComputedStyleExtractor.h: Removed unneeded includes and
forward declarations. Removed zoomAdjustedPixelValue,
zoomAdjustedPixelValueForLength, fontNonKeywordWeightFromStyleValue,
fontWeightFromStyleValue, fontNonKeywordStretchFromStyleValue,
fontStretchFromStyleValue, fontNonKeywordStyleFromStyleValue, and
fontStyleFromStyleValue.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::appendFontLonghandValueIfExplicit const):
Use spaces around the slash when serializing line height. Also tweaked to
slightly increase efficiency.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeFont): Don't assume "normal" is the
value for a specific longhand, just skip it and figure out indirectly
later which it was. Added a count to make sure we don't allow too many.
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeFontRaw): Ditto.

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




More information about the webkit-changes mailing list