Simon Hausmann <shausman@trolltech.com>
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2008 08:51:02 +0000 (08:51 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Apr 2008 08:51:02 +0000 (08:51 +0000)
Fixes: QWebPage::acceptNavigationRequest not being called / linkClicked() not being emitted when clicking on <a href="..." target="_blank"> kind of links.

Call QWebPage::acceptNavigationRequest when the creation of a new window with
URL is requested. The frame pointer is set to null in this case.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@32681 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/Api/qwebpage.cpp
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

index 109fe22..097eb32 100644 (file)
@@ -1408,6 +1408,9 @@ void QWebPage::setViewportSize(const QSize &size) const
     This function is called whenever WebKit requests to navigate \a frame to the resource specified by \a request by means of
     the specified navigation type \a type.
 
+    If \a frame is a null pointer then navigation to a new window is requested. If the request is
+    accepted createWindow() will be called.
+
     The default implementation interprets the page's linkDelegationPolicy and emits linkClicked accordingly or returns true
     to let QWebPage handle the navigation itself.
 
index 556eb7d..dbd9564 100644 (file)
@@ -1,3 +1,19 @@
+2008-04-29  Simon Hausmann  <shausman@trolltech.com>
+
+        Reviewed by Holger.
+
+        Fixes: QWebPage::acceptNavigationRequest not being called / linkClicked() not being emitted when clicking on <a href="..." target="_blank"> kind of links.
+        
+        Call QWebPage::acceptNavigationRequest when the creation of a new window with
+        URL is requested. The frame pointer is set to null in this case.
+        
+
+        * Api/qwebpage.cpp:
+        (QWebPage::setViewportSize):
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::startDownload):
+        (WebCore::FrameLoaderClientQt::createFrame):
+
 2008-04-29  Holger Hans Peter Freyther  <zecke@selfish.org>
 
         Reviewed by Simon.
index 70fbbd4..e04292b 100644 (file)
@@ -833,34 +833,46 @@ void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu
         slotCallPolicyFunction(PolicyDownload);
 }
 
-void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::String&)
+void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, const WebCore::String&)
 {
     Q_ASSERT(!m_policyFunction);
+    Q_ASSERT(m_webFrame);
     m_policyFunction = function;
+#if QT_VERSION < 0x040400
+    QWebNetworkRequest r(request);
+#else
+    QNetworkRequest r(request.toNetworkRequest());
+#endif
+    QWebPage* page = m_webFrame->page();
+
+    if (!page->d->acceptNavigationRequest(0, r, QWebPage::NavigationType(action.type()))) {
+        if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
+            m_frame->loader()->resetMultipleFormSubmissionProtection();
+        slotCallPolicyFunction(PolicyIgnore);
+        return;
+    }
     slotCallPolicyFunction(PolicyUse);
 }
 
 void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request)
 {
     Q_ASSERT(!m_policyFunction);
+    Q_ASSERT(m_webFrame);
     m_policyFunction = function;
-    if (m_webFrame) {
 #if QT_VERSION < 0x040400
-        QWebNetworkRequest r(request);
+    QWebNetworkRequest r(request);
 #else
-        QNetworkRequest r(request.toNetworkRequest());
+    QNetworkRequest r(request.toNetworkRequest());
 #endif
-        QWebPage *page = m_webFrame->page();
+    QWebPage*page = m_webFrame->page();
 
-        if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) {
-            if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
-                m_frame->loader()->resetMultipleFormSubmissionProtection();
-            slotCallPolicyFunction(PolicyIgnore);
-            return;
-        }
+    if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) {
+        if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
+            m_frame->loader()->resetMultipleFormSubmissionProtection();
+        slotCallPolicyFunction(PolicyIgnore);
+        return;
     }
     slotCallPolicyFunction(PolicyUse);
-    return;
 }
 
 void FrameLoaderClientQt::dispatchUnableToImplementPolicy(const WebCore::ResourceError&)