[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

kenneth at webkit.org kenneth at webkit.org
Wed Dec 22 14:28:47 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4497b34bcf4b447bde35e3a4e09827407287ed16
Author: kenneth at webkit.org <kenneth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 11 14:12:02 2010 +0000

    Adding Qt WebKit2 API for dealing with viewport meta info
    https://bugs.webkit.org/show_bug.cgi?id=47202
    
    Reviewed by Sam Weinig.
    
    Add new API for setting scale and layout viewport given the data
    provided by the viewport meta tag.
    
    Any Qt view components who wants to support this, will need to
    compute the viewport attributes before first load using
    viewportAttributesForSize(..), and then again everytime
    the viewport attributes gets invalidates (loading a new page,
    navigating page cache) or every time on of the browser
    attributes change, such as when the device is rotates (which
    changes the actual visible viewport). A signal
    viewportChangeRequested() is provided for the former.
    
    * Shared/WebCoreArgumentCoders.h:
    * UIProcess/API/mac/PageClientImpl.h:
    * UIProcess/API/mac/PageClientImpl.mm:
    (WebKit::PageClientImpl::setViewportArguments):
    * UIProcess/API/qt/qwkpage.cpp:
    (QWKPagePrivate::setViewportArguments):
    (QWKPage::ViewportAttributes::ViewportAttributes):
    (QWKPage::ViewportAttributes::~ViewportAttributes):
    (QWKPage::ViewportAttributes::operator=):
    (QWKPage::viewportAttributesForSize):
    * UIProcess/API/qt/qwkpage.h:
    * UIProcess/API/qt/qwkpage_p.h:
    (QtViewportAttributesPrivate::QtViewportAttributesPrivate):
    * UIProcess/PageClient.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::didReceiveMessage):
    (WebKit::WebPageProxy::didChangeViewportData):
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:
    * UIProcess/win/WebView.cpp:
    (WebKit::WebView::setViewportArguments):
    * UIProcess/win/WebView.h:
    * WebProcess/WebCoreSupport/WebChromeClient.cpp:
    (WebKit::WebChromeClient::dispatchViewportDataDidChange):
    * WebProcess/WebCoreSupport/WebChromeClient.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69490 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index bdb751c..7296583 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,48 @@
+2010-10-08  Kenneth Rohde Christiansen  <kenneth.christiansen at openbossa.org>
+
+        Reviewed by Sam Weinig.
+
+        Adding Qt WebKit2 API for dealing with viewport meta info
+        https://bugs.webkit.org/show_bug.cgi?id=47202
+
+        Add new API for setting scale and layout viewport given the data
+        provided by the viewport meta tag.
+
+        Any Qt view components who wants to support this, will need to
+        compute the viewport attributes before first load using
+        viewportAttributesForSize(..), and then again everytime
+        the viewport attributes gets invalidates (loading a new page,
+        navigating page cache) or every time on of the browser
+        attributes change, such as when the device is rotates (which
+        changes the actual visible viewport). A signal
+        viewportChangeRequested() is provided for the former.
+
+        * Shared/WebCoreArgumentCoders.h:
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::setViewportArguments):
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPagePrivate::setViewportArguments):
+        (QWKPage::ViewportAttributes::ViewportAttributes):
+        (QWKPage::ViewportAttributes::~ViewportAttributes):
+        (QWKPage::ViewportAttributes::operator=):
+        (QWKPage::viewportAttributesForSize):
+        * UIProcess/API/qt/qwkpage.h:
+        * UIProcess/API/qt/qwkpage_p.h:
+        (QtViewportAttributesPrivate::QtViewportAttributesPrivate):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage):
+        (WebKit::WebPageProxy::didChangeViewportData):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::setViewportArguments):
+        * UIProcess/win/WebView.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::dispatchViewportDataDidChange):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2010-10-11  Csaba Osztrogonác  <ossy at webkit.org>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit2/Shared/WebCoreArgumentCoders.h b/WebKit2/Shared/WebCoreArgumentCoders.h
index f61fdcf..6aa842e 100644
--- a/WebKit2/Shared/WebCoreArgumentCoders.h
+++ b/WebKit2/Shared/WebCoreArgumentCoders.h
@@ -35,6 +35,7 @@
 #include <WebCore/IntRect.h>
 #include <WebCore/PluginData.h>
 #include <WebCore/ResourceRequest.h>
+#include <WebCore/ViewportArguments.h>
 #include <limits>
 
 namespace CoreIPC {
@@ -42,6 +43,7 @@ namespace CoreIPC {
 template<> struct ArgumentCoder<WebCore::IntPoint> : SimpleArgumentCoder<WebCore::IntPoint> { };
 template<> struct ArgumentCoder<WebCore::IntSize> : SimpleArgumentCoder<WebCore::IntSize> { };
 template<> struct ArgumentCoder<WebCore::IntRect> : SimpleArgumentCoder<WebCore::IntRect> { };
+template<> struct ArgumentCoder<WebCore::ViewportArguments> : SimpleArgumentCoder<WebCore::ViewportArguments> { };
 
 template<> struct ArgumentCoder<WebCore::FloatPoint> : SimpleArgumentCoder<WebCore::FloatPoint> { };
 template<> struct ArgumentCoder<WebCore::FloatSize> : SimpleArgumentCoder<WebCore::FloatSize> { };
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.h b/WebKit2/UIProcess/API/mac/PageClientImpl.h
index e621f3c..f72cc07 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -51,6 +51,7 @@ private:
     virtual void takeFocus(bool direction);
     virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
     virtual void setCursor(const WebCore::Cursor&);
+    virtual void setViewportArguments(const WebCore::ViewportArguments&);
 
     void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
     void clearAllEditCommands();
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index f005e16..507401e 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -136,6 +136,11 @@ void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
     [m_wkView _setCursor:cursor.platformCursor()];
 }
 
+void PageClientImpl::setViewportArguments(const WebCore::ViewportArguments&)
+{
+
+}
+
 static NSString* nameForEditAction(EditAction editAction)
 {
     // FIXME: Use localized strings.
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index e79a554..79b1a9c 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -79,6 +79,12 @@ void QWKPagePrivate::setCursor(const WebCore::Cursor& cursor)
 #endif
 }
 
+void QWKPagePrivate::setViewportArguments(const ViewportArguments& args)
+{
+    viewportArguments = args;
+    emit q->viewportChangeRequested();
+}
+
 void QWKPagePrivate::toolTipChanged(const String&, const String& newTooltip)
 {
     emit q->statusBarMessage(QString(newTooltip));
@@ -295,7 +301,7 @@ QWKPage::~QWKPage()
     delete d;
 }
 
-QWKPage::ViewportConfiguration::ViewportConfiguration()
+QWKPage::ViewportAttributes::ViewportAttributes()
     : d(0)
     , m_initialScaleFactor(-1.0)
     , m_minimumScaleFactor(-1.0)
@@ -307,7 +313,7 @@ QWKPage::ViewportConfiguration::ViewportConfiguration()
 
 }
 
-QWKPage::ViewportConfiguration::ViewportConfiguration(const QWKPage::ViewportConfiguration& other)
+QWKPage::ViewportAttributes::ViewportAttributes(const QWKPage::ViewportAttributes& other)
     : d(other.d)
     , m_initialScaleFactor(other.m_initialScaleFactor)
     , m_minimumScaleFactor(other.m_minimumScaleFactor)
@@ -320,12 +326,12 @@ QWKPage::ViewportConfiguration::ViewportConfiguration(const QWKPage::ViewportCon
 
 }
 
-QWKPage::ViewportConfiguration::~ViewportConfiguration()
+QWKPage::ViewportAttributes::~ViewportAttributes()
 {
 
 }
 
-QWKPage::ViewportConfiguration& QWKPage::ViewportConfiguration::operator=(const QWKPage::ViewportConfiguration& other)
+QWKPage::ViewportAttributes& QWKPage::ViewportAttributes::operator=(const QWKPage::ViewportAttributes& other)
 {
     if (this != &other) {
         d = other.d;
@@ -341,7 +347,7 @@ QWKPage::ViewportConfiguration& QWKPage::ViewportConfiguration::operator=(const
     return *this;
 }
 
-QWKPage::ViewportConfiguration QWKPage::viewportConfigurationForSize(QSize availableSize) const
+QWKPage::ViewportAttributes QWKPage::viewportAttributesForSize(QSize availableSize) const
 {
     static int desktopWidth = 980;
     static int deviceDPI = 160;
@@ -351,11 +357,9 @@ QWKPage::ViewportConfiguration QWKPage::viewportConfigurationForSize(QSize avail
     int deviceWidth = 480;
     int deviceHeight = 864;
 
-    ViewportArguments args;
-
-    WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args, desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize);
+    WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize);
 
-    ViewportConfiguration result;
+    ViewportAttributes result;
 
     result.m_isValid = true;
     result.m_size = conf.layoutSize;
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.h b/WebKit2/UIProcess/API/qt/qwkpage.h
index 0bb9db9..ed54a61 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.h
+++ b/WebKit2/UIProcess/API/qt/qwkpage.h
@@ -16,7 +16,7 @@ class QCursor;
 class QWKGraphicsWidget;
 class QWKPreferences;
 class QWKPagePrivate;
-class QtViewportConfigurationPrivate;
+class QtViewportAttributesPrivate;
 
 class QWEBKIT_EXPORT QWKPage : public QObject {
     Q_OBJECT
@@ -35,14 +35,14 @@ public:
         WebActionCount
     };
 
-    class ViewportConfiguration {
+    class ViewportAttributes {
     public:
-        ViewportConfiguration();
-        ViewportConfiguration(const QWKPage::ViewportConfiguration& other);
+        ViewportAttributes();
+        ViewportAttributes(const QWKPage::ViewportAttributes& other);
 
-        ~ViewportConfiguration();
+        ~ViewportAttributes();
 
-        QWKPage::ViewportConfiguration& operator=(const QWKPage::ViewportConfiguration& other);
+        QWKPage::ViewportAttributes& operator=(const QWKPage::ViewportAttributes& other);
 
         inline qreal initialScaleFactor() const { return m_initialScaleFactor; };
         inline qreal minimumScaleFactor() const { return m_minimumScaleFactor; };
@@ -53,7 +53,7 @@ public:
         inline QSize size() const { return m_size; };
 
     private:
-        QSharedDataPointer<QtViewportConfigurationPrivate> d;
+        QSharedDataPointer<QtViewportAttributesPrivate> d;
         qreal m_initialScaleFactor;
         qreal m_minimumScaleFactor;
         qreal m_maximumScaleFactor;
@@ -79,7 +79,7 @@ public:
     QString title() const;
 
     void setViewportSize(const QSize&);
-    ViewportConfiguration viewportConfigurationForSize(QSize availableSize) const;
+    ViewportAttributes viewportAttributesForSize(QSize availableSize) const;
 
     QAction* action(WebAction action) const;
     void triggerAction(WebAction action, bool checked = false);
@@ -99,6 +99,7 @@ public:
     Q_SIGNAL void urlChanged(const QUrl&);
     Q_SIGNAL void contentsSizeChanged(const QSize&);
     Q_SIGNAL void cursorChanged(const QCursor&);
+    Q_SIGNAL void viewportChangeRequested();
 
 protected:
     void timerEvent(QTimerEvent*);
diff --git a/WebKit2/UIProcess/API/qt/qwkpage_p.h b/WebKit2/UIProcess/API/qt/qwkpage_p.h
index 2d863f9..af7ede6 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -51,6 +51,7 @@ public:
     virtual void processDidExit() { }
     virtual void processDidRevive() { }
     virtual void setCursor(const WebCore::Cursor&);
+    virtual void setViewportArguments(const WebCore::ViewportArguments&);
     virtual void takeFocus(bool direction) { }
     virtual void toolTipChanged(const WTF::String&, const WTF::String&);
     virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
@@ -84,6 +85,7 @@ public:
 
     RefPtr<WebKit::WebPageProxy> page;
     WKPageNamespaceRef pageNamespaceRef;
+    WebCore::ViewportArguments viewportArguments;
 
     QWKPage::CreateNewPageFn createNewPageFn;
 
@@ -91,13 +93,13 @@ public:
     QBasicTimer tripleClickTimer;
 };
 
-class QtViewportConfigurationPrivate : public QSharedData {
+class QtViewportAttributesPrivate : public QSharedData {
 public:
-    QtViewportConfigurationPrivate(QWKPage::ViewportConfiguration* qq)
+    QtViewportAttributesPrivate(QWKPage::ViewportAttributes* qq)
         : q(qq)
     { }
 
-    QWKPage::ViewportConfiguration* q;
+    QWKPage::ViewportAttributes* q;
 };
 
 
diff --git a/WebKit2/UIProcess/PageClient.h b/WebKit2/UIProcess/PageClient.h
index 3ba21cd..3c0134f 100644
--- a/WebKit2/UIProcess/PageClient.h
+++ b/WebKit2/UIProcess/PageClient.h
@@ -31,6 +31,7 @@
 
 namespace WebCore {
     class Cursor;
+    class ViewportArguments;
 }
 
 namespace WebKit {
@@ -48,6 +49,7 @@ public:
     virtual void toolTipChanged(const String&, const String&) = 0;
 
     virtual void setCursor(const WebCore::Cursor&) = 0;
+    virtual void setViewportArguments(const WebCore::ViewportArguments&) = 0;
 
     virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0;
     virtual void clearAllEditCommands() = 0;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 63dc757..b2d78fb 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -560,7 +560,6 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
     }
 
     didReceiveWebPageProxyMessage(connection, messageID, arguments);
-
 }
 
 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
@@ -887,6 +886,11 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t f
     shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, process()->webFrame(frameID));
 }
 
+void WebPageProxy::didChangeViewportData(const ViewportArguments& args)
+{
+    m_pageClient->setViewportArguments(args);
+}
+
 // BackForwardList
 
 void WebPageProxy::backForwardAddItem(uint64_t itemID)
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 7fc79e3..3c7627b 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -59,6 +59,7 @@ namespace WebCore {
     class Cursor;
     class FloatRect;
     class IntSize;
+    class ViewportArguments;
 }
 
 struct WKContextStatistics;
@@ -261,6 +262,7 @@ private:
     void getWindowFrame(WebCore::FloatRect&);
     void canRunBeforeUnloadConfirmPanel(bool& canRun);
     void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
+    void didChangeViewportData(const WebCore::ViewportArguments&);
 
     // Back/Forward list management
     void backForwardAddItem(uint64_t itemID);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index cc045be..b01560a 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -30,6 +30,7 @@ messages -> WebPageProxy {
     RunJavaScriptPrompt(uint64_t frameID, WTF::String message, WTF::String defaultValue) -> (WTF::String result)
     MouseDidMoveOverElement(uint32_t modifiers, WebKit::InjectedBundleUserMessageEncoder userData);
     ContentsSizeChanged(uint64_t frameID, WebCore::IntSize newSize)
+    DidChangeViewportData(WebCore::ViewportArguments arguments)
     DidReceiveEvent(uint32_t type, bool handled)
     DidValidateMenuItem(WTF::String commandName, bool isEnabled, int32_t state)
     SetCursor(WebCore::Cursor cursor)
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index a5fdd37..a1096f1 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -573,6 +573,10 @@ void WebView::setCursor(const WebCore::Cursor& cursor)
     ::SetCursor(platformCursor);
 }
 
+void WebView::setViewportArguments(const WebCore::ViewportArguments&)
+{
+}
+
 void WebView::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo)
 {
 }
diff --git a/WebKit2/UIProcess/win/WebView.h b/WebKit2/UIProcess/win/WebView.h
index 7a85bc3..66deccf 100644
--- a/WebKit2/UIProcess/win/WebView.h
+++ b/WebKit2/UIProcess/win/WebView.h
@@ -95,6 +95,7 @@ private:
     virtual void takeFocus(bool direction);
     virtual void toolTipChanged(const WTF::String&, const WTF::String&);
     virtual void setCursor(const WebCore::Cursor&);
+    virtual void setViewportArguments(const WebCore::ViewportArguments&);
     virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
     virtual void clearAllEditCommands();
     virtual void setEditCommandState(const WTF::String&, bool, int);
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 5dffea5..dbf5a0d 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -31,6 +31,7 @@
 
 #include "DrawingArea.h"
 #include "InjectedBundleUserMessageCoders.h"
+#include "ViewportArguments.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebFrame.h"
 #include "WebFrameLoaderClient.h"
@@ -564,5 +565,9 @@ void WebChromeClient::setLastSetCursorToCurrentCursor()
 }
 #endif
 
+void WebChromeClient::dispatchViewportDataDidChange(const ViewportArguments& args) const
+{
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::DidChangeViewportData(args), m_page->pageID());
+}
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
index 419a6c9..ad488f9 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -28,6 +28,7 @@
 #define WebChromeClient_h
 
 #include <WebCore/ChromeClient.h>
+#include <WebCore/ViewportArguments.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebKit {
@@ -187,6 +188,8 @@ private:
     virtual void setLastSetCursorToCurrentCursor();
 #endif
 
+    virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments&) const;
+
     String m_cachedToolTip;
     WebPage* m_page;
 };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list