Created
November 23, 2011 13:31
-
-
Save Slow3000/1388667 to your computer and use it in GitHub Desktop.
Reworked patch for experimental viewportAttributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e64013ea9f28d7ac38c23c9bb76be32496d4b129 Mon Sep 17 00:00:00 2001 | |
From: Michael Bruning <michael.bruning@nokia.com> | |
Date: Wed, 23 Nov 2011 14:24:46 +0100 | |
Subject: [PATCH] [QT][WK2]Add (experimental) viewport attributes view to Minibrowser/qt | |
https://bugs.webkit.org/show_bug.cgi?id=72893 | |
Reviewed by Tor Arne Vestbo | |
This extends QQuickWebViewExperimental by a property named | |
viewportAttributes, which contains the viewport scalability and | |
layout size information. This property is exposed to QML through | |
the experimental extension for QQuickWebView. | |
Source: | |
* Source/qtwebkit-export.map: | |
Source/WebKit/qt: | |
* declaratiqve/experimental/plugin.cpp: | |
Source/WebKit2: | |
* Target.pri: | |
* UIProcess/API/qt/qquickwebview.cpp: | |
(QQuickWebViewPrivate::computeViewportConstraints): | |
(QQuickWebViewExperimental::QQuickWebViewExperimental): | |
(QQuickWebViewExperimental::attributes): | |
* UIProcess/API/qt/qquickwebview_p.h: | |
* UIProcess/API/qt/qwebviewportattributes.cpp: Added. | |
(QWebViewportAttributes::QWebViewportAttributes): | |
(QWebViewportAttributes::~QWebViewportAttributes): | |
(QWebViewportAttributes::initialScale): | |
(QWebViewportAttributes::minimumScale): | |
(QWebViewportAttributes::maximumScale): | |
(QWebViewportAttributes::isScalable): | |
(QWebViewportAttributes::layoutWidth): | |
(QWebViewportAttributes::layoutHeight): | |
(QWebViewportAttributes::updateFromViewportAttributes): | |
* UIProcess/API/qt/qwebviewportattributes_p.h: Added. | |
Tools: | |
* MiniBrowser/qt/MiniBrowser.pro: | |
* MiniBrowser/qt/MiniBrowser.qrc: | |
* MiniBrowser/qt/icons/info.png: Added. | |
* MiniBrowser/qt/qml/BrowserWindow.qml: | |
* MiniBrowser/qt/qml/ViewportAttributesItem.qml: Added. | |
--- | |
ChangeLog | 14 +++ | |
Source/WebKit/qt/ChangeLog | 14 +++ | |
.../WebKit/qt/declarative/experimental/plugin.cpp | 3 + | |
Source/WebKit2/ChangeLog | 30 +++++++ | |
Source/WebKit2/Target.pri | 2 + | |
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | 9 ++ | |
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h | 4 + | |
.../UIProcess/API/qt/qwebviewportattributes.cpp | 89 ++++++++++++++++++++ | |
.../UIProcess/API/qt/qwebviewportattributes_p.h | 70 +++++++++++++++ | |
Source/qtwebkit-export.map | 3 + | |
Tools/ChangeLog | 18 ++++ | |
Tools/MiniBrowser/qt/MiniBrowser.pro | 3 +- | |
Tools/MiniBrowser/qt/MiniBrowser.qrc | 2 + | |
Tools/MiniBrowser/qt/icons/info.png | Bin 0 -> 340 bytes | |
Tools/MiniBrowser/qt/qml/BrowserWindow.qml | 42 +++++++++- | |
.../MiniBrowser/qt/qml/ViewportAttributesItem.qml | 32 +++++++ | |
16 files changed, 331 insertions(+), 4 deletions(-) | |
create mode 100644 Source/WebKit2/UIProcess/API/qt/qwebviewportattributes.cpp | |
create mode 100644 Source/WebKit2/UIProcess/API/qt/qwebviewportattributes_p.h | |
create mode 100644 Tools/MiniBrowser/qt/icons/info.png | |
create mode 100644 Tools/MiniBrowser/qt/qml/ViewportAttributesItem.qml | |
diff --git a/ChangeLog b/ChangeLog | |
index 768475e..c03dd35 100644 | |
--- a/ChangeLog | |
+++ b/ChangeLog | |
@@ -1,3 +1,17 @@ | |
+2011-11-21 Michael Bruning <michael.bruning@nokia.com> | |
+ | |
+ [QT][WK2]Add (experimental) viewport attributes view to Minibrowser/qt. | |
+ https://bugs.webkit.org/show_bug.cgi?id=72893 | |
+ | |
+ Reviewed by Tor Arne Vestbo. | |
+ | |
+ This patch extends QQuickWebViewExperimental by a property named | |
+ viewportAttributes, which contains the viewport scalability and | |
+ layout size information. This property is exposed to QML through | |
+ the experimental extension for QQuickWebView. | |
+ | |
+ * Source/qtwebkit-export.map: | |
+ | |
2011-10-08 Martin Robinson <mrobinson@igalia.com> | |
[GTK] Enable WebGL by default | |
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog | |
index 585dcd6..30b349f 100644 | |
--- a/Source/WebKit/qt/ChangeLog | |
+++ b/Source/WebKit/qt/ChangeLog | |
@@ -1,3 +1,17 @@ | |
+2011-11-21 Michael Bruning <michael.bruning@nokia.com> | |
+ | |
+ [QT][WK2]Add (experimental) viewport attributes view to Minibrowser/qt. | |
+ https://bugs.webkit.org/show_bug.cgi?id=72893 | |
+ | |
+ Reviewed by Tor Arne Vestbo. | |
+ | |
+ This patch extends QQuickWebViewExperimental by a property named | |
+ viewportAttributes, which contains the viewport scalability and | |
+ layout size information. This property is exposed to QML through | |
+ the experimental extension for QQuickWebView. | |
+ | |
+ * declarative/experimental/plugin.cpp: | |
+ | |
2011-11-22 Pavel Feldman <pfeldman@google.com> | |
Web Inspector: remove Inspector::bringToFront from the protocol. | |
diff --git a/Source/WebKit/qt/declarative/experimental/plugin.cpp b/Source/WebKit/qt/declarative/experimental/plugin.cpp | |
index 3e682fd..73d0201 100644 | |
--- a/Source/WebKit/qt/declarative/experimental/plugin.cpp | |
+++ b/Source/WebKit/qt/declarative/experimental/plugin.cpp | |
@@ -19,6 +19,7 @@ | |
#include "qquickwebpage_p.h" | |
#include "qquickwebview_p.h" | |
+#include "qwebviewportattributes_p.h" | |
#include <QtDeclarative/qdeclarative.h> | |
#include <QtDeclarative/qdeclarativeextensionplugin.h> | |
@@ -43,6 +44,8 @@ public: | |
qmlRegisterExtendedType<QQuickWebView, QQuickWebViewExperimentalExtension>(uri, 3, 0, "WebView"); | |
qmlRegisterUncreatableType<QQuickWebViewExperimental>(uri, 3, 0, "QQuickWebViewExperimental", | |
QObject::tr("Cannot create separate instance of QQuickWebViewExperimental")); | |
+ qmlRegisterUncreatableType<QWebViewportAttributes>(uri, 3, 0, "QWebViewportAttributes", | |
+ QObject::tr("Cannot create separate instance of QWebViewportAttributes")); | |
} | |
}; | |
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog | |
index 2508021..520f003 100644 | |
--- a/Source/WebKit2/ChangeLog | |
+++ b/Source/WebKit2/ChangeLog | |
@@ -1,3 +1,33 @@ | |
+2011-11-21 Michael Bruning <michael.bruning@nokia.com> | |
+ | |
+ [QT][WK2]Add (experimental) viewport attributes view to Minibrowser/qt. | |
+ https://bugs.webkit.org/show_bug.cgi?id=72893 | |
+ | |
+ Reviewed by Tor Arne Vestbo. | |
+ | |
+ This patch extends QQuickWebViewExperimental by a property named | |
+ viewportAttributes, which contains the viewport scalability and | |
+ layout size information. This property is exposed to QML through | |
+ the experimental extension for QQuickWebView. | |
+ | |
+ * Target.pri: | |
+ * UIProcess/API/qt/qquickwebview.cpp: | |
+ (QQuickWebViewPrivate::computeViewportConstraints): | |
+ (QQuickWebViewExperimental::QQuickWebViewExperimental): | |
+ (QQuickWebViewExperimental::attributes): | |
+ * UIProcess/API/qt/qquickwebview_p.h: | |
+ * UIProcess/API/qt/qwebviewportattributes.cpp: Added. | |
+ (QWebViewportAttributes::QWebViewportAttributes): | |
+ (QWebViewportAttributes::~QWebViewportAttributes): | |
+ (QWebViewportAttributes::initialScale): | |
+ (QWebViewportAttributes::minimumScale): | |
+ (QWebViewportAttributes::maximumScale): | |
+ (QWebViewportAttributes::isScalable): | |
+ (QWebViewportAttributes::layoutWidth): | |
+ (QWebViewportAttributes::layoutHeight): | |
+ (QWebViewportAttributes::updateFromViewportAttributes): | |
+ * UIProcess/API/qt/qwebviewportattributes_p.h: Added. | |
+ | |
2011-11-22 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> | |
[Qt] [WK2] Move PagePolicyClient related code to QtWebPagePolicyClient | |
diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri | |
index 14c9c0c..d948dd6 100644 | |
--- a/Source/WebKit2/Target.pri | |
+++ b/Source/WebKit2/Target.pri | |
@@ -252,6 +252,7 @@ HEADERS += \ | |
UIProcess/API/qt/qquickwebpage_p_p.h \ | |
UIProcess/API/qt/qquickwebview_p.h \ | |
UIProcess/API/qt/qquickwebview_p_p.h \ | |
+ UIProcess/API/qt/qwebviewportattributes_p.h \ | |
UIProcess/Authentication/AuthenticationChallengeProxy.h \ | |
UIProcess/Authentication/AuthenticationDecisionListener.h \ | |
UIProcess/Authentication/WebCredential.h \ | |
@@ -556,6 +557,7 @@ SOURCES += \ | |
UIProcess/API/qt/qquickwebpage.cpp \ | |
UIProcess/API/qt/qquickwebview.cpp \ | |
UIProcess/API/qt/qwebpreferences.cpp \ | |
+ UIProcess/API/qt/qwebviewportattributes.cpp \ | |
UIProcess/Authentication/AuthenticationChallengeProxy.cpp \ | |
UIProcess/Authentication/AuthenticationDecisionListener.cpp \ | |
UIProcess/Authentication/WebCredential.cpp \ | |
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | |
index 513e98e..255c9c6 100644 | |
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | |
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | |
@@ -30,6 +30,7 @@ | |
#include "qquickwebpage_p_p.h" | |
#include "qquickwebview_p_p.h" | |
#include "qwebpreferences_p_p.h" | |
+#include "qwebviewportattributes_p.h" | |
#include <QtDeclarative/QQuickCanvas> | |
#include <QtWidgets/QFileDialog> | |
@@ -216,6 +217,8 @@ QtViewportInteractionEngine::Constraints QQuickWebViewPrivate::computeViewportCo | |
newConstraints.devicePixelRatio = attr.devicePixelRatio; | |
newConstraints.isUserScalable = !!attr.userScalable; | |
+ q->m_experimental->viewportAttributes()->updateFromViewportAttributes(attr); | |
+ | |
return newConstraints; | |
} | |
@@ -411,6 +414,7 @@ QQuickWebViewExperimental::QQuickWebViewExperimental(QQuickWebView *webView) | |
: QObject(webView) | |
, q_ptr(webView) | |
, d_ptr(webView->d_ptr.data()) | |
+ , m_viewportAttributes(new QWebViewportAttributes(this)) | |
{ | |
} | |
@@ -469,6 +473,11 @@ void QQuickWebViewExperimental::setPromptDialog(QDeclarativeComponent* promptDia | |
emit promptDialogChanged(); | |
} | |
+QWebViewportAttributes* QQuickWebViewExperimental::viewportAttributes() | |
+{ | |
+ return m_viewportAttributes; | |
+} | |
+ | |
QQuickWebView::QQuickWebView(QQuickItem* parent) | |
: QQuickItem(parent) | |
, d_ptr(new QQuickWebViewPrivate(this)) | |
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h | |
index 7be2a89..3ad0454 100644 | |
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h | |
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h | |
@@ -31,6 +31,7 @@ class QQuickWebViewPrivate; | |
class QQuickWebViewExperimental; | |
class QWebDownloadItem; | |
class QWebPreferences; | |
+class QWebViewportAttributes; | |
namespace WTR { | |
class PlatformWebView; | |
@@ -167,6 +168,7 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject { | |
Q_PROPERTY(QDeclarativeComponent* alertDialog READ alertDialog WRITE setAlertDialog NOTIFY alertDialogChanged) | |
Q_PROPERTY(QDeclarativeComponent* confirmDialog READ confirmDialog WRITE setConfirmDialog NOTIFY confirmDialogChanged) | |
Q_PROPERTY(QDeclarativeComponent* promptDialog READ promptDialog WRITE setPromptDialog NOTIFY promptDialogChanged) | |
+ Q_PROPERTY(QWebViewportAttributes* viewportAttributes READ viewportAttributes CONSTANT FINAL) | |
public: | |
QQuickWebViewExperimental(QQuickWebView* webView); | |
@@ -178,6 +180,7 @@ public: | |
void setConfirmDialog(QDeclarativeComponent*); | |
QDeclarativeComponent* promptDialog() const; | |
void setPromptDialog(QDeclarativeComponent*); | |
+ QWebViewportAttributes* viewportAttributes(); | |
public Q_SLOTS: | |
void setUseTraditionalDesktopBehaviour(bool enable); | |
@@ -190,6 +193,7 @@ Q_SIGNALS: | |
private: | |
QQuickWebView* q_ptr; | |
QQuickWebViewPrivate* d_ptr; | |
+ QWebViewportAttributes* m_viewportAttributes; | |
Q_DECLARE_PRIVATE(QQuickWebView) | |
Q_DECLARE_PUBLIC(QQuickWebView) | |
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebviewportattributes.cpp b/Source/WebKit2/UIProcess/API/qt/qwebviewportattributes.cpp | |
new file mode 100644 | |
index 0000000..6f14715 | |
--- /dev/null | |
+++ b/Source/WebKit2/UIProcess/API/qt/qwebviewportattributes.cpp | |
@@ -0,0 +1,89 @@ | |
+/* | |
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) | |
+ * | |
+ * This library is free software; you can redistribute it and/or | |
+ * modify it under the terms of the GNU Library General Public | |
+ * License as published by the Free Software Foundation; either | |
+ * version 2 of the License, or (at your option) any later version. | |
+ * | |
+ * This program is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
+ * Library General Public License for more details. | |
+ * | |
+ * You should have received a copy of the GNU Library General Public License | |
+ * along with this program; see the file COPYING.LIB. If not, write to | |
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
+ * Boston, MA 02110-1301, USA. | |
+ * | |
+ */ | |
+ | |
+#include "config.h" | |
+#include "qwebviewportattributes_p.h" | |
+ | |
+#include <WebCore/ViewportArguments.h> | |
+ | |
+QWebViewportAttributes::QWebViewportAttributes(QObject* parent) | |
+ : QObject(parent) | |
+{ | |
+ | |
+} | |
+ | |
+QWebViewportAttributes::~QWebViewportAttributes() | |
+{ | |
+ | |
+} | |
+ | |
+qreal QWebViewportAttributes::initialScale() const | |
+{ | |
+ return m_initialScale; | |
+} | |
+ | |
+qreal QWebViewportAttributes::minimumScale() const | |
+{ | |
+ return m_minimumScale; | |
+} | |
+ | |
+qreal QWebViewportAttributes::maximumScale() const | |
+{ | |
+ return m_maximumScale; | |
+} | |
+ | |
+bool QWebViewportAttributes::isScalable() const | |
+{ | |
+ return m_isScalable; | |
+} | |
+ | |
+int QWebViewportAttributes::layoutWidth() const | |
+{ | |
+ return m_layoutSize.width(); | |
+} | |
+ | |
+int QWebViewportAttributes::layoutHeight() const | |
+{ | |
+ return m_layoutSize.height(); | |
+} | |
+ | |
+void QWebViewportAttributes::updateFromViewportAttributes(const WebCore::ViewportAttributes& attr) | |
+{ | |
+ if (m_initialScale != attr.initialScale) { | |
+ m_initialScale = attr.initialScale; | |
+ emit initialScaleUpdated(); | |
+ } | |
+ if (m_minimumScale != attr.minimumScale) { | |
+ m_minimumScale = attr.minimumScale; | |
+ emit minimumScaleUpdated(); | |
+ } | |
+ if (m_maximumScale != attr.maximumScale) { | |
+ m_maximumScale = attr.maximumScale; | |
+ emit maximumScaleUpdated(); | |
+ } | |
+ if (m_isScalable != !!attr.userScalable) { | |
+ m_isScalable = !!attr.userScalable; | |
+ emit isScalableUpdated(); | |
+ } | |
+ if (m_layoutSize != QSize(attr.layoutSize)) { | |
+ m_layoutSize = attr.layoutSize; | |
+ emit layoutSizeUpdated(); | |
+ } | |
+} | |
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebviewportattributes_p.h b/Source/WebKit2/UIProcess/API/qt/qwebviewportattributes_p.h | |
new file mode 100644 | |
index 0000000..86c5ad7 | |
--- /dev/null | |
+++ b/Source/WebKit2/UIProcess/API/qt/qwebviewportattributes_p.h | |
@@ -0,0 +1,70 @@ | |
+/* | |
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) | |
+ * | |
+ * This library is free software; you can redistribute it and/or | |
+ * modify it under the terms of the GNU Library General Public | |
+ * License as published by the Free Software Foundation; either | |
+ * version 2 of the License, or (at your option) any later version. | |
+ * | |
+ * This program is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
+ * Library General Public License for more details. | |
+ * | |
+ * You should have received a copy of the GNU Library General Public License | |
+ * along with this program; see the file COPYING.LIB. If not, write to | |
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
+ * Boston, MA 02110-1301, USA. | |
+ * | |
+ */ | |
+ | |
+#ifndef qwebviewportattributes_p_h | |
+#define qwebviewportattributes_p_h | |
+ | |
+#include "qwebkitglobal.h" | |
+#include <QtCore/QObject> | |
+#include <QtCore/QSize> | |
+#include <QtDeclarative/QtDeclarative> | |
+ | |
+namespace WebCore { | |
+class ViewportAttributes; | |
+} | |
+ | |
+class QWEBKIT_EXPORT QWebViewportAttributes : public QObject { | |
+ Q_OBJECT | |
+ Q_PROPERTY(qreal initialScale READ initialScale NOTIFY initialScaleUpdated) | |
+ Q_PROPERTY(qreal minimumScale READ minimumScale NOTIFY minimumScaleUpdated) | |
+ Q_PROPERTY(qreal maximumScale READ maximumScale NOTIFY maximumScaleUpdated) | |
+ Q_PROPERTY(bool isScalable READ isScalable NOTIFY isScalableUpdated) | |
+ Q_PROPERTY(int layoutWidth READ layoutWidth NOTIFY layoutSizeUpdated) | |
+ Q_PROPERTY(int layoutHeight READ layoutHeight NOTIFY layoutSizeUpdated) | |
+ | |
+signals: | |
+ void initialScaleUpdated(); | |
+ void maximumScaleUpdated(); | |
+ void minimumScaleUpdated(); | |
+ void isScalableUpdated(); | |
+ void layoutSizeUpdated(); | |
+ | |
+public: | |
+ QWebViewportAttributes(QObject* parent = 0); | |
+ virtual ~QWebViewportAttributes(); | |
+ | |
+ qreal initialScale() const; | |
+ qreal minimumScale() const; | |
+ qreal maximumScale() const; | |
+ bool isScalable() const; | |
+ | |
+ int layoutWidth() const; | |
+ int layoutHeight() const; | |
+ | |
+ void updateFromViewportAttributes(const WebCore::ViewportAttributes& attr); | |
+private: | |
+ qreal m_initialScale; | |
+ qreal m_minimumScale; | |
+ qreal m_maximumScale; | |
+ bool m_isScalable; | |
+ QSize m_layoutSize; | |
+}; | |
+ | |
+#endif // qwebviewportattributes_p_h | |
diff --git a/Source/qtwebkit-export.map b/Source/qtwebkit-export.map | |
index a426203..d3984ef 100644 | |
--- a/Source/qtwebkit-export.map | |
+++ b/Source/qtwebkit-export.map | |
@@ -124,6 +124,9 @@ qwk_1.0 { | |
*QWebDownloadItem; | |
non-virtual?thunk?to?QWebDownloadItem*; | |
QWebDownloadItem::*; | |
+ *QWebViewportAttributes; | |
+ non-virtual?thunk?to?QWebViewportAttributes; | |
+ QWebViewportAttributes::*; | |
*QQuickWebPage; | |
non-virtual?thunk?to?QQuickWebPage*; | |
QQuickWebPage::*; | |
diff --git a/Tools/ChangeLog b/Tools/ChangeLog | |
index 24b5e51..a87eee8 100644 | |
--- a/Tools/ChangeLog | |
+++ b/Tools/ChangeLog | |
@@ -1,3 +1,21 @@ | |
+2011-11-21 Michael Bruning <michael.bruning@nokia.com> | |
+ | |
+ [QT][WK2]Add (experimental) viewport attributes view to Minibrowser/qt. | |
+ https://bugs.webkit.org/show_bug.cgi?id=72893 | |
+ | |
+ Reviewed by Tor Arne Vestbo. | |
+ | |
+ This patch extends QQuickWebViewExperimental by a property named | |
+ viewportAttributes, which contains the viewport scalability and | |
+ layout size information. This property is exposed to QML through | |
+ the experimental extension for QQuickWebView. | |
+ | |
+ * MiniBrowser/qt/MiniBrowser.pro: | |
+ * MiniBrowser/qt/MiniBrowser.qrc: | |
+ * MiniBrowser/qt/icons/info.png: Added. | |
+ * MiniBrowser/qt/qml/BrowserWindow.qml: | |
+ * MiniBrowser/qt/qml/ViewportAttributesItem.qml: Added. | |
+ | |
2011-11-23 Ryan Sleevi <rsleevi@chromium.org> | |
Add new Chromium tests to the flakiness dashboard | |
diff --git a/Tools/MiniBrowser/qt/MiniBrowser.pro b/Tools/MiniBrowser/qt/MiniBrowser.pro | |
index 5c43198..a6478d4 100644 | |
--- a/Tools/MiniBrowser/qt/MiniBrowser.pro | |
+++ b/Tools/MiniBrowser/qt/MiniBrowser.pro | |
@@ -35,4 +35,5 @@ macx: QT += xml | |
RESOURCES += MiniBrowser.qrc | |
OTHER_FILES += \ | |
- qml/BrowserWindow.qml | |
+ qml/BrowserWindow.qml \ | |
+ qml/ViewportAttributesItem.qml | |
diff --git a/Tools/MiniBrowser/qt/MiniBrowser.qrc b/Tools/MiniBrowser/qt/MiniBrowser.qrc | |
index a57a954..b21984c 100644 | |
--- a/Tools/MiniBrowser/qt/MiniBrowser.qrc | |
+++ b/Tools/MiniBrowser/qt/MiniBrowser.qrc | |
@@ -1,10 +1,12 @@ | |
<RCC> | |
<qresource prefix="/"> | |
+ <file>icons/info.png</file> | |
<file>icons/next.png</file> | |
<file>icons/previous.png</file> | |
<file>icons/refresh.png</file> | |
<file>icons/stop.png</file> | |
<file>qml/BrowserWindow.qml</file> | |
+ <file>qml/ViewportAttributesItem.qml</file> | |
<file>useragentlist.txt</file> | |
</qresource> | |
</RCC> | |
diff --git a/Tools/MiniBrowser/qt/icons/info.png b/Tools/MiniBrowser/qt/icons/info.png | |
new file mode 100644 | |
index 0000000000000000000000000000000000000000..db483ff100f14e79c1c6185e19b31fe14faede9f | |
GIT binary patch | |
literal 340 | |
zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fjKx9jP7LeL$-D$|*pj^6T^Rm@ | |
z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg)ZZQFAvG3lCmI8&Yc)B=-Se$-) | |
zWv>^rqX_GR^QKD^Bo#wnO^7;n=$yL8R^MN$3j5B69W2_)D<)Q!B*s+9E&Y`<sAcO+ | |
zt(L!vQ5u#7JI|cAEVd|USFV#*FKt)UX38t<EVg;bcs_MrSm~X(!-r4L{c3WJH||x3 | |
zXY&VXwH*gI`U~sJ0z|48Nj{LBpE~awf8n0)!Z+Q^x;@#qJD=Hj>~6n{pmN1gw(F_$ | |
z>P!o(bb0S5cdRyB6uXFH<N8}}*Ta7BoU*z5uXiVZWMJ!>6}t+A-2a^Kw_7By{zXJ| | |
e+eW)r9`{Adv}NlJ(sY6TWAJqKb6Mw<&;$U%VSuIp | |
literal 0 | |
HcmV?d00001 | |
diff --git a/Tools/MiniBrowser/qt/qml/BrowserWindow.qml b/Tools/MiniBrowser/qt/qml/BrowserWindow.qml | |
index 5cc152a..7467c66 100644 | |
--- a/Tools/MiniBrowser/qt/qml/BrowserWindow.qml | |
+++ b/Tools/MiniBrowser/qt/qml/BrowserWindow.qml | |
@@ -28,11 +28,13 @@ | |
import QtQuick 2.0 | |
import QtWebKit 3.0 | |
+import QtWebKit.experimental 3.0 | |
Rectangle { | |
// Do not define anchors or an initial size here! This would mess up with QSGView::SizeRootObjectToView. | |
- property alias webview: webView | |
+ property alias webView: m_webView | |
+ property alias viewportAttributesItem: m_viewportAttributesItem | |
signal pageTitleChanged(string title) | |
@@ -134,6 +136,25 @@ Rectangle { | |
} | |
} | |
} | |
+ | |
+ Rectangle { | |
+ id: viewportAttributesInfoButton | |
+ height: navigationBar.height - 2 | |
+ width: height | |
+ color: "#efefef" | |
+ | |
+ Image { | |
+ anchors.centerIn: parent | |
+ source: "../icons/info.png" | |
+ } | |
+ | |
+ MouseArea { | |
+ anchors.fill: parent | |
+ onClicked: { | |
+ viewportAttributesItem.visible = !viewportAttributesItem.visible | |
+ } | |
+ } | |
+ } | |
} | |
Rectangle { | |
color: "white" | |
@@ -186,9 +207,24 @@ Rectangle { | |
} | |
} | |
} | |
- | |
+ ViewportAttributesItem { | |
+ id: m_viewportAttributesItem | |
+ anchors { | |
+ top: navigationBar.bottom | |
+ left: parent.left | |
+ right: parent.right | |
+ bottom: parent.bottom | |
+ } | |
+ visible: false | |
+ maximumScale: webView.experimental.viewportAttributes.maximumScale | |
+ minimumScale: webView.experimental.viewportAttributes.minimumScale | |
+ initialScale: webView.experimental.viewportAttributes.initialScale | |
+ isScalable: webView.experimental.viewportAttributes.isScalable | |
+ layoutWidth: webView.experimental.viewportAttributes.layoutWidth | |
+ layoutHeight: webView.experimental.viewportAttributes.layoutHeight | |
+ } | |
WebView { | |
- id: webView | |
+ id: m_webView | |
anchors { | |
top: navigationBar.bottom | |
left: parent.left | |
diff --git a/Tools/MiniBrowser/qt/qml/ViewportAttributesItem.qml b/Tools/MiniBrowser/qt/qml/ViewportAttributesItem.qml | |
new file mode 100644 | |
index 0000000..2f85d0a | |
--- /dev/null | |
+++ b/Tools/MiniBrowser/qt/qml/ViewportAttributesItem.qml | |
@@ -0,0 +1,32 @@ | |
+import QtQuick 2.0 | |
+import QtWebKit 3.0 | |
+ | |
+Rectangle { | |
+ color: "black" | |
+ opacity: 0.5 | |
+ | |
+ property real initialScale | |
+ property real maximumScale | |
+ property real minimumScale | |
+ property int layoutWidth | |
+ property int layoutHeight | |
+ property bool isScalable | |
+ | |
+ Text { | |
+ id: scaleInfoText | |
+ text: "Scale factors (initial, max, min) : (" + initialScale + ", " + maximumScale + ", " + minimumScale + ")" | |
+ color: "white" | |
+ } | |
+ Text { | |
+ id: layoutSizeInfoText | |
+ anchors.top: scaleInfoText.bottom | |
+ text: "Viewport layout size: (" + layoutWidth + "x" + layoutHeight + ")" | |
+ color: "white" | |
+ } | |
+ Text { | |
+ id: scalabilityInfoText | |
+ anchors.top: layoutSizeInfoText.bottom | |
+ text: "View " + (isScalable ? "is " : "is not " ) + "scalable." | |
+ color: "white" | |
+ } | |
+} | |
-- | |
1.7.4.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment