Diff
Modified: trunk/Source/WebKit2/ChangeLog (100743 => 100744)
--- trunk/Source/WebKit2/ChangeLog 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/ChangeLog 2011-11-18 11:34:51 UTC (rev 100744)
@@ -1,3 +1,51 @@
+2011-11-18 Simon Hausmann <[email protected]>
+
+ [Qt] Removal of QtViewInterface part 3
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Move the remaining forwarded calls from ClientImpl that went through
+ ViewInterface and then PageProxy or WebView to go straight to
+ QtWebPageProxy. QtViewInterface is empty now and therefore removed.
+
+ * Target.pri:
+ * UIProcess/API/qt/qquickwebpage_p.h:
+ * UIProcess/API/qt/qquickwebpage_p_p.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewPrivate::initialize):
+ (QQuickWebViewPrivate::chooseFiles):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qquickwebview_p_p.h:
+ * UIProcess/qt/ClientImpl.cpp:
+ (qt_wk_runJavaScriptAlert):
+ (qt_wk_runJavaScriptConfirm):
+ (qt_wk_runJavaScriptPrompt):
+ (qt_wk_setStatusText):
+ (qt_wk_runOpenPanel):
+ (qt_wk_mouseDidMoveOverElement):
+ (setupPageUiClient):
+ * UIProcess/qt/QtViewInterface.cpp: Removed.
+ * UIProcess/qt/QtViewInterface.h: Removed.
+ * UIProcess/qt/QtWebPageProxy.cpp:
+ (QtWebPageProxy::QtWebPageProxy):
+ (QtWebPageProxy::didChangeStatusText):
+ (QtWebPageProxy::didMouseMoveOverElement):
+ (QtWebPageProxy::showContextMenu):
+ (QtWebPageProxy::hideContextMenu):
+ (QtWebPageProxy::runJavaScriptAlert):
+ (QtWebPageProxy::runJavaScriptConfirm):
+ (QtWebPageProxy::runJavaScriptPrompt):
+ (QtWebPageProxy::chooseFiles):
+ (QtWebPageProxy::createContextMenuProxy):
+ (QtWebPageProxy::didChangeLoadProgress):
+ * UIProcess/qt/QtWebPageProxy.h:
+ (QtWebPageProxy::contextMenuItemSelected):
+ * UIProcess/qt/WebContextMenuProxyQt.cpp:
+ (WebKit::WebContextMenuProxyQt::WebContextMenuProxyQt):
+ (WebKit::WebContextMenuProxyQt::create):
+ (WebKit::WebContextMenuProxyQt::hideContextMenu):
+ * UIProcess/qt/WebContextMenuProxyQt.h:
+
2011-11-18 Zalan Bujtas <[email protected]>
[Qt][WK2] UI process segfaults, when visiblity properties are set while the WebProcess is dead.
Modified: trunk/Source/WebKit2/Target.pri (100743 => 100744)
--- trunk/Source/WebKit2/Target.pri 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/Target.pri 2011-11-18 11:34:51 UTC (rev 100744)
@@ -324,7 +324,6 @@
UIProcess/qt/qwkhistory_p.h \
UIProcess/qt/QtSGUpdateQueue.h \
UIProcess/qt/QtSGTileNode.h \
- UIProcess/qt/QtViewInterface.h \
UIProcess/qt/QtViewportInteractionEngine.h \
UIProcess/qt/QtWebUndoCommand.h \
UIProcess/qt/WebContextMenuProxyQt.h \
@@ -618,7 +617,6 @@
UIProcess/WebUIClient.cpp \
UIProcess/qt/ClientImpl.cpp \
UIProcess/qt/LayerTreeHostProxyQt.cpp \
- UIProcess/qt/QtViewInterface.cpp \
UIProcess/qt/QtGestureRecognizer.cpp \
UIProcess/qt/QtPanGestureRecognizer.cpp \
UIProcess/qt/QtPinchGestureRecognizer.cpp \
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h 2011-11-18 11:34:51 UTC (rev 100744)
@@ -31,7 +31,6 @@
class QWebPreferences;
namespace WebKit {
-class QtViewInterface;
class QtSGUpdateQueue;
}
class QtWebPageProxy;
@@ -74,7 +73,6 @@
QQuickWebPagePrivate* d;
friend class QQuickWebViewPrivate;
- friend class WebKit::QtViewInterface;
friend class QtWebPageProxy;
};
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h 2011-11-18 11:34:51 UTC (rev 100744)
@@ -22,7 +22,6 @@
#define qquickwebpage_p_p_h
#include "QtSGUpdateQueue.h"
-#include "QtViewInterface.h"
#include "QtWebPageProxy.h"
#include "qquickwebpage_p.h"
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2011-11-18 11:34:51 UTC (rev 100744)
@@ -21,7 +21,6 @@
#include "config.h"
#include "qquickwebview_p.h"
-#include "QtViewInterface.h"
#include "QtWebPageProxy.h"
#include "UtilsQt.h"
#include "WebPageGroup.h"
@@ -70,10 +69,9 @@
QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
pageView.reset(new QQuickWebPage(viewport));
- viewInterface.reset(new WebKit::QtViewInterface(viewport));
QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
- setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, viewInterface.data(), 0, this, contextRef, pageGroupRef));
+ setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, 0, this, contextRef, pageGroupRef));
pageViewPrivate->setPageProxy(pageProxy.data());
QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true);
@@ -264,7 +262,7 @@
#endif
}
-void QQuickWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, QtViewInterface::FileChooserType type)
+void QQuickWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, QtWebPageProxy::FileChooserType type)
{
#ifndef QT_NO_FILEDIALOG
Q_Q(QQuickWebView);
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2011-11-18 11:34:51 UTC (rev 100744)
@@ -30,10 +30,6 @@
class QWebDownloadItem;
class QWebPreferences;
-namespace WebKit {
-class QtViewInterface;
-}
-
namespace WTR {
class PlatformWebView;
}
@@ -133,7 +129,6 @@
QQuickWebViewExperimental* m_experimental;
friend class QtWebPageProxy;
- friend class WebKit::QtViewInterface;
friend class WTR::PlatformWebView;
friend class QQuickWebViewExperimental;
};
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2011-11-18 11:34:51 UTC (rev 100744)
@@ -22,7 +22,6 @@
#define qquickwebview_p_p_h
#include "QtPolicyInterface.h"
-#include "QtViewInterface.h"
#include "QtViewportInteractionEngine.h"
#include "QtWebPageProxy.h"
@@ -71,7 +70,7 @@
// QtPolicyInterface.
virtual QtPolicyInterface::PolicyAction navigationPolicyForURL(const QUrl&, Qt::MouseButton, Qt::KeyboardModifiers);
- void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, WebKit::QtViewInterface::FileChooserType);
+ void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, QtWebPageProxy::FileChooserType);
void runJavaScriptAlert(const QString&);
bool runJavaScriptConfirm(const QString&);
QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
@@ -108,7 +107,6 @@
bool isTransitioningToNewPage() const { return transitioningToNewPage; }
QScopedPointer<QQuickWebPage> pageView;
- QScopedPointer<WebKit::QtViewInterface> viewInterface;
QScopedPointer<QtViewportInteractionEngine> interactionEngine;
QQuickWebView* q_ptr;
Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-11-18 11:34:51 UTC (rev 100744)
@@ -26,7 +26,6 @@
#include "WKStringQt.h"
#include "WKURLQt.h"
#include <QtPolicyInterface.h>
-#include <QtViewInterface.h>
#include <QtWebPageProxy.h>
#include <WKArray.h>
#include <WKFrame.h>
@@ -48,12 +47,6 @@
return 0;
}
-static inline QtViewInterface* toQtViewInterface(const void* clientInfo)
-{
- ASSERT(clientInfo);
- return reinterpret_cast<QtViewInterface*>(const_cast<void*>(clientInfo));
-}
-
static inline QtPolicyInterface* toQtPolicyInterface(const void* clientInfo)
{
ASSERT(clientInfo);
@@ -162,13 +155,13 @@
static void qt_wk_runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
{
QString qAlertText = WKStringCopyQString(alertText);
- toQtViewInterface(clientInfo)->runJavaScriptAlert(qAlertText);
+ toQtWebPageProxy(clientInfo)->runJavaScriptAlert(qAlertText);
}
static bool qt_wk_runJavaScriptConfirm(WKPageRef, WKStringRef message, WKFrameRef, const void* clientInfo)
{
QString qMessage = WKStringCopyQString(message);
- return toQtViewInterface(clientInfo)->runJavaScriptConfirm(qMessage);
+ return toQtWebPageProxy(clientInfo)->runJavaScriptConfirm(qMessage);
}
static inline WKStringRef createNullWKString()
@@ -182,7 +175,7 @@
QString qMessage = WKStringCopyQString(message);
QString qDefaultValue = WKStringCopyQString(defaultValue);
bool ok = false;
- QString result = toQtViewInterface(clientInfo)->runJavaScriptPrompt(qMessage, qDefaultValue, ok);
+ QString result = toQtWebPageProxy(clientInfo)->runJavaScriptPrompt(qMessage, qDefaultValue, ok);
if (!ok)
return createNullWKString();
return WKStringCreateWithQString(result);
@@ -191,7 +184,7 @@
static void qt_wk_setStatusText(WKPageRef, WKStringRef text, const void *clientInfo)
{
QString qText = WKStringCopyQString(text);
- toQtViewInterface(clientInfo)->didChangeStatusText(qText);
+ toQtWebPageProxy(clientInfo)->didChangeStatusText(qText);
}
static void qt_wk_runOpenPanel(WKPageRef, WKFrameRef, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void* clientInfo)
@@ -203,15 +196,15 @@
for (unsigned i = 0; wkSelectedFileNames.size(); ++i)
selectedFileNames += wkSelectedFileNames.at(i);
- QtViewInterface::FileChooserType allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? QtViewInterface::MultipleFilesSelection : QtViewInterface::SingleFileSelection;
- toQtViewInterface(clientInfo)->chooseFiles(listener, selectedFileNames, allowMultipleFiles);
+ QtWebPageProxy::FileChooserType allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? QtWebPageProxy::MultipleFilesSelection : QtWebPageProxy::SingleFileSelection;
+ toQtWebPageProxy(clientInfo)->chooseFiles(listener, selectedFileNames, allowMultipleFiles);
}
static void qt_wk_mouseDidMoveOverElement(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void* clientInfo)
{
const QUrl absoluteLinkUrl = WKURLCopyQUrl(WKHitTestResultCopyAbsoluteLinkURL(hitTestResult));
const QString linkTitle = WKStringCopyQString(WKHitTestResultCopyLinkTitle(hitTestResult));
- toQtViewInterface(clientInfo)->didMouseMoveOverElement(absoluteLinkUrl, linkTitle);
+ toQtWebPageProxy(clientInfo)->didMouseMoveOverElement(absoluteLinkUrl, linkTitle);
}
static Qt::MouseButton toQtMouseButton(WKEventMouseButton button)
@@ -333,7 +326,7 @@
WKPageUIClient uiClient;
memset(&uiClient, 0, sizeof(WKPageUIClient));
uiClient.version = kWKPageUIClientCurrentVersion;
- uiClient.clientInfo = qtWebPageProxy->viewInterface();
+ uiClient.clientInfo = qtWebPageProxy;
uiClient.runJavaScriptAlert = qt_wk_runJavaScriptAlert;
uiClient.runJavaScriptConfirm = qt_wk_runJavaScriptConfirm;
uiClient.runJavaScriptPrompt = qt_wk_runJavaScriptPrompt;
Deleted: trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.cpp (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.cpp 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.cpp 2011-11-18 11:34:51 UTC (rev 100744)
@@ -1,115 +0,0 @@
-/*
- * 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 "QtViewInterface.h"
-
-#include "QtWebError.h"
-#include "qquickwebpage_p.h"
-#include "qquickwebpage_p_p.h"
-#include "qquickwebview_p.h"
-#include "qquickwebview_p_p.h"
-
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QQuickView>
-#include <QtGui/QDrag>
-#include <QtGui/QGuiApplication>
-
-namespace WebKit {
-
-QtViewInterface::QtViewInterface(QQuickWebView* viewportView)
- : m_viewportView(viewportView)
-{
- Q_ASSERT(m_viewportView);
-}
-
-void QtViewInterface::didChangeStatusText(const QString& newMessage)
-{
- emit m_viewportView->statusBarMessageChanged(newMessage);
-}
-
-void QtViewInterface::didChangeLoadProgress(int percentageLoaded)
-{
- emit m_viewportView->loadProgressChanged(percentageLoaded);
-}
-
-void QtViewInterface::didMouseMoveOverElement(const QUrl& linkURL, const QString& linkTitle)
-{
- if (linkURL == lastHoveredURL && linkTitle == lastHoveredTitle)
- return;
- lastHoveredURL = linkURL;
- lastHoveredTitle = linkTitle;
- emit m_viewportView->linkHovered(lastHoveredURL, lastHoveredTitle);
-}
-
-void QtViewInterface::showContextMenu(QSharedPointer<QMenu> menu)
-{
- // Remove the active menu in case this function is called twice.
- if (activeMenu)
- activeMenu->hide();
-
- if (menu->isEmpty())
- return;
-
- QWindow* window = m_viewportView->canvas();
- if (!window)
- return;
-
- activeMenu = menu;
-
- activeMenu->window()->winId(); // Ensure that the menu has a window
- Q_ASSERT(activeMenu->window()->windowHandle());
- activeMenu->window()->windowHandle()->setTransientParent(window);
-
- QPoint menuPositionInScene = m_viewportView->mapToScene(menu->pos()).toPoint();
- menu->exec(window->mapToGlobal(menuPositionInScene));
- // The last function to get out of exec() clear the local copy.
- if (activeMenu == menu)
- activeMenu.clear();
-}
-
-void QtViewInterface::hideContextMenu()
-{
- if (activeMenu)
- activeMenu->hide();
-}
-
-void QtViewInterface::runJavaScriptAlert(const QString& alertText)
-{
- m_viewportView->d_func()->runJavaScriptAlert(alertText);
-}
-
-bool QtViewInterface::runJavaScriptConfirm(const QString& message)
-{
- return m_viewportView->d_func()->runJavaScriptConfirm(message);
-}
-
-QString QtViewInterface::runJavaScriptPrompt(const QString& message, const QString& defaultValue, bool& ok)
-{
- return m_viewportView->d_func()->runJavaScriptPrompt(message, defaultValue, ok);
-}
-
-void QtViewInterface::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, QtViewInterface::FileChooserType type)
-{
- m_viewportView->d_func()->chooseFiles(listenerRef, selectedFileNames, type);
-}
-
-}
-
Deleted: trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.h (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.h 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewInterface.h 2011-11-18 11:34:51 UTC (rev 100744)
@@ -1,87 +0,0 @@
-/*
- * 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 QtViewInterface_h
-#define QtViewInterface_h
-
-#include <QMenu>
-#include <QtCore/QSharedPointer>
-#include <QtCore/QSize>
-#include <QtCore/QUrl>
-#include <WebKit2/WKBase.h>
-
-class QQuickWebPage;
-class QQuickWebView;
-class QtWebError;
-class QWebDownloadItem;
-
-QT_BEGIN_NAMESPACE
-class QCursor;
-class QGraphicsWidget;
-class QImage;
-class QJSEngine;
-class QMimeData;
-class QPoint;
-class QRect;
-class QWidget;
-QT_END_NAMESPACE
-
-namespace WebCore {
-class ViewportArguments;
-}
-
-namespace WebKit {
-
-class QtSGUpdateQueue;
-
-class QtViewInterface {
-public:
- enum FileChooserType {
- SingleFileSelection,
- MultipleFilesSelection
- };
-
- QtViewInterface(QQuickWebView* viewportView);
-
- virtual void didChangeStatusText(const QString&);
- virtual void didChangeLoadProgress(int);
-
- virtual void showContextMenu(QSharedPointer<QMenu>);
- virtual void hideContextMenu();
-
- virtual void runJavaScriptAlert(const QString&);
- virtual bool runJavaScriptConfirm(const QString&);
- virtual QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
-
- virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, FileChooserType);
-
- virtual void didMouseMoveOverElement(const QUrl&, const QString&);
-
-private:
- QQuickWebView* const m_viewportView;
-
- QSharedPointer<QMenu> activeMenu;
- QUrl lastHoveredURL;
- QString lastHoveredTitle;
-};
-
-}
-
-#endif // QtViewInterface_h
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-11-18 11:34:51 UTC (rev 100744)
@@ -45,7 +45,6 @@
#include "NativeWebWheelEvent.h"
#include "NotImplemented.h"
#include "QtPolicyInterface.h"
-#include "QtViewInterface.h"
#include "QtViewportInteractionEngine.h"
#include "QtWebUndoCommand.h"
#include "WebBackForwardList.h"
@@ -134,10 +133,9 @@
return (DragOperation)result;
}
-QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView, QtViewInterface* viewInterface, QtViewportInteractionEngine* viewportInteractionEngine, QtPolicyInterface* policyInterface, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+QtWebPageProxy::QtWebPageProxy(QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView, QtViewportInteractionEngine* viewportInteractionEngine, QtPolicyInterface* policyInterface, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
: m_qmlWebPage(qmlWebPage)
, m_qmlWebView(qmlWebView)
- , m_viewInterface(viewInterface)
, m_interactionEngine(viewportInteractionEngine)
, m_panGestureRecognizer(viewportInteractionEngine)
, m_pinchGestureRecognizer(viewportInteractionEngine)
@@ -355,6 +353,72 @@
m_webPageProxy->findZoomableAreaForPoint(point.pos().toPoint());
}
+void QtWebPageProxy::didChangeStatusText(const QString& newMessage)
+{
+ emit m_qmlWebView->statusBarMessageChanged(newMessage);
+}
+
+void QtWebPageProxy::didMouseMoveOverElement(const QUrl& linkURL, const QString& linkTitle)
+{
+ if (linkURL == lastHoveredURL && linkTitle == lastHoveredTitle)
+ return;
+ lastHoveredURL = linkURL;
+ lastHoveredTitle = linkTitle;
+ emit m_qmlWebView->linkHovered(lastHoveredURL, lastHoveredTitle);
+}
+
+void QtWebPageProxy::showContextMenu(QSharedPointer<QMenu> menu)
+{
+ // Remove the active menu in case this function is called twice.
+ if (activeMenu)
+ activeMenu->hide();
+
+ if (menu->isEmpty())
+ return;
+
+ QWindow* window = m_qmlWebView->canvas();
+ if (!window)
+ return;
+
+ activeMenu = menu;
+
+ activeMenu->window()->winId(); // Ensure that the menu has a window
+ Q_ASSERT(activeMenu->window()->windowHandle());
+ activeMenu->window()->windowHandle()->setTransientParent(window);
+
+ QPoint menuPositionInScene = m_qmlWebView->mapToScene(menu->pos()).toPoint();
+ menu->exec(window->mapToGlobal(menuPositionInScene));
+ // The last function to get out of exec() clear the local copy.
+ if (activeMenu == menu)
+ activeMenu.clear();
+}
+
+void QtWebPageProxy::hideContextMenu()
+{
+ if (activeMenu)
+ activeMenu->hide();
+}
+
+void QtWebPageProxy::runJavaScriptAlert(const QString& alertText)
+{
+ m_qmlWebView->d_func()->runJavaScriptAlert(alertText);
+}
+
+bool QtWebPageProxy::runJavaScriptConfirm(const QString& message)
+{
+ return m_qmlWebView->d_func()->runJavaScriptConfirm(message);
+}
+
+QString QtWebPageProxy::runJavaScriptPrompt(const QString& message, const QString& defaultValue, bool& ok)
+{
+ return m_qmlWebView->d_func()->runJavaScriptPrompt(message, defaultValue, ok);
+}
+
+void QtWebPageProxy::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, FileChooserType type)
+{
+ m_qmlWebView->d_func()->chooseFiles(listenerRef, selectedFileNames, type);
+}
+
void QtWebPageProxy::timerEvent(QTimerEvent* ev)
{
int timerId = ev->timerId();
@@ -541,7 +605,7 @@
PassRefPtr<WebContextMenuProxy> QtWebPageProxy::createContextMenuProxy(WebPageProxy*)
{
- return WebContextMenuProxyQt::create(m_webPageProxy.get(), m_viewInterface);
+ return WebContextMenuProxyQt::create(this);
}
void QtWebPageProxy::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate)
@@ -611,10 +675,10 @@
emit m_qmlWebView->loadFailed(static_cast<QQuickWebView::ErrorType>(error.type()), error.errorCode(), error.url());
}
-void QtWebPageProxy::didChangeLoadProgress(int newLoadProgress)
+void QtWebPageProxy::didChangeLoadProgress(int percentageLoaded)
{
- m_loadProgress = newLoadProgress;
- m_viewInterface->didChangeLoadProgress(newLoadProgress);
+ m_loadProgress = percentageLoaded;
+ emit m_qmlWebView->loadProgressChanged(percentageLoaded);
}
bool QtWebPageProxy::canGoBack() const
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h 2011-11-18 11:34:51 UTC (rev 100744)
@@ -29,7 +29,6 @@
#include "QtPinchGestureRecognizer.h"
#include "QtPolicyInterface.h"
#include "QtTapGestureRecognizer.h"
-#include "QtViewInterface.h"
#include "ShareableBitmap.h"
#include "ViewportArguments.h"
#include "WebContext.h"
@@ -75,7 +74,12 @@
WebActionCount
};
- QtWebPageProxy(QQuickWebPage*, QQuickWebView*, WebKit::QtViewInterface*, WebKit::QtViewportInteractionEngine* = 0, WebKit::QtPolicyInterface* = 0, WKContextRef = 0, WKPageGroupRef = 0);
+ enum FileChooserType {
+ SingleFileSelection,
+ MultipleFilesSelection
+ };
+
+ QtWebPageProxy(QQuickWebPage*, QQuickWebView*, WebKit::QtViewportInteractionEngine* = 0, WebKit::QtPolicyInterface* = 0, WKContextRef = 0, WKPageGroupRef = 0);
~QtWebPageProxy();
virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
@@ -193,15 +197,31 @@
void renderToCurrentGLContext(const WebCore::TransformationMatrix&, float);
QWKHistory* history() const;
- QtViewInterface* viewInterface() const { return m_viewInterface; }
- QQuickWebPage* qmlWebPage() const { return m_qmlWebPage; }
+ void contextMenuItemSelected(const WebContextMenuItemData& data)
+ {
+ m_webPageProxy->contextMenuItemSelected(data);
+ }
+
void handleDownloadRequest(DownloadProxy*);
void init();
void handleSingleTapEvent(const QTouchEvent::TouchPoint&);
void handleDoubleTapEvent(const QTouchEvent::TouchPoint&);
+ void didChangeStatusText(const QString&);
+
+ void showContextMenu(QSharedPointer<QMenu>);
+ void hideContextMenu();
+
+ void runJavaScriptAlert(const QString&);
+ bool runJavaScriptConfirm(const QString&);
+ QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
+
+ void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, FileChooserType);
+
+ void didMouseMoveOverElement(const QUrl&, const QString&);
+
public Q_SLOTS:
void navigationStateChanged();
void didReceiveDownloadResponse(QWebDownloadItem* downloadItem);
@@ -215,7 +235,6 @@
QQuickWebPage* m_qmlWebPage;
QQuickWebView* m_qmlWebView;
RefPtr<WebKit::WebPageProxy> m_webPageProxy;
- WebKit::QtViewInterface* const m_viewInterface;
QtViewportInteractionEngine* m_interactionEngine;
QtPanGestureRecognizer m_panGestureRecognizer;
QtPinchGestureRecognizer m_pinchGestureRecognizer;
@@ -263,6 +282,10 @@
bool m_navigatorQtObjectEnabled;
QPoint m_tripleClick;
QBasicTimer m_tripleClickTimer;
+
+ QSharedPointer<QMenu> activeMenu;
+ QUrl lastHoveredURL;
+ QString lastHoveredTitle;
};
#endif /* QtWebPageProxy_h */
Modified: trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp 2011-11-18 11:34:51 UTC (rev 100744)
@@ -39,15 +39,14 @@
namespace WebKit {
-WebContextMenuProxyQt::WebContextMenuProxyQt(WebPageProxy* pageProxy, QtViewInterface* viewInterface)
+WebContextMenuProxyQt::WebContextMenuProxyQt(QtWebPageProxy* pageProxy)
: m_webPageProxy(pageProxy)
- , m_viewInterface(viewInterface)
{
}
-PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(WebPageProxy* pageProxy, QtViewInterface* viewInterface)
+PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(QtWebPageProxy *pageProxy)
{
- return adoptRef(new WebContextMenuProxyQt(pageProxy, viewInterface));
+ return adoptRef(new WebContextMenuProxyQt(pageProxy));
}
void WebContextMenuProxyQt::actionTriggered(bool)
@@ -74,7 +73,7 @@
void WebContextMenuProxyQt::hideContextMenu()
{
- m_viewInterface->hideContextMenu();
+ m_webPageProxy->hideContextMenu();
}
PassOwnPtr<QMenu> WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items) const
Modified: trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h (100743 => 100744)
--- trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h 2011-11-18 11:33:07 UTC (rev 100743)
+++ trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h 2011-11-18 11:34:51 UTC (rev 100744)
@@ -35,31 +35,29 @@
class QtWebPageProxy;
namespace WebKit {
-class QtViewInterface;
class WebContextMenuItemData;
-class WebPageProxy;
}
+class QtWebPageProxy;
namespace WebKit {
class WebContextMenuProxyQt : public QObject, public WebContextMenuProxy {
Q_OBJECT
public:
- static PassRefPtr<WebContextMenuProxyQt> create(WebPageProxy*, QtViewInterface*);
+ static PassRefPtr<WebContextMenuProxyQt> create(QtWebPageProxy*);
private Q_SLOTS:
void actionTriggered(bool);
private:
- WebContextMenuProxyQt(WebPageProxy*, QtViewInterface*);
+ WebContextMenuProxyQt(QtWebPageProxy*);
virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&);
virtual void hideContextMenu();
PassOwnPtr<QMenu> createContextMenu(const Vector<WebContextMenuItemData>& items) const;
- WebPageProxy* const m_webPageProxy;
- QtViewInterface* const m_viewInterface;
+ QtWebPageProxy* const m_webPageProxy;
};
} // namespace WebKit