Title: [248622] branches/safari-608-branch
Revision
248622
Author
alanc...@apple.com
Date
2019-08-13 13:01:22 -0700 (Tue, 13 Aug 2019)

Log Message

Cherry-pick r248541. rdar://problem/54237768

    [iPadOS] Web pages sometimes load at half width in Safari
    https://bugs.webkit.org/show_bug.cgi?id=200624
    <rdar://problem/52694257>

    Reviewed by Simon Fraser.

    Source/WebKit:

    Whenever WKWebView's size changes, it normally notifies the web content process by calling into WebPageProxy::
    setViewportConfigurationViewLayoutSize, which remembers this view layout size using a member variable,
    m_viewportConfigurationViewLayoutSize. Later, m_viewportConfigurationViewLayoutSize is consulted as a part of
    constructing the creation parameters used to set up a new page.

    However, during animated resize, WKWebView avoids these calls to setViewportConfigurationViewLayoutSize via the
    dynamic viewport update mode check in -[WKWebView _frameOrBoundsChanged]. Instead, the new view layout size is
    pushed to the web process by calling WebPageProxy::dynamicViewportSizeUpdate.

    Since dynamicViewportSizeUpdate doesn't update m_viewportConfigurationViewLayoutSize, the next
    WebPageCreationParameters that are created with this WebPageProxy (e.g. after a process swap, or after
    reloading, if the process was terminated) will use the size of the WKWebView prior to the most recent animated
    resize.

    To fix the bug, we simply make sure that m_viewportConfigurationViewLayoutSize is updated in the dynamic
    viewport size update (i.e. animated resize) case as well.

    Test: WebKit.CreateWebPageAfterAnimatedResize

    * UIProcess/ios/WebPageProxyIOS.mm:
    (WebKit::WebPageProxy::dynamicViewportSizeUpdate):

    Tools:

    Add an API test to verify that after performing an animated resize and killing the web process, the subsequent
    web page is created using the post-animated-resize web view dimensions, rather than the original layout
    dimensions.

    * TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm:

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (248621 => 248622)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-08-13 20:01:19 UTC (rev 248621)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-08-13 20:01:22 UTC (rev 248622)
@@ -1,5 +1,80 @@
 2019-08-13  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r248541. rdar://problem/54237768
+
+    [iPadOS] Web pages sometimes load at half width in Safari
+    https://bugs.webkit.org/show_bug.cgi?id=200624
+    <rdar://problem/52694257>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebKit:
+    
+    Whenever WKWebView's size changes, it normally notifies the web content process by calling into WebPageProxy::
+    setViewportConfigurationViewLayoutSize, which remembers this view layout size using a member variable,
+    m_viewportConfigurationViewLayoutSize. Later, m_viewportConfigurationViewLayoutSize is consulted as a part of
+    constructing the creation parameters used to set up a new page.
+    
+    However, during animated resize, WKWebView avoids these calls to setViewportConfigurationViewLayoutSize via the
+    dynamic viewport update mode check in -[WKWebView _frameOrBoundsChanged]. Instead, the new view layout size is
+    pushed to the web process by calling WebPageProxy::dynamicViewportSizeUpdate.
+    
+    Since dynamicViewportSizeUpdate doesn't update m_viewportConfigurationViewLayoutSize, the next
+    WebPageCreationParameters that are created with this WebPageProxy (e.g. after a process swap, or after
+    reloading, if the process was terminated) will use the size of the WKWebView prior to the most recent animated
+    resize.
+    
+    To fix the bug, we simply make sure that m_viewportConfigurationViewLayoutSize is updated in the dynamic
+    viewport size update (i.e. animated resize) case as well.
+    
+    Test: WebKit.CreateWebPageAfterAnimatedResize
+    
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
+    
+    Tools:
+    
+    Add an API test to verify that after performing an animated resize and killing the web process, the subsequent
+    web page is created using the post-animated-resize web view dimensions, rather than the original layout
+    dimensions.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-12  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            [iPadOS] Web pages sometimes load at half width in Safari
+            https://bugs.webkit.org/show_bug.cgi?id=200624
+            <rdar://problem/52694257>
+
+            Reviewed by Simon Fraser.
+
+            Whenever WKWebView's size changes, it normally notifies the web content process by calling into WebPageProxy::
+            setViewportConfigurationViewLayoutSize, which remembers this view layout size using a member variable,
+            m_viewportConfigurationViewLayoutSize. Later, m_viewportConfigurationViewLayoutSize is consulted as a part of
+            constructing the creation parameters used to set up a new page.
+
+            However, during animated resize, WKWebView avoids these calls to setViewportConfigurationViewLayoutSize via the
+            dynamic viewport update mode check in -[WKWebView _frameOrBoundsChanged]. Instead, the new view layout size is
+            pushed to the web process by calling WebPageProxy::dynamicViewportSizeUpdate.
+
+            Since dynamicViewportSizeUpdate doesn't update m_viewportConfigurationViewLayoutSize, the next
+            WebPageCreationParameters that are created with this WebPageProxy (e.g. after a process swap, or after
+            reloading, if the process was terminated) will use the size of the WKWebView prior to the most recent animated
+            resize.
+
+            To fix the bug, we simply make sure that m_viewportConfigurationViewLayoutSize is updated in the dynamic
+            viewport size update (i.e. animated resize) case as well.
+
+            Test: WebKit.CreateWebPageAfterAnimatedResize
+
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
+
+2019-08-13  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r248487. rdar://problem/54237679
 
     [iOS 13] Google Docs/Slides/Sheets: paste often doesn't work and sometimes produces an error

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (248621 => 248622)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-08-13 20:01:19 UTC (rev 248621)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-08-13 20:01:22 UTC (rev 248622)
@@ -300,6 +300,7 @@
 
     hideValidationMessage();
 
+    m_viewportConfigurationViewLayoutSize = viewLayoutSize;
     m_process->send(Messages::WebPage::DynamicViewportSizeUpdate(viewLayoutSize,
         maximumUnobscuredSize, targetExposedContentRect, targetUnobscuredRect,
         targetUnobscuredRectInScrollViewCoordinates, unobscuredSafeAreaInsets,

Modified: branches/safari-608-branch/Tools/ChangeLog (248621 => 248622)


--- branches/safari-608-branch/Tools/ChangeLog	2019-08-13 20:01:19 UTC (rev 248621)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-08-13 20:01:22 UTC (rev 248622)
@@ -1,5 +1,64 @@
 2019-08-13  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r248541. rdar://problem/54237768
+
+    [iPadOS] Web pages sometimes load at half width in Safari
+    https://bugs.webkit.org/show_bug.cgi?id=200624
+    <rdar://problem/52694257>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebKit:
+    
+    Whenever WKWebView's size changes, it normally notifies the web content process by calling into WebPageProxy::
+    setViewportConfigurationViewLayoutSize, which remembers this view layout size using a member variable,
+    m_viewportConfigurationViewLayoutSize. Later, m_viewportConfigurationViewLayoutSize is consulted as a part of
+    constructing the creation parameters used to set up a new page.
+    
+    However, during animated resize, WKWebView avoids these calls to setViewportConfigurationViewLayoutSize via the
+    dynamic viewport update mode check in -[WKWebView _frameOrBoundsChanged]. Instead, the new view layout size is
+    pushed to the web process by calling WebPageProxy::dynamicViewportSizeUpdate.
+    
+    Since dynamicViewportSizeUpdate doesn't update m_viewportConfigurationViewLayoutSize, the next
+    WebPageCreationParameters that are created with this WebPageProxy (e.g. after a process swap, or after
+    reloading, if the process was terminated) will use the size of the WKWebView prior to the most recent animated
+    resize.
+    
+    To fix the bug, we simply make sure that m_viewportConfigurationViewLayoutSize is updated in the dynamic
+    viewport size update (i.e. animated resize) case as well.
+    
+    Test: WebKit.CreateWebPageAfterAnimatedResize
+    
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
+    
+    Tools:
+    
+    Add an API test to verify that after performing an animated resize and killing the web process, the subsequent
+    web page is created using the post-animated-resize web view dimensions, rather than the original layout
+    dimensions.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-12  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            [iPadOS] Web pages sometimes load at half width in Safari
+            https://bugs.webkit.org/show_bug.cgi?id=200624
+            <rdar://problem/52694257>
+
+            Reviewed by Simon Fraser.
+
+            Add an API test to verify that after performing an animated resize and killing the web process, the subsequent
+            web page is created using the post-animated-resize web view dimensions, rather than the original layout
+            dimensions.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm:
+
+2019-08-13  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r248487. rdar://problem/54237679
 
     [iOS 13] Google Docs/Slides/Sheets: paste often doesn't work and sometimes produces an error

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm (248621 => 248622)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm	2019-08-13 20:01:19 UTC (rev 248621)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm	2019-08-13 20:01:22 UTC (rev 248622)
@@ -28,6 +28,7 @@
 #import "PlatformUtilities.h"
 #import "Test.h"
 #import "TestNavigationDelegate.h"
+#import "TestWKWebView.h"
 #import <WebKit/WKPreferences.h>
 #import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/WKWebView.h>
@@ -428,4 +429,32 @@
     TestWebKitAPI::Util::run(&didGetCommitAfterEndAnimatedResize);
 }
 
+TEST(WebKit, CreateWebPageAfterAnimatedResize)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)]);
+    [webView synchronouslyLoadTestPageNamed:@"large-red-square-image"];
+
+    [webView _beginAnimatedResizeWithUpdates:^{
+        [webView setFrame:CGRectMake(0, 0, 768, 1024)];
+    }];
+
+    __block bool doneWaitingForPresentationUpdate = false;
+    [webView _doAfterNextPresentationUpdate:^{
+        doneWaitingForPresentationUpdate = true;
+    }];
+
+    [webView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:^{
+        [webView _endAnimatedResize];
+    }];
+
+    TestWebKitAPI::Util::run(&doneWaitingForPresentationUpdate);
+
+    [webView _killWebContentProcessAndResetState];
+    [webView synchronouslyLoadTestPageNamed:@"large-red-square-image"];
+
+    NSArray<NSNumber *> *dimensions = [webView objectByEvaluatingJavaScript:@"[innerWidth, innerHeight]"];
+    EXPECT_EQ(768, dimensions.firstObject.intValue);
+    EXPECT_EQ(1024, dimensions.lastObject.intValue);
+}
+
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to