[webkit-changes] [WebKit/WebKit] ef82a0: Refactoring font-face src parsing

Vitor Roriz noreply at github.com
Fri Jan 13 06:24:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ef82a019637be51b1882305e819eeb2bba96f316
      https://github.com/WebKit/WebKit/commit/ef82a019637be51b1882305e819eeb2bba96f316
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M LayoutTests/fast/css/font-face-src-parsing-expected.txt
    M LayoutTests/fast/css/font-face-src-parsing.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-list-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt
    M Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp

  Log Message:
  -----------
  Refactoring font-face src parsing
https://bugs.webkit.org/show_bug.cgi?id=250471
rdar://104135235

Reviewed by Myles C. Maxfield.

Refactoring font-face src parsing such that we parse each component
separated by commas, individually.

If all components can't be parsed, then the src descriptor is
invalidated. This was already done before, but now each component parser,
such as consumeFontFaceSrcURI() and consumeFontFaceSrcLocal() will
receive a subrange, and the whole subrange has to be parsed for the
component to be valid.  This will fix test failures we had when parsing
format() in a URI component.

The optional format() token can optionally follow a url() token. Before,
if garbage was following the url() token, we would ignore it and still
validate the component with an empty format. However, we would not
consume the range being parsed, and if the next token was not a Comma,
we would invalidate the whole descriptor.

* LayoutTests/fast/css/font-face-src-parsing-expected.txt:
Update on which src descriptors are valid.
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-list-expected.txt:
Missing failures should pass now.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt:
We don't support tech() yet but we need to rebaseline here. Increment
tests will pass now.

* Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcLocal):
Component is invalidated if the whole range is not consumed.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrc):

* LayoutTests/fast/css/font-face-src-parsing-expected.txt:
* LayoutTests/fast/css/font-face-src-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-list-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt:
* Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcLocal):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrc):

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




More information about the webkit-changes mailing list