Device orientation may be wrong on page reload after crash
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 18:12:10 +0000 (18:12 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 18:12:10 +0000 (18:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192349
<rdar://problem/46359466>

Reviewed by Eric Carlson.

On page crash, the process is relaunched and the page is reloaded.
At that point, the orientation information of the page is not reset until the next device orientation change.
To fix that, add the device orientation to the page creation parameters so that we pass it everytime we create a page.
Covered by manual testing.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:

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

Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp

index 315e7fb..99e9175 100644 (file)
@@ -1,3 +1,24 @@
+2018-12-04  Youenn Fablet  <youenn@apple.com>
+
+        Device orientation may be wrong on page reload after crash
+        https://bugs.webkit.org/show_bug.cgi?id=192349
+        <rdar://problem/46359466>
+
+        Reviewed by Eric Carlson.
+
+        On page crash, the process is relaunched and the page is reloaded.
+        At that point, the orientation information of the page is not reset until the next device orientation change.
+        To fix that, add the device orientation to the page creation parameters so that we pass it everytime we create a page.
+        Covered by manual testing.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        * WebProcess/WebPage/WebPage.cpp:
+
 2018-12-04  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
 
         [WPE] Add gtk-doc
index 9419b4c..3ea064a 100644 (file)
@@ -90,6 +90,7 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << viewportConfigurationLayoutSizeScaleFactor;
     encoder << viewportConfigurationViewSize;
     encoder << maximumUnobscuredSize;
+    encoder << deviceOrientation;
 #endif
 #if PLATFORM(COCOA)
     encoder << smartInsertDeleteEnabled;
@@ -257,6 +258,8 @@ std::optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::
         return std::nullopt;
     if (!decoder.decode(parameters.maximumUnobscuredSize))
         return std::nullopt;
+    if (!decoder.decode(parameters.deviceOrientation))
+        return std::nullopt;
 #endif
 
 #if PLATFORM(COCOA)
index 93c8d0b..4f71d4d 100644 (file)
@@ -146,6 +146,7 @@ struct WebPageCreationParameters {
     double viewportConfigurationLayoutSizeScaleFactor;
     WebCore::FloatSize viewportConfigurationViewSize;
     WebCore::FloatSize maximumUnobscuredSize;
+    int32_t deviceOrientation { 0 };
 #endif
 #if PLATFORM(COCOA)
     bool smartInsertDeleteEnabled;
index 77fc452..9aa054a 100644 (file)
@@ -6533,6 +6533,7 @@ WebPageCreationParameters WebPageProxy::creationParameters()
     parameters.viewportConfigurationViewLayoutSize = m_viewportConfigurationViewLayoutSize;
     parameters.viewportConfigurationLayoutSizeScaleFactor = m_viewportConfigurationLayoutSizeScaleFactor;
     parameters.maximumUnobscuredSize = m_maximumUnobscuredSize;
+    parameters.deviceOrientation = m_deviceOrientation;
 #endif
 
 #if PLATFORM(MAC)
index 10968cd..ac47515 100644 (file)
@@ -388,6 +388,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters)
     , m_screenSize(parameters.screenSize)
     , m_availableScreenSize(parameters.availableScreenSize)
     , m_overrideScreenSize(parameters.overrideScreenSize)
+    , m_deviceOrientation(parameters.deviceOrientation)
 #endif
     , m_layerVolatilityTimer(*this, &WebPage::layerVolatilityTimerFired)
     , m_activityState(parameters.activityState)