Move viewport meta handling to the web process side
authorkenneth@webkit.org <kenneth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 14:43:38 +0000 (14:43 +0000)
committerkenneth@webkit.org <kenneth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 14:43:38 +0000 (14:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83771

Reviewed by Simon Hausmann.

Instead of computing the viewport attributes on both sides,
we now do everything on the web process side, and just send
over the computed result.

* Scripts/webkit2/messages.py:
(struct_or_class):
(headers_for_type):
* Shared/WebCoreArgumentCoders.cpp:
(CoreIPC::::encode):
(CoreIPC::::decode):
* Shared/WebCoreArgumentCoders.h:
(WebCore):
* UIProcess/API/efl/PageClientImpl.cpp:
(WebKit::PageClientImpl::didChangeViewportProperties):
* UIProcess/API/efl/PageClientImpl.h:
(PageClientImpl):
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::didChangeViewportProperties):
* UIProcess/API/gtk/PageClientImpl.h:
(PageClientImpl):
* UIProcess/API/mac/PageClientImpl.h:
(PageClientImpl):
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didChangeViewportProperties):
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::didRelaunchProcess):
(QQuickWebViewFlickablePrivate::didChangeViewportProperties):
(QQuickWebViewFlickablePrivate::updateViewportSize):
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate::didChangeViewportProperties):
(QQuickWebViewPrivate):
(QQuickWebViewFlickablePrivate):
* UIProcess/PageClient.h:
(WebCore):
(PageClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChangeViewportProperties):
* UIProcess/WebPageProxy.h:
(WebCore):
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/qt/QtPageClient.cpp:
(QtPageClient::didChangeViewportProperties):
* UIProcess/qt/QtPageClient.h:
(QtPageClient):
* UIProcess/win/WebView.cpp:
(WebKit::WebView::didChangeViewportProperties):
* UIProcess/win/WebView.h:
(WebView):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::dispatchViewportPropertiesDidChange):
(WebKit):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::sendViewportAttributesChanged):
(WebKit):
(WebKit::WebPage::setViewportSize):
* WebProcess/WebPage/WebPage.h:
(WebPage):

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

23 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Scripts/webkit2/messages.py
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/qt/QtPageClient.cpp
Source/WebKit2/UIProcess/qt/QtPageClient.h
Source/WebKit2/UIProcess/win/WebView.cpp
Source/WebKit2/UIProcess/win/WebView.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h

index e7bab20..530ef9a 100644 (file)
@@ -1,3 +1,69 @@
+2012-04-12  Kenneth Rohde Christiansen  <kenneth@webkit.org>
+
+        Move viewport meta handling to the web process side
+        https://bugs.webkit.org/show_bug.cgi?id=83771
+
+        Reviewed by Simon Hausmann.
+
+        Instead of computing the viewport attributes on both sides,
+        we now do everything on the web process side, and just send
+        over the computed result.
+
+        * Scripts/webkit2/messages.py:
+        (struct_or_class):
+        (headers_for_type):
+        * Shared/WebCoreArgumentCoders.cpp:
+        (CoreIPC::::encode):
+        (CoreIPC::::decode):
+        * Shared/WebCoreArgumentCoders.h:
+        (WebCore):
+        * UIProcess/API/efl/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::didChangeViewportProperties):
+        * UIProcess/API/efl/PageClientImpl.h:
+        (PageClientImpl):
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::didChangeViewportProperties):
+        * UIProcess/API/gtk/PageClientImpl.h:
+        (PageClientImpl):
+        * UIProcess/API/mac/PageClientImpl.h:
+        (PageClientImpl):
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::didChangeViewportProperties):
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::didRelaunchProcess):
+        (QQuickWebViewFlickablePrivate::didChangeViewportProperties):
+        (QQuickWebViewFlickablePrivate::updateViewportSize):
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewPrivate::didChangeViewportProperties):
+        (QQuickWebViewPrivate):
+        (QQuickWebViewFlickablePrivate):
+        * UIProcess/PageClient.h:
+        (WebCore):
+        (PageClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didChangeViewportProperties):
+        * UIProcess/WebPageProxy.h:
+        (WebCore):
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/qt/QtPageClient.cpp:
+        (QtPageClient::didChangeViewportProperties):
+        * UIProcess/qt/QtPageClient.h:
+        (QtPageClient):
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::didChangeViewportProperties):
+        * UIProcess/win/WebView.h:
+        (WebView):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::dispatchViewportPropertiesDidChange):
+        (WebKit):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::sendViewportAttributesChanged):
+        (WebKit):
+        (WebKit::WebPage::setViewportSize):
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+
 2012-04-12  Zalan Bujtas  <zbujtas@gmail.com>
 
         [Qt][WK2] Zoom gesture with double tap crashes on iframe when main frame has scroll offset.
index 456cb10..ed8b508 100644 (file)
@@ -191,7 +191,7 @@ def struct_or_class(namespace, type):
         'WebCore::TransformOperation',
         'WebCore::TransformOperations',
         'WebCore::TranslateTransformOperation',
-        'WebCore::ViewportArguments',
+        'WebCore::ViewportAttributes',
         'WebCore::WindowFeatures',
         'WebKit::AttributedString',
         'WebKit::ContextMenuState',
@@ -386,6 +386,7 @@ def headers_for_type(type):
         'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
         'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
         'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],
+        'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'],
         'WebKit::InjectedBundleUserMessageEncoder': [],
         'WebKit::WebContextUserMessageEncoder': [],
         'WebKit::WebGestureEvent': ['"WebEvent.h"'],
index 10505c3..c6a1673 100644 (file)
@@ -142,15 +142,14 @@ bool ArgumentCoder<IntSize>::decode(ArgumentDecoder* decoder, IntSize& intSize)
     return SimpleArgumentCoder<IntSize>::decode(decoder, intSize);
 }
 
-
-void ArgumentCoder<ViewportArguments>::encode(ArgumentEncoder* encoder, const ViewportArguments& viewportArguments)
+void ArgumentCoder<ViewportAttributes>::encode(ArgumentEncoder* encoder, const ViewportAttributes& viewportAttributes)
 {
-    SimpleArgumentCoder<ViewportArguments>::encode(encoder, viewportArguments);
+    SimpleArgumentCoder<ViewportAttributes>::encode(encoder, viewportAttributes);
 }
 
-bool ArgumentCoder<ViewportArguments>::decode(ArgumentDecoder* decoder, ViewportArguments& viewportArguments)
+bool ArgumentCoder<ViewportAttributes>::decode(ArgumentDecoder* decoder, ViewportAttributes& viewportAttributes)
 {
-    return SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments);
+    return SimpleArgumentCoder<ViewportAttributes>::decode(decoder, viewportAttributes);
 }
 
 void ArgumentCoder<MimeClassInfo>::encode(ArgumentEncoder* encoder, const MimeClassInfo& mimeClassInfo)
index 6f9700c..033e179 100644 (file)
@@ -56,7 +56,7 @@ namespace WebCore {
     struct MimeClassInfo;
     struct PluginInfo;
     struct TextCheckingResult;
-    struct ViewportArguments;
+    struct ViewportAttributes;
     struct WindowFeatures;
 }
 
@@ -122,9 +122,9 @@ template<> struct ArgumentCoder<WebCore::IntSize> {
     static bool decode(ArgumentDecoder*, WebCore::IntSize&);
 };
 
-template<> struct ArgumentCoder<WebCore::ViewportArguments> {
-    static void encode(ArgumentEncoder*, const WebCore::ViewportArguments&);
-    static bool decode(ArgumentDecoder*, WebCore::ViewportArguments&);
+template<> struct ArgumentCoder<WebCore::ViewportAttributes> {
+    static void encode(ArgumentEncoder*, const WebCore::ViewportAttributes&);
+    static bool decode(ArgumentDecoder*, WebCore::ViewportAttributes&);
 };
 
 template<> struct ArgumentCoder<WebCore::MimeClassInfo> {
index c211629..cc46cf9 100644 (file)
@@ -131,7 +131,7 @@ void PageClientImpl::setCursorHiddenUntilMouseMoves(bool)
     notImplemented();
 }
 
-void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribues&)
 {
     notImplemented();
 }
index 40af3b2..0858fc3 100644 (file)
@@ -65,7 +65,7 @@ private:
 
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
 
     virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
     virtual void clearAllEditCommands();
index 94da0dd..8fbfe73 100644 (file)
@@ -158,7 +158,7 @@ void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
     notImplemented();
 }
 
-void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
 {
     notImplemented();
 }
index 6a1cb24..54ad99f 100644 (file)
@@ -69,7 +69,7 @@ private:
     virtual void toolTipChanged(const WTF::String&, const WTF::String&);
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
     virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
     virtual void clearAllEditCommands();
     virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
index f47c579..a9d7a9f 100644 (file)
@@ -63,7 +63,7 @@ private:
     virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
 
     virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
     virtual void clearAllEditCommands();
index 85d6417..72ea349 100644 (file)
@@ -236,7 +236,7 @@ void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
     [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
 }
 
-void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
 {
 }
 
index 4b3abd1..01f8da4 100644 (file)
@@ -206,12 +206,10 @@ void QQuickWebViewPrivate::processDidCrash()
 
 void QQuickWebViewPrivate::didRelaunchProcess()
 {
-    Q_Q(QQuickWebView);
-
     qWarning("WARNING: The web process has been successfully restarted.");
 
-    webPageProxy->setViewportSize(q->boundingRect().size().toSize());
     webPageProxy->drawingArea()->setSize(viewSize(), IntSize());
+    updateViewportSize();
 }
 
 PassOwnPtr<DrawingAreaProxy> QQuickWebViewPrivate::createDrawingAreaProxy()
@@ -615,12 +613,29 @@ void QQuickWebViewFlickablePrivate::didFinishFirstNonEmptyLayout()
 {
 }
 
-void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportArguments& args)
+void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportAttributes& attributes)
 {
-    viewportArguments = args;
+    Q_Q(QQuickWebView);
+
+    QSize viewportSize = q->boundingRect().size().toSize();
+
+    // FIXME: Revise these when implementing fit-to-width.
+    WebCore::ViewportAttributes attr = attributes;
+    WebCore::restrictMinimumScaleFactorToViewportSize(attr, viewportSize);
+    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr);
+
+    QtViewportInteractionEngine::Constraints newConstraints;
+    newConstraints.initialScale = attr.initialScale;
+    newConstraints.minimumScale = attr.minimumScale;
+    newConstraints.maximumScale = attr.maximumScale;
+    newConstraints.devicePixelRatio = attr.devicePixelRatio;
+    newConstraints.isUserScalable = !!attr.userScalable;
+    newConstraints.layoutSize = attr.layoutSize;
+
+    q->experimental()->viewportInfo()->didUpdateViewportConstraints();
 
     // FIXME: If suspended we should do this on resume.
-    interactionEngine->applyConstraints(computeViewportConstraints());
+    interactionEngine->applyConstraints(newConstraints);
 }
 
 void QQuickWebViewFlickablePrivate::updateViewportSize()
@@ -631,11 +646,18 @@ void QQuickWebViewFlickablePrivate::updateViewportSize()
     if (viewportSize.isEmpty() || !interactionEngine)
         return;
 
+    WebPreferences* wkPrefs = webPageProxy->pageGroup()->preferences();
+
+    // FIXME: Remove later; Hardcode a value for now to make sure the DPI adjustment is being tested.
+    wkPrefs->setDeviceDPI(160);
+
+    wkPrefs->setDeviceWidth(viewportSize.width());
+    wkPrefs->setDeviceHeight(viewportSize.height());
+
     // Let the WebProcess know about the new viewport size, so that
     // it can resize the content accordingly.
     webPageProxy->setViewportSize(viewportSize);
 
-    interactionEngine->applyConstraints(computeViewportConstraints());
     _q_contentViewportChanged(QPointF());
 }
 
@@ -684,43 +706,6 @@ void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize)
     q->experimental()->viewportInfo()->didUpdateContentsSize();
 }
 
-QtViewportInteractionEngine::Constraints QQuickWebViewFlickablePrivate::computeViewportConstraints()
-{
-    Q_Q(QQuickWebView);
-
-    QtViewportInteractionEngine::Constraints newConstraints;
-    QSize availableSize = q->boundingRect().size().toSize();
-
-    // Return default values for zero sized viewport.
-    if (availableSize.isEmpty())
-        return newConstraints;
-
-    WebPreferences* wkPrefs = webPageProxy->pageGroup()->preferences();
-
-    // FIXME: Remove later; Hardcode a value for now to make sure the DPI adjustment is being tested.
-    wkPrefs->setDeviceDPI(160);
-
-    wkPrefs->setDeviceWidth(availableSize.width());
-    wkPrefs->setDeviceHeight(availableSize.height());
-
-    int minimumLayoutFallbackWidth = qMax<int>(wkPrefs->layoutFallbackWidth(), availableSize.width());
-
-    WebCore::ViewportAttributes attr = WebCore::computeViewportAttributes(viewportArguments, minimumLayoutFallbackWidth, wkPrefs->deviceWidth(), wkPrefs->deviceHeight(), wkPrefs->deviceDPI(), availableSize);
-    WebCore::restrictMinimumScaleFactorToViewportSize(attr, availableSize);
-    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr);
-
-    newConstraints.initialScale = attr.initialScale;
-    newConstraints.minimumScale = attr.minimumScale;
-    newConstraints.maximumScale = attr.maximumScale;
-    newConstraints.devicePixelRatio = attr.devicePixelRatio;
-    newConstraints.isUserScalable = !!attr.userScalable;
-    newConstraints.layoutSize = attr.layoutSize;
-
-    q->experimental()->viewportInfo()->didUpdateViewportConstraints();
-
-    return newConstraints;
-}
-
 /*!
     \qmlsignal WebView::onNavigationRequested(request)
 
index 7f4304f..22c5996 100644 (file)
@@ -75,7 +75,7 @@ public:
     virtual void onComponentComplete();
     virtual void loadDidCommit() { }
     virtual void didFinishFirstNonEmptyLayout() { }
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments& args) { }
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes& attr) { }
     void didChangeLoadingState(QWebLoadRequest* loadRequest);
     void didChangeBackForwardList();
 
@@ -160,8 +160,6 @@ protected:
     QDeclarativeComponent* filePicker;
     QDeclarativeComponent* databaseQuotaDialog;
 
-    WebCore::ViewportArguments viewportArguments;
-
     bool m_useDefaultContentItemSize;
     bool m_navigatorQtObjectEnabled;
     bool m_renderToOffscreenBuffer;
@@ -196,7 +194,7 @@ public:
     virtual void onComponentComplete();
     virtual void loadDidCommit();
     virtual void didFinishFirstNonEmptyLayout();
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments& args);
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
     virtual QtViewportInteractionEngine* viewportInteractionEngine() { return interactionEngine.data(); }
     virtual void updateViewportSize();
 
@@ -207,8 +205,6 @@ public:
     virtual void pageDidRequestScroll(const QPoint& pos);
     virtual void didChangeContentsSize(const QSize& newSize);
 
-    QtViewportInteractionEngine::Constraints computeViewportConstraints();
-
 private:
     QScopedPointer<QtViewportInteractionEngine> interactionEngine;
     bool pageIsSuspended;
index 47d6af7..7c81510 100644 (file)
@@ -41,7 +41,7 @@ OBJC_CLASS WKView;
 
 namespace WebCore {
     class Cursor;
-    struct ViewportArguments;
+    struct ViewportAttributes;
 }
 
 namespace WebKit {
@@ -123,7 +123,7 @@ public:
 
     virtual void setCursor(const WebCore::Cursor&) = 0;
     virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&) = 0;
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
 
     virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0;
     virtual void clearAllEditCommands() = 0;
index d1bd40c..cdd39e5 100644 (file)
@@ -2394,9 +2394,9 @@ void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
 }
 #endif
 
-void WebPageProxy::didChangeViewportProperties(const ViewportArguments& args)
+void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
 {
-    m_pageClient->didChangeViewportProperties(args);
+    m_pageClient->didChangeViewportProperties(attr);
 }
 
 void WebPageProxy::pageDidScroll()
index 36423e2..17de19f 100644 (file)
@@ -92,7 +92,7 @@ namespace WebCore {
     class ProtectionSpace;
     struct FileChooserSettings;
     struct TextCheckingResult;
-    struct ViewportArguments;
+    struct ViewportAttributes;
     struct WindowFeatures;
 }
 
@@ -721,7 +721,7 @@ private:
     void screenToWindow(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
     void windowToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
     void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
-    void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    void didChangeViewportProperties(const WebCore::ViewportAttributes&);
     void pageDidScroll();
     void runOpenPanel(uint64_t frameID, const WebCore::FileChooserSettings&);
     void printFrame(uint64_t frameID);
index e4f7aaf..373d848 100644 (file)
@@ -31,7 +31,7 @@ messages -> WebPageProxy {
     ShouldInterruptJavaScript() -> (bool shouldInterupt)
     MouseDidMoveOverElement(WebKit::WebHitTestResult::Data hitTestResultData, uint32_t modifiers, WebKit::InjectedBundleUserMessageEncoder userData);
     MissingPluginButtonClicked(WTF::String mimeType, WTF::String url, WTF::String pluginsPageURL)
-    DidChangeViewportProperties(WebCore::ViewportArguments arguments)
+    DidChangeViewportProperties(WebCore::ViewportAttributes attributes)
     DidReceiveEvent(uint32_t type, bool handled)
     StopResponsivenessTimer()
     SetCursor(WebCore::Cursor cursor)
index a69ca06..98ea3b7 100644 (file)
@@ -86,9 +86,9 @@ void QtPageClient::didChangeContentsSize(const IntSize& newSize)
     QQuickWebViewPrivate::get(m_webView)->didChangeContentsSize(newSize);
 }
 
-void QtPageClient::didChangeViewportProperties(const WebCore::ViewportArguments& args)
+void QtPageClient::didChangeViewportProperties(const WebCore::ViewportAttributes& attr)
 {
-    QQuickWebViewPrivate::get(m_webView)->didChangeViewportProperties(args);
+    QQuickWebViewPrivate::get(m_webView)->didChangeViewportProperties(attr);
 }
 
 void QtPageClient::startDrag(const WebCore::DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
index 00caf9c..a458614 100644 (file)
@@ -48,7 +48,7 @@ public:
     virtual void didReceiveMessageFromNavigatorQtObject(const String&);
     virtual void pageDidRequestScroll(const WebCore::IntPoint&);
     virtual void didChangeContentsSize(const WebCore::IntSize&);
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
     virtual void processDidCrash();
     virtual void didRelaunchProcess();
     virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
index 94334d8..f6e75d6 100644 (file)
@@ -1080,7 +1080,7 @@ void WebView::setScrollOffsetOnNextResize(const IntSize& scrollOffset)
     m_nextResizeScrollOffset = scrollOffset;
 }
 
-void WebView::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void WebView::didChangeViewportProperties(const WebCore::ViewportAttributes&)
 {
 }
 
index daa13c1..dba1593 100644 (file)
@@ -185,7 +185,7 @@ private:
     virtual void toolTipChanged(const WTF::String&, const WTF::String&);
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);
-    virtual void didChangeViewportProperties(const WebCore::ViewportArguments&);
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
     virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
     virtual void clearAllEditCommands();
     virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
index 69f16b2..5d3afe6 100644 (file)
@@ -709,26 +709,16 @@ void WebChromeClient::exitFullScreenForElement(WebCore::Element* element)
 }
 #endif
 
-void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& args) const
+void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments&) const
 {
-    m_page->send(Messages::WebPageProxy::DidChangeViewportProperties(args));
-
 #if USE(TILED_BACKING_STORE)
-    // When viewport properties change, recalculate and set the new recommended layout size in case of fixed layout rendering.
-    // Viewport properties have no impact on zero sized fixed viewports.
-    if (m_page->useFixedLayout() && !m_page->viewportSize().isEmpty()) {
-        Settings* settings = m_page->corePage()->settings();
-
-        int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_page->viewportSize().width());
+    if (!m_page->useFixedLayout())
+        return;
 
-        IntSize targetLayoutSize = computeViewportAttributes(m_page->corePage()->viewportArguments(),
-            minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(),
-            settings->deviceDPI(), m_page->viewportSize()).layoutSize;
-        m_page->setResizesToContentsUsingLayoutSize(targetLayoutSize);
-    }
+    m_page->sendViewportAttributesChanged();
 #endif
 }
-    
+
 void WebChromeClient::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
 {
     m_page->send(Messages::WebPageProxy::NotifyScrollerThumbIsVisibleInRect(scrollerThumb));
index e3b1d24..1ea91c7 100644 (file)
@@ -863,22 +863,35 @@ void WebPage::resizeToContentsIfNeeded()
     view->setNeedsLayout();
 }
 
-void WebPage::setViewportSize(const IntSize& size)
+void WebPage::sendViewportAttributesChanged()
 {
     ASSERT(m_useFixedLayout);
 
-    if (m_viewportSize == size)
+    // Viewport properties have no impact on zero sized fixed viewports.
+    if (m_viewportSize.isEmpty())
         return;
 
-     m_viewportSize = size;
-
     // Recalculate the recommended layout size, when the available size (device pixel) changes.
     Settings* settings = m_page->settings();
 
-    int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), size.width());
+    int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_viewportSize.width());
+
+    ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(), settings->deviceDPI(), m_viewportSize);
+
+    setResizesToContentsUsingLayoutSize(attr.layoutSize);
+    send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
+}
+
+void WebPage::setViewportSize(const IntSize& size)
+{
+    ASSERT(m_useFixedLayout);
+
+    if (m_viewportSize == size)
+        return;
+
+     m_viewportSize = size;
 
-    IntSize targetLayoutSize = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(), settings->deviceDPI(), size).layoutSize;
-    setResizesToContentsUsingLayoutSize(targetLayoutSize);
+    sendViewportAttributesChanged();
 }
 
 #endif
index 3a303bf..7d52d4c 100644 (file)
@@ -342,6 +342,7 @@ public:
     void setFixedVisibleContentRect(const WebCore::IntRect&);
     void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&);
     void resizeToContentsIfNeeded();
+    void sendViewportAttributesChanged();
     void setViewportSize(const WebCore::IntSize&);
     WebCore::IntSize viewportSize() const { return m_viewportSize; }
 #endif