⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 293268 in webkit


Ignore:
Timestamp:
Apr 22, 2022, 4:59:56 PM (4 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r292274. rdar://problem/80544133

[Cocoa] Automatically relayout the page when new fonts are installed
https://bugs.webkit.org/show_bug.cgi?id=238483
<rdar://problem/80544133>

Reviewed by Chris Dumez.

Source/WebCore:

This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a
kCTFontManagerRegisteredFontsChangedNotification.

FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and
therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global
callback and calls that instead. This callback is set at initialization time.

Test: fast/text/install-font-style-recalc.html

  • page/Page.cpp: (WebCore::m_contentSecurityPolicyModeForExtension): (WebCore::Page::firstTimeInitialization):
  • page/Page.h:
  • platform/graphics/FontCache.cpp: (WebCore::Function<void): (WebCore::FontCache::registerFontCacheInvalidationCallback): (WebCore::FontCache::invalidateAllFontCaches):
  • platform/graphics/FontCache.h:

Tools:

Make TestRunner::dumpResourceLoadStatistics() clear any currently-recorded statistics.
This avoids the problem where spurious layouts during the time when the page has been created but
before the test has begun record irrelevant statistics.

  • WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::beginTesting): (WTR::InjectedBundle::clearResourceLoadStatistics):
  • WebKitTestRunner/InjectedBundle/InjectedBundle.h:
  • WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::dumpResourceLoadStatistics):

LayoutTests:

  • TestExpectations:
  • fast/text/install-font-style-recalc-expected.txt: Added.
  • fast/text/install-font-style-recalc.html: Added.
  • platform/ios-wk2/TestExpectations:
  • platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292274 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-613.2.7.1-branch
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-613.2.7.1-branch/LayoutTests/ChangeLog

    r293267 r293268  
     12022-04-22  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r292274. rdar://problem/80544133
     4
     5    [Cocoa] Automatically relayout the page when new fonts are installed
     6    https://bugs.webkit.org/show_bug.cgi?id=238483
     7    <rdar://problem/80544133>
     8   
     9    Reviewed by Chris Dumez.
     10   
     11    Source/WebCore:
     12   
     13    This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a
     14    kCTFontManagerRegisteredFontsChangedNotification.
     15   
     16    FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and
     17    therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global
     18    callback and calls that instead. This callback is set at initialization time.
     19   
     20    Test: fast/text/install-font-style-recalc.html
     21   
     22    * page/Page.cpp:
     23    (WebCore::m_contentSecurityPolicyModeForExtension):
     24    (WebCore::Page::firstTimeInitialization):
     25    * page/Page.h:
     26    * platform/graphics/FontCache.cpp:
     27    (WebCore::Function<void):
     28    (WebCore::FontCache::registerFontCacheInvalidationCallback):
     29    (WebCore::FontCache::invalidateAllFontCaches):
     30    * platform/graphics/FontCache.h:
     31   
     32    Tools:
     33   
     34    Make TestRunner::dumpResourceLoadStatistics() clear any currently-recorded statistics.
     35    This avoids the problem where spurious layouts during the time when the page has been created but
     36    before the test has begun record irrelevant statistics.
     37   
     38    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     39    (WTR::InjectedBundle::beginTesting):
     40    (WTR::InjectedBundle::clearResourceLoadStatistics):
     41    * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
     42    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     43    (WTR::TestRunner::dumpResourceLoadStatistics):
     44   
     45    LayoutTests:
     46   
     47    * TestExpectations:
     48    * fast/text/install-font-style-recalc-expected.txt: Added.
     49    * fast/text/install-font-style-recalc.html: Added.
     50    * platform/ios-wk2/TestExpectations:
     51    * platform/mac-wk2/TestExpectations:
     52   
     53    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     54
     55    2022-04-02  Myles C. Maxfield  <mmaxfield@apple.com>
     56
     57            [Cocoa] Automatically relayout the page when new fonts are installed
     58            https://bugs.webkit.org/show_bug.cgi?id=238483
     59            <rdar://problem/80544133>
     60
     61            Reviewed by Chris Dumez.
     62
     63            * TestExpectations:
     64            * fast/text/install-font-style-recalc-expected.txt: Added.
     65            * fast/text/install-font-style-recalc.html: Added.
     66            * platform/ios-wk2/TestExpectations:
     67            * platform/mac-wk2/TestExpectations:
     68
    1692022-04-22  Russell Epstein  <repstein@apple.com>
    270
  • branches/safari-613.2.7.1-branch/LayoutTests/platform/ios-wk2/TestExpectations

    r293133 r293268  
    22122212imported/w3c/web-platform-tests/pointerevents [ Skip ]
    22132213pointerevents/mouse [ Failure ]
     2214
     2215fast/text/install-font-style-recalc.html [ Pass ]
  • branches/safari-613.2.7.1-branch/LayoutTests/platform/mac-wk2/TestExpectations

    r293133 r293268  
    16761676# rdar://86037417 WindowServer returned not alive with context:,unresponsive work processor(s)
    16771677[ Monterey+ ] http/tests/model/model-document.html [ Skip ]
     1678
     1679fast/text/install-font-style-recalc.html [ Pass ]
  • branches/safari-613.2.7.1-branch/Source/WebCore/ChangeLog

    r293267 r293268  
     12022-04-22  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r292274. rdar://problem/80544133
     4
     5    [Cocoa] Automatically relayout the page when new fonts are installed
     6    https://bugs.webkit.org/show_bug.cgi?id=238483
     7    <rdar://problem/80544133>
     8   
     9    Reviewed by Chris Dumez.
     10   
     11    Source/WebCore:
     12   
     13    This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a
     14    kCTFontManagerRegisteredFontsChangedNotification.
     15   
     16    FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and
     17    therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global
     18    callback and calls that instead. This callback is set at initialization time.
     19   
     20    Test: fast/text/install-font-style-recalc.html
     21   
     22    * page/Page.cpp:
     23    (WebCore::m_contentSecurityPolicyModeForExtension):
     24    (WebCore::Page::firstTimeInitialization):
     25    * page/Page.h:
     26    * platform/graphics/FontCache.cpp:
     27    (WebCore::Function<void):
     28    (WebCore::FontCache::registerFontCacheInvalidationCallback):
     29    (WebCore::FontCache::invalidateAllFontCaches):
     30    * platform/graphics/FontCache.h:
     31   
     32    Tools:
     33   
     34    Make TestRunner::dumpResourceLoadStatistics() clear any currently-recorded statistics.
     35    This avoids the problem where spurious layouts during the time when the page has been created but
     36    before the test has begun record irrelevant statistics.
     37   
     38    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     39    (WTR::InjectedBundle::beginTesting):
     40    (WTR::InjectedBundle::clearResourceLoadStatistics):
     41    * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
     42    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     43    (WTR::TestRunner::dumpResourceLoadStatistics):
     44   
     45    LayoutTests:
     46   
     47    * TestExpectations:
     48    * fast/text/install-font-style-recalc-expected.txt: Added.
     49    * fast/text/install-font-style-recalc.html: Added.
     50    * platform/ios-wk2/TestExpectations:
     51    * platform/mac-wk2/TestExpectations:
     52   
     53    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     54
     55    2022-04-02  Myles C. Maxfield  <mmaxfield@apple.com>
     56
     57            [Cocoa] Automatically relayout the page when new fonts are installed
     58            https://bugs.webkit.org/show_bug.cgi?id=238483
     59            <rdar://problem/80544133>
     60
     61            Reviewed by Chris Dumez.
     62
     63            This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a
     64            kCTFontManagerRegisteredFontsChangedNotification.
     65
     66            FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and
     67            therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global
     68            callback and calls that instead. This callback is set at initialization time.
     69
     70            Test: fast/text/install-font-style-recalc.html
     71
     72            * page/Page.cpp:
     73            (WebCore::m_contentSecurityPolicyModeForExtension):
     74            (WebCore::Page::firstTimeInitialization):
     75            * page/Page.h:
     76            * platform/graphics/FontCache.cpp:
     77            (WebCore::Function<void):
     78            (WebCore::FontCache::registerFontCacheInvalidationCallback):
     79            (WebCore::FontCache::invalidateAllFontCaches):
     80            * platform/graphics/FontCache.h:
     81
    1822022-04-22  Russell Epstein  <repstein@apple.com>
    283
  • branches/safari-613.2.7.1-branch/Source/WebCore/page/Page.cpp

    r293267 r293268  
    350350    m_visitedLinkStore->addPage(*this);
    351351
    352     static bool addedListener;
    353     if (!addedListener) {
    354         platformStrategies()->loaderStrategy()->addOnlineStateChangeListener(&networkStateChanged);
    355         addedListener = true;
     352    static bool firstTimeInitializationRan = false;
     353    if (!firstTimeInitializationRan) {
     354        firstTimeInitialization();
     355        firstTimeInitializationRan = true;
    356356    }
    357357
     
    435435    m_userContentProvider->removePage(*this);
    436436    m_visitedLinkStore->removePage(*this);
     437}
     438
     439void Page::firstTimeInitialization()
     440{
     441    platformStrategies()->loaderStrategy()->addOnlineStateChangeListener(&networkStateChanged);
     442
     443    FontCache::registerFontCacheInvalidationCallback([] {
     444        forEachPage([](auto& page) {
     445            page.setNeedsRecalcStyleInAllFrames();
     446        });
     447    });
    437448}
    438449
  • branches/safari-613.2.7.1-branch/Source/WebCore/page/Page.h

    r293133 r293268  
    940940    void logNavigation(const Navigation&);
    941941
     942    static void firstTimeInitialization();
     943
    942944    WEBCORE_EXPORT void initGroup();
    943945
  • branches/safari-613.2.7.1-branch/Tools/ChangeLog

    r293248 r293268  
     12022-04-22  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r292274. rdar://problem/80544133
     4
     5    [Cocoa] Automatically relayout the page when new fonts are installed
     6    https://bugs.webkit.org/show_bug.cgi?id=238483
     7    <rdar://problem/80544133>
     8   
     9    Reviewed by Chris Dumez.
     10   
     11    Source/WebCore:
     12   
     13    This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a
     14    kCTFontManagerRegisteredFontsChangedNotification.
     15   
     16    FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and
     17    therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global
     18    callback and calls that instead. This callback is set at initialization time.
     19   
     20    Test: fast/text/install-font-style-recalc.html
     21   
     22    * page/Page.cpp:
     23    (WebCore::m_contentSecurityPolicyModeForExtension):
     24    (WebCore::Page::firstTimeInitialization):
     25    * page/Page.h:
     26    * platform/graphics/FontCache.cpp:
     27    (WebCore::Function<void):
     28    (WebCore::FontCache::registerFontCacheInvalidationCallback):
     29    (WebCore::FontCache::invalidateAllFontCaches):
     30    * platform/graphics/FontCache.h:
     31   
     32    Tools:
     33   
     34    Make TestRunner::dumpResourceLoadStatistics() clear any currently-recorded statistics.
     35    This avoids the problem where spurious layouts during the time when the page has been created but
     36    before the test has begun record irrelevant statistics.
     37   
     38    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     39    (WTR::InjectedBundle::beginTesting):
     40    (WTR::InjectedBundle::clearResourceLoadStatistics):
     41    * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
     42    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     43    (WTR::TestRunner::dumpResourceLoadStatistics):
     44   
     45    LayoutTests:
     46   
     47    * TestExpectations:
     48    * fast/text/install-font-style-recalc-expected.txt: Added.
     49    * fast/text/install-font-style-recalc.html: Added.
     50    * platform/ios-wk2/TestExpectations:
     51    * platform/mac-wk2/TestExpectations:
     52   
     53    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     54
     55    2022-04-02  Myles C. Maxfield  <mmaxfield@apple.com>
     56
     57            [Cocoa] Automatically relayout the page when new fonts are installed
     58            https://bugs.webkit.org/show_bug.cgi?id=238483
     59            <rdar://problem/80544133>
     60
     61            Reviewed by Chris Dumez.
     62
     63            Make TestRunner::dumpResourceLoadStatistics() clear any currently-recorded statistics.
     64            This avoids the problem where spurious layouts during the time when the page has been created but
     65            before the test has begun record irrelevant statistics.
     66
     67            * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     68            (WTR::InjectedBundle::beginTesting):
     69            (WTR::InjectedBundle::clearResourceLoadStatistics):
     70            * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
     71            * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     72            (WTR::TestRunner::dumpResourceLoadStatistics):
     73
    1742022-04-22  Russell Epstein  <repstein@apple.com>
    275
  • branches/safari-613.2.7.1-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r293133 r293268  
    544544    WKBundlePageClearApplicationCache(page()->page());
    545545    WKBundleResetOriginAccessAllowLists(m_bundle.get());
    546     WKBundleClearResourceLoadStatistics(m_bundle.get());
     546    clearResourceLoadStatistics();
    547547
    548548    // [WK2] REGRESSION(r128623): It made layout tests extremely slow
     
    575575
    576576    m_state = Idle;
     577}
     578
     579void InjectedBundle::clearResourceLoadStatistics()
     580{
     581    WKBundleClearResourceLoadStatistics(m_bundle.get());
    577582}
    578583
  • branches/safari-613.2.7.1-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h

    r293133 r293268  
    149149    size_t userScriptInjectedCount() const { return m_userScriptInjectedCount; }
    150150
     151    void clearResourceLoadStatistics();
     152
    151153private:
    152154    InjectedBundle() = default;
  • branches/safari-613.2.7.1-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r293133 r293268  
    13341334void TestRunner::dumpResourceLoadStatistics()
    13351335{
     1336    InjectedBundle::singleton().clearResourceLoadStatistics();
    13361337    postSynchronousPageMessage("dumpResourceLoadStatistics");
    13371338}
Note: See TracChangeset for help on using the changeset viewer.