[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 13:49:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 07f151e101b96317e4b77ae16e3585f9094a3c21
Author: kenneth at webkit.org <kenneth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 00:31:09 2010 +0000

    [Qt] Remove setDeviceSize methods
    https://bugs.webkit.org/show_bug.cgi?id=46347
    
    Reviewed by Antonio Gomes.
    
    Remove our setDeviceHeight() API and obtain it automatically from the
    system. Also for testing purposes, make it possible to override the
    values via two newly introduced environment variables.
    
    * Api/qgraphicswebview.cpp:
    * Api/qgraphicswebview.h:
    * Api/qwebpage.cpp:
    (getintenv):
    (queryDeviceSizeForScreenContainingWidget):
    (QWebPage::viewportConfigurationForSize):
    * WebCoreSupport/PageClientQt.cpp:
    (WebCore::PageClientQGraphicsWidget::windowRect):
    * symbian/eabi/QtWebKitu.def:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68457 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index 7f66d98..3836e34 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -75,7 +75,6 @@ public:
     QGraphicsWebView* q;
     QWebPage* page;
     bool resizesToContents;
-    QSize deviceSize;
 
     // Just a convenience to avoid using page->client->overlay always
     QSharedPointer<QGraphicsItemOverlay> overlay;
@@ -555,24 +554,6 @@ QIcon QGraphicsWebView::icon() const
 }
 
 /*!
-    \property QGraphicsWebView::deviceSize
-    \brief the size of the device using the web view
-
-    The device size is used by the DOM window object methods
-    otherHeight(), otherWidth() as well as a page for the viewport
-    meta tag attributes device-width and device-height.
-*/
-void QGraphicsWebView::setDeviceSize(const QSize& size)
-{
-    d->deviceSize = size;
-}
-
-QSize QGraphicsWebView::deviceSize() const
-{
-    return d->deviceSize;
-}
-
-/*!
     \property QGraphicsWebView::zoomFactor
     \brief the zoom factor for the view
 */
diff --git a/WebKit/qt/Api/qgraphicswebview.h b/WebKit/qt/Api/qgraphicswebview.h
index 77f0359..8620ac5 100644
--- a/WebKit/qt/Api/qgraphicswebview.h
+++ b/WebKit/qt/Api/qgraphicswebview.h
@@ -41,7 +41,6 @@ class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
     Q_PROPERTY(QString title READ title NOTIFY titleChanged)
     Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
     Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
-    Q_PROPERTY(QSize deviceSize READ deviceSize WRITE setDeviceSize)
 
     Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
 
@@ -65,9 +64,6 @@ public:
     qreal zoomFactor() const;
     void setZoomFactor(qreal);
 
-    QSize deviceSize() const;
-    void setDeviceSize(const QSize&);
-
     bool isModified() const;
 
     void load(const QUrl& url);
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 573500e..a5234bd 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "qwebpage.h"
+
 #include "qwebview.h"
 #include "qwebframe.h"
 #include "qwebpage_p.h"
@@ -94,6 +95,7 @@
 #include <QBasicTimer>
 #include <QBitArray>
 #include <QDebug>
+#include <QDesktopWidget>
 #include <QDragEnterEvent>
 #include <QDragLeaveEvent>
 #include <QDragMoveEvent>
@@ -2338,19 +2340,67 @@ void QWebPage::setViewportSize(const QSize &size) const
     }
 }
 
+static int getintenv(const char* variable)
+{
+    bool ok;
+    int value = qgetenv(variable).toInt(&ok);
+    return (ok) ? value : -1;
+}
+
+static QSize queryDeviceSizeForScreenContainingWidget(const QWidget* widget)
+{
+    QDesktopWidget* desktop = QApplication::desktop();
+    if (!desktop)
+        return QSize();
+
+    QSize size;
+
+    if (widget) {
+        // Returns the available geometry of the screen which contains widget.
+        // NOTE: this must be the the full screen size including any fixed status areas etc.
+        size = desktop->availableGeometry(widget).size();
+    } else
+        size = desktop->availableGeometry().size();
+
+    // This must be in portrait mode, adjust if not.
+    if (size.width() > size.height()) {
+        int width = size.width();
+        size.setWidth(size.height());
+        size.setHeight(width);
+    }
+
+    return size;
+}
+
+/*!
+    Computes the optimal viewport configuration given the \a availableSize, when
+    user interface components are disregarded.
+
+    The configuration is also dependent on the device screen size which is obtained
+    automatically. For testing purposes the size can be overridden by setting two
+    environment variables QTWEBKIT_DEVICE_WIDTH and QTWEBKIT_DEVICE_HEIGHT, which
+    both needs to be set.
+*/
+
 QWebPage::ViewportConfiguration QWebPage::viewportConfigurationForSize(QSize availableSize) const
 {
     static int desktopWidth = 980;
     static int deviceDPI = 160;
 
-    FloatRect rect = d->page->chrome()->windowRect();
+    ViewportConfiguration result;
 
-    int deviceWidth = rect.width();
-    int deviceHeight = rect.height();
+    int deviceWidth = getintenv("QTWEBKIT_DEVICE_WIDTH");
+    int deviceHeight = getintenv("QTWEBKIT_DEVICE_HEIGHT");
 
-    WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize);
+    // Both environment variables need to be set - or they will be ignored.
+    if (deviceWidth < 0 && deviceHeight < 0) {
+        QSize size = queryDeviceSizeForScreenContainingWidget((d->client) ? d->client->ownerWidget() : 0);
+        deviceWidth = size.width();
+        deviceHeight = size.height();
+    }
 
-    ViewportConfiguration result;
+    WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments(),
+            desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize);
 
     result.m_isValid = true;
     result.m_size = conf.layoutViewport;
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 3341828..b30b397 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,24 @@
+2010-09-27  Kenneth Rohde Christiansen  <kenneth.christiansen at openbossa.org>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] Remove setDeviceSize methods
+        https://bugs.webkit.org/show_bug.cgi?id=46347
+
+        Remove our setDeviceHeight() API and obtain it automatically from the
+        system. Also for testing purposes, make it possible to override the
+        values via two newly introduced environment variables.
+
+        * Api/qgraphicswebview.cpp:
+        * Api/qgraphicswebview.h:
+        * Api/qwebpage.cpp:
+        (getintenv):
+        (queryDeviceSizeForScreenContainingWidget):
+        (QWebPage::viewportConfigurationForSize):
+        * WebCoreSupport/PageClientQt.cpp:
+        (WebCore::PageClientQGraphicsWidget::windowRect):
+        * symbian/eabi/QtWebKitu.def:
+
 2010-09-27  Girish Ramakrishnan  <girish at forwardbias.in>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp
index 62f48ff..83f0f48 100644
--- a/WebKit/qt/WebCoreSupport/PageClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp
@@ -318,9 +318,6 @@ QStyle* PageClientQGraphicsWidget::style() const
 
 QRectF PageClientQGraphicsWidget::windowRect() const
 {
-    if (!view->deviceSize().isEmpty())
-        return QRectF(QRect(QPoint(0, 0), view->deviceSize()));
-
     if (!view->scene())
         return QRectF();
 
diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def
index 8291197..2b917e1 100644
--- a/WebKit/qt/symbian/eabi/QtWebKitu.def
+++ b/WebKit/qt/symbian/eabi/QtWebKitu.def
@@ -799,7 +799,6 @@ EXPORTS
 	_ZN8QWebPage23allowGeolocationRequestEP9QWebFrame @ 798 NONAME
 	_ZN8QWebPage23viewportChangeRequestedERKNS_13ViewportHintsE @ 799 NONAME ABSENT
 	_ZNK15QWebScriptWorld5worldEv @ 800 NONAME
-	_ZN16QGraphicsWebView13setDeviceSizeERK5QSize @ 801 NONAME
 	_ZN23DumpRenderTreeSupportQt12pagePropertyEP9QWebFrameRK7QStringi @ 802 NONAME
 	_ZN23DumpRenderTreeSupportQt16isPageBoxVisibleEP9QWebFramei @ 803 NONAME
 	_ZN23DumpRenderTreeSupportQt16resumeAnimationsEP9QWebFrame @ 804 NONAME
@@ -811,7 +810,6 @@ EXPORTS
 	_ZN8QWebPage23checkPermissionFromUserEP9QWebFrameNS_16PermissionDomainERNS_16PermissionPolicyE @ 810 NONAME
 	_ZN8QWebPage25requestPermissionFromUserEP9QWebFrameNS_16PermissionDomainE @ 811 NONAME
 	_ZN8QWebPage27cancelRequestsForPermissionEP9QWebFrameNS_16PermissionDomainE @ 812 NONAME
-	_ZNK16QGraphicsWebView10deviceSizeEv @ 813 NONAME
 	_ZN23DumpRenderTreeSupportQt14viewportAsTextEP8QWebPageRK5QSize @ 814 NONAME
 	_ZN23DumpRenderTreeSupportQt32simulateDesktopNotificationClickERK7QString @ 815 NONAME
 	_ZN8QWebPage23viewportChangeRequestedEv @ 816 NONAME

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list