[Extra zoom mode] fast/viewport/extrazoom/viewport-change-min-device-width.html somet...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 May 2018 23:15:49 +0000 (23:15 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 May 2018 23:15:49 +0000 (23:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185490
<rdar://problem/40097629>

Reviewed by Tim Horton.

This test is currently flaky due to incorrect logic when computing the unobscured content rect, in the slice of
time after a frame load has been committed, and before the first visible content rect update from the UI process
after the frame load has been committed.

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

In the case where !m_hasReceivedVisibleContentRectsAfterDidCommitLoad, we try to set the unobscured content size
to be the view size divided by the initial scale. However, in extra zoom mode, `ViewportConfiguration`'s
`minimumLayoutSize()` is the layout size, which is larger than the size of the view by default, so dividing this
by the initial scale yields a bogus value. Instead, use `viewLayoutSize()` instead.

(WebKit::WebPage::updateViewportSizeForCSSViewportUnits):

We also try to divide the view size by the initial scale when computing the effective viewport size for `vw` and
`vh`. Additionally, fix the misleading name of a variable (largestUnobscuredRect) that stores a size.

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

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

index 88d4475..6c50dfe 100644 (file)
@@ -1,3 +1,28 @@
+2018-05-09  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Extra zoom mode] fast/viewport/extrazoom/viewport-change-min-device-width.html sometimes fails
+        https://bugs.webkit.org/show_bug.cgi?id=185490
+        <rdar://problem/40097629>
+
+        Reviewed by Tim Horton.
+
+        This test is currently flaky due to incorrect logic when computing the unobscured content rect, in the slice of
+        time after a frame load has been committed, and before the first visible content rect update from the UI process
+        after the frame load has been committed.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::viewportConfigurationChanged):
+
+        In the case where !m_hasReceivedVisibleContentRectsAfterDidCommitLoad, we try to set the unobscured content size
+        to be the view size divided by the initial scale. However, in extra zoom mode, `ViewportConfiguration`'s
+        `minimumLayoutSize()` is the layout size, which is larger than the size of the view by default, so dividing this
+        by the initial scale yields a bogus value. Instead, use `viewLayoutSize()` instead.
+
+        (WebKit::WebPage::updateViewportSizeForCSSViewportUnits):
+
+        We also try to divide the view size by the initial scale when computing the effective viewport size for `vw` and
+        `vh`. Additionally, fix the misleading name of a variable (largestUnobscuredRect) that stores a size.
+
 2018-05-09  Brent Fulgham  <bfulgham@apple.com>
 
         Restrict unarchiving of bundle parameters to a set of known classes
 2018-05-09  Brent Fulgham  <bfulgham@apple.com>
 
         Restrict unarchiving of bundle parameters to a set of known classes
index ff770d6..e57c86f 100644 (file)
@@ -2727,7 +2727,7 @@ void WebPage::viewportConfigurationChanged()
     FrameView& frameView = *mainFrameView();
     IntPoint scrollPosition = frameView.scrollPosition();
     if (!m_hasReceivedVisibleContentRectsAfterDidCommitLoad) {
     FrameView& frameView = *mainFrameView();
     IntPoint scrollPosition = frameView.scrollPosition();
     if (!m_hasReceivedVisibleContentRectsAfterDidCommitLoad) {
-        FloatSize minimumLayoutSizeInScrollViewCoordinates = m_viewportConfiguration.minimumLayoutSize();
+        FloatSize minimumLayoutSizeInScrollViewCoordinates = m_viewportConfiguration.viewLayoutSize();
         minimumLayoutSizeInScrollViewCoordinates.scale(1 / scale);
         IntSize minimumLayoutSizeInDocumentCoordinates = roundedIntSize(minimumLayoutSizeInScrollViewCoordinates);
         frameView.setUnobscuredContentSize(minimumLayoutSizeInDocumentCoordinates);
         minimumLayoutSizeInScrollViewCoordinates.scale(1 / scale);
         IntSize minimumLayoutSizeInDocumentCoordinates = roundedIntSize(minimumLayoutSizeInScrollViewCoordinates);
         frameView.setUnobscuredContentSize(minimumLayoutSizeInDocumentCoordinates);
@@ -2749,13 +2749,13 @@ void WebPage::viewportConfigurationChanged()
 
 void WebPage::updateViewportSizeForCSSViewportUnits()
 {
 
 void WebPage::updateViewportSizeForCSSViewportUnits()
 {
-    FloatSize largestUnobscuredRect = m_maximumUnobscuredSize;
-    if (largestUnobscuredRect.isEmpty())
-        largestUnobscuredRect = m_viewportConfiguration.minimumLayoutSize();
+    FloatSize largestUnobscuredSize = m_maximumUnobscuredSize;
+    if (largestUnobscuredSize.isEmpty())
+        largestUnobscuredSize = m_viewportConfiguration.viewLayoutSize();
 
     FrameView& frameView = *mainFrameView();
 
     FrameView& frameView = *mainFrameView();
-    largestUnobscuredRect.scale(1 / m_viewportConfiguration.initialScaleIgnoringContentSize());
-    frameView.setViewportSizeForCSSViewportUnits(roundedIntSize(largestUnobscuredRect));
+    largestUnobscuredSize.scale(1 / m_viewportConfiguration.initialScaleIgnoringContentSize());
+    frameView.setViewportSizeForCSSViewportUnits(roundedIntSize(largestUnobscuredSize));
 }
 
 void WebPage::applicationWillResignActive()
 }
 
 void WebPage::applicationWillResignActive()