Title: [166343] trunk/Source/WebKit2
Revision
166343
Author
[email protected]
Date
2014-03-26 21:31:07 -0700 (Wed, 26 Mar 2014)

Log Message

[iOS][WK2] <rdar://problem/16265272> REGRESSION (WebKit2): Some pages appear blank until you scroll
https://bugs.webkit.org/show_bug.cgi?id=130819

Patch by Benjamin Poulain <[email protected]> on 2014-03-26
Reviewed by Tim Horton.

When loading a new page, we never define the unobscured rect and exposed rect on the new frame.
As a result, there is nothing to render.

It uses to work thanks to dumb luck and a bug in Safari updating the visibleContentRects from
the UIProcess. Now that the bug is gone, "dumb luck" is not reliable enough to get the content rects :)

What this patch does is save if we have ever received new rects from the UI. If we have not, create them
based on the minimum layout size. This works because we know Safari shows the minimum layout size by default
and will tell us if it changes the obscured rects.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::viewportConfigurationChanged):
(WebKit::WebPage::updateVisibleContentRects):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (166342 => 166343)


--- trunk/Source/WebKit2/ChangeLog	2014-03-27 04:16:32 UTC (rev 166342)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-27 04:31:07 UTC (rev 166343)
@@ -1,3 +1,28 @@
+2014-03-26  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] <rdar://problem/16265272> REGRESSION (WebKit2): Some pages appear blank until you scroll
+        https://bugs.webkit.org/show_bug.cgi?id=130819
+
+        Reviewed by Tim Horton.
+
+        When loading a new page, we never define the unobscured rect and exposed rect on the new frame.
+        As a result, there is nothing to render.
+
+        It uses to work thanks to dumb luck and a bug in Safari updating the visibleContentRects from
+        the UIProcess. Now that the bug is gone, "dumb luck" is not reliable enough to get the content rects :)
+
+        What this patch does is save if we have ever received new rects from the UI. If we have not, create them
+        based on the minimum layout size. This works because we know Safari shows the minimum layout size by default
+        and will tell us if it changes the obscured rects.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        (WebKit::WebPage::didCommitLoad):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::viewportConfigurationChanged):
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2014-03-26  Anders Carlsson  <[email protected]>
 
         Add a _WKScriptWorld class

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (166342 => 166343)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-03-27 04:16:32 UTC (rev 166342)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-03-27 04:31:07 UTC (rev 166343)
@@ -285,6 +285,7 @@
 #if PLATFORM(IOS)
     , m_shouldReturnWordAtSelection(false)
     , m_lastVisibleContentRectUpdateID(0)
+    , m_hasReceivedVisibleContentRectsAfterDidCommitLoad(false)
     , m_scaleWasSetByUIProcess(false)
     , m_userHasChangedPageScaleFactor(false)
     , m_viewportScreenSize(parameters.viewportScreenSize)
@@ -4229,6 +4230,7 @@
         }
     }
 #if PLATFORM(IOS)
+    m_hasReceivedVisibleContentRectsAfterDidCommitLoad = false;
     m_userHasChangedPageScaleFactor = false;
 
     Document* document = frame->coreFrame()->document();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (166342 => 166343)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-03-27 04:16:32 UTC (rev 166342)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-03-27 04:31:07 UTC (rev 166343)
@@ -1133,6 +1133,7 @@
 
     WebCore::ViewportConfiguration m_viewportConfiguration;
     uint64_t m_lastVisibleContentRectUpdateID;
+    bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
     bool m_scaleWasSetByUIProcess;
     bool m_userHasChangedPageScaleFactor;
     WebCore::FloatSize m_viewportScreenSize;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (166342 => 166343)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-03-27 04:16:32 UTC (rev 166342)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-03-27 04:31:07 UTC (rev 166343)
@@ -1703,7 +1703,21 @@
     else
         scale = m_viewportConfiguration.initialScale();
 
-    scalePage(scale, m_page->mainFrame().view()->scrollPosition());
+    FrameView& frameView = *m_page->mainFrame().view();
+    IntPoint scrollPosition = frameView.scrollPosition();
+    if (!m_hasReceivedVisibleContentRectsAfterDidCommitLoad) {
+        IntSize minimumLayoutSizeInDocumentCoordinate = m_viewportConfiguration.minimumLayoutSize();
+        minimumLayoutSizeInDocumentCoordinate.scale(scale);
+
+        IntRect unobscuredContentRect(scrollPosition, minimumLayoutSizeInDocumentCoordinate);
+        frameView.setUnobscuredContentRect(unobscuredContentRect);
+        frameView.setScrollVelocity(0, 0, 0, monotonicallyIncreasingTime());
+
+        // FIXME: We could send down the obscured margins to find a better exposed rect and unobscured rect.
+        // It is not a big deal at the moment because the tile coverage will always extend past the obscured bottom inset.
+        m_drawingArea->setExposedContentRect(unobscuredContentRect);
+    }
+    scalePage(scale, scrollPosition);
 }
 
 void WebPage::applicationWillResignActive()
@@ -1723,6 +1737,7 @@
 
 void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)
 {
+    m_hasReceivedVisibleContentRectsAfterDidCommitLoad = true;
     m_lastVisibleContentRectUpdateID = visibleContentRectUpdateInfo.updateID();
 
     FloatRect exposedRect = visibleContentRectUpdateInfo.exposedRect();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to