[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:29:37 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 4b753b43ab35dbff15f6e12c301297ef9ccb9688
Author: kenneth at webkit.org <kenneth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 27 17:02:18 2010 +0000
Rubberstamped by Simon Hausmann.
[Qt] QtLauncher refactoring, separating the webview and
adding a QGraphicsWebView based version.
* QtLauncher/QtLauncher.pro:
* QtLauncher/main.cpp:
(MainWindow::MainWindow):
* QtLauncher/webpage.h:
* QtLauncher/webview.cpp: Added.
(createContextMenu):
(WebViewGraphicsBased::mousePressEvent):
(WebViewTraditional::mousePressEvent):
(WebViewGraphicsBased::contextMenuEvent):
(WebViewTraditional::contextMenuEvent):
* QtLauncher/webview.h: Added.
(WebViewGraphicsBased::WebViewGraphicsBased):
(WebViewTraditional::WebViewTraditional):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index fdcf03c..2656298 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,24 @@
+2010-01-27 Kenneth Rohde Christiansen <kenneth at webkit.org>
+
+ Rubberstamped by Simon Hausmann.
+
+ [Qt] QtLauncher refactoring, separating the webview and
+ adding a QGraphicsWebView based version.
+
+ * QtLauncher/QtLauncher.pro:
+ * QtLauncher/main.cpp:
+ (MainWindow::MainWindow):
+ * QtLauncher/webpage.h:
+ * QtLauncher/webview.cpp: Added.
+ (createContextMenu):
+ (WebViewGraphicsBased::mousePressEvent):
+ (WebViewTraditional::mousePressEvent):
+ (WebViewGraphicsBased::contextMenuEvent):
+ (WebViewTraditional::contextMenuEvent):
+ * QtLauncher/webview.h: Added.
+ (WebViewGraphicsBased::WebViewGraphicsBased):
+ (WebViewTraditional::WebViewTraditional):
+
2010-01-27 Alexander Pavlov <apavlov at chromium.org>
Adding myself as committer. No review necessary.
diff --git a/WebKitTools/QtLauncher/QtLauncher.pro b/WebKitTools/QtLauncher/QtLauncher.pro
index 150fd59..d0712b6 100644
--- a/WebKitTools/QtLauncher/QtLauncher.pro
+++ b/WebKitTools/QtLauncher/QtLauncher.pro
@@ -2,15 +2,17 @@ TEMPLATE = app
SOURCES += \
main.cpp \
- webpage.cpp \
urlloader.cpp \
utils.cpp \
+ webpage.cpp \
+ webview.cpp \
HEADERS += \
- webinspector.h \
- webpage.h \
urlloader.h \
utils.h \
+ webinspector.h \
+ webpage.h \
+ webview.h \
CONFIG -= app_bundle
CONFIG += uitools
diff --git a/WebKitTools/QtLauncher/main.cpp b/WebKitTools/QtLauncher/main.cpp
index 3cbca6f..ad059ed 100644
--- a/WebKitTools/QtLauncher/main.cpp
+++ b/WebKitTools/QtLauncher/main.cpp
@@ -48,48 +48,16 @@
#include <qwebframe.h>
#include <qwebinspector.h>
#include <qwebsettings.h>
-#include <qwebview.h>
#include "urlloader.h"
#include "utils.h"
#include "webinspector.h"
#include "webpage.h"
+#include "webview.h"
#ifndef NDEBUG
void QWEBKIT_EXPORT qt_drt_garbageCollector_collect();
#endif
-class WebView : public QWebView {
- Q_OBJECT
-public:
- WebView(QWidget* parent) : QWebView(parent) {}
-
-protected:
- virtual void contextMenuEvent(QContextMenuEvent* event)
- {
- QMenu* menu = page()->createStandardContextMenu();
-
- QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos());
-
- if (!r.linkUrl().isEmpty()) {
- QAction* newTabAction = menu->addAction(tr("Open in Default &Browser"), this, SLOT(openUrlInDefaultBrowser()));
- newTabAction->setData(r.linkUrl());
- menu->insertAction(menu->actions().at(2), newTabAction);
- }
-
- menu->exec(mapToGlobal(event->pos()));
- delete menu;
- }
-
- virtual void mousePressEvent(QMouseEvent* event)
- {
- setProperty("mouseButtons", QVariant::fromValue(int(event->buttons())));
- setProperty("keyboardModifiers", QVariant::fromValue(int(event->modifiers())));
-
- QWebView::mousePressEvent(event);
- }
-
-};
-
class MainWindow : public QMainWindow {
Q_OBJECT
@@ -105,7 +73,7 @@ public:
QSplitter* splitter = new QSplitter(Qt::Vertical, this);
setCentralWidget(splitter);
- view = new WebView(splitter);
+ view = new WebViewTraditional(splitter);
WebPage* page = new WebPage(view);
view->setPage(page);
diff --git a/WebKitTools/QtLauncher/webpage.h b/WebKitTools/QtLauncher/webpage.h
index 8c1d07d..14a0571 100644
--- a/WebKitTools/QtLauncher/webpage.h
+++ b/WebKitTools/QtLauncher/webpage.h
@@ -37,6 +37,8 @@
#include <qwebpage.h>
class WebPage : public QWebPage {
+ Q_OBJECT
+
public:
WebPage(QObject* parent = 0);
diff --git a/WebKitTools/QtLauncher/webview.cpp b/WebKitTools/QtLauncher/webview.cpp
new file mode 100644
index 0000000..d08da4c
--- /dev/null
+++ b/WebKitTools/QtLauncher/webview.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+#include "webview.h"
+
+#include <QtGui>
+
+static QMenu* createContextMenu(QWebPage* page, QPoint position)
+{
+ QMenu* menu = page->createStandardContextMenu();
+
+ QWebHitTestResult r = page->mainFrame()->hitTestContent(position);
+
+ if (!r.linkUrl().isEmpty()) {
+ WebPage* webPage = qobject_cast<WebPage*>(page);
+ QAction* newTabAction = menu->addAction("Open in Default &Browser", webPage, SLOT(openUrlInDefaultBrowser()));
+ newTabAction->setData(r.linkUrl());
+ menu->insertAction(menu->actions().at(2), newTabAction);
+ }
+ return menu;
+}
+
+void WebViewGraphicsBased::mousePressEvent(QGraphicsSceneMouseEvent* event)
+{
+ setProperty("mouseButtons", QVariant::fromValue(int(event->buttons())));
+ setProperty("keyboardModifiers", QVariant::fromValue(int(event->modifiers())));
+
+ QGraphicsWebView::mousePressEvent(event);
+}
+
+void WebViewTraditional::mousePressEvent(QMouseEvent* event)
+{
+ setProperty("mouseButtons", QVariant::fromValue(int(event->buttons())));
+ setProperty("keyboardModifiers", QVariant::fromValue(int(event->modifiers())));
+
+ QWebView::mousePressEvent(event);
+}
+
+void WebViewGraphicsBased::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
+{
+ QMenu* menu = createContextMenu(page(), event->pos().toPoint());
+ menu->exec(mapToScene(event->pos()).toPoint());
+ delete menu;
+}
+
+void WebViewTraditional::contextMenuEvent(QContextMenuEvent* event)
+{
+ QMenu* menu = createContextMenu(page(), event->pos());
+ menu->exec(mapToGlobal(event->pos()));
+ delete menu;
+}
+
diff --git a/WebKitTools/QtLauncher/webview.h b/WebKitTools/QtLauncher/webview.h
new file mode 100644
index 0000000..68f220e
--- /dev/null
+++ b/WebKitTools/QtLauncher/webview.h
@@ -0,0 +1,62 @@
+/*
+ * 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 webview_h
+#define webview_h
+
+#include "webpage.h"
+#include <qwebview.h>
+#include <qgraphicswebview.h>
+
+class WebViewGraphicsBased : public QGraphicsWebView {
+ Q_OBJECT
+
+public:
+ WebViewGraphicsBased(QGraphicsItem* parent = 0) : QGraphicsWebView(parent) {};
+
+protected:
+ virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*);
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
+};
+
+class WebViewTraditional : public QWebView {
+ Q_OBJECT
+
+public:
+ WebViewTraditional(QWidget* parent) : QWebView(parent) {}
+
+protected:
+ virtual void contextMenuEvent(QContextMenuEvent*);
+ virtual void mousePressEvent(QMouseEvent*);
+};
+
+#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list