[webkit-changes] [WebKit/WebKit] 89bdb0: [CSS Fonts] The `from-font` value for CSS `font-si...

ChangSeok Oh noreply at github.com
Sat Oct 7 07:54:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 89bdb0336c3b32a4130822ed976d858538e0d596
      https://github.com/WebKit/WebKit/commit/89bdb0336c3b32a4130822ed976d858538e0d596
  Author: ChangSeok Oh <changseok at webkit.org>
  Date:   2023-10-07 (Sat, 07 Oct 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/platform/graphics/FontCascade.h
    M Source/WebCore/platform/graphics/FontCascadeCache.h
    M Source/WebCore/platform/graphics/FontCascadeFonts.h
    M Source/WebCore/platform/graphics/FontSizeAdjust.h
    M Source/WebCore/style/StyleBuilderConverter.h
    M Source/WebCore/style/StyleFontSizeFunctions.cpp
    M Source/WebCore/style/StyleFontSizeFunctions.h

  Log Message:
  -----------
  [CSS Fonts] The `from-font` value for CSS `font-size-adjust` is not computed correctly
https://bugs.webkit.org/show_bug.cgi?id=259551

Reviewed by Tim Nguyen.

When resolving styles, we used the parent-style font to compute the aspect ratio
for font-size-adjust: from-font because the first available font could not be
determined at that moment. Unfortunately, this causes the failure of
font-size-adjust-014.html. To make the test happy, we should defer resolving
the aspect value after determining a primary font. Also, FontDescriptionKey
should consider if the font-size-adjust has from-font, not simply checking if
it has a valid value when looking up a proper FontCascadeFonts.

For minimizing performance regression, this patch is updated as follows.
1. The resolving place changed from FontCascadeFonts::glyphDataForCharacter() to
   FontCascadeFonts::primaryFont(). Font-size-adjust:from-font is resolved when
   the primary font is created the first time.
2. Copying FontCascadeDescription is avoided. Instead, the source font description
   is directly modified.

* LayoutTests/TestExpectations:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::fontSizeAdjustFromStyle):
* Source/WebCore/platform/graphics/FontCascade.h:
* Source/WebCore/platform/graphics/FontCascadeCache.h:
(WebCore::FontDescriptionKey::FontDescriptionKey):
* Source/WebCore/platform/graphics/FontCascadeFonts.h:
(WebCore::FontCascadeFonts::primaryFont):
* Source/WebCore/platform/graphics/FontSizeAdjust.h:
(WebCore::FontSizeAdjust::operator bool const):
(WebCore::FontSizeAdjust::resolve const):
(WebCore::add):
(WebCore::operator<<):
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertFontSizeAdjust):
* Source/WebCore/style/StyleFontSizeFunctions.cpp:
(WebCore::Style::aspectValueOfPrimaryFont): Deleted.
* Source/WebCore/style/StyleFontSizeFunctions.h:

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




More information about the webkit-changes mailing list