Changeset 282016 in webkit


Ignore:
Timestamp:
Sep 3, 2021 1:08:00 PM (11 months ago)
Author:
mmaxfield@apple.com
Message:

FontFaceSet.check() needs to react to style changes
https://bugs.webkit.org/show_bug.cgi?id=229844

Reviewed by Sam Weinig.

Source/WebCore:

When content says "document.fonts.check(...)", the ".check(...)" part needs to
update style instead of the "document.fonts" part. This is because it's
totally legal for content to say:

var f = document.fonts;
Modify style here
... f.check(...) ... <=== This needs to reflect the style changes.

Test: fast/text/FontFaceSet-check-after-style-update.html

  • WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme:
  • css/CSSFontFaceSet.cpp:

(WebCore::CSSFontFaceSet::check):

  • css/FontFaceSet.cpp:

(WebCore::FontFaceSet::check):

LayoutTests:

This can't be a WPT test because it requires internals.invalidateFontCache().

  • fast/text/FontFaceSet-check-after-style-update-expected.txt: Added.
  • fast/text/FontFaceSet-check-after-style-update.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r282015 r282016  
     12021-09-03  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        FontFaceSet.check() needs to react to style changes
     4        https://bugs.webkit.org/show_bug.cgi?id=229844
     5
     6        Reviewed by Sam Weinig.
     7
     8        This can't be a WPT test because it requires internals.invalidateFontCache().
     9
     10        * fast/text/FontFaceSet-check-after-style-update-expected.txt: Added.
     11        * fast/text/FontFaceSet-check-after-style-update.html: Added.
     12
    1132021-09-03  Myles C. Maxfield  <mmaxfield@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r282015 r282016  
     12021-09-03  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        FontFaceSet.check() needs to react to style changes
     4        https://bugs.webkit.org/show_bug.cgi?id=229844
     5
     6        Reviewed by Sam Weinig.
     7
     8        When content says "document.fonts.check(...)", the ".check(...)" part needs to
     9        update style instead of the "document.fonts" part. This is because it's
     10        totally legal for content to say:
     11
     12        var f = document.fonts;
     13        // Modify style here
     14        ... f.check(...) ... <=== This needs to reflect the style changes.
     15
     16        Test: fast/text/FontFaceSet-check-after-style-update.html
     17
     18        * WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme:
     19        * css/CSSFontFaceSet.cpp:
     20        (WebCore::CSSFontFaceSet::check):
     21        * css/FontFaceSet.cpp:
     22        (WebCore::FontFaceSet::check):
     23
    1242021-09-03  Myles C. Maxfield  <mmaxfield@apple.com>
    225
  • trunk/Source/WebCore/css/CSSFontFaceSet.cpp

    r281845 r282016  
    443443
    444444    for (auto& face : matchingFaces.releaseReturnValue()) {
    445         if (face.get().status() == CSSFontFace::Status::Pending)
     445        if (face.get().status() == CSSFontFace::Status::Pending
     446            || face.get().status() == CSSFontFace::Status::Loading)
    446447            return false;
    447448    }
  • trunk/Source/WebCore/css/FontFaceSet.cpp

    r282015 r282016  
    189189ExceptionOr<bool> FontFaceSet::check(const String& family, const String& text)
    190190{
    191     return m_backing->check(family, text);
     191    Ref protect = m_backing;
     192    protect->updateStyleIfNeeded();
     193    return protect->check(family, text);
    192194}
    193195   
Note: See TracChangeset for help on using the changeset viewer.