[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

timothy at apple.com timothy at apple.com
Wed Dec 22 17:59:34 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a5ffaba66b341ec850523bd336677130b9c32fd1
Author: timothy at apple.com <timothy at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 4 03:19:24 2010 +0000

    Make the Web Inspector window show and be usable on Mac.
    
    https://webkit.org/b/50490
    
    Reviewed by Sam Weinig.
    
    * UIProcess/WebInspectorProxy.cpp:
    (WebKit::WebInspectorProxy::invalidate): Call platformClose.
    (WebKit::WebInspectorProxy::didLoadInspectorPage): Call platformOpen.
    (WebKit::WebInspectorProxy::didClose): Call platformClose.
    * UIProcess/WebInspectorProxy.h:
    * UIProcess/WebInspectorProxy.messages.in: Added DidClose.
    * UIProcess/mac/WebInspectorProxyMac.mm:
    (-[WebInspectorProxyObjCAdapter initWithWebInspectorProxy:]): Added.
    (-[WebInspectorProxyObjCAdapter windowWillClose:]): Added. Call WebInspectorProxy::close.
    (WebKit::WebInspectorProxy::platformOpen): Added.
    (WebKit::WebInspectorProxy::platformClose): Added.
    * UIProcess/qt/WebInspectorProxyQt.cpp:
    (WebKit::WebInspectorProxy::platformOpen): Added stub.
    (WebKit::WebInspectorProxy::platformClose): Added stub.
    * UIProcess/win/WebInspectorProxyWin.cpp:
    (WebKit::WebInspectorProxy::platformOpen): Added stub.
    (WebKit::WebInspectorProxy::platformClose): Added stub.
    * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
    (WebKit::WebInspectorClient::sendMessageToFrontend): Added more null checks to avoid a crash.
    * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
    (WebKit::WebInspectorFrontendClient::closeWindow): Call WebInspector::didClose.
    (WebKit::WebInspectorFrontendClient::disconnectFromBackend): Ditto.
    (WebKit::WebInspectorFrontendClient::sendMessageToBackend): Removed. This does not need to be
    implemented by our subclass since we are in a single process.
    * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: Removed sendMessageToBackend.
    * WebProcess/WebPage/WebInspector.cpp:
    (WebKit::WebInspector::didClose): Added. Send a DidClose message to the UI process.
    * WebProcess/WebPage/WebInspector.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73324 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 787a56f..82145dd 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,40 @@
+2010-12-03  Timothy Hatcher  <timothy at apple.com>
+
+        Make the Web Inspector window show and be usable on Mac.
+
+        https://webkit.org/b/50490
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::invalidate): Call platformClose.
+        (WebKit::WebInspectorProxy::didLoadInspectorPage): Call platformOpen.
+        (WebKit::WebInspectorProxy::didClose): Call platformClose.
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/WebInspectorProxy.messages.in: Added DidClose.
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (-[WebInspectorProxyObjCAdapter initWithWebInspectorProxy:]): Added.
+        (-[WebInspectorProxyObjCAdapter windowWillClose:]): Added. Call WebInspectorProxy::close.
+        (WebKit::WebInspectorProxy::platformOpen): Added.
+        (WebKit::WebInspectorProxy::platformClose): Added.
+        * UIProcess/qt/WebInspectorProxyQt.cpp:
+        (WebKit::WebInspectorProxy::platformOpen): Added stub.
+        (WebKit::WebInspectorProxy::platformClose): Added stub.
+        * UIProcess/win/WebInspectorProxyWin.cpp:
+        (WebKit::WebInspectorProxy::platformOpen): Added stub.
+        (WebKit::WebInspectorProxy::platformClose): Added stub.
+        * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
+        (WebKit::WebInspectorClient::sendMessageToFrontend): Added more null checks to avoid a crash.
+        * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
+        (WebKit::WebInspectorFrontendClient::closeWindow): Call WebInspector::didClose.
+        (WebKit::WebInspectorFrontendClient::disconnectFromBackend): Ditto.
+        (WebKit::WebInspectorFrontendClient::sendMessageToBackend): Removed. This does not need to be
+        implemented by our subclass since we are in a single process.
+        * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: Removed sendMessageToBackend.
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::didClose): Added. Send a DidClose message to the UI process.
+        * WebProcess/WebPage/WebInspector.h:
+
 2010-12-03  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig and Dan Bernstein.
diff --git a/WebKit2/UIProcess/WebInspectorProxy.cpp b/WebKit2/UIProcess/WebInspectorProxy.cpp
index d9feffe..62b4bd2 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -62,7 +62,11 @@ WebInspectorProxy::~WebInspectorProxy()
 
 void WebInspectorProxy::invalidate()
 {
+    platformClose();
+
     m_page = 0;
+
+    m_isVisible = false;
     m_isDebuggingJavaScript = false;
     m_isProfilingJavaScript = false;
     m_isProfilingPage = false;
@@ -166,7 +170,16 @@ void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCr
 
 void WebInspectorProxy::didLoadInspectorPage()
 {
-    // FIXME: show the window or attach the inspector here.
+    m_isVisible = true;
+
+    platformOpen();
+}
+
+void WebInspectorProxy::didClose()
+{
+    platformClose();
+
+    m_isVisible = false;
 }
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebInspectorProxy.h b/WebKit2/UIProcess/WebInspectorProxy.h
index e0d623e..19e7a7b 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.h
+++ b/WebKit2/UIProcess/WebInspectorProxy.h
@@ -36,9 +36,13 @@
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
 #ifdef __OBJC__
+ at class NSWindow;
 @class WKView;
+ at class WebInspectorProxyObjCAdapter;
 #else
+class NSWindow;
 class WKView;
+class WebInspectorProxyObjCAdapter;
 #endif
 #endif
 
@@ -95,6 +99,8 @@ private:
     virtual Type type() const { return APIType; }
 
     WebPageProxy* platformCreateInspectorPage();
+    void platformOpen();
+    void platformClose();
 
     // Implemented the platform WebInspectorProxy file
     String inspectorPageURL() const;
@@ -102,9 +108,16 @@ private:
     // Called by WebInspectorProxy messages
     void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&);
     void didLoadInspectorPage();
+    void didClose();
 
     static WebPageGroup* inspectorPageGroup();
 
+    static const unsigned minimumWindowWidth = 500;
+    static const unsigned minimumWindowHeight = 400;
+
+    static const unsigned initialWindowWidth = 750;
+    static const unsigned initialWindowHeight = 650;
+
     WebPageProxy* m_page;
 
     bool m_isVisible;
@@ -115,6 +128,8 @@ private:
 
 #if PLATFORM(MAC)
     RetainPtr<WKView> m_inspectorView;
+    RetainPtr<NSWindow> m_inspectorWindow;
+    RetainPtr<WebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter;
 #endif
 };
 
diff --git a/WebKit2/UIProcess/WebInspectorProxy.messages.in b/WebKit2/UIProcess/WebInspectorProxy.messages.in
index 9040f3c..cc10248 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.messages.in
+++ b/WebKit2/UIProcess/WebInspectorProxy.messages.in
@@ -25,6 +25,7 @@
 messages -> WebInspectorProxy {
     CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters)
     DidLoadInspectorPage()
+    DidClose()
 }
 
 #endif
diff --git a/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
index 3cec06e..11a72fa 100644
--- a/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
+++ b/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
@@ -30,9 +30,46 @@
 #import "WKAPICast.h"
 #import "WKView.h"
 #import "WebPageProxy.h"
+#import <WebKitSystemInterface.h>
 #import <wtf/text/WTFString.h>
 
 using namespace WebCore;
+using namespace WebKit;
+
+// The height needed to match a typical NSToolbar.
+static const CGFloat windowContentBorderThickness = 55;
+
+// WebInspectorProxyObjCAdapter is a helper ObjC object used as a delegate or notification observer
+// for the sole purpose of getting back into the C++ code from an ObjC caller.
+
+ at interface WebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate> {
+    WebInspectorProxy* _inspectorProxy; // Not retained to prevent cycles
+}
+
+- (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy;
+
+ at end
+
+ at implementation WebInspectorProxyObjCAdapter
+
+- (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy
+{
+    ASSERT_ARG(inspectorProxy, inspectorProxy);
+
+    if (!(self = [super init]))
+        return nil;
+
+    _inspectorProxy = inspectorProxy; // Not retained to prevent cycles
+
+    return self;
+}
+
+- (void)windowWillClose:(NSNotification *)notification;
+{
+    _inspectorProxy->close();
+}
+
+ at end
 
 namespace WebKit {
 
@@ -47,6 +84,51 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
     return toImpl([m_inspectorView.get() pageRef]);
 }
 
+void WebInspectorProxy::platformOpen()
+{
+    ASSERT(!m_inspectorWindow);
+
+    m_inspectorProxyObjCAdapter.adoptNS([[WebInspectorProxyObjCAdapter alloc] initWithWebInspectorProxy:this]);
+
+    // FIXME: support opening in docked mode here.
+
+    NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | NSTexturedBackgroundWindowMask);
+    NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO];
+    [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
+    [window setContentBorderThickness:windowContentBorderThickness forEdge:NSMaxYEdge];
+    [window setDelegate:m_inspectorProxyObjCAdapter.get()];
+    [window setMinSize:NSMakeSize(minimumWindowWidth, minimumWindowHeight)];
+    [window setReleasedWhenClosed:NO];
+
+    // Center the window initially before setting the frame autosave name so that the window will be in a good
+    // position if there is no saved frame yet.
+    [window center];
+    [window setFrameAutosaveName:@"Web Inspector 2"];
+
+    WKNSWindowMakeBottomCornersSquare(window);
+
+    NSView *contentView = [window contentView];
+    [m_inspectorView.get() setFrame:[contentView bounds]];
+    [m_inspectorView.get() setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
+    [contentView addSubview:m_inspectorView.get()];
+
+    [window makeKeyAndOrderFront:nil];
+
+    m_inspectorWindow.adoptNS(window);
+}
+
+void WebInspectorProxy::platformClose()
+{
+    // FIXME: support closing in docked mode here.
+
+    [m_inspectorWindow.get() setDelegate:nil];
+    [m_inspectorWindow.get() orderOut:nil];
+
+    m_inspectorWindow = 0;
+    m_inspectorView = 0;
+    m_inspectorProxyObjCAdapter = 0;
+}
+
 String WebInspectorProxy::inspectorPageURL() const
 {
     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
diff --git a/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp b/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
index 79b2606..c04bd99 100644
--- a/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
+++ b/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
@@ -40,6 +40,16 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
     return 0;
 }
 
+void WebInspectorProxy::platformOpen()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformClose()
+{
+    notImplemented();
+}
+
 String WebInspectorProxy::inspectorPageURL() const
 {
     notImplemented();
diff --git a/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
index 79b2606..c04bd99 100644
--- a/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
+++ b/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
@@ -40,6 +40,16 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
     return 0;
 }
 
+void WebInspectorProxy::platformOpen()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformClose()
+{
+    notImplemented();
+}
+
 String WebInspectorProxy::inspectorPageURL() const
 {
     notImplemented();
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
index aa03b74..1d8fa1c 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
@@ -76,9 +76,13 @@ void WebInspectorClient::storeSetting(const String&, const String&)
 
 bool WebInspectorClient::sendMessageToFrontend(const String& message)
 {
-    if (WebPage* inspectorPage = m_page->inspector()->inspectorPage())
-        return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);
-    return false;
+    WebInspector* inspector = m_page->inspector();
+    if (!inspector)
+        return false;
+    WebPage* inspectorPage = inspector->inspectorPage();
+    if (!inspectorPage)
+        return false;
+    return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
index b8278bd..28d3b3d 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
@@ -70,12 +70,12 @@ void WebInspectorFrontendClient::bringToFront()
 
 void WebInspectorFrontendClient::closeWindow()
 {
-    notImplemented();
+    m_page->inspector()->didClose();
 }
 
 void WebInspectorFrontendClient::disconnectFromBackend()
 {
-    notImplemented();
+    m_page->inspector()->didClose();
 }
 
 void WebInspectorFrontendClient::attachWindow()
@@ -98,11 +98,6 @@ void WebInspectorFrontendClient::inspectedURLChanged(const String&)
     notImplemented();
 }
 
-void WebInspectorFrontendClient::sendMessageToBackend(const String&)
-{
-    notImplemented();
-}
-
 } // namespace WebKit
 
 #endif // ENABLE(INSPECTOR)
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h b/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h
index b3c2162..48b4de9 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h
@@ -54,8 +54,6 @@ private:
 
     virtual void inspectedURLChanged(const String&);
 
-    virtual void sendMessageToBackend(const String&);
-
     WebPage* m_page;
 };
 
diff --git a/WebKit2/WebProcess/WebPage/WebInspector.cpp b/WebKit2/WebProcess/WebPage/WebInspector.cpp
index 0eec3fd..ad294f6 100644
--- a/WebKit2/WebProcess/WebPage/WebInspector.cpp
+++ b/WebKit2/WebProcess/WebPage/WebInspector.cpp
@@ -75,6 +75,11 @@ void WebInspector::didLoadInspectorPage()
     WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidLoadInspectorPage(), m_page->pageID());
 }
 
+void WebInspector::didClose()
+{
+    WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID());
+}
+
 // Called by WebInspector messages
 void WebInspector::show()
 {
diff --git a/WebKit2/WebProcess/WebPage/WebInspector.h b/WebKit2/WebProcess/WebPage/WebInspector.h
index fbd0942..21a7529 100644
--- a/WebKit2/WebProcess/WebPage/WebInspector.h
+++ b/WebKit2/WebProcess/WebPage/WebInspector.h
@@ -58,6 +58,7 @@ private:
 
     // Called from WebInspectorFrontendClient
     void didLoadInspectorPage();
+    void didClose();
 
     // Implemented in platform WebInspector file
     String localizedStringsURL() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list