Title: [293263] branches/safari-613.2.7.0-branch
Revision
293263
Author
repst...@apple.com
Date
2022-04-22 16:06:32 -0700 (Fri, 22 Apr 2022)

Log 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

Modified Paths

Diff

Modified: branches/safari-613.2.7.0-branch/LayoutTests/ChangeLog (293262 => 293263)


--- branches/safari-613.2.7.0-branch/LayoutTests/ChangeLog	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/LayoutTests/ChangeLog	2022-04-22 23:06:32 UTC (rev 293263)
@@ -1,5 +1,73 @@
 2022-04-22  Alan Coon  <alanc...@apple.com>
 
+        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
+
+    2022-04-02  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+            [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.
+
+            * 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:
+
+2022-04-22  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r292072. rdar://problem/80544133
 
     [Cocoa] Automatically relayout the page when new fonts are installed

Modified: branches/safari-613.2.7.0-branch/LayoutTests/platform/ios-wk2/TestExpectations (293262 => 293263)


--- branches/safari-613.2.7.0-branch/LayoutTests/platform/ios-wk2/TestExpectations	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/LayoutTests/platform/ios-wk2/TestExpectations	2022-04-22 23:06:32 UTC (rev 293263)
@@ -2211,3 +2211,5 @@
 # See webkit.org/b/233498 for context on this pointerevents tests
 imported/w3c/web-platform-tests/pointerevents [ Skip ]
 pointerevents/mouse [ Failure ]
+
+fast/text/install-font-style-recalc.html [ Pass ]

Modified: branches/safari-613.2.7.0-branch/LayoutTests/platform/mac-wk2/TestExpectations (293262 => 293263)


--- branches/safari-613.2.7.0-branch/LayoutTests/platform/mac-wk2/TestExpectations	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/LayoutTests/platform/mac-wk2/TestExpectations	2022-04-22 23:06:32 UTC (rev 293263)
@@ -1675,3 +1675,5 @@
 
 # rdar://86037417 WindowServer returned not alive with context:,unresponsive work processor(s)
 [ Monterey+ ] http/tests/model/model-document.html [ Skip ]
+
+fast/text/install-font-style-recalc.html [ Pass ]

Modified: branches/safari-613.2.7.0-branch/Source/WebCore/ChangeLog (293262 => 293263)


--- branches/safari-613.2.7.0-branch/Source/WebCore/ChangeLog	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/Source/WebCore/ChangeLog	2022-04-22 23:06:32 UTC (rev 293263)
@@ -1,5 +1,86 @@
 2022-04-22  Alan Coon  <alanc...@apple.com>
 
+        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
+
+    2022-04-02  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+            [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.
+
+            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:
+
+2022-04-22  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r292072. rdar://problem/80544133
 
     [Cocoa] Automatically relayout the page when new fonts are installed

Modified: branches/safari-613.2.7.0-branch/Source/WebCore/page/Page.cpp (293262 => 293263)


--- branches/safari-613.2.7.0-branch/Source/WebCore/page/Page.cpp	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/Source/WebCore/page/Page.cpp	2022-04-22 23:06:32 UTC (rev 293263)
@@ -349,10 +349,10 @@
     m_userContentProvider->addPage(*this);
     m_visitedLinkStore->addPage(*this);
 
-    static bool addedListener;
-    if (!addedListener) {
-        platformStrategies()->loaderStrategy()->addOnlineStateChangeListener(&networkStateChanged);
-        addedListener = true;
+    static bool firstTimeInitializationRan = false;
+    if (!firstTimeInitializationRan) {
+        firstTimeInitialization();
+        firstTimeInitializationRan = true;
     }
 
     ASSERT(!allPages().contains(this));
@@ -436,6 +436,17 @@
     m_visitedLinkStore->removePage(*this);
 }
 
+void Page::firstTimeInitialization()
+{
+    platformStrategies()->loaderStrategy()->addOnlineStateChangeListener(&networkStateChanged);
+
+    FontCache::registerFontCacheInvalidationCallback([] {
+        forEachPage([](auto& page) {
+            page.setNeedsRecalcStyleInAllFrames();
+        });
+    });
+}
+
 void Page::clearPreviousItemFromAllPages(HistoryItem* item)
 {
     for (auto* page : allPages()) {

Modified: branches/safari-613.2.7.0-branch/Source/WebCore/page/Page.h (293262 => 293263)


--- branches/safari-613.2.7.0-branch/Source/WebCore/page/Page.h	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/Source/WebCore/page/Page.h	2022-04-22 23:06:32 UTC (rev 293263)
@@ -939,6 +939,8 @@
     };
     void logNavigation(const Navigation&);
 
+    static void firstTimeInitialization();
+
     WEBCORE_EXPORT void initGroup();
 
     void setIsInWindowInternal(bool);

Modified: branches/safari-613.2.7.0-branch/Tools/ChangeLog (293262 => 293263)


--- branches/safari-613.2.7.0-branch/Tools/ChangeLog	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/Tools/ChangeLog	2022-04-22 23:06:32 UTC (rev 293263)
@@ -1,3 +1,76 @@
+2022-04-22  Alan Coon  <alanc...@apple.com>
+
+        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
+
+    2022-04-02  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+            [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.
+
+            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):
+
 2022-04-22  Russell Epstein  <repst...@apple.com>
 
         Apply patch. rdar://problem/88904160

Modified: branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (293262 => 293263)


--- branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2022-04-22 23:06:32 UTC (rev 293263)
@@ -543,7 +543,7 @@
     WKBundleClearAllDatabases(m_bundle.get());
     WKBundlePageClearApplicationCache(page()->page());
     WKBundleResetOriginAccessAllowLists(m_bundle.get());
-    WKBundleClearResourceLoadStatistics(m_bundle.get());
+    clearResourceLoadStatistics();
 
     // [WK2] REGRESSION(r128623): It made layout tests extremely slow
     // https://bugs.webkit.org/show_bug.cgi?id=96862
@@ -576,6 +576,11 @@
     m_state = Idle;
 }
 
+void InjectedBundle::clearResourceLoadStatistics()
+{
+    WKBundleClearResourceLoadStatistics(m_bundle.get());
+}
+
 void InjectedBundle::dumpBackForwardListsForAllPages(StringBuilder& stringBuilder)
 {
     size_t size = m_pages.size();

Modified: branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (293262 => 293263)


--- branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2022-04-22 23:06:32 UTC (rev 293263)
@@ -148,6 +148,8 @@
     void increaseUserScriptInjectedCount() { ++m_userScriptInjectedCount; }
     size_t userScriptInjectedCount() const { return m_userScriptInjectedCount; }
 
+    void clearResourceLoadStatistics();
+
 private:
     InjectedBundle() = default;
     ~InjectedBundle();

Modified: branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (293262 => 293263)


--- branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2022-04-22 23:06:25 UTC (rev 293262)
+++ branches/safari-613.2.7.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2022-04-22 23:06:32 UTC (rev 293263)
@@ -1333,6 +1333,7 @@
     
 void TestRunner::dumpResourceLoadStatistics()
 {
+    InjectedBundle::singleton().clearResourceLoadStatistics();
     postSynchronousPageMessage("dumpResourceLoadStatistics");
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to