Title: [113974] trunk/Source/WebKit2
Revision
113974
Author
[email protected]
Date
2012-04-12 07:43:38 -0700 (Thu, 12 Apr 2012)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (113973 => 113974)


--- trunk/Source/WebKit2/ChangeLog	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-12 14:43:38 UTC (rev 113974)
@@ -1,3 +1,69 @@
+2012-04-12  Kenneth Rohde Christiansen  <[email protected]>
+
+        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  <[email protected]>
 
         [Qt][WK2] Zoom gesture with double tap crashes on iframe when main frame has scroll offset.

Modified: trunk/Source/WebKit2/Scripts/webkit2/messages.py (113973 => 113974)


--- trunk/Source/WebKit2/Scripts/webkit2/messages.py	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages.py	2012-04-12 14:43:38 UTC (rev 113974)
@@ -191,7 +191,7 @@
         'WebCore::TransformOperation',
         'WebCore::TransformOperations',
         'WebCore::TranslateTransformOperation',
-        'WebCore::ViewportArguments',
+        'WebCore::ViewportAttributes',
         'WebCore::WindowFeatures',
         'WebKit::AttributedString',
         'WebKit::ContextMenuState',
@@ -386,6 +386,7 @@
         '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"'],

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (113973 => 113974)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -142,15 +142,14 @@
     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)

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (113973 => 113974)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -56,7 +56,7 @@
     struct MimeClassInfo;
     struct PluginInfo;
     struct TextCheckingResult;
-    struct ViewportArguments;
+    struct ViewportAttributes;
     struct WindowFeatures;
 }
 
@@ -122,9 +122,9 @@
     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> {

Modified: trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -131,7 +131,7 @@
     notImplemented();
 }
 
-void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribues&)
 {
     notImplemented();
 }

Modified: trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -65,7 +65,7 @@
 
     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();

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -158,7 +158,7 @@
     notImplemented();
 }
 
-void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
 {
     notImplemented();
 }

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -69,7 +69,7 @@
     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);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -63,7 +63,7 @@
     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();

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2012-04-12 14:43:38 UTC (rev 113974)
@@ -236,7 +236,7 @@
     [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
 }
 
-void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
 {
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -206,12 +206,10 @@
 
 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::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 @@
     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 @@
     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)
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -75,7 +75,7 @@
     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 @@
     QDeclarativeComponent* filePicker;
     QDeclarativeComponent* databaseQuotaDialog;
 
-    WebCore::ViewportArguments viewportArguments;
-
     bool m_useDefaultContentItemSize;
     bool m_navigatorQtObjectEnabled;
     bool m_renderToOffscreenBuffer;
@@ -196,7 +194,7 @@
     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 @@
     virtual void pageDidRequestScroll(const QPoint& pos);
     virtual void didChangeContentsSize(const QSize& newSize);
 
-    QtViewportInteractionEngine::Constraints computeViewportConstraints();
-
 private:
     QScopedPointer<QtViewportInteractionEngine> interactionEngine;
     bool pageIsSuspended;

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -41,7 +41,7 @@
 
 namespace WebCore {
     class Cursor;
-    struct ViewportArguments;
+    struct ViewportAttributes;
 }
 
 namespace WebKit {
@@ -123,7 +123,7 @@
 
     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;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -2394,9 +2394,9 @@
 }
 #endif
 
-void WebPageProxy::didChangeViewportProperties(const ViewportArguments& args)
+void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
 {
-    m_pageClient->didChangeViewportProperties(args);
+    m_pageClient->didChangeViewportProperties(attr);
 }
 
 void WebPageProxy::pageDidScroll()

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -92,7 +92,7 @@
     class ProtectionSpace;
     struct FileChooserSettings;
     struct TextCheckingResult;
-    struct ViewportArguments;
+    struct ViewportAttributes;
     struct WindowFeatures;
 }
 
@@ -721,7 +721,7 @@
     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);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-04-12 14:43:38 UTC (rev 113974)
@@ -31,7 +31,7 @@
     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)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -86,9 +86,9 @@
     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)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -48,7 +48,7 @@
     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();

Modified: trunk/Source/WebKit2/UIProcess/win/WebView.cpp (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/win/WebView.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -1080,7 +1080,7 @@
     m_nextResizeScrollOffset = scrollOffset;
 }
 
-void WebView::didChangeViewportProperties(const WebCore::ViewportArguments&)
+void WebView::didChangeViewportProperties(const WebCore::ViewportAttributes&)
 {
 }
 

Modified: trunk/Source/WebKit2/UIProcess/win/WebView.h (113973 => 113974)


--- trunk/Source/WebKit2/UIProcess/win/WebView.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -185,7 +185,7 @@
     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);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (113973 => 113974)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -709,26 +709,16 @@
 }
 #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();
+    if (!m_page->useFixedLayout())
+        return;
 
-        int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_page->viewportSize().width());
-
-        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));

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (113973 => 113974)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-04-12 14:43:38 UTC (rev 113974)
@@ -863,24 +863,37 @@
     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());
 
-    IntSize targetLayoutSize = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(), settings->deviceDPI(), size).layoutSize;
-    setResizesToContentsUsingLayoutSize(targetLayoutSize);
+    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;
+
+    sendViewportAttributesChanged();
+}
+
 #endif
 
 void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffset)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (113973 => 113974)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-04-12 14:23:42 UTC (rev 113973)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-04-12 14:43:38 UTC (rev 113974)
@@ -342,6 +342,7 @@
     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
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to