[Qt] Delay viewport position, scale and contents size updates until tiles are rendered
authorjocelyn.turcotte@digia.com <jocelyn.turcotte@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2012 11:18:20 +0000 (11:18 +0000)
committerjocelyn.turcotte@digia.com <jocelyn.turcotte@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2012 11:18:20 +0000 (11:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97775

Reviewed by Kenneth Rohde Christiansen.

A few events from the web process can cause the viewport position or scale to be
adjusted in the UI process:
- Scroll position request
- Viewport attributes (initialScale, minimumScale)
- Contents size change

We previously applied those updates directly to the viewport, which would then in turn
produce a corresponding visible rect request to the web process to render the contents
at the new position/scale. This could leave the viewport showing the old content, either
by scaling the tiles, or by showing checkerboard if no contents was rendered at this
position yet. When the web process was done rendering new tiles, the proper tiles
were then shown to the user.
Since many of these updates happen during page load, all producing an itterative adjustment
to the viewport, this could show sharpness and position jitter until the final rendering
was done.

This patch makes those updates go through the PageViewportController first and then to the
QQuickWebView rather than the other way around, and keep them pending until the
LayerTreeHostProxy reports that the new tiles are ready to be shown. Since the rendering
is blocked until the page first layout is done, this apply the modifications to
the viewport only once when the first frame is ready to be shown.

* UIProcess/API/qt/qquickwebview.cpp:
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewFlickablePrivate):
* UIProcess/API/qt/raw/qrawwebview_p_p.h:
(QRawWebViewPrivate::didRenderFrame):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
(WebKit::LayerTreeCoordinatorProxy::didRenderFrame):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
(LayerTreeCoordinatorProxy):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
* UIProcess/PageClient.h:
(PageClient):
* UIProcess/PageViewportController.cpp:
(WebKit::PageViewportController::didCommitLoad):
(WebKit::PageViewportController::didChangeContentsSize):
(WebKit::PageViewportController::didRenderFrame):
(WebKit::PageViewportController::initialViewportReady):
(WebKit::PageViewportController::pageDidRequestScroll):
(WebKit::PageViewportController::didChangeContentsVisibility):
(WebKit::PageViewportController::resumeContent):
(WebKit::PageViewportController::applyScaleAfterRenderingContents):
(WebKit):
(WebKit::PageViewportController::applyPositionAfterRenderingContents):
(WebKit::PageViewportController::updateMinimumScaleToFit):
* UIProcess/PageViewportController.h:
(PageViewportController):
* UIProcess/PageViewportControllerClient.h:
(PageViewportControllerClient):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/qt/PageViewportControllerClientQt.cpp:
(WebKit::PageViewportControllerClientQt::didChangeContentsSize):
* UIProcess/qt/PageViewportControllerClientQt.h:
(PageViewportControllerClientQt):
* UIProcess/qt/QtPageClient.cpp:
(WebKit::QtPageClient::didRenderFrame):
(WebKit):
(WebKit::QtPageClient::didChangeContentsSize):
* UIProcess/qt/QtPageClient.h:
(QtPageClient):
* UIProcess/qt/QtWebPageLoadClient.cpp:
(WebKit::QtWebPageLoadClient::didCommitLoad):
* UIProcess/qt/WebPageProxyQt.cpp:
(WebKit::WebPageProxy::didRenderFrame):
(WebKit):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
(WebKit::LayerTreeCoordinator::flushPendingLayerChanges):

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

19 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/PageViewportController.cpp
Source/WebKit2/UIProcess/PageViewportController.h
Source/WebKit2/UIProcess/PageViewportControllerClient.h
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp
Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.h
Source/WebKit2/UIProcess/qt/QtPageClient.cpp
Source/WebKit2/UIProcess/qt/QtPageClient.h
Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp

index 20309af..f171af1 100644 (file)
@@ -1,5 +1,82 @@
 2012-09-27  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
 
+        [Qt] Delay viewport position, scale and contents size updates until tiles are rendered
+        https://bugs.webkit.org/show_bug.cgi?id=97775
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        A few events from the web process can cause the viewport position or scale to be
+        adjusted in the UI process:
+        - Scroll position request
+        - Viewport attributes (initialScale, minimumScale)
+        - Contents size change
+
+        We previously applied those updates directly to the viewport, which would then in turn
+        produce a corresponding visible rect request to the web process to render the contents
+        at the new position/scale. This could leave the viewport showing the old content, either
+        by scaling the tiles, or by showing checkerboard if no contents was rendered at this
+        position yet. When the web process was done rendering new tiles, the proper tiles
+        were then shown to the user.
+        Since many of these updates happen during page load, all producing an iterative adjustment
+        to the viewport, this could show sharpness and position jitter until the final rendering
+        was done.
+
+        This patch makes those updates go through the PageViewportController first and then to the
+        QQuickWebView rather than the other way around, and keep them pending until the
+        LayerTreeHostProxy reports that the new tiles are ready to be shown. Since the rendering
+        is blocked until the page first layout is done, this apply the modifications to
+        the viewport only once when the first frame is ready to be shown.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewFlickablePrivate):
+        * UIProcess/API/qt/raw/qrawwebview_p_p.h:
+        (QRawWebViewPrivate::didRenderFrame):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
+        (WebKit::LayerTreeCoordinatorProxy::didRenderFrame):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
+        (LayerTreeCoordinatorProxy):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
+        * UIProcess/PageClient.h:
+        (PageClient):
+        * UIProcess/PageViewportController.cpp:
+        (WebKit::PageViewportController::didCommitLoad):
+        (WebKit::PageViewportController::didChangeContentsSize):
+        (WebKit::PageViewportController::didRenderFrame):
+        (WebKit::PageViewportController::initialViewportReady):
+        (WebKit::PageViewportController::pageDidRequestScroll):
+        (WebKit::PageViewportController::didChangeContentsVisibility):
+        (WebKit::PageViewportController::resumeContent):
+        (WebKit::PageViewportController::applyScaleAfterRenderingContents):
+        (WebKit):
+        (WebKit::PageViewportController::applyPositionAfterRenderingContents):
+        (WebKit::PageViewportController::updateMinimumScaleToFit):
+        * UIProcess/PageViewportController.h:
+        (PageViewportController):
+        * UIProcess/PageViewportControllerClient.h:
+        (PageViewportControllerClient):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/qt/PageViewportControllerClientQt.cpp:
+        (WebKit::PageViewportControllerClientQt::didChangeContentsSize):
+        * UIProcess/qt/PageViewportControllerClientQt.h:
+        (PageViewportControllerClientQt):
+        * UIProcess/qt/QtPageClient.cpp:
+        (WebKit::QtPageClient::didRenderFrame):
+        (WebKit):
+        (WebKit::QtPageClient::didChangeContentsSize):
+        * UIProcess/qt/QtPageClient.h:
+        (QtPageClient):
+        * UIProcess/qt/QtWebPageLoadClient.cpp:
+        (WebKit::QtWebPageLoadClient::didCommitLoad):
+        * UIProcess/qt/WebPageProxyQt.cpp:
+        (WebKit::WebPageProxy::didRenderFrame):
+        (WebKit):
+        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
+        (WebKit::LayerTreeCoordinator::flushPendingLayerChanges):
+
+2012-09-27  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
+
         [Qt] Wait for the UI process before re-enabling rendering during page load
         https://bugs.webkit.org/show_bug.cgi?id=97773
 
index b78cae0..12f8db3 100644 (file)
@@ -877,13 +877,6 @@ void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos)
         m_pageViewportController->pageDidRequestScroll(pos);
 }
 
-void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize)
-{
-    QQuickWebViewPrivate::didChangeContentsSize(newSize);
-    pageView->setContentsSize(newSize); // emits contentsSizeChanged()
-    m_pageViewportController->didChangeContentsSize(newSize);
-}
-
 void QQuickWebViewFlickablePrivate::handleMouseEvent(QMouseEvent* event)
 {
     if (!pageView->eventHandler())
index f172ad6..af8ef7d 100644 (file)
@@ -130,7 +130,6 @@ public:
     WebCore::IntSize viewSize() const;
     void didReceiveMessageFromNavigatorQtObject(const String& message);
     virtual void pageDidRequestScroll(const QPoint& pos) { }
-    virtual void didChangeContentsSize(const QSize& newSize) { }
     void processDidCrash();
     void didRelaunchProcess();
     PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy();
@@ -223,7 +222,6 @@ public:
     virtual void updateViewportSize();
 
     virtual void pageDidRequestScroll(const QPoint& pos);
-    virtual void didChangeContentsSize(const QSize& newSize);
     virtual void handleMouseEvent(QMouseEvent*);
 };
 
index b00d467..890f808 100644 (file)
@@ -105,6 +105,7 @@ public:
     virtual void didRelaunchProcess();
     virtual void setViewNeedsDisplay(const WebCore::IntRect& rect);
     virtual void didChangeContentsSize(const WebCore::IntSize& newSize);
+    virtual void didRenderFrame(const WebCore::IntSize& contentsSize) { }
     virtual void setCursor(const WebCore::Cursor&);
 
     virtual bool isViewFocused() { return m_focused; }
index e6f582f..031a4f8 100644 (file)
@@ -116,10 +116,15 @@ void LayerTreeCoordinatorProxy::setCompositingLayerFilters(WebLayerID id, const
 }
 #endif
 
-void LayerTreeCoordinatorProxy::didRenderFrame()
+void LayerTreeCoordinatorProxy::didRenderFrame(const WebCore::IntSize& contentsSize)
 {
     dispatchUpdate(bind(&LayerTreeRenderer::flushLayerChanges, m_renderer.get()));
     updateViewport();
+#if PLATFORM(QT)
+    m_drawingAreaProxy->page()->didRenderFrame(contentsSize);
+#else
+    UNUSED_PARAM(contentsSize);
+#endif
 }
 
 void LayerTreeCoordinatorProxy::createDirectlyCompositedImage(int64_t key, const WebKit::ShareableBitmap::Handle& handle)
index 65a9f5e..92c610b 100644 (file)
@@ -63,7 +63,7 @@ public:
     void purgeGLResources();
     void setContentsSize(const WebCore::FloatSize&);
     void setVisibleContentsRect(const WebCore::FloatRect&, float scale, const WebCore::FloatPoint& trajectoryVector);
-    void didRenderFrame();
+    void didRenderFrame(const WebCore::IntSize& contentsSize);
     void createTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
     void updateTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
     void removeTileForLayer(int layerID, int tileID);
index 2386923..52d61af 100644 (file)
@@ -31,7 +31,7 @@ messages -> LayerTreeCoordinatorProxy {
     RemoveTileForLayer(uint32_t layerID, int tileID)
     CreateDirectlyCompositedImage(int64_t key, WebKit::ShareableBitmap::Handle handle)
     DestroyDirectlyCompositedImage(int64_t key)
-    DidRenderFrame()
+    DidRenderFrame(WebCore::IntSize contentsSize)
     DidChangeScrollPosition(WebCore::IntPoint position)
     SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, uint64_t graphicsSurfaceToken, uint32_t frontBuffer)
     SetLayerAnimatedOpacity(uint32_t id, float opacity)
index a3f47a9..d52f5d2 100644 (file)
@@ -118,6 +118,7 @@ public:
     virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
 #endif
 #if PLATFORM(QT)
+    virtual void didRenderFrame(const WebCore::IntSize& contentsSize) = 0;
     virtual void pageTransitionViewportReady() = 0;
     virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
     virtual void didReceiveMessageFromNavigatorQtObject(const String&) = 0;
index 29cf6de..345b4b1 100644 (file)
@@ -109,19 +109,47 @@ FloatPoint PageViewportController::clampViewportToContents(const WebCore::FloatP
     return FloatPoint(clampTo(viewportPos.x(), 0.f, horizontalRange), clampTo(viewportPos.y(), 0.f, verticalRange));
 }
 
-void PageViewportController::didChangeContentsSize(const IntSize& newSize)
+void PageViewportController::didCommitLoad()
 {
-    if (m_viewportSize.isEmpty() || newSize.isEmpty())
-        return;
+    // Reset the position to the top, page/history scroll requests may override this before we re-enable rendering.
+    applyPositionAfterRenderingContents(FloatPoint());
+}
 
+void PageViewportController::didChangeContentsSize(const IntSize& newSize)
+{
     m_contentsSize = newSize;
     updateMinimumScaleToFit();
+}
 
-    m_client->didChangeContentsSize();
+void PageViewportController::didRenderFrame(const IntSize& contentsSize)
+{
+    // Only update the viewport's contents dimensions along with its render.
+    m_client->didChangeContentsSize(contentsSize);
+
+    // Apply any scale or scroll position we locked to be set on the viewport
+    // only when there is something to display there. The scale goes first to
+    // avoid offsetting our deferred position by scaling at the viewport center.
+    // All position and scale changes resulting from a web process event should
+    // go through here to be applied on the viewport to avoid showing incomplete
+    // tiles to the user during a few milliseconds.
+    ViewportUpdateDeferrer guard(this);
+    if (m_effectiveScaleIsLocked) {
+        m_client->setContentsScale(m_effectiveScale, false);
+        m_effectiveScaleIsLocked = false;
+    }
+    if (m_viewportPosIsLocked) {
+        m_client->setViewportPosition(clampViewportToContents(m_viewportPos, m_effectiveScale));
+        m_viewportPosIsLocked = false;
+    }
 }
 
 void PageViewportController::pageTransitionViewportReady()
 {
+    if (!m_rawAttributes.layoutSize.isEmpty()) {
+        m_hadUserInteraction = false;
+        applyScaleAfterRenderingContents(innerBoundedViewportScale(toViewportScale(m_rawAttributes.initialScale)));
+    }
+
     // At this point we should already have received the first viewport arguments and the requested scroll
     // position for the newly loaded page and sent our reactions to the web process. It's now safe to tell
     // the web process to start rendering the new page contents and possibly re-use the current tiles.
@@ -135,7 +163,8 @@ void PageViewportController::pageDidRequestScroll(const IntPoint& cssPosition)
     if (m_activeDeferrerCount)
         return;
 
-    m_client->setViewportPosition(clampViewportToContents(cssPosition, m_effectiveScale));
+    // Keep the unclamped position in case the contents size is changed later on.
+    applyPositionAfterRenderingContents(cssPosition);
 }
 
 void PageViewportController::didChangeViewportSize(const FloatSize& newSize)
@@ -154,8 +183,11 @@ void PageViewportController::didChangeViewportSize(const FloatSize& newSize)
 
 void PageViewportController::didChangeContentsVisibility(const FloatPoint& viewportPos, float viewportScale, const FloatPoint& trajectoryVector)
 {
-    m_viewportPos = viewportPos;
-    m_effectiveScale = viewportScale;
+    if (!m_viewportPosIsLocked)
+        m_viewportPos = viewportPos;
+    if (!m_effectiveScaleIsLocked)
+        m_effectiveScale = viewportScale;
+
     syncVisibleContents(trajectoryVector);
 }
 
@@ -197,12 +229,6 @@ void PageViewportController::suspendContent()
 
 void PageViewportController::resumeContent()
 {
-    if (!m_rawAttributes.layoutSize.isEmpty() && m_rawAttributes.initialScale > 0) {
-        m_hadUserInteraction = false;
-        m_client->setContentsScale(innerBoundedViewportScale(toViewportScale(m_rawAttributes.initialScale)), /* isInitialScale */ true);
-        m_rawAttributes.initialScale = -1; // Mark used.
-    }
-
     m_client->didResumeContent();
 
     if (!m_hasSuspendedContent)
@@ -212,15 +238,32 @@ void PageViewportController::resumeContent()
     m_webPageProxy->resumeActiveDOMObjectsAndAnimations();
 }
 
+void PageViewportController::applyScaleAfterRenderingContents(float scale)
+{
+    m_effectiveScale = scale;
+    m_effectiveScaleIsLocked = true;
+    syncVisibleContents();
+}
+
+void PageViewportController::applyPositionAfterRenderingContents(const FloatPoint& pos)
+{
+    m_viewportPos = pos;
+    m_viewportPosIsLocked = true;
+    syncVisibleContents();
+}
+
 void PageViewportController::updateMinimumScaleToFit()
 {
+    if (m_viewportSize.isEmpty())
+        return;
+
     float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize));
 
     if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) {
         m_minimumScaleToFit = minimumScale;
 
         if (!m_hadUserInteraction && !hasSuspendedContent())
-            m_client->setContentsScale(toViewportScale(minimumScale), true /* isInitialScale */);
+            applyScaleAfterRenderingContents(toViewportScale(minimumScale));
 
         m_client->didChangeViewportAttributes();
     }
index a35d933..2b94cea 100644 (file)
@@ -95,8 +95,10 @@ public:
     void didChangeContentsVisibility(const WebCore::FloatPoint& viewportPos, float viewportScale, const WebCore::FloatPoint& trajectoryVector = WebCore::FloatPoint::zero());
 
     // Notifications from the WebProcess.
+    void didCommitLoad();
     void didChangeContentsSize(const WebCore::IntSize& newSize);
     void didChangeViewportAttributes(const WebCore::ViewportAttributes&);
+    void didRenderFrame(const WebCore::IntSize& contentsSize);
     void pageTransitionViewportReady();
     void pageDidRequestScroll(const WebCore::IntPoint& cssPosition);
 
@@ -104,6 +106,8 @@ private:
     float fromViewportScale(float scale) const { return scale / devicePixelRatio(); }
     float toViewportScale(float scale) const { return scale * devicePixelRatio(); }
     void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero());
+    void applyScaleAfterRenderingContents(float scale);
+    void applyPositionAfterRenderingContents(const WebCore::FloatPoint& pos);
     void updateMinimumScaleToFit();
 
     WebPageProxy* const m_webPageProxy;
@@ -123,6 +127,9 @@ private:
     WebCore::FloatSize m_contentsSize;
     float m_effectiveScale; // Should always be cssScale * devicePixelRatio.
 
+    bool m_viewportPosIsLocked;
+    bool m_effectiveScaleIsLocked;
+
     friend class ViewportUpdateDeferrer;
 };
 
index 3d91b9a..2f87d59 100644 (file)
@@ -37,7 +37,7 @@ public:
     virtual void setContentsScale(float, bool treatAsInitialValue) = 0;
 
     virtual void didResumeContent() = 0;
-    virtual void didChangeContentsSize() = 0;
+    virtual void didChangeContentsSize(const WebCore::IntSize&) = 0;
     virtual void didChangeVisibleContents() = 0;
     virtual void didChangeViewportAttributes() = 0;
 
index e61d881..79c51dc 100644 (file)
@@ -356,6 +356,7 @@ public:
     bool maintainsInactiveSelection() const { return m_maintainsInactiveSelection; }
     void setMaintainsInactiveSelection(bool);
 #if PLATFORM(QT)
+    void didRenderFrame(const WebCore::IntSize& contentsSize);
     void registerApplicationScheme(const String& scheme);
     void resolveApplicationSchemeRequest(QtNetworkRequestData);
     void sendApplicationSchemeReply(const QQuickNetworkReply*);
index 9e2531f..8508210 100644 (file)
@@ -468,8 +468,10 @@ void PageViewportControllerClientQt::pinchGestureCancelled()
     m_scaleUpdateDeferrer.reset();
 }
 
-void PageViewportControllerClientQt::didChangeContentsSize()
+void PageViewportControllerClientQt::didChangeContentsSize(const IntSize& newSize)
 {
+    m_pageItem->setContentsSize(QSizeF(newSize));
+
     // Emit for testing purposes, so that it can be verified that
     // we didn't do scale adjustment.
     emit m_viewportItem->experimental()->test()->contentsScaleCommitted();
index bd0e173..089b5b7 100644 (file)
@@ -51,7 +51,7 @@ public:
     virtual void setContentsScale(float scale, bool treatAsInitialValue);
 
     virtual void didResumeContent();
-    virtual void didChangeContentsSize();
+    virtual void didChangeContentsSize(const WebCore::IntSize&);
     virtual void didChangeVisibleContents();
     virtual void didChangeViewportAttributes();
 
index bd932b7..e7573d8 100644 (file)
@@ -73,6 +73,11 @@ void QtPageClient::setViewNeedsDisplay(const WebCore::IntRect& rect)
     QQuickWebViewPrivate::get(m_webView)->setNeedsDisplay();
 }
 
+void QtPageClient::didRenderFrame(const WebCore::IntSize& contentsSize)
+{
+    QQuickWebViewPrivate::get(m_webView)->viewportController()->didRenderFrame(contentsSize);
+}
+
 void QtPageClient::pageDidRequestScroll(const IntPoint& pos)
 {
     QQuickWebViewPrivate::get(m_webView)->pageDidRequestScroll(pos);
@@ -90,7 +95,7 @@ void QtPageClient::didRelaunchProcess()
 
 void QtPageClient::didChangeContentsSize(const IntSize& newSize)
 {
-    QQuickWebViewPrivate::get(m_webView)->didChangeContentsSize(newSize);
+    QQuickWebViewPrivate::get(m_webView)->viewportController()->didChangeContentsSize(newSize);
 }
 
 void QtPageClient::didChangeViewportProperties(const WebCore::ViewportAttributes& attr)
index bb42580..173c2d7 100644 (file)
@@ -43,6 +43,7 @@ public:
 
     // QQuickWebView.
     virtual void setViewNeedsDisplay(const WebCore::IntRect&);
+    virtual void didRenderFrame(const WebCore::IntSize& contentsSize);
     virtual WebCore::IntSize viewSize();
     virtual bool isViewFocused();
     virtual bool isViewVisible();
index 0e9c5cf..d111ad1 100644 (file)
@@ -62,6 +62,7 @@ void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoad(const WTF::
 
 void QtWebPageLoadClient::didCommitLoad()
 {
+    m_webView->d_func()->viewportController()->didCommitLoad();
     m_webView->d_func()->loadDidCommit();
 }
 
index 549fc28..8389640 100644 (file)
@@ -93,6 +93,11 @@ void WebPageProxy::cancelComposition()
     process()->send(Messages::WebPage::CancelComposition(), m_pageID);
 }
 
+void WebPageProxy::didRenderFrame(const WebCore::IntSize& contentsSize)
+{
+    m_pageClient->didRenderFrame(contentsSize);
+}
+
 void WebPageProxy::registerApplicationScheme(const String& scheme)
 {
     process()->send(Messages::WebPage::RegisterApplicationScheme(scheme), m_pageID);
index b0c8ce3..ce35bfe 100644 (file)
@@ -272,7 +272,9 @@ bool LayerTreeCoordinator::flushPendingLayerChanges()
 
     if (m_shouldSyncFrame) {
         didSync = true;
-        m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidRenderFrame());
+
+        IntSize contentsSize = roundedIntSize(m_nonCompositedContentLayer->size());
+        m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidRenderFrame(contentsSize));
         m_waitingForUIProcess = true;
         m_shouldSyncFrame = false;
     }