qt:
authortristan <tristan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Nov 2007 22:43:45 +0000 (22:43 +0000)
committertristan <tristan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Nov 2007 22:43:45 +0000 (22:43 +0000)
        Reviewed by Darin Adler.

        * WebCoreSupport/ChromeClientQt.cpp:
        (WebCore::ChromeClientQt::createWindow):
        * WebCoreSupport/ChromeClientQt.h:
        Revised to use new WebCore ChromeClient createWindow API.

WebCore:

        Reviewed by Darin Adler.

        * WebCore.xcodeproj/project.pbxproj:
        Set WindowFeatures.h as a Private header.

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::createWindow):
        Revised to use a single createWindow function instead of
        two createWindow functions and one createModalDialog function.
        The logic for this is now addressed in WebKit in an effort
        to make this easier to follow.

        * page/Chrome.cpp:
        (WebCore::Chrome::createWindow):
        * page/Chrome.h:
        * page/ChromeClient.h:
        * page/ContextMenuController.cpp:
        (WebCore::openNewWindow):
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyChromeClient::createWindow):
        Revised to take new additional windowFeatures parameter.

WebKit:

        Reviewed by Darin Adler.

        * DefaultDelegates/WebDefaultUIDelegate.m:
        (-[WebDefaultUIDelegate webView:createWebViewWithRequest:windowFeatures:]):
        Forward the UI delegate to call webView:createWebViewWithRequest: if
        this method doesn't exist.

        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::dispatchCreatePage):
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView loadPluginRequest:]):
        * WebView/WebView.mm:
        (-[WebView _openNewWindowWithRequest:]):
        Revised to use new webView:createWebViewWithRequest:windowFeatures: callback.

        * WebCoreSupport/WebChromeClient.h:
        * WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::createWindow):
        Added a new createWindow that accepts 3 parameters, so we can pass up windowFeatures to the chrome.
        Removed createModalDialog to use new createWindow function.

        * WebView/WebUIDelegatePrivate.h:
        Added new webView:createWebViewWithRequest:windowFeatures: method.

win:

        Reviewed by Darin Adler.

        Part of the WebKit/WebCore API changes for
        <rdar://problem/5368188>

        * WebChromeClient.cpp:
        (WebChromeClient::createWindow):
        Removed usage of createModalDialog and revised to use new createWindow
        ChromeClient API.

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

23 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/loader/FrameLoader.cpp
WebCore/page/Chrome.cpp
WebCore/page/Chrome.h
WebCore/page/ChromeClient.h
WebCore/page/ContextMenuController.cpp
WebCore/platform/graphics/svg/SVGImageEmptyClients.h
WebKit/ChangeLog
WebKit/DefaultDelegates/WebDefaultUIDelegate.m
WebKit/Plugins/WebBaseNetscapePluginView.mm
WebKit/WebCoreSupport/WebChromeClient.h
WebKit/WebCoreSupport/WebChromeClient.mm
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/WebView/WebUIDelegatePrivate.h
WebKit/WebView/WebView.mm
WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
WebKit/qt/WebCoreSupport/ChromeClientQt.h
WebKit/win/ChangeLog
WebKit/win/WebChromeClient.cpp

index ad7d2e86ddc942ae12875b8210a70740dcef2039..293a118a9911f8d590cced4cdf32e258ee9aa9f3 100644 (file)
@@ -1,3 +1,27 @@
+2007-11-02  Tristan O'Tierney  <tristan@apple.com>
+
+        Reviewed by Darin Adler.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Set WindowFeatures.h as a Private header.
+        
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::createWindow):
+        Revised to use a single createWindow function instead of
+        two createWindow functions and one createModalDialog function.
+        The logic for this is now addressed in WebKit in an effort
+        to make this easier to follow.
+        
+        * page/Chrome.cpp:
+        (WebCore::Chrome::createWindow):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+        * page/ContextMenuController.cpp:
+        (WebCore::openNewWindow):
+        * platform/graphics/svg/SVGImageEmptyClients.h:
+        (WebCore::SVGEmptyChromeClient::createWindow):
+        Revised to take new additional windowFeatures parameter.
+
 2007-11-04  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin Adler.
index 040321f91c5ad432ec81a0519456907f229c6c41..9c798078fdab56279fe1a5167085eb21e25650b7 100644 (file)
@@ -78,7 +78,7 @@
                14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 14E8378D09F85D4F00B85AE4 /* JSEvent.h */; };
                14EC267F09CA07E000E1EEEC /* EventTargetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EC267D09CA07E000E1EEEC /* EventTargetNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14EC268009CA07E000E1EEEC /* EventTargetNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */; };
-               14FD6DFD0AE5EA1B00AD67AD /* WindowFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FD6DFC0AE5EA1B00AD67AD /* WindowFeatures.h */; };
+               14FD6DFD0AE5EA1B00AD67AD /* WindowFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FD6DFC0AE5EA1B00AD67AD /* WindowFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14FFE31D0AE1963300136BF5 /* HTMLFrameElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FFE31B0AE1963300136BF5 /* HTMLFrameElementBase.h */; };
                14FFE31E0AE1963300136BF5 /* HTMLFrameElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FFE31C0AE1963300136BF5 /* HTMLFrameElementBase.cpp */; };
                1A0D57360A5C77FE007EDD4C /* OverflowEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0D57340A5C77FE007EDD4C /* OverflowEvent.cpp */; };
index d583a2c7e50f013ceda9c495d4593fdd4d19d343..58c04ae33f17208d35020b3074b71ee781d10ea1 100644 (file)
@@ -319,12 +319,8 @@ Frame* FrameLoader::createWindow(const FrameLoadRequest& request, const WindowFe
     requestWithReferrer.resourceRequest().setHTTPReferrer(m_outgoingReferrer);
     
     Page* page = m_frame->page();
-    if (page) {
-        if (features.dialog)
-            page = page->chrome()->createModalDialog(m_frame, requestWithReferrer);
-        else
-            page = page->chrome()->createWindow(m_frame, requestWithReferrer);
-    }
+    if (page)
+        page = page->chrome()->createWindow(m_frame, requestWithReferrer, features);
     if (!page)
         return 0;
 
index c4ca35d14d99d4e4055b173217cb63565348ec4b..174c40ad8b4a85cd908d7402c139deee7aebe40e 100644 (file)
@@ -34,6 +34,7 @@
 #include "Page.h"
 #include "ResourceHandle.h"
 #include "Settings.h"
+#include "WindowFeatures.h"
 #include "kjs_window.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
@@ -107,15 +108,10 @@ void Chrome::takeFocus(FocusDirection direction) const
 {
     m_client->takeFocus(direction);
 }
-
-Page* Chrome::createWindow(Frame* frame, const FrameLoadRequest& request) const
-{
-    return m_client->createWindow(frame, request);
-}
-
-Page* Chrome::createModalDialog(Frame* frame, const FrameLoadRequest& request) const
+    
+Page* Chrome::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& features) const
 {
-    return m_client->createModalDialog(frame, request);
+    return m_client->createWindow(frame, request, features);
 }
 
 void Chrome::show() const
index 1c5306787ad21435631f46c160221673cb9da005..58bc614b9f78a458fd640dc1942b73a40ac3bc6d 100644 (file)
@@ -43,6 +43,7 @@ namespace WebCore {
     class String;
     
     struct FrameLoadRequest;
+    struct WindowFeatures;
     
     enum MessageSource {
         HTMLMessageSource,
@@ -79,8 +80,7 @@ namespace WebCore {
         bool canTakeFocus(FocusDirection) const;
         void takeFocus(FocusDirection) const;
 
-        Page* createWindow(Frame*, const FrameLoadRequest&) const;
-        Page* createModalDialog(Frame*, const FrameLoadRequest&) const;
+        Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&) const;
         void show() const;
 
         bool canRunModal() const;
index 6f99085d49fa76400c99bf7ca41d6e0dd76ce7eb..da0b1a1b90f4b7c2abc2f9d9e06a310db92dbd2d 100644 (file)
@@ -33,6 +33,7 @@ namespace WebCore {
     class String;
     
     struct FrameLoadRequest;
+    struct WindowFeatures;
     
     class ChromeClient {
     public:
@@ -56,8 +57,7 @@ namespace WebCore {
         // Frame wants to create the new Page.  Also, the newly created window
         // should not be shown to the user until the ChromeClient of the newly
         // created Page has its show method called.
-        virtual Page* createWindow(Frame*, const FrameLoadRequest&) = 0;
-        virtual Page* createModalDialog(Frame*, const FrameLoadRequest&) = 0;
+        virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&) = 0;
         virtual void show() = 0;
 
         virtual bool canRunModal() = 0;
index 6b08e109f54184a51c5ed89d251cb146a372a8d2..19216ae5cbb00edbb1629f48e2735470998084f8 100644 (file)
@@ -54,6 +54,7 @@
 #include "SelectionController.h"
 #include "Settings.h"
 #include "TextIterator.h"
+#include "WindowFeatures.h"
 #include "markup.h"
 
 namespace WebCore {
@@ -107,10 +108,12 @@ void ContextMenuController::handleContextMenuEvent(Event* event)
 
 static void openNewWindow(const KURL& urlToLoad, Frame* frame)
 {
-    if (Page* oldPage = frame->page())
+    if (Page* oldPage = frame->page()) {
+        WindowFeatures features;
         if (Page* newPage = oldPage->chrome()->createWindow(frame,
-                FrameLoadRequest(ResourceRequest(urlToLoad, frame->loader()->outgoingReferrer()))))
+                FrameLoadRequest(ResourceRequest(urlToLoad, frame->loader()->outgoingReferrer())), features))
             newPage->chrome()->show();
+    }
 }
 
 void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
index ae6f728d62a3952180e76c410f88d8c5bea2ebf8..d314fe0dfa06c1e36752eac04de5ed1318d1f1e8 100644 (file)
@@ -69,8 +69,7 @@ public:
     virtual bool canTakeFocus(FocusDirection) { return false; }
     virtual void takeFocus(FocusDirection) { }
     
-    virtual Page* createWindow(Frame*, const FrameLoadRequest&) { return 0; }
-    virtual Page* createModalDialog(Frame*, const FrameLoadRequest&) { return 0; }
+    virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&) { return 0; }
     virtual void show() { }
     
     virtual bool canRunModal() { return false; }
index f2afcab716af312eff6417c462731048807d56c9..2a0d3543e37786636046b73c4547827c5078a907 100644 (file)
@@ -1,3 +1,29 @@
+2007-11-02  Tristan O'Tierney  <tristan@apple.com>
+
+        Reviewed by Darin Adler.
+
+        * DefaultDelegates/WebDefaultUIDelegate.m:
+        (-[WebDefaultUIDelegate webView:createWebViewWithRequest:windowFeatures:]):
+        Forward the UI delegate to call webView:createWebViewWithRequest: if
+        this method doesn't exist.
+        
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::dispatchCreatePage):
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView loadPluginRequest:]):
+        * WebView/WebView.mm:
+        (-[WebView _openNewWindowWithRequest:]):
+        Revised to use new webView:createWebViewWithRequest:windowFeatures: callback.
+        
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::createWindow):
+        Added a new createWindow that accepts 3 parameters, so we can pass up windowFeatures to the chrome.
+        Removed createModalDialog to use new createWindow function.
+        
+        * WebView/WebUIDelegatePrivate.h:
+        Added new webView:createWebViewWithRequest:windowFeatures: method.
+
 2007-11-05  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin Adler.
index 5ad3046c1b6d434ba72ca5c7201be95dbf001078..8cc84459f9766f1b76c76c1bd72e900d21fcc101 100644 (file)
@@ -57,8 +57,12 @@ static WebDefaultUIDelegate *sharedDelegate = nil;
     return sharedDelegate;
 }
 
-- (WebView *)webView: (WebView *)wv createWebViewWithRequest:(NSURLRequest *)request
+- (WebView *)webView: (WebView *)wv createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features
 {
+    // If the new API method doesn't exist, fallback to the old version of createWebViewWithRequest
+    // for backwards compatability
+    if (![[wv UIDelegate] respondsToSelector:@selector(webView:createWebViewWithRequest:windowFeatures:)] && [[wv UIDelegate] respondsToSelector:@selector(webView:createWebViewWithRequest:)])
+        return [[wv UIDelegate] webView:wv createWebViewWithRequest:request];
     return nil;
 }
 
index 9179a73124338a4a73e7c0fdb688e1d081301c42..fc9e1a91e159090f7b921ef6fb68345809ef20bc 100644 (file)
@@ -50,6 +50,7 @@
 #import "WebNullPluginView.h"
 #import "WebPreferences.h"
 #import "WebViewInternal.h"
+#import "WebUIDelegatePrivate.h"
 #import <Carbon/Carbon.h>
 #import <JavaScriptCore/Assertions.h>
 #import <JavaScriptCore/JSLock.h>
@@ -2131,7 +2132,11 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     
         if (frame == nil) {
             WebView *currentWebView = [self webView];
-            WebView *newWebView = CallUIDelegate(currentWebView, @selector(webView:createWebViewWithRequest:), nil);
+            NSDictionary *features = [[NSDictionary alloc] init];
+            WebView *newWebView = [[currentWebView _UIDelegateForwarder] webView:currentWebView
+                                                        createWebViewWithRequest:nil
+                                                                  windowFeatures:features];
+            [features release];
 
             if (!newWebView) {
                 if ([pluginRequest sendNotification]) {
index 1a189b43d408554144ba0b9caca1aec8e1ff0f99..f32834a1eec2b4bef637c18ea19dcd54074c8f24 100644 (file)
@@ -53,8 +53,7 @@ public:
     virtual bool canTakeFocus(WebCore::FocusDirection);
     virtual void takeFocus(WebCore::FocusDirection);
 
-    virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&);
-    virtual WebCore::Page* createModalDialog(WebCore::Frame*, const WebCore::FrameLoadRequest&);
+    virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&);
     virtual void show();
 
     virtual bool canRunModal();
index 7e8e746c6e086267ea089017c5450667b40acded..cc09eaab382bf5c4ce056655e1198a1134c9d410 100644 (file)
@@ -48,6 +48,7 @@
 #import <WebCore/PlatformScreen.h>
 #import <WebCore/PlatformString.h>
 #import <WebCore/ResourceRequest.h>
+#import <WebCore/WindowFeatures.h>
 #import <wtf/PassRefPtr.h>
 
 @interface NSView (AppKitSecretsWebBridgeKnowsAbout)
@@ -131,27 +132,67 @@ void WebChromeClient::takeFocus(FocusDirection direction)
     }
 }
 
-Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& request)
+Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& features)
 {
     NSURLRequest *URLRequest = nil;
     if (!request.isEmpty())
         URLRequest = request.resourceRequest().nsURLRequest();
-    WebView *newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewWithRequest:), URLRequest);
-    return core(newWebView);
-}
-
-Page* WebChromeClient::createModalDialog(Frame*, const FrameLoadRequest& request)
-{
-    NSURLRequest *URLRequest = nil;
-    if (!request.isEmpty())
-        URLRequest = request.resourceRequest().nsURLRequest();
-
-    WebView *newWebView = nil;
+    
     id delegate = [m_webView UIDelegate];
-    if ([delegate respondsToSelector:@selector(webView:createWebViewModalDialogWithRequest:)])
+    WebView *newWebView;
+    
+    if ([delegate respondsToSelector:@selector(webView:createWebViewWithRequest:windowFeatures:)]) {
+        NSNumber *x = features.xSet ? [[NSNumber alloc] initWithFloat:features.x] : nil;
+        NSNumber *y = features.ySet ? [[NSNumber alloc] initWithFloat:features.y] : nil;
+        NSNumber *width = features.widthSet ? [[NSNumber alloc] initWithFloat:features.width] : nil;
+        NSNumber *height = features.heightSet ? [[NSNumber alloc] initWithFloat:features.height] : nil;
+        NSNumber *menuBarVisible = [[NSNumber alloc] initWithBool:features.menuBarVisible];
+        NSNumber *statusBarVisible = [[NSNumber alloc] initWithBool:features.statusBarVisible];
+        NSNumber *toolBarVisible = [[NSNumber alloc] initWithBool:features.toolBarVisible];
+        NSNumber *scrollbarsVisible = [[NSNumber alloc] initWithBool:features.scrollbarsVisible];
+        NSNumber *resizable = [[NSNumber alloc] initWithBool:features.resizable];
+        NSNumber *fullscreen = [[NSNumber alloc] initWithBool:features.fullscreen];
+        NSNumber *dialog = [[NSNumber alloc] initWithBool:features.dialog];
+        
+        NSMutableDictionary *dictFeatures = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
+                                             menuBarVisible, @"menuBarVisible", 
+                                             statusBarVisible, @"statusBarVisible",
+                                             toolBarVisible, @"toolBarVisible",
+                                             scrollbarsVisible, @"scrollbarsVisible",
+                                             resizable, @"resizable",
+                                             fullscreen, @"fullscreen",
+                                             dialog, @"dialog",
+                                             nil];
+        
+        if (x)
+            [dictFeatures setObject:x forKey:@"x"];
+        if (y)
+            [dictFeatures setObject:y forKey:@"y"];
+        if (width)
+            [dictFeatures setObject:width forKey:@"width"];
+        if (height)
+            [dictFeatures setObject:height forKey:@"height"];
+        
+        newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewWithRequest:windowFeatures:), URLRequest, dictFeatures);
+        
+        [dictFeatures release];
+        [x release];
+        [y release];
+        [width release];
+        [height release];
+        [menuBarVisible release];
+        [statusBarVisible release];
+        [toolBarVisible release];
+        [scrollbarsVisible release];
+        [resizable release];
+        [fullscreen release];
+        [dialog release];
+    } else if (features.dialog && [delegate respondsToSelector:@selector(webView:createWebViewModalDialogWithRequest:)]) {
         newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewModalDialogWithRequest:), URLRequest);
-    else if ([delegate respondsToSelector:@selector(webView:createWebViewWithRequest:)])
+    } else {
         newWebView = CallUIDelegate(m_webView, @selector(webView:createWebViewWithRequest:), URLRequest);
+    }
+    
     return core(newWebView);
 }
 
index d2b8a5e3dfd1d8be66ac125f5088b7d10c87b392..32cb00d89b605a2952c7f2ae37364db273a2f839 100644 (file)
@@ -65,6 +65,7 @@
 #import "WebResourcePrivate.h"
 #import "WebScriptDebugServerPrivate.h"
 #import "WebUIDelegate.h"
+#import "WebUIDelegatePrivate.h"
 #import "WebViewInternal.h"
 #import <WebCore/AuthenticationMac.h>
 #import <WebCore/BlockExceptions.h>
@@ -589,7 +590,11 @@ void WebFrameLoaderClient::dispatchDidFirstLayout()
 Frame* WebFrameLoaderClient::dispatchCreatePage()
 {
     WebView *currentWebView = getWebView(m_webFrame.get());
-    WebView *newWebView = CallUIDelegate(currentWebView, @selector(webView:createWebViewWithRequest:), nil);
+    NSDictionary *features = [[NSDictionary alloc] init];
+    WebView *newWebView = [[currentWebView _UIDelegateForwarder] webView:currentWebView 
+                                                createWebViewWithRequest:nil
+                                                          windowFeatures:features];
+    [features release];
     return core([newWebView mainFrame]);
 }
 
index 2be32b1bb82e7365d9d87d6f7b39b2f4e2222eed..058936646e4b59ecbf4da1b650c4bc19442f87f9 100644 (file)
@@ -96,4 +96,6 @@ enum {
 */
 - (BOOL)webView:(WebView *)sender runDatabaseSizeLimitPromptForOrigin:(NSString *)origin initiatedByFrame:(WebFrame *)frame;
 
+- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request windowFeatures:(NSDictionary *)features;
+
 @end
index 614d917b30b200ea8c5f567dd04d5d473112de6e..ea1d3765170222796cb71738ec4786d7f6742da4 100644 (file)
@@ -771,7 +771,11 @@ static bool debugWidget = true;
 
 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request
 {
-    WebView *newWindowWebView = CallUIDelegate(self, @selector(webView:createWebViewWithRequest:), request);
+    NSDictionary *features = [[NSDictionary alloc] init];
+    WebView *newWindowWebView = [[self _UIDelegateForwarder] webView:self
+                                            createWebViewWithRequest:nil
+                                                      windowFeatures:features];
+    [features release];
     if (!newWindowWebView)
         return nil;
 
index 2a7e5831dae8f55247f7229d580b8c186fc23e3d..b270c05564fef1910bd61efb3201157254d1af2d 100644 (file)
@@ -37,6 +37,7 @@
 #include "webkitgtkpage.h"
 #include "webkitgtkprivate.h"
 #include "NotImplemented.h"
+#include "WindowFeatures.h"
 
 using namespace WebCore;
 
@@ -84,21 +85,20 @@ void ChromeClient::unfocus()
     notImplemented();
 }
     
-Page* ChromeClient::createWindow(Frame*, const FrameLoadRequest&)
+Page* ChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& features)
 {
-    /* TODO: FrameLoadRequest is not used */
-    WebKitPage* page = WEBKIT_PAGE_GET_CLASS(m_webPage)->create_page(m_webPage);
-    if (!page)
+    if (features.dialog) {
+        notImplemented();
         return 0;
-
-    WebKitPagePrivate *privateData = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(page));
-    return privateData->page;
-}
-
-Page* ChromeClient::createModalDialog(Frame*, const FrameLoadRequest&)
-{
-    notImplemented();
-    return 0;
+    } else {
+        /* TODO: FrameLoadRequest is not used */
+        WebKitPage* page = WEBKIT_PAGE_GET_CLASS(m_webPage)->create_page(m_webPage);
+        if (!page)
+            return 0;
+
+        WebKitPagePrivate *privateData = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(page));
+        return privateData->page;
+    }
 }
 
 void ChromeClient::show()
index 45144d445fd88a9b0d4f68b9818d58cfa1f16659..b325b0020083e42ae45d693e2394e6de62ed1dd6 100644 (file)
@@ -56,8 +56,7 @@ namespace WebKit {
         virtual bool canTakeFocus(WebCore::FocusDirection);
         virtual void takeFocus(WebCore::FocusDirection);
 
-        virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&);
-        virtual WebCore::Page* createModalDialog(WebCore::Frame*, const WebCore::FrameLoadRequest&);
+        virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&);
         virtual void show();
 
         virtual bool canRunModal();
index 5616f35d615fe3abf74204901b2bbdb88715433e..12d0313f0ec25167d582a4624578d2d329eaed15 100644 (file)
@@ -1,3 +1,12 @@
+2007-11-05  Tristan O'Tierney  <tristan@apple.com>
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::createWindow):
+        * WebCoreSupport/ChromeClientQt.h:
+        Revised to use new WebCore ChromeClient createWindow API.
+
 2007-10-31  Lars Knoll  <lars@trolltech.com>
 
         Reviewed by Simon.
index cb15d3abb67b31d346d76a53631309ece57bbe06..ea54b7c252e1127e8c2d94980dcdd03cc6b9443f 100644 (file)
@@ -34,6 +34,7 @@
 #include "FrameLoaderClientQt.h"
 #include "FrameView.h"
 #include "NotImplemented.h"
+#include "WindowFeatures.h"
 
 #include "qwebpage.h"
 #include "qwebpage_p.h"
@@ -118,9 +119,9 @@ void ChromeClientQt::takeFocus(FocusDirection)
 }
 
 
-Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request)
+Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features)
 {
-    QWebPage *newPage = m_webPage->createWindow();
+    QWebPage *newPage = features.dialog ? m_webPage->createModalDialog() : m_webPage->createWindow();
     if (!newPage)
         return 0;
     KURL url = request.resourceRequest().url();
@@ -128,18 +129,6 @@ Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request)
     return newPage->d->page;
 }
 
-
-Page* ChromeClientQt::createModalDialog(Frame*, const FrameLoadRequest& request)
-{
-    QWebPage *newPage = m_webPage->createModalDialog();
-    if (!newPage)
-        return 0;
-    KURL url = request.resourceRequest().url();
-    newPage->open(QUrl(url.prettyURL()));
-    return newPage->d->page;
-}
-
-
 void ChromeClientQt::show()
 {
     if (!m_webPage)
index f98cb80813ec69cf124ccb7c97828daca1e73403..ced3931139c5cad15b183738ea1cd4f9b0ccc290 100644 (file)
@@ -60,8 +60,7 @@ namespace WebCore {
         virtual bool canTakeFocus(FocusDirection);
         virtual void takeFocus(FocusDirection);
 
-        virtual Page* createWindow(Frame*, const FrameLoadRequest&);
-        virtual Page* createModalDialog(Frame*, const FrameLoadRequest&);
+        virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&);
         virtual void show();
 
         virtual bool canRunModal();
index 42a10713f16ccfc2f8438a82c29240ac00bec67f..d108610b5ac0534a2ffc9f220afe4a7753f30acc 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-05  Tristan O'Tierney  <tristan@apple.com>
+
+        Reviewed by Darin Adler.
+        
+        Part of the WebKit/WebCore API changes for
+        <rdar://problem/5368188>
+
+        * WebChromeClient.cpp:
+        (WebChromeClient::createWindow):
+        Removed usage of createModalDialog and revised to use new createWindow
+        ChromeClient API.
+
 2007-11-04  Adam Roben  <aroben@apple.com>
 
         Add IWebCache::disabled
index a0db4b9f2c8ab2017b49609621a6315c7fe1e9d4..b090db38354b3b7aeec0a155bb87382394779baa 100644 (file)
@@ -37,6 +37,7 @@
 #include <WebCore/FrameLoadRequest.h>
 #include <WebCore/FrameView.h>
 #include <WebCore/NotImplemented.h>
+#include <WebCore/WindowFeatures.h>
 #pragma warning(pop)
 
 using namespace WebCore;
@@ -131,17 +132,21 @@ void WebChromeClient::takeFocus(FocusDirection direction)
     }
 }
 
-Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadRequest)
+Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& features)
 {
     Page* page = 0;
+    IWebUIDelegate* uiDelegate = 0;
     IWebMutableURLRequest* request = WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest());
 
-    IWebUIDelegate* uiDelegate = 0;
     if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
-        IWebView* webView = 0;
-        if (SUCCEEDED(uiDelegate->createWebViewWithRequest(m_webView, request, &webView))) {
-            page = core(webView);
-            webView->Release();
+        if (features.dialog) {
+            notImplemented();
+        } else {
+            IWebView* webView = 0;
+            if (SUCCEEDED(uiDelegate->createWebViewWithRequest(m_webView, request, &webView))) {
+                page = core(webView);
+                webView->Release();
+            }
         }
     
         uiDelegate->Release();
@@ -151,17 +156,6 @@ Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadReq
     return page;
 }
 
-Page* WebChromeClient::createModalDialog(Frame*, const FrameLoadRequest&)
-{
-    Page* page = 0;
-    IWebUIDelegate* uiDelegate = 0;
-    if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
-        notImplemented();
-        uiDelegate->Release();
-    }
-    return page;
-}
-
 void WebChromeClient::show()
 {
     IWebUIDelegate* uiDelegate = 0;