From f6b094cd94e7be55960bb26eeb96f7005b0ccff0 Mon Sep 17 00:00:00 2001 From: "darin@apple.com" Date: Fri, 13 Jun 2008 21:47:30 +0000 Subject: [PATCH] WebCore: 2008-06-13 Darin Adler Reviewed by John Sullivan. - added FormState argument to action policy functions * loader/FrameLoader.cpp: (WebCore::FrameLoader::checkNewWindowPolicy): (WebCore::FrameLoader::checkNavigationPolicy): * loader/FrameLoaderClient.h: * svg/graphics/SVGImageEmptyClients.h: (WebCore::SVGEmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebCore::SVGEmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction): WebKit/gtk: 2008-06-13 Darin Adler Reviewed by John Sullivan. - updated for addition of FormState argument to action policy functions * WebCoreSupport/FrameLoaderClientGtk.cpp: (WebKit::FrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction): WebKit/mac: 2008-06-13 Darin Adler Reviewed by John Sullivan. - updated for addition of FormState argument to action policy functions - added WebActionFormKey * WebCoreSupport/WebFrameLoaderClient.h: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): (WebFrameLoaderClient::actionDictionary): * WebKit.exp: * WebView/WebPolicyDelegate.mm: * WebView/WebPolicyDelegatePrivate.h: WebKit/qt: 2008-06-13 Darin Adler Reviewed by John Sullivan. - updated for addition of FormState argument to action policy functions * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): WebKit/win: 2008-06-13 Darin Adler Reviewed by John Sullivan. - updated for addition of FormState argument to action policy functions - added WebActionFormKey * Interfaces/IWebPolicyDelegate.idl: * WebActionPropertyBag.cpp: (WebActionPropertyBag::WebActionPropertyBag): (WebActionPropertyBag::createInstance): (WebActionPropertyBag::AddRef): (WebActionPropertyBag::Release): (WebActionPropertyBag::Read): * WebActionPropertyBag.h: * WebFrame.cpp: (WebFrame::dispatchDecidePolicyForNewWindowAction): (WebFrame::dispatchDecidePolicyForNavigationAction): WebKit/wx: 2008-06-13 Darin Adler Reviewed by John Sullivan. - updated for addition of FormState argument to action policy functions * WebKitSupport/FrameLoaderClientWx.cpp: (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34523 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 14 +++++++ WebCore/loader/FrameLoader.cpp | 6 +-- WebCore/loader/FrameLoaderClient.h | 4 +- WebCore/svg/graphics/SVGImageEmptyClients.h | 4 +- WebKit/gtk/ChangeLog | 10 +++++ .../WebCoreSupport/FrameLoaderClientGtk.cpp | 6 +-- WebKit/mac/ChangeLog | 16 ++++++++ .../mac/WebCoreSupport/WebFrameLoaderClient.h | 6 +-- .../WebCoreSupport/WebFrameLoaderClient.mm | 41 +++++++++++-------- WebKit/mac/WebKit.exp | 1 + WebKit/mac/WebView/WebPolicyDelegate.mm | 7 ++-- WebKit/mac/WebView/WebPolicyDelegatePrivate.h | 4 +- WebKit/qt/ChangeLog | 10 +++++ .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 4 +- WebKit/win/ChangeLog | 19 +++++++++ WebKit/win/Interfaces/IWebPolicyDelegate.idl | 13 ++---- WebKit/win/WebActionPropertyBag.cpp | 35 ++++++++++------ WebKit/win/WebActionPropertyBag.h | 22 +++++----- WebKit/win/WebFrame.cpp | 8 ++-- WebKit/wx/ChangeLog | 10 +++++ .../wx/WebKitSupport/FrameLoaderClientWx.cpp | 4 +- 21 files changed, 168 insertions(+), 76 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 13e715f2179e9..4f150a52909e9 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,17 @@ +2008-06-13 Darin Adler + + Reviewed by John Sullivan. + + - added FormState argument to action policy functions + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::checkNewWindowPolicy): + (WebCore::FrameLoader::checkNavigationPolicy): + * loader/FrameLoaderClient.h: + * svg/graphics/SVGImageEmptyClients.h: + (WebCore::SVGEmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebCore::SVGEmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + 2008-06-13 Justin Garcia Reviewed by Jess. diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 7c23df0a0641d..e0dfc380d23d7 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -3621,7 +3621,7 @@ void FrameLoader::checkNewWindowPolicy(const NavigationAction& action, const Res m_policyCheck.set(request, formState, frameName, callContinueLoadAfterNewWindowPolicy, this); m_client->dispatchDecidePolicyForNewWindowAction(&FrameLoader::continueAfterNewWindowPolicy, - action, request, frameName); + action, request, formState, frameName); } void FrameLoader::continueAfterNewWindowPolicy(PolicyAction policy) @@ -3672,11 +3672,11 @@ void FrameLoader::checkNavigationPolicy(const ResourceRequest& request, Document loader->setLastCheckedRequest(request); - m_policyCheck.set(request, formState, function, argument); + m_policyCheck.set(request, formState.get(), function, argument); m_delegateIsDecidingNavigationPolicy = true; m_client->dispatchDecidePolicyForNavigationAction(&FrameLoader::continueAfterNavigationPolicy, - action, request); + action, request, formState); m_delegateIsDecidingNavigationPolicy = false; } diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h index c0a0440f030f6..98b2f6ca9808c 100644 --- a/WebCore/loader/FrameLoaderClient.h +++ b/WebCore/loader/FrameLoaderClient.h @@ -119,8 +119,8 @@ namespace WebCore { virtual void dispatchShow() = 0; virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, const ResourceRequest&) = 0; - virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, const String& frameName) = 0; - virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&) = 0; + virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr, const String& frameName) = 0; + virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr) = 0; virtual void cancelPolicyCheck() = 0; virtual void dispatchUnableToImplementPolicy(const ResourceError&) = 0; diff --git a/WebCore/svg/graphics/SVGImageEmptyClients.h b/WebCore/svg/graphics/SVGImageEmptyClients.h index 73061775a8706..3083e8c506df5 100644 --- a/WebCore/svg/graphics/SVGImageEmptyClients.h +++ b/WebCore/svg/graphics/SVGImageEmptyClients.h @@ -178,8 +178,8 @@ class SVGEmptyFrameLoaderClient : public FrameLoaderClient { virtual void dispatchShow() { } virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, const ResourceRequest&) { } - virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, const String& frameName) { } - virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&) { } + virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr, const String& frameName) { } + virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr) { } virtual void cancelPolicyCheck() { } virtual void dispatchUnableToImplementPolicy(const ResourceError&) { } diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 1a0f9e5566ced..364620343ea28 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,13 @@ +2008-06-13 Darin Adler + + Reviewed by John Sullivan. + + - updated for addition of FormState argument to action policy functions + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction): + 2008-06-10 Christian Dywan Reviewed by Alp Toker and Darin Adler. diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 5fcd25658cb79..b4fc8177267ec 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -153,7 +153,7 @@ WTF::PassRefPtr FrameLoaderClient::createDocumentLoader return loader.release(); } -void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunction, PassRefPtr) +void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunction, PassRefPtr) { // FIXME: This is surely too simple ASSERT(policyFunction); @@ -252,7 +252,7 @@ void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction poli (core(m_frame)->loader()->*policyFunction)(PolicyUse); } -void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction&, const ResourceRequest&, const String&) +void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr, const String&) { ASSERT(policyFunction); if (!policyFunction) @@ -262,7 +262,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFuncti (core(m_frame)->loader()->*policyFunction)(PolicyIgnore); } -void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest) +void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr) { ASSERT(policyFunction); if (!policyFunction) diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index dc2289fc9529d..9468dcddf2fea 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,19 @@ +2008-06-13 Darin Adler + + Reviewed by John Sullivan. + + - updated for addition of FormState argument to action policy functions + - added WebActionFormKey + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): + (WebFrameLoaderClient::actionDictionary): + * WebKit.exp: + * WebView/WebPolicyDelegate.mm: + * WebView/WebPolicyDelegatePrivate.h: + 2008-06-12 John Sullivan Reviewed by Dan and Darin diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index 7c8cafe71ebab..45fd17fc93785 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -109,9 +109,9 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const WebCore::String& MIMEType, const WebCore::ResourceRequest&); virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, - const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::String& frameName); + const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr, const WebCore::String& frameName); virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, - const WebCore::NavigationAction&, const WebCore::ResourceRequest&); + const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr); virtual void cancelPolicyCheck(); virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); @@ -197,7 +197,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { RetainPtr setUpPolicyListener(WebCore::FramePolicyFunction); - NSDictionary *actionDictionary(const WebCore::NavigationAction&) const; + NSDictionary *actionDictionary(const WebCore::NavigationAction&, PassRefPtr) const; virtual bool canCachePage() const; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 77e33303f86e5..9334a01133125 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -585,22 +585,22 @@ - (void)invalidate; } void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, - const NavigationAction& action, const ResourceRequest& request, const String& frameName) + const NavigationAction& action, const ResourceRequest& request, PassRefPtr formState, const String& frameName) { WebView *webView = getWebView(m_webFrame.get()); [[webView _policyDelegateForwarder] webView:webView - decidePolicyForNewWindowAction:actionDictionary(action) + decidePolicyForNewWindowAction:actionDictionary(action, formState) request:request.nsURLRequest() newFrameName:frameName decisionListener:setUpPolicyListener(function).get()]; } void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, - const NavigationAction& action, const ResourceRequest& request) + const NavigationAction& action, const ResourceRequest& request, PassRefPtr formState) { WebView *webView = getWebView(m_webFrame.get()); [[webView _policyDelegateForwarder] webView:webView - decidePolicyForNavigationAction:actionDictionary(action) + decidePolicyForNavigationAction:actionDictionary(action, formState) request:request.nsURLRequest() frame:m_webFrame.get() decisionListener:setUpPolicyListener(function).get()]; @@ -1014,7 +1014,7 @@ - (void)invalidate; return 0; } -NSDictionary *WebFrameLoaderClient::actionDictionary(const NavigationAction& action) const +NSDictionary *WebFrameLoaderClient::actionDictionary(const NavigationAction& action, PassRefPtr formState) const { unsigned modifierFlags = 0; const Event* event = action.event(); @@ -1028,26 +1028,31 @@ - (void)invalidate; if (keyStateEvent->metaKey()) modifierFlags |= NSCommandKeyMask; } + NSURL *originalURL = action.url(); + + NSMutableDictionary *result = [NSMutableDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt:action.type()], WebActionNavigationTypeKey, + [NSNumber numberWithInt:modifierFlags], WebActionModifierFlagsKey, + originalURL, WebActionOriginalURLKey, + nil]; + if (const MouseEvent* mouseEvent = findMouseEvent(event)) { IntPoint point(mouseEvent->pageX(), mouseEvent->pageY()); WebElementDictionary *element = [[WebElementDictionary alloc] initWithHitTestResult:core(m_webFrame.get())->eventHandler()->hitTestResultAtPoint(point, false)]; - NSDictionary *result = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:action.type()], WebActionNavigationTypeKey, - element, WebActionElementKey, - [NSNumber numberWithInt:mouseEvent->button()], WebActionButtonKey, - [NSNumber numberWithInt:modifierFlags], WebActionModifierFlagsKey, - originalURL, WebActionOriginalURLKey, - nil]; + [result setObject:element forKey:WebActionElementKey]; [element release]; - return result; + + [result setObject:[NSNumber numberWithInt:mouseEvent->button()] forKey:WebActionButtonKey]; } - return [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:action.type()], WebActionNavigationTypeKey, - [NSNumber numberWithInt:modifierFlags], WebActionModifierFlagsKey, - originalURL, WebActionOriginalURLKey, - nil]; + + if (formState) { + ASSERT(formState->form()); + [result setObject:kit(formState->form()) forKey:WebActionFormKey]; + } + + return result; } bool WebFrameLoaderClient::canCachePage() const diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp index 36b8cceebe756..c284ffa3b4967 100644 --- a/WebKit/mac/WebKit.exp +++ b/WebKit/mac/WebKit.exp @@ -34,6 +34,7 @@ _HIWebViewCreate _HIWebViewGetWebView _WebActionButtonKey _WebActionElementKey +_WebActionFormKey _WebActionModifierFlagsKey _WebActionNavigationTypeKey _WebActionOriginalURLKey diff --git a/WebKit/mac/WebView/WebPolicyDelegate.mm b/WebKit/mac/WebView/WebPolicyDelegate.mm index 147e761860b9f..f2df744292b7e 100644 --- a/WebKit/mac/WebView/WebPolicyDelegate.mm +++ b/WebKit/mac/WebView/WebPolicyDelegate.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,10 +33,11 @@ using namespace WebCore; -NSString *WebActionNavigationTypeKey = @"WebActionNavigationTypeKey"; -NSString *WebActionElementKey = @"WebActionElementKey"; NSString *WebActionButtonKey = @"WebActionButtonKey"; +NSString *WebActionElementKey = @"WebActionElementKey"; +NSString *WebActionFormKey = @"WebActionFormKey"; NSString *WebActionModifierFlagsKey = @"WebActionModifierFlagsKey"; +NSString *WebActionNavigationTypeKey = @"WebActionNavigationTypeKey"; NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey"; @interface WebPolicyDecisionListenerPrivate : NSObject diff --git a/WebKit/mac/WebView/WebPolicyDelegatePrivate.h b/WebKit/mac/WebView/WebPolicyDelegatePrivate.h index f7bbbd53ef23a..45f8f45336216 100644 --- a/WebKit/mac/WebView/WebPolicyDelegatePrivate.h +++ b/WebKit/mac/WebView/WebPolicyDelegatePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,6 +31,8 @@ @class WebHistoryItem; @class WebPolicyDecisionListenerPrivate; +extern NSString *WebActionFormKey; // HTMLFormElement + typedef enum { WebNavigationTypePlugInRequest = WebNavigationTypeOther + 1 } WebExtraNavigationType; diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index a1e763c4bbb1a..c65a80243919b 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,13 @@ +2008-06-13 Darin Adler + + Reviewed by John Sullivan. + + - updated for addition of FormState argument to action policy functions + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + 2008-06-11 Ariya Hidayat Reviewed by Simon. diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 112c45eee9e74..052a8efdb638a 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -872,7 +872,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu slotCallPolicyFunction(PolicyDownload); } -void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, const WebCore::String&) +void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr, const WebCore::String&) { Q_ASSERT(!m_policyFunction); Q_ASSERT(m_webFrame); @@ -893,7 +893,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc slotCallPolicyFunction(PolicyUse); } -void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request) +void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr) { Q_ASSERT(!m_policyFunction); Q_ASSERT(m_webFrame); diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 6edb72b88cd45..70ce00975a939 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,22 @@ +2008-06-13 Darin Adler + + Reviewed by John Sullivan. + + - updated for addition of FormState argument to action policy functions + - added WebActionFormKey + + * Interfaces/IWebPolicyDelegate.idl: + * WebActionPropertyBag.cpp: + (WebActionPropertyBag::WebActionPropertyBag): + (WebActionPropertyBag::createInstance): + (WebActionPropertyBag::AddRef): + (WebActionPropertyBag::Release): + (WebActionPropertyBag::Read): + * WebActionPropertyBag.h: + * WebFrame.cpp: + (WebFrame::dispatchDecidePolicyForNewWindowAction): + (WebFrame::dispatchDecidePolicyForNavigationAction): + 2008-06-07 Darin Adler Reviewed by Mitz. diff --git a/WebKit/win/Interfaces/IWebPolicyDelegate.idl b/WebKit/win/Interfaces/IWebPolicyDelegate.idl index 450fe89fe6ea6..204b98581a562 100644 --- a/WebKit/win/Interfaces/IWebPolicyDelegate.idl +++ b/WebKit/win/Interfaces/IWebPolicyDelegate.idl @@ -57,20 +57,13 @@ typedef enum WebNavigationType { WebNavigationTypeOther } WebNavigationType; -cpp_quote("#define WebActionNavigationTypeKey TEXT(\"WebActionNavigationTypeKey\")") -cpp_quote("#define WebActionElementKey TEXT(\"WebActionElementKey\")") cpp_quote("#define WebActionButtonKey TEXT(\"WebActionButtonKey\")") +cpp_quote("#define WebActionElementKey TEXT(\"WebActionElementKey\")") +cpp_quote("#define WebActionFormKey TEXT(\"WebActionFormKey\")") cpp_quote("#define WebActionModifierFlagsKey TEXT(\"WebActionModifierFlagsKey\")") +cpp_quote("#define WebActionNavigationTypeKey TEXT(\"WebActionNavigationTypeKey\")") cpp_quote("#define WebActionOriginalURLKey TEXT(\"WebActionOriginalURLKey\")") -/* -extern NSString *WebActionNavigationTypeKey; // NSNumber (WebNavigationType) -extern NSString *WebActionElementKey; // NSDictionary of element info -extern NSString *WebActionButtonKey; // NSEventType -extern NSString *WebActionModifierFlagsKey; // NSNumber (unsigned) -extern NSString *WebActionOriginalURLKey; // NSURL -*/ - /*! @protocol WebPolicyDecisionListener @discussion This protocol is used to call back with the results of a diff --git a/WebKit/win/WebActionPropertyBag.cpp b/WebKit/win/WebActionPropertyBag.cpp index 13aede8a1d649..84f122d094f1a 100644 --- a/WebKit/win/WebActionPropertyBag.cpp +++ b/WebKit/win/WebActionPropertyBag.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,9 +41,11 @@ using namespace WebCore; // WebActionPropertyBag ------------------------------------------------ -WebActionPropertyBag::WebActionPropertyBag(const NavigationAction& action, Frame* frame) + +WebActionPropertyBag::WebActionPropertyBag(const NavigationAction& action, PassRefPtr form, PassRefPtr frame) : m_refCount(0) - , m_action(action) + , m_action(action) + , m_form(form) , m_frame(frame) { gClassCount++; @@ -54,11 +56,10 @@ WebActionPropertyBag::~WebActionPropertyBag() gClassCount--; } -WebActionPropertyBag* WebActionPropertyBag::createInstance(const NavigationAction& action, Frame* frame) +WebActionPropertyBag* WebActionPropertyBag::createInstance(const NavigationAction& action, PassRefPtr form, PassRefPtr frame) { - WebActionPropertyBag* instance = new WebActionPropertyBag(action, frame); + WebActionPropertyBag* instance = new WebActionPropertyBag(action, form, frame); instance->AddRef(); - return instance; } @@ -78,12 +79,12 @@ HRESULT STDMETHODCALLTYPE WebActionPropertyBag::QueryInterface(REFIID riid, void return S_OK; } -ULONG STDMETHODCALLTYPE WebActionPropertyBag::AddRef(void) +ULONG STDMETHODCALLTYPE WebActionPropertyBag::AddRef() { return ++m_refCount; } -ULONG STDMETHODCALLTYPE WebActionPropertyBag::Release(void) +ULONG STDMETHODCALLTYPE WebActionPropertyBag::Release() { ULONG newRef = --m_refCount; if (!newRef) @@ -116,24 +117,28 @@ HRESULT STDMETHODCALLTYPE WebActionPropertyBag::Read(LPCOLESTR pszPropName, VARI V_VT(pVar) = VT_I4; V_I4(pVar) = m_action.type(); return S_OK; - } else if (isEqual(pszPropName, WebActionElementKey)) { + } + if (isEqual(pszPropName, WebActionElementKey)) { if (const MouseEvent* mouseEvent = findMouseEvent(m_action.event())) { IntPoint point(mouseEvent->clientX(), mouseEvent->clientY()); V_VT(pVar) = VT_UNKNOWN; V_UNKNOWN(pVar) = WebElementPropertyBag::createInstance(m_frame->eventHandler()->hitTestResultAtPoint(point, false)); return S_OK; } - } else if (isEqual(pszPropName, WebActionButtonKey)) { + } + if (isEqual(pszPropName, WebActionButtonKey)) { if (const MouseEvent* mouseEvent = findMouseEvent(m_action.event())) { V_VT(pVar) = VT_I4; V_I4(pVar) = mouseEvent->button(); return S_OK; } - } else if (isEqual(pszPropName, WebActionOriginalURLKey)) { + } + if (isEqual(pszPropName, WebActionOriginalURLKey)) { V_VT(pVar) = VT_BSTR; V_BSTR(pVar) = BString(m_action.url().string()).release(); return S_OK; - } else if (isEqual(pszPropName, WebActionModifierFlagsKey)) { + } + if (isEqual(pszPropName, WebActionModifierFlagsKey)) { if (const UIEventWithKeyState* keyEvent = findEventWithKeyState(const_cast(m_action.event()))) { int modifiers = 0; @@ -149,6 +154,12 @@ HRESULT STDMETHODCALLTYPE WebActionPropertyBag::Read(LPCOLESTR pszPropName, VARI return S_OK; } } + if (isEqual(pszPropName, WebActionFormKey)) { + IHTMLFormElement* form = HTMLFormElement::createInstance(m_form.get()); + V_VT(pVar) = VT_UNKNOWN; + V_UNKNOWN(pVar) = form; + return S_OK; + } return E_INVALIDARG; } diff --git a/WebKit/win/WebActionPropertyBag.h b/WebKit/win/WebActionPropertyBag.h index 3c2f19ee4c26a..56f8f520cc133 100644 --- a/WebKit/win/WebActionPropertyBag.h +++ b/WebKit/win/WebActionPropertyBag.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,27 +27,26 @@ #define WebActionPropertyBag_h #include "ocidl.h" -#include #pragma warning(push, 0) #include +#include #include #pragma warning(pop) -class WebActionPropertyBag : public IPropertyBag -{ +class WebActionPropertyBag : public IPropertyBag { public: - static WebActionPropertyBag* createInstance(const WebCore::NavigationAction&, WebCore::Frame*); + static WebActionPropertyBag* createInstance(const WebCore::NavigationAction&, PassRefPtr, PassRefPtr); -protected: - WebActionPropertyBag(const WebCore::NavigationAction&, WebCore::Frame*); +private: + WebActionPropertyBag(const WebCore::NavigationAction&, PassRefPtr, PassRefPtr); ~WebActionPropertyBag(); public: // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); // IPropertyBag virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read( @@ -62,7 +61,8 @@ class WebActionPropertyBag : public IPropertyBag private: ULONG m_refCount; WebCore::NavigationAction m_action; + RefPtr m_form; RefPtr m_frame; }; -#endif \ No newline at end of file +#endif diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index 28294edec6037..de694a487d2e8 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -1361,7 +1361,7 @@ void WebFrame::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, con (coreFrame->loader()->*function)(PolicyUse); } -void WebFrame::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, const String& frameName) +void WebFrame::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, const String& frameName, PassRefPtr formState) { Frame* coreFrame = core(this); ASSERT(coreFrame); @@ -1371,7 +1371,7 @@ void WebFrame::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction functi policyDelegate = DefaultPolicyDelegate::sharedInstance(); COMPtr urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(request)); - COMPtr actionInformation(AdoptCOM, WebActionPropertyBag::createInstance(action, coreFrame)); + COMPtr actionInformation(AdoptCOM, WebActionPropertyBag::createInstance(action, coreFrame, formState)); if (SUCCEEDED(policyDelegate->decidePolicyForNewWindowAction(d->webView, actionInformation.get(), urlRequest.get(), BString(frameName), setUpPolicyListener(function).get()))) return; @@ -1379,7 +1379,7 @@ void WebFrame::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction functi (coreFrame->loader()->*function)(PolicyUse); } -void WebFrame::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request) +void WebFrame::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr formState) { Frame* coreFrame = core(this); ASSERT(coreFrame); @@ -1389,7 +1389,7 @@ void WebFrame::dispatchDecidePolicyForNavigationAction(FramePolicyFunction funct policyDelegate = DefaultPolicyDelegate::sharedInstance(); COMPtr urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(request)); - COMPtr actionInformation(AdoptCOM, WebActionPropertyBag::createInstance(action, coreFrame)); + COMPtr actionInformation(AdoptCOM, WebActionPropertyBag::createInstance(action, coreFrame, formState)); if (SUCCEEDED(policyDelegate->decidePolicyForNavigationAction(d->webView, actionInformation.get(), urlRequest.get(), this, setUpPolicyListener(function).get()))) return; diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index ca9ac54d550d8..5292b0635b270 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,13 @@ +2008-06-13 Darin Adler + + Reviewed by John Sullivan. + + - updated for addition of FormState argument to action policy functions + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + 2008-06-10 Kevin Ollivier wx Linux build fix. Only use -undefined dynamic_lookup flag under Mac. diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 221cabdb17420..0980e23801ab1 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -710,7 +710,7 @@ void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu (m_frame->loader()->*function)(PolicyUse); } -void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, const String&) +void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, PassRefPtr, const String&) { if (!m_frame) return; @@ -719,7 +719,7 @@ void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc (m_frame->loader()->*function)(PolicyUse); } -void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request) +void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr) { if (!m_frame) return;