[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
kenneth at webkit.org
kenneth at webkit.org
Thu Feb 4 21:24:35 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit f3747ec45387a4ffab2821c0e34091dae87f3fab
Author: kenneth at webkit.org <kenneth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 22 09:17:41 2010 +0000
[Qt] Separate out the WebPage class into it's own
cpp/header files. Also, removed the assumption that
the view is a QWebView, in preparation of a merger
of the two Qt WebKit launchers.
Rubberstamped by Antti Koivisto.
* QtLauncher/QtLauncher.pro:
* QtLauncher/main.cpp:
(WebView::mousePressEvent):
* QtLauncher/webpage.cpp: Added.
(WebPage::supportsExtension):
(WebPage::extension):
(WebPage::acceptNavigationRequest):
(WebPage::openUrlInDefaultBrowser):
* QtLauncher/webpage.h: Added.
(WebPage::WebPage):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index d144e9d..3734211 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-01-22 Kenneth Rohde Christiansen <kenneth at webkit.org>
+
+ Rubberstamped by Antti Koivisto.
+
+ [Qt] Separate out the WebPage class into it's own
+ cpp/header files. Also, removed the assumption that
+ the view is a QWebView, in preparation of a merger
+ of the two Qt WebKit launchers.
+
+ * QtLauncher/QtLauncher.pro:
+ * QtLauncher/main.cpp:
+ (WebView::mousePressEvent):
+ * QtLauncher/webpage.cpp: Added.
+ (WebPage::supportsExtension):
+ (WebPage::extension):
+ (WebPage::acceptNavigationRequest):
+ (WebPage::openUrlInDefaultBrowser):
+ * QtLauncher/webpage.h: Added.
+ (WebPage::WebPage):
+
2010-01-21 Chris Jerdonek <cjerdonek at webkit.org>
Reviewed by Shinichiro Hamaji.
diff --git a/WebKitTools/QtLauncher/QtLauncher.pro b/WebKitTools/QtLauncher/QtLauncher.pro
index 05d6cbe..eaeef1f 100644
--- a/WebKitTools/QtLauncher/QtLauncher.pro
+++ b/WebKitTools/QtLauncher/QtLauncher.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
-SOURCES += main.cpp
+SOURCES += main.cpp webpage.cpp
CONFIG -= app_bundle
CONFIG += uitools
DESTDIR = ../../bin
diff --git a/WebKitTools/QtLauncher/main.cpp b/WebKitTools/QtLauncher/main.cpp
index 6c71f86..b020267 100644
--- a/WebKitTools/QtLauncher/main.cpp
+++ b/WebKitTools/QtLauncher/main.cpp
@@ -51,7 +51,7 @@
#include <qwebelement.h>
#include <qwebframe.h>
#include <qwebinspector.h>
-#include <qwebpage.h>
+#include "webpage.h"
#include <qwebsettings.h>
#include <qwebview.h>
@@ -93,56 +93,12 @@ protected:
virtual void mousePressEvent(QMouseEvent* event)
{
- mouseButtons = event->buttons();
- keyboardModifiers = event->modifiers();
+ setProperty("mouseButtons", QVariant::fromValue(int(event->buttons())));
+ setProperty("keyboardModifiers", QVariant::fromValue(int(event->modifiers())));
QWebView::mousePressEvent(event);
}
-public slots:
- void openUrlInDefaultBrowser(const QUrl &url = QUrl())
- {
- if (QAction* action = qobject_cast<QAction*>(sender()))
- QDesktopServices::openUrl(action->data().toUrl());
- else
- QDesktopServices::openUrl(url);
- }
-
-public:
- Qt::MouseButtons mouseButtons;
- Qt::KeyboardModifiers keyboardModifiers;
-};
-
-class WebPage : public QWebPage {
-public:
- WebPage(QWidget *parent) : QWebPage(parent) {}
-
- virtual QWebPage *createWindow(QWebPage::WebWindowType);
- virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&);
- virtual bool supportsExtension(QWebPage::Extension extension) const
- {
- if (extension == QWebPage::ErrorPageExtension)
- return true;
- return false;
- }
- virtual bool extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output);
-
-
- virtual bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type)
- {
- WebView* webView = static_cast<WebView*>(view());
- if (webView->keyboardModifiers & Qt::ShiftModifier) {
- QWebPage* page = createWindow(QWebPage::WebBrowserWindow);
- page->mainFrame()->load(request);
- return false;
- }
- if (webView->keyboardModifiers & Qt::AltModifier) {
- webView->openUrlInDefaultBrowser(request.url());
- return false;
- }
-
- return QWebPage::acceptNavigationRequest(frame, request, type);
- }
};
class WebInspector : public QWebInspector {
@@ -628,16 +584,6 @@ private:
#endif
};
-bool WebPage::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output)
-{
- const QWebPage::ErrorPageExtensionOption* info = static_cast<const QWebPage::ErrorPageExtensionOption*>(option);
- QWebPage::ErrorPageExtensionReturn* errorPage = static_cast<QWebPage::ErrorPageExtensionReturn*>(output);
-
- errorPage->content = QString("<html><head><title>Failed loading page</title></head><body>%1</body></html>")
- .arg(info->errorString).toUtf8();
-
- return true;
-}
QWebPage* WebPage::createWindow(QWebPage::WebWindowType)
{
diff --git a/WebKitTools/QtLauncher/webpage.cpp b/WebKitTools/QtLauncher/webpage.cpp
new file mode 100644
index 0000000..f1c7690
--- /dev/null
+++ b/WebKitTools/QtLauncher/webpage.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2009 Girish Ramakrishnan <girish at forwardbias.in>
+ * Copyright (C) 2006 George Staikos <staikos at kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller at kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack at kde.org>
+ * Copyright (C) 2006 Simon Hausmann <hausmann at kde.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "webpage.h"
+
+#include <QDesktopServices>
+#include <QtGui>
+#include <QtNetwork/QNetworkRequest>
+
+bool WebPage::supportsExtension(QWebPage::Extension extension) const
+{
+ if (extension == QWebPage::ErrorPageExtension)
+ return true;
+ return false;
+}
+
+bool WebPage::extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output)
+{
+ const QWebPage::ErrorPageExtensionOption* info = static_cast<const QWebPage::ErrorPageExtensionOption*>(option);
+ QWebPage::ErrorPageExtensionReturn* errorPage = static_cast<QWebPage::ErrorPageExtensionReturn*>(output);
+
+ errorPage->content = QString("<html><head><title>Failed loading page</title></head><body>%1</body></html>")
+ .arg(info->errorString).toUtf8();
+
+ return true;
+}
+
+bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type)
+{
+ QObject* view = parent();
+
+ QVariant value = view->property("keyboardModifiers");
+
+ if (!value.isNull()) {
+ Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers(value.toInt());
+
+ if (modifiers & Qt::ShiftModifier) {
+ QWebPage* page = createWindow(QWebPage::WebBrowserWindow);
+ page->mainFrame()->load(request);
+ return false;
+ }
+
+ if (modifiers & Qt::AltModifier) {
+ openUrlInDefaultBrowser(request.url());
+ return false;
+ }
+ }
+
+ return QWebPage::acceptNavigationRequest(frame, request, type);
+}
+
+void WebPage::openUrlInDefaultBrowser(const QUrl& url)
+{
+ if (QAction* action = qobject_cast<QAction*>(sender()))
+ QDesktopServices::openUrl(action->data().toUrl());
+ else
+ QDesktopServices::openUrl(url);
+}
diff --git a/WebKitTools/QtLauncher/webpage.h b/WebKitTools/QtLauncher/webpage.h
new file mode 100644
index 0000000..4302701
--- /dev/null
+++ b/WebKitTools/QtLauncher/webpage.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2009 Girish Ramakrishnan <girish at forwardbias.in>
+ * Copyright (C) 2006 George Staikos <staikos at kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller at kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack at kde.org>
+ * Copyright (C) 2006 Simon Hausmann <hausmann at kde.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef webpage_h
+#define webpage_h
+
+#include <qwebframe.h>
+#include <qwebpage.h>
+
+class WebPage : public QWebPage {
+public:
+ WebPage(QWidget* parent) : QWebPage(parent) {}
+
+ virtual QWebPage* createWindow(QWebPage::WebWindowType);
+ virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&);
+ virtual bool supportsExtension(QWebPage::Extension extension) const;
+ virtual bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output);
+
+ virtual bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type);
+
+public slots:
+ void openUrlInDefaultBrowser(const QUrl& url = QUrl());
+};
+
+#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list