Title: [250368] branches/safari-608-branch/Source/WebKit
Revision
250368
Author
[email protected]
Date
2019-09-25 16:08:27 -0700 (Wed, 25 Sep 2019)

Log Message

Cherry-pick r250187. rdar://problem/55644650

    Regression(iOS 13) web views do not deal properly with their window's UIScene changing
    https://bugs.webkit.org/show_bug.cgi?id=202070
    <rdar://problem/55580699>

    Reviewed by Tim Horton.

    Web views do not deal properly with their window's UIScene changing. If a Safari window is in the
    background for 1 minute, its UIScene will be detached and the window will get a new UIScene if
    the user later switches to this window. Our web views listen to UIScene notifications to determine
    their visibility and currently stop receiving visibility updates once the window’s UIScene has
    changed. This causes view freezes because our WebContent process does not know its view is visible
    and keeps its layer tree frozen.

    Previously, when our view would be added to a window, we would get this window's UIScene and listen
    for UISceneDidEnterBackgroundNotification / UISceneWillEnterForegroundNotification for this UIScene
    object. Instead, we now listen to these notifications for ALL the application's UIScenes. Our handler
    then checks if the notification's UIScene object matches the current window's UIScene before
    forwarding the notification to the rest of WebKit.

    * UIProcess/ApplicationStateTracker.mm:
    (WebKit::ApplicationStateTracker::ApplicationStateTracker):
    (WebKit::ApplicationStateTracker::~ApplicationStateTracker):

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (250367 => 250368)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-25 23:08:25 UTC (rev 250367)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-25 23:08:27 UTC (rev 250368)
@@ -1,5 +1,60 @@
 2019-09-25  Alan Coon  <[email protected]>
 
+        Cherry-pick r250187. rdar://problem/55644650
+
+    Regression(iOS 13) web views do not deal properly with their window's UIScene changing
+    https://bugs.webkit.org/show_bug.cgi?id=202070
+    <rdar://problem/55580699>
+    
+    Reviewed by Tim Horton.
+    
+    Web views do not deal properly with their window's UIScene changing. If a Safari window is in the
+    background for 1 minute, its UIScene will be detached and the window will get a new UIScene if
+    the user later switches to this window. Our web views listen to UIScene notifications to determine
+    their visibility and currently stop receiving visibility updates once the window’s UIScene has
+    changed. This causes view freezes because our WebContent process does not know its view is visible
+    and keeps its layer tree frozen.
+    
+    Previously, when our view would be added to a window, we would get this window's UIScene and listen
+    for UISceneDidEnterBackgroundNotification / UISceneWillEnterForegroundNotification for this UIScene
+    object. Instead, we now listen to these notifications for ALL the application's UIScenes. Our handler
+    then checks if the notification's UIScene object matches the current window's UIScene before
+    forwarding the notification to the rest of WebKit.
+    
+    * UIProcess/ApplicationStateTracker.mm:
+    (WebKit::ApplicationStateTracker::ApplicationStateTracker):
+    (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-21  Chris Dumez  <[email protected]>
+
+            Regression(iOS 13) web views do not deal properly with their window's UIScene changing
+            https://bugs.webkit.org/show_bug.cgi?id=202070
+            <rdar://problem/55580699>
+
+            Reviewed by Tim Horton.
+
+            Web views do not deal properly with their window's UIScene changing. If a Safari window is in the
+            background for 1 minute, its UIScene will be detached and the window will get a new UIScene if
+            the user later switches to this window. Our web views listen to UIScene notifications to determine
+            their visibility and currently stop receiving visibility updates once the window’s UIScene has
+            changed. This causes view freezes because our WebContent process does not know its view is visible
+            and keeps its layer tree frozen.
+
+            Previously, when our view would be added to a window, we would get this window's UIScene and listen
+            for UISceneDidEnterBackgroundNotification / UISceneWillEnterForegroundNotification for this UIScene
+            object. Instead, we now listen to these notifications for ALL the application's UIScenes. Our handler
+            then checks if the notification's UIScene object matches the current window's UIScene before
+            forwarding the notification to the rest of WebKit.
+
+            * UIProcess/ApplicationStateTracker.mm:
+            (WebKit::ApplicationStateTracker::ApplicationStateTracker):
+            (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
+
+2019-09-25  Alan Coon  <[email protected]>
+
         Cherry-pick r250154. rdar://problem/55644650
 
     ApplicationStateTracker::m_isBackground initialization does not account for UIScenes

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm (250367 => 250368)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2019-09-25 23:08:25 UTC (rev 250367)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ApplicationStateTracker.mm	2019-09-25 23:08:27 UTC (rev 250368)
@@ -108,14 +108,18 @@
         m_isInBackground = window.windowScene.activationState == UISceneActivationStateBackground || window.windowScene.activationState == UISceneActivationStateUnattached;
         RELEASE_LOG(ViewState, "%p - ApplicationStateTracker::ApplicationStateTracker(): m_isInBackground: %d", this, m_isInBackground);
 
-        m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
-            RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
-            applicationDidEnterBackground();
+        m_didEnterBackgroundObserver = [notificationCenter addObserverForName:UISceneDidEnterBackgroundNotification object:nil queue:nil usingBlock:[this](NSNotification *notification) {
+            if (notification.object == [[m_view window] windowScene]) {
+                RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneDidEnterBackground", this);
+                applicationDidEnterBackground();
+            }
         }];
 
-        m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:window.windowScene queue:nil usingBlock:[this](NSNotification *) {
-            RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneWillEnterForeground", this);
-            applicationWillEnterForeground();
+        m_willEnterForegroundObserver = [notificationCenter addObserverForName:UISceneWillEnterForegroundNotification object:nil queue:nil usingBlock:[this](NSNotification *notification) {
+            if (notification.object == [[m_view window] windowScene]) {
+                RELEASE_LOG(ViewState, "%p - ApplicationStateTracker: UISceneWillEnterForeground", this);
+                applicationWillEnterForeground();
+            }
         }];
 #else
         m_isInBackground = application.applicationState == UIApplicationStateBackground;
@@ -180,6 +184,7 @@
 
 ApplicationStateTracker::~ApplicationStateTracker()
 {
+    RELEASE_LOG(ViewState, "%p - ~ApplicationStateTracker", this);
     if (m_applicationStateMonitor) {
         [m_applicationStateMonitor invalidate];
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to