Changeset 73324 in webkit
- Timestamp:
- Dec 3, 2010 7:19:24 PM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r73318 r73324 1 2010-12-03 Timothy Hatcher <timothy@apple.com> 2 3 Make the Web Inspector window show and be usable on Mac. 4 5 https://webkit.org/b/50490 6 7 Reviewed by Sam Weinig. 8 9 * UIProcess/WebInspectorProxy.cpp: 10 (WebKit::WebInspectorProxy::invalidate): Call platformClose. 11 (WebKit::WebInspectorProxy::didLoadInspectorPage): Call platformOpen. 12 (WebKit::WebInspectorProxy::didClose): Call platformClose. 13 * UIProcess/WebInspectorProxy.h: 14 * UIProcess/WebInspectorProxy.messages.in: Added DidClose. 15 * UIProcess/mac/WebInspectorProxyMac.mm: 16 (-[WebInspectorProxyObjCAdapter initWithWebInspectorProxy:]): Added. 17 (-[WebInspectorProxyObjCAdapter windowWillClose:]): Added. Call WebInspectorProxy::close. 18 (WebKit::WebInspectorProxy::platformOpen): Added. 19 (WebKit::WebInspectorProxy::platformClose): Added. 20 * UIProcess/qt/WebInspectorProxyQt.cpp: 21 (WebKit::WebInspectorProxy::platformOpen): Added stub. 22 (WebKit::WebInspectorProxy::platformClose): Added stub. 23 * UIProcess/win/WebInspectorProxyWin.cpp: 24 (WebKit::WebInspectorProxy::platformOpen): Added stub. 25 (WebKit::WebInspectorProxy::platformClose): Added stub. 26 * WebProcess/WebCoreSupport/WebInspectorClient.cpp: 27 (WebKit::WebInspectorClient::sendMessageToFrontend): Added more null checks to avoid a crash. 28 * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp: 29 (WebKit::WebInspectorFrontendClient::closeWindow): Call WebInspector::didClose. 30 (WebKit::WebInspectorFrontendClient::disconnectFromBackend): Ditto. 31 (WebKit::WebInspectorFrontendClient::sendMessageToBackend): Removed. This does not need to be 32 implemented by our subclass since we are in a single process. 33 * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h: Removed sendMessageToBackend. 34 * WebProcess/WebPage/WebInspector.cpp: 35 (WebKit::WebInspector::didClose): Added. Send a DidClose message to the UI process. 36 * WebProcess/WebPage/WebInspector.h: 37 1 38 2010-12-03 Anders Carlsson <andersca@apple.com> 2 39 -
trunk/WebKit2/UIProcess/WebInspectorProxy.cpp
r73066 r73324 63 63 void WebInspectorProxy::invalidate() 64 64 { 65 platformClose(); 66 65 67 m_page = 0; 68 69 m_isVisible = false; 66 70 m_isDebuggingJavaScript = false; 67 71 m_isProfilingJavaScript = false; … … 167 171 void WebInspectorProxy::didLoadInspectorPage() 168 172 { 169 // FIXME: show the window or attach the inspector here. 173 m_isVisible = true; 174 175 platformOpen(); 176 } 177 178 void WebInspectorProxy::didClose() 179 { 180 platformClose(); 181 182 m_isVisible = false; 170 183 } 171 184 -
trunk/WebKit2/UIProcess/WebInspectorProxy.h
r73066 r73324 37 37 #include <wtf/RetainPtr.h> 38 38 #ifdef __OBJC__ 39 @class NSWindow; 39 40 @class WKView; 41 @class WebInspectorProxyObjCAdapter; 40 42 #else 43 class NSWindow; 41 44 class WKView; 45 class WebInspectorProxyObjCAdapter; 42 46 #endif 43 47 #endif … … 96 100 97 101 WebPageProxy* platformCreateInspectorPage(); 102 void platformOpen(); 103 void platformClose(); 98 104 99 105 // Implemented the platform WebInspectorProxy file … … 103 109 void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&); 104 110 void didLoadInspectorPage(); 111 void didClose(); 105 112 106 113 static WebPageGroup* inspectorPageGroup(); 114 115 static const unsigned minimumWindowWidth = 500; 116 static const unsigned minimumWindowHeight = 400; 117 118 static const unsigned initialWindowWidth = 750; 119 static const unsigned initialWindowHeight = 650; 107 120 108 121 WebPageProxy* m_page; … … 116 129 #if PLATFORM(MAC) 117 130 RetainPtr<WKView> m_inspectorView; 131 RetainPtr<NSWindow> m_inspectorWindow; 132 RetainPtr<WebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter; 118 133 #endif 119 134 }; -
trunk/WebKit2/UIProcess/WebInspectorProxy.messages.in
r72666 r73324 26 26 CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters) 27 27 DidLoadInspectorPage() 28 DidClose() 28 29 } 29 30 -
trunk/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
r73066 r73324 31 31 #import "WKView.h" 32 32 #import "WebPageProxy.h" 33 #import <WebKitSystemInterface.h> 33 34 #import <wtf/text/WTFString.h> 34 35 35 36 using namespace WebCore; 37 using namespace WebKit; 38 39 // The height needed to match a typical NSToolbar. 40 static const CGFloat windowContentBorderThickness = 55; 41 42 // WebInspectorProxyObjCAdapter is a helper ObjC object used as a delegate or notification observer 43 // for the sole purpose of getting back into the C++ code from an ObjC caller. 44 45 @interface WebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate> { 46 WebInspectorProxy* _inspectorProxy; // Not retained to prevent cycles 47 } 48 49 - (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy; 50 51 @end 52 53 @implementation WebInspectorProxyObjCAdapter 54 55 - (id)initWithWebInspectorProxy:(WebInspectorProxy*)inspectorProxy 56 { 57 ASSERT_ARG(inspectorProxy, inspectorProxy); 58 59 if (!(self = [super init])) 60 return nil; 61 62 _inspectorProxy = inspectorProxy; // Not retained to prevent cycles 63 64 return self; 65 } 66 67 - (void)windowWillClose:(NSNotification *)notification; 68 { 69 _inspectorProxy->close(); 70 } 71 72 @end 36 73 37 74 namespace WebKit { … … 48 85 } 49 86 87 void WebInspectorProxy::platformOpen() 88 { 89 ASSERT(!m_inspectorWindow); 90 91 m_inspectorProxyObjCAdapter.adoptNS([[WebInspectorProxyObjCAdapter alloc] initWithWebInspectorProxy:this]); 92 93 // FIXME: support opening in docked mode here. 94 95 NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | NSTexturedBackgroundWindowMask); 96 NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; 97 [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; 98 [window setContentBorderThickness:windowContentBorderThickness forEdge:NSMaxYEdge]; 99 [window setDelegate:m_inspectorProxyObjCAdapter.get()]; 100 [window setMinSize:NSMakeSize(minimumWindowWidth, minimumWindowHeight)]; 101 [window setReleasedWhenClosed:NO]; 102 103 // Center the window initially before setting the frame autosave name so that the window will be in a good 104 // position if there is no saved frame yet. 105 [window center]; 106 [window setFrameAutosaveName:@"Web Inspector 2"]; 107 108 WKNSWindowMakeBottomCornersSquare(window); 109 110 NSView *contentView = [window contentView]; 111 [m_inspectorView.get() setFrame:[contentView bounds]]; 112 [m_inspectorView.get() setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; 113 [contentView addSubview:m_inspectorView.get()]; 114 115 [window makeKeyAndOrderFront:nil]; 116 117 m_inspectorWindow.adoptNS(window); 118 } 119 120 void WebInspectorProxy::platformClose() 121 { 122 // FIXME: support closing in docked mode here. 123 124 [m_inspectorWindow.get() setDelegate:nil]; 125 [m_inspectorWindow.get() orderOut:nil]; 126 127 m_inspectorWindow = 0; 128 m_inspectorView = 0; 129 m_inspectorProxyObjCAdapter = 0; 130 } 131 50 132 String WebInspectorProxy::inspectorPageURL() const 51 133 { -
trunk/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
r72666 r73324 41 41 } 42 42 43 void WebInspectorProxy::platformOpen() 44 { 45 notImplemented(); 46 } 47 48 void WebInspectorProxy::platformClose() 49 { 50 notImplemented(); 51 } 52 43 53 String WebInspectorProxy::inspectorPageURL() const 44 54 { -
trunk/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
r72666 r73324 41 41 } 42 42 43 void WebInspectorProxy::platformOpen() 44 { 45 notImplemented(); 46 } 47 48 void WebInspectorProxy::platformClose() 49 { 50 notImplemented(); 51 } 52 43 53 String WebInspectorProxy::inspectorPageURL() const 44 54 { -
trunk/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
r72666 r73324 77 77 bool WebInspectorClient::sendMessageToFrontend(const String& message) 78 78 { 79 if (WebPage* inspectorPage = m_page->inspector()->inspectorPage()) 80 return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message); 81 return false; 79 WebInspector* inspector = m_page->inspector(); 80 if (!inspector) 81 return false; 82 WebPage* inspectorPage = inspector->inspectorPage(); 83 if (!inspectorPage) 84 return false; 85 return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message); 82 86 } 83 87 -
trunk/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
r72666 r73324 71 71 void WebInspectorFrontendClient::closeWindow() 72 72 { 73 notImplemented();73 m_page->inspector()->didClose(); 74 74 } 75 75 76 76 void WebInspectorFrontendClient::disconnectFromBackend() 77 77 { 78 notImplemented();78 m_page->inspector()->didClose(); 79 79 } 80 80 … … 99 99 } 100 100 101 void WebInspectorFrontendClient::sendMessageToBackend(const String&)102 {103 notImplemented();104 }105 106 101 } // namespace WebKit 107 102 -
trunk/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h
r72666 r73324 55 55 virtual void inspectedURLChanged(const String&); 56 56 57 virtual void sendMessageToBackend(const String&);58 59 57 WebPage* m_page; 60 58 }; -
trunk/WebKit2/WebProcess/WebPage/WebInspector.cpp
r72666 r73324 76 76 } 77 77 78 void WebInspector::didClose() 79 { 80 WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID()); 81 } 82 78 83 // Called by WebInspector messages 79 84 void WebInspector::show() -
trunk/WebKit2/WebProcess/WebPage/WebInspector.h
r72666 r73324 59 59 // Called from WebInspectorFrontendClient 60 60 void didLoadInspectorPage(); 61 void didClose(); 61 62 62 63 // Implemented in platform WebInspector file
Note: See TracChangeset
for help on using the changeset viewer.