[webkit-changes] [WebKit/WebKit] 3dde88: font shorthand should not reject values that happe...

Darin Adler noreply at github.com
Sun Oct 23 01:00:27 PDT 2022


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

  Changed paths:
    M LayoutTests/fast/css/font-shorthand-mix-inherit-expected.txt
    M LayoutTests/fast/css/font-shorthand-mix-inherit.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/test_font_family_parsing-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/target-text-007-expected.txt
    M Source/WebCore/css/FontSelectionValueInlines.h
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.h

  Log Message:
  -----------
  font shorthand should not reject values that happen to have CSS-wide keywords as non-first identifiers in a font family name
https://bugs.webkit.org/show_bug.cgi?id=246570
rdar://problem/101459948

Reviewed by Tim Nguyen.

* LayoutTests/fast/css/font-shorthand-mix-inherit-expected.txt: Updated to match the new test below
including different expectations for some test cases.
* LayoutTests/fast/css/font-shorthand-mix-inherit.html: Changed to expect allowing CSS-wide keywords
in cases where they are supposed to be allowed. Refined the test to be simpler and so the test output
is easier to understand.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/test_font_family_parsing-expected.txt:

* LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/target-text-007-expected.txt: Removed.
This was an unnecessary ignored file since this is a reference test. Not related to the code change.

* Source/WebCore/css/FontSelectionValueInlines.h: Removed unused isCSS21Weight function.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontVariantCSS21): Deleted. Rolled this in to the one place it was used. This
helps make it clear that place was doing some unnecessary redundant work, and gets rid of the fairly
unclear name of this function.
(WebCore::CSSPropertyParser::consumeFont): Removed unnecessary and incorrect check for inherit and
initial keywords. The individual parsing steps already forbid those as appropriate, and allow them
in the case that was causing this bug. I have some doubts about whether this function correctly
returns true vs. false in all cases and what it consumes when it fails, but those don't seem to have
observable effects at this time, so I left that as is. Also tightened up the idiom in the loop that
parses the style, variant, weight, and stretch so it's easier to see an overview of it.

* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: Fixed the "interger" typo throughout
this file.
(WebCore::CSSPropertyParserHelpers::consumeIntegerTypeRaw):
(WebCore::CSSPropertyParserHelpers::consumeNumberRawAllowingSymbolTableIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumePercentRaw): Made local to this file, and removed
the ValueRange argument.
(WebCore::CSSPropertyParserHelpers::consumePercentRawAllowingSymbolTableIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeLengthRaw): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAngleRaw): Made local to this file.
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent): Removed the ValueRange, UnitlessQuirk,
UnitlessZeroQuirk, and CSSValuePool arguments.
(WebCore::CSSPropertyParserHelpers::consumeLengthOrPercentRaw): Made local to this file
and removed the ValueRange and UnitlessQuirk arguments.
(WebCore::CSSPropertyParserHelpers::consumeAngleOrNumberRaw): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeAngleOrNumberRawAllowingSymbolTableIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeNumberOrPercentRawAllowingSymbolTableIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeNumberOrNoneRawAllowingSymbolTableIdent): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumberRaw): Made local to this file.
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeIdentRangeRaw): Made local to this file.
(WebCore::CSSPropertyParserHelpers::consumeFontVariantCSS21Raw): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeFontWeightKeywordValueRaw): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeFontWeightRaw): Moved the font weight keyword list
in here instead of a separate function.
(WebCore::CSSPropertyParserHelpers::consumeGenericFamilyRaw): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeFontFamilyRaw): Made local to this file. Moved the
generic family range here instead of a separate function.
(WebCore::CSSPropertyParserHelpers::consumeFontSizeRaw): Made local to this file. Removed the
UnitlessQuirk argument.
(WebCore::CSSPropertyParserHelpers::consumeLineHeightRaw): Made local to this file.
(WebCore::CSSPropertyParserHelpers::consumeFontRaw): Removed unnecessary and incorrect check for
inherit and initial keywords. The individual parsing steps already forbid those as appropriate.
Also tightened up the idiom in the loop that parses the style, variant, weight, and stretch so
it's easier to see an overview of it.

* Source/WebCore/css/parser/CSSPropertyParserHelpers.h: Removed NumberOrPercentRaw,
NumberOrNoneRaw, PercentOrNoneRaw, NumberOrPercentOrNoneRaw, AngleOrNumberRaw,
AngleOrNumberOrNoneRaw, consumeFontWeightNumberRaw, consumeFontWeightNumber,
consumeLengthRaw, consumePercentRaw, consumeLengthOrPercentRaw, consumeAngleRaw,
consumeIdentRangeRaw, consumeFontVariantCSS21Raw, consumeFontWeightKeywordValueRaw,
consumeGenericFamilyRaw, consumeFontFamilyRaw, consumeFontSizeRaw, and consumeLineHeightRaw,
since none are used outside CSSPropertyParserHelpers.cpp.

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




More information about the webkit-changes mailing list