Changeset 271688 in webkit


Ignore:
Timestamp:
Jan 21, 2021 1:51:11 AM (18 months ago)
Author:
commit-queue@webkit.org
Message:

Update font when resolving letter-spacing: calc(...) values
https://bugs.webkit.org/show_bug.cgi?id=216659

Patch by Frederic Wang <fwang@igalia.com> on 2021-01-21
Reviewed by Ryosuke Niwa.

Source/WebCore:

In bug 176215, maybeUpdateFontForLetterSpacing was added to ensure a font is available for
resolution of letter-spacing values that rely on relative font lengths. However, this does
not take into account the case when these lengths are part of a calc expression. In order to
keep things simple, this patch unconditionally updates the font when letter-spacing is a
calc expression.

Test: fast/css/letter-spacing-calc-with-font-relative-lengths-crash.html

  • style/StyleBuilderCustom.h:

(WebCore::Style::maybeUpdateFontForLetterSpacing):

LayoutTests:

  • fast/css/letter-spacing-calc-with-font-relative-lengths-crash-expected.txt: Added.
  • fast/css/letter-spacing-calc-with-font-relative-lengths-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271679 r271688  
     12021-01-21  Frederic Wang  <fwang@igalia.com>
     2
     3        Update font when resolving letter-spacing: calc(...) values
     4        https://bugs.webkit.org/show_bug.cgi?id=216659
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/css/letter-spacing-calc-with-font-relative-lengths-crash-expected.txt: Added.
     9        * fast/css/letter-spacing-calc-with-font-relative-lengths-crash.html: Added.
     10
    1112021-01-20  Kenneth Russell  <kbr@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r271686 r271688  
     12021-01-21  Frederic Wang  <fwang@igalia.com>
     2
     3        Update font when resolving letter-spacing: calc(...) values
     4        https://bugs.webkit.org/show_bug.cgi?id=216659
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        In bug 176215, maybeUpdateFontForLetterSpacing was added to ensure a font is available for
     9        resolution of letter-spacing values that rely on relative font lengths. However, this does
     10        not take into account the case when these lengths are part of a calc expression. In order to
     11        keep things simple, this patch unconditionally updates the font when letter-spacing is a
     12        calc expression.
     13
     14        Test: fast/css/letter-spacing-calc-with-font-relative-lengths-crash.html
     15
     16        * style/StyleBuilderCustom.h:
     17        (WebCore::Style::maybeUpdateFontForLetterSpacing):
     18
    1192021-01-20  Yusuke Suzuki  <ysuzuki@apple.com>
    220
  • trunk/Source/WebCore/style/StyleBuilderCustom.h

    r269957 r271688  
    655655    // to only do work if the font is actually dirty.
    656656
    657     if (is<CSSPrimitiveValue>(value) && downcast<CSSPrimitiveValue>(value).isFontRelativeLength())
    658         builderState.updateFont();
     657    if (is<CSSPrimitiveValue>(value)) {
     658        auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
     659        if (primitiveValue.isFontRelativeLength() || primitiveValue.isCalculated())
     660            builderState.updateFont();
     661    }
    659662}
    660663
Note: See TracChangeset for help on using the changeset viewer.