[iOS] REGRESSION(r251269): fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html and fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html fail
https://bugs.webkit.org/show_bug.cgi?id=203162
<rdar://problem/56418459>

Reviewed by Simon Fraser.

Source/WebKit:

Synchronously update the rendering before the orientation change and other viewport size updates.

Otherwise, resize event will be dispatched in the middle of orientation animation,
and would result in non-determistic results.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::dynamicViewportSizeUpdate):

LayoutTests:

Rebaselined the test now that the order of execution of orientationchange and resize events have changed.

* fast/events/ios/rotation/layout-viewport-during-safari-type-rotation-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ea7dea5..3e30e9a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2019-10-18  Ryosuke Niwa  <rniwa@webkit.org>
+
+        [iOS] REGRESSION(r251269): fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html and fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html fail
+        https://bugs.webkit.org/show_bug.cgi?id=203162
+        <rdar://problem/56418459>
+
+        Reviewed by Simon Fraser.
+
+        Rebaselined the test now that the order of execution of orientationchange and resize events have changed.
+
+        * fast/events/ios/rotation/layout-viewport-during-safari-type-rotation-expected.txt:
+
 2019-10-18  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Elements: allow WebKit engineers to edit UserAgent shadow trees
diff --git a/LayoutTests/fast/events/ios/rotation/layout-viewport-during-safari-type-rotation-expected.txt b/LayoutTests/fast/events/ios/rotation/layout-viewport-during-safari-type-rotation-expected.txt
index 5dface0..d60749c 100644
--- a/LayoutTests/fast/events/ios/rotation/layout-viewport-during-safari-type-rotation-expected.txt
+++ b/LayoutTests/fast/events/ios/rotation/layout-viewport-during-safari-type-rotation-expected.txt
@@ -5,11 +5,11 @@
 
 In orientationchange event handler:
 (This will trigger the resize handler by forcing a layout.)
-
-In resize event handler:
 layoutViewport: 0, 0 - 568 x 320
 visualViewport: 0, 0 - 568 x 320
 client rect of fixed object:0, 0 - 568 x 320
+
+In resize event handler:
 layoutViewport: 0, 0 - 568 x 320
 visualViewport: 0, 0 - 568 x 320
 client rect of fixed object:0, 0 - 568 x 320
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 38915f0..2dc3ce3 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2019-10-18  Ryosuke Niwa  <rniwa@webkit.org>
+
+        [iOS] REGRESSION(r251269): fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html and fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html fail
+        https://bugs.webkit.org/show_bug.cgi?id=203162
+        <rdar://problem/56418459>
+
+        Reviewed by Simon Fraser.
+
+        Synchronously update the rendering before the orientation change and other viewport size updates.
+
+        Otherwise, resize event will be dispatched in the middle of orientation animation,
+        and would result in non-determistic results.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::dynamicViewportSizeUpdate):
+
 2019-10-18  Chris Dumez  <cdumez@apple.com>
 
         [iOS] "Unexpectedly Resumed" process assertion may cause us to get terminated
diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
index ae5591e..919599c 100644
--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
@@ -3309,6 +3309,8 @@
     setDeviceOrientation(deviceOrientation);
     frameView.setScrollOffset(roundedUnobscuredContentRectPosition);
 
+    m_page->updateRendering();
+
 #if ENABLE(VIEWPORT_RESIZING)
     if (immediatelyShrinkToFitContent())
         viewportConfigurationChanged();