https://bugs.webkit.org/show_bug.cgi?id=78867
Patch by Michael Tyutyunik <michael.tyutyunik@nokia.com> on 2012-02-22
Reviewed by Simon Hausmann.
In QtWebPagePolicyClient::decidePolicyForNavigationAction()
navigationType argument is dropped by mistake. Adding it back
and make it available through NavigationRequest.
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qwebnavigationrequest.cpp:
(QWebNavigationRequestPrivate::QWebNavigationRequestPrivate):
(QWebNavigationRequestPrivate):
(QWebNavigationRequest::QWebNavigationRequest):
(QWebNavigationRequest::navigationType):
* UIProcess/API/qt/qwebnavigationrequest_p.h:
* UIProcess/qt/QtWebPagePolicyClient.cpp:
(QtWebPagePolicyClient::decidePolicyForNavigationAction):
(toQuickWebViewNavigationType):
* UIProcess/qt/QtWebPagePolicyClient.h:
(QtWebPagePolicyClient):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108614
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-22 Michael Tyutyunik <michael.tyutyunik@nokia.com>
+
+ [Qt][WK2] navigationType is missing in new API
+ https://bugs.webkit.org/show_bug.cgi?id=78867
+
+ Reviewed by Simon Hausmann.
+
+ In QtWebPagePolicyClient::decidePolicyForNavigationAction()
+ navigationType argument is dropped by mistake. Adding it back
+ and make it available through NavigationRequest.
+
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/API/qt/qwebnavigationrequest.cpp:
+ (QWebNavigationRequestPrivate::QWebNavigationRequestPrivate):
+ (QWebNavigationRequestPrivate):
+ (QWebNavigationRequest::QWebNavigationRequest):
+ (QWebNavigationRequest::navigationType):
+ * UIProcess/API/qt/qwebnavigationrequest_p.h:
+ * UIProcess/qt/QtWebPagePolicyClient.cpp:
+ (QtWebPagePolicyClient::decidePolicyForNavigationAction):
+ (toQuickWebViewNavigationType):
+ * UIProcess/qt/QtWebPagePolicyClient.h:
+ (QtWebPagePolicyClient):
+
2012-02-22 Anders Carlsson <andersca@apple.com>
Implement TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange
Q_PROPERTY(bool canReload READ canReload NOTIFY navigationStateChanged FINAL)
Q_ENUMS(NavigationRequestAction)
Q_ENUMS(ErrorDomain)
+ Q_ENUMS(NavigationType)
public:
enum NavigationRequestAction {
HttpErrorDomain,
DownloadErrorDomain
};
+
+ enum NavigationType {
+ LinkClickedNavigation,
+ FormSubmittedNavigation,
+ BackForwardNavigation,
+ ReloadNavigation,
+ FormResubmittedNavigation,
+ OtherNavigation
+ };
+
QQuickWebView(QQuickItem* parent = 0);
virtual ~QQuickWebView();
class QWebNavigationRequestPrivate {
public:
- QWebNavigationRequestPrivate(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
+ QWebNavigationRequestPrivate(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers, QQuickWebView::NavigationType navigationType)
: url(url)
, originatingUrl(originatingUrl)
, button(button)
, modifiers(modifiers)
, action(QQuickWebView::AcceptRequest)
+ , navigationType(navigationType)
{
}
Qt::MouseButton button;
Qt::KeyboardModifiers modifiers;
int action;
+ QQuickWebView::NavigationType navigationType;
};
-QWebNavigationRequest::QWebNavigationRequest(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QObject* parent)
+QWebNavigationRequest::QWebNavigationRequest(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers, QQuickWebView::NavigationType navigationType, QObject* parent)
: QObject(parent)
- , d(new QWebNavigationRequestPrivate(url, originatingUrl, button, modifiers))
+ , d(new QWebNavigationRequestPrivate(url, originatingUrl, button, modifiers, navigationType))
{
}
return int(d->action);
}
+QQuickWebView::NavigationType QWebNavigationRequest::navigationType() const
+{
+ return d->navigationType;
+}
#ifndef qwebnavigationrequest_p_h
#define qwebnavigationrequest_p_h
+#include "qquickwebview_p.h"
#include "qwebkitglobal.h"
#include <QtCore/QObject>
Q_PROPERTY(int button READ button CONSTANT FINAL)
Q_PROPERTY(int modifiers READ modifiers CONSTANT FINAL)
Q_PROPERTY(int action READ action WRITE setAction NOTIFY actionChanged FINAL)
+ Q_PROPERTY(QQuickWebView::NavigationType navigationType READ navigationType CONSTANT FINAL)
public:
- QWebNavigationRequest(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QObject* parent = 0);
+ QWebNavigationRequest(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton button, Qt::KeyboardModifiers modifiers,
+ QQuickWebView::NavigationType navigationType, QObject* parent = 0);
~QWebNavigationRequest();
QUrl url() const;
int action() const;
void setAction(int action);
+ QQuickWebView::NavigationType navigationType() const;
Q_SIGNALS:
void actionChanged();
#include "WKFrame.h"
#include "WKURLQt.h"
-#include "qquickwebview_p.h"
#include "qquickwebview_p_p.h"
#include "qwebnavigationrequest_p.h"
#include <QtCore/QObject>
WKPageSetPagePolicyClient(pageRef, &policyClient);
}
-void QtWebPagePolicyClient::decidePolicyForNavigationAction(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton mouseButton, Qt::KeyboardModifiers keyboardModifiers, WKFramePolicyListenerRef listener)
+void QtWebPagePolicyClient::decidePolicyForNavigationAction(const QUrl& url, const QUrl& originatingUrl, Qt::MouseButton mouseButton,
+ Qt::KeyboardModifiers keyboardModifiers, QQuickWebView::NavigationType navigationType, WKFramePolicyListenerRef listener)
{
// NOTE: even though the C API (and the WebKit2 IPC) supports an asynchronous answer, this is not currently working.
// We are expected to call the listener immediately. See the patch for https://bugs.webkit.org/show_bug.cgi?id=53785.
- QWebNavigationRequest navigationRequest(url, originatingUrl, mouseButton, keyboardModifiers);
+ QWebNavigationRequest navigationRequest(url, originatingUrl, mouseButton, keyboardModifiers, navigationType);
emit m_webView->navigationRequested(&navigationRequest);
switch (navigationRequest.action()) {
return qtModifiers;
}
-void QtWebPagePolicyClient::decidePolicyForNavigationAction(WKPageRef, WKFrameRef frame, WKFrameNavigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
+static QQuickWebView::NavigationType toQuickWebViewNavigationType(WKFrameNavigationType navigationType)
+{
+ switch (navigationType) {
+ case kWKFrameNavigationTypeLinkClicked:
+ return QQuickWebView::LinkClickedNavigation;
+ case kWKFrameNavigationTypeFormSubmitted:
+ return QQuickWebView::FormSubmittedNavigation;
+ case kWKFrameNavigationTypeBackForward:
+ return QQuickWebView::BackForwardNavigation;
+ case kWKFrameNavigationTypeReload:
+ return QQuickWebView::ReloadNavigation;
+ case kWKFrameNavigationTypeFormResubmitted:
+ return QQuickWebView::FormResubmittedNavigation;
+ case kWKFrameNavigationTypeOther:
+ return QQuickWebView::OtherNavigation;
+ }
+ ASSERT_NOT_REACHED();
+ return QQuickWebView::OtherNavigation;
+}
+
+void QtWebPagePolicyClient::decidePolicyForNavigationAction(WKPageRef, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
{
WKRetainPtr<WKURLRef> frameURL(AdoptWK, WKFrameCopyURL(frame));
WKRetainPtr<WKURLRef> requestURL(AdoptWK, WKURLRequestCopyURL(request));
QUrl qUrlFrame = WKURLCopyQUrl(frameURL.get());
QUrl qUrl = WKURLCopyQUrl(requestURL.get());
- toQtWebPagePolicyClient(clientInfo)->decidePolicyForNavigationAction(qUrl, qUrlFrame, toQtMouseButton(mouseButton), toQtKeyboardModifiers(modifiers), listener);
+ toQtWebPagePolicyClient(clientInfo)->decidePolicyForNavigationAction(qUrl, qUrlFrame, toQtMouseButton(mouseButton), toQtKeyboardModifiers(modifiers), toQuickWebViewNavigationType(navigationType), listener);
}
void QtWebPagePolicyClient::decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef, const void*)
#ifndef QtWebPagePolicyClient_h
#define QtWebPagePolicyClient_h
+#include "qquickwebview_p.h"
#include <QtCore/QUrl>
#include <WKPage.h>
class QQuickWebView;
-
class QtWebPagePolicyClient {
public:
QtWebPagePolicyClient(WKPageRef, QQuickWebView*);
private:
- void decidePolicyForNavigationAction(const QUrl&, const QUrl&, Qt::MouseButton, Qt::KeyboardModifiers, WKFramePolicyListenerRef);
+ void decidePolicyForNavigationAction(const QUrl&, const QUrl&, Qt::MouseButton, Qt::KeyboardModifiers, QQuickWebView::NavigationType, WKFramePolicyListenerRef);
// WKPagePolicyClient callbacks.
static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo);