[webkit-changes] [WebKit/WebKit] eecfb4: Fix serialization of font-stretch in font shorthand

Darin Adler noreply at github.com
Mon Oct 17 08:14:37 PDT 2022


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

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-font-stretch-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-font-stretch.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-valid-expected.txt
    M Source/WebCore/css/StyleProperties.cpp

  Log Message:
  -----------
  Fix serialization of font-stretch in font shorthand
https://bugs.webkit.org/show_bug.cgi?id=246573
rdar://problem/101217780

Reviewed by Tim Nguyen.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-font-stretch-expected.txt:
Expect PASS instead of FAIL.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-shorthand-serialization-font-stretch.html:
Expand test to cover handling of keywords, including the normal keyword that should be omitted from
the serialization of the font shorthand. Also check the fontStretch values as well to make the
coverage a little more thorough, and added a case of a value that would round to one of the keywords
to make sure the mapping from percentage to keyword is precise.

* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-valid-expected.txt:
Update results that had the normal keyword serialized for font-stretch as part of the font
shorthand. There are lots of other problems of the same type here that need to be fixed, so this
still has mostly failing tests. Needs to be revisited.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::fontStretchKeyword): Added. Helper for the function below.
(WebCore::StyleProperties::fontValue const): Added code to treat font-stretch with a
percentage as a special case, and map it to a keyword, even if it wasn't specified with one.
Also make sure we don't include "normal" since that's the font-stretch default.

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




More information about the webkit-changes mailing list