Changeset 73877 in webkit
- Timestamp:
- Dec 12, 2010 12:15:51 PM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r73876 r73877 1 2010-12-11 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Web Inspector: Make inspector on Windows show and be usable in WebKit2 6 https://bugs.webkit.org/show_bug.cgi?id=50877 7 8 Hook up the unimplemented methods in WebInspectorProxyWin to get the web inspector 9 showing and usable in WebKit2 on Windows. 10 11 * UIProcess/WebInspectorProxy.cpp: 12 (WebKit::WebInspectorProxy::WebInspectorProxy): Initialize Windows-specific variables to 0. 13 * UIProcess/WebInspectorProxy.h: 14 * UIProcess/win/WebInspectorProxyWin.cpp: 15 (WebKit::WebInspectorProxy::registerInspectorViewWindowClass): Sets up the inspector view class. 16 (WebKit::WebInspectorProxy::InspectorViewWndProc): Calls through to the WebInspectorProxy's non-static 17 WndProc. 18 (WebKit::WebInspectorProxy::wndProc): Handles WM_SIZE, WM_CLOSE, and WM_GETMINMAXINFO, the rest go to 19 ::DefWindowProc. 20 (WebKit::WebInspectorProxy::onSizeEvent): Resize the WKView that has the inspector page to match the 21 outer window that was just resized. 22 (WebKit::WebInspectorProxy::onMinMaxInfoEvent): Set the minimum size the window can be resized to. 23 (WebKit::WebInspectorProxy::onCloseEvent): Hide the window, and call WebInspectorProxy::close. 24 (WebKit::WebInspectorProxy::platformCreateInspectorPage): Create a WKView and return its page. 25 (WebKit::WebInspectorProxy::platformOpen): Create an HWND for the inspector, put the inspector's WKView 26 inside of it, and show the window. 27 (WebKit::WebInspectorProxy::platformClose): Destroy the inspector's window (which destroys the child WKView), 28 and 0 out instance variables. 29 (WebKit::WebInspectorProxy::inspectorPageURL): Finds inspector/inspector.html in the WebKit bundle. 30 1 31 2010-12-12 Balazs Kelemen <kbalazs@webkit.org> 2 32 -
trunk/WebKit2/UIProcess/WebInspectorProxy.cpp
r73324 r73877 54 54 , m_isProfilingJavaScript(false) 55 55 , m_isProfilingPage(false) 56 #if PLATFORM(WIN) 57 , m_inspectorWindow(0) 58 , m_inspectorView(0) 59 #endif 56 60 { 57 61 } -
trunk/WebKit2/UIProcess/WebInspectorProxy.h
r73324 r73877 52 52 class WebPageProxy; 53 53 struct WebPageCreationParameters; 54 55 #if PLATFORM(WIN) 56 class WebView; 57 #endif 54 58 55 59 class WebInspectorProxy : public APIObject { … … 113 117 static WebPageGroup* inspectorPageGroup(); 114 118 119 #if PLATFORM(WIN) 120 static bool registerInspectorViewWindowClass(); 121 static LRESULT CALLBACK InspectorViewWndProc(HWND, UINT, WPARAM, LPARAM); 122 LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 123 124 LRESULT onSizeEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 125 LRESULT onMinMaxInfoEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 126 LRESULT onCloseEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled); 127 #endif 128 115 129 static const unsigned minimumWindowWidth = 500; 116 130 static const unsigned minimumWindowHeight = 400; … … 131 145 RetainPtr<NSWindow> m_inspectorWindow; 132 146 RetainPtr<WebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter; 147 #elif PLATFORM(WIN) 148 HWND m_inspectorWindow; 149 WebView* m_inspectorView; 133 150 #endif 134 151 }; -
trunk/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
r73324 r73877 28 28 #if ENABLE(INSPECTOR) 29 29 30 #include "WebPageProxy.h" 31 #include "WebView.h" 32 #include <WebCore/WebCoreInstanceHandle.h> 33 #include <wtf/PassRefPtr.h> 30 34 #include <wtf/text/WTFString.h> 31 35 32 #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 33 #include "NotImplemented.h" 36 using namespace WebCore; 34 37 35 38 namespace WebKit { 36 39 40 static const LPCWSTR kWebKit2InspectorWindowClassName = L"WebKit2InspectorWindowClass"; 41 42 bool WebInspectorProxy::registerInspectorViewWindowClass() 43 { 44 static bool haveRegisteredWindowClass = false; 45 if (haveRegisteredWindowClass) 46 return true; 47 haveRegisteredWindowClass = true; 48 49 WNDCLASSEX wcex; 50 51 wcex.cbSize = sizeof(WNDCLASSEX); 52 wcex.style = CS_DBLCLKS; 53 wcex.lpfnWndProc = WebInspectorProxy::InspectorViewWndProc; 54 wcex.cbClsExtra = 0; 55 wcex.cbWndExtra = sizeof(WebInspectorProxy*); 56 wcex.hInstance = instanceHandle(); 57 wcex.hIcon = 0; 58 wcex.hCursor = ::LoadCursor(0, IDC_ARROW); 59 wcex.hbrBackground = 0; 60 wcex.lpszMenuName = 0; 61 wcex.lpszClassName = kWebKit2InspectorWindowClassName; 62 wcex.hIconSm = 0; 63 64 return !!::RegisterClassEx(&wcex); 65 } 66 67 LRESULT CALLBACK WebInspectorProxy::InspectorViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 68 { 69 LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0); 70 71 if (WebInspectorProxy* inspectorView = reinterpret_cast<WebInspectorProxy*>(longPtr)) 72 return inspectorView->wndProc(hWnd, message, wParam, lParam); 73 74 if (message == WM_CREATE) { 75 LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); 76 77 // Associate the WebInspectorProxy with the window. 78 ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams); 79 return 0; 80 } 81 82 return ::DefWindowProc(hWnd, message, wParam, lParam); 83 } 84 85 LRESULT WebInspectorProxy::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 86 { 87 LRESULT lResult = 0; 88 bool handled = true; 89 90 switch (message) { 91 case WM_SIZE: 92 lResult = onSizeEvent(hWnd, message, wParam, lParam, handled); 93 break; 94 case WM_GETMINMAXINFO: 95 lResult = onMinMaxInfoEvent(hWnd, message, wParam, lParam, handled); 96 break; 97 case WM_CLOSE: 98 lResult = onCloseEvent(hWnd, message, wParam, lParam, handled); 99 break; 100 default: 101 handled = false; 102 break; 103 } 104 105 if (!handled) 106 lResult = ::DefWindowProc(hWnd, message, wParam, lParam); 107 108 return lResult; 109 } 110 111 LRESULT WebInspectorProxy::onSizeEvent(HWND, UINT, WPARAM, LPARAM, bool&) 112 { 113 RECT rect; 114 ::GetClientRect(m_inspectorWindow, &rect); 115 116 ::SetWindowPos(m_inspectorView->window(), 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); 117 118 return 0; 119 } 120 121 LRESULT WebInspectorProxy::onMinMaxInfoEvent(HWND, UINT, WPARAM, LPARAM lParam, bool&) 122 { 123 MINMAXINFO* info = reinterpret_cast<MINMAXINFO*>(lParam); 124 POINT size = {minimumWindowWidth, minimumWindowHeight}; 125 info->ptMinTrackSize = size; 126 127 return 0; 128 } 129 130 LRESULT WebInspectorProxy::onCloseEvent(HWND, UINT, WPARAM, LPARAM, bool&) 131 { 132 ::ShowWindow(m_inspectorWindow, SW_HIDE); 133 close(); 134 135 return 0; 136 } 137 37 138 WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() 38 139 { 39 notImplemented(); 40 return 0; 140 ASSERT(!m_inspectorView); 141 ASSERT(!m_inspectorWindow); 142 143 RECT emptyRect = {0}; 144 m_inspectorView = WebView::create(emptyRect, m_page->pageNamespace(), inspectorPageGroup(), 0).leakRef(); 145 146 return m_inspectorView->page(); 41 147 } 42 148 43 149 void WebInspectorProxy::platformOpen() 44 150 { 45 notImplemented(); 151 registerInspectorViewWindowClass(); 152 153 m_inspectorWindow = ::CreateWindowEx(0, kWebKit2InspectorWindowClassName, 0, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 154 0, 0, initialWindowWidth, initialWindowHeight, 0, 0, instanceHandle(), this); 155 ASSERT(::IsWindow(m_inspectorWindow)); 156 157 m_inspectorView->setParentWindow(m_inspectorWindow); 158 ::ShowWindow(m_inspectorWindow, SW_SHOW); 46 159 } 47 160 48 161 void WebInspectorProxy::platformClose() 49 162 { 50 notImplemented(); 163 ASSERT(m_inspectorWindow); 164 ASSERT(m_inspectorView); 165 166 ::DestroyWindow(m_inspectorWindow); 167 168 m_inspectorWindow = 0; 169 m_inspectorView = 0; 51 170 } 52 171 53 172 String WebInspectorProxy::inspectorPageURL() const 54 173 { 55 notImplemented(); 56 return String(); 174 RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector"))); 175 if (!htmlURLRef) 176 return String(); 177 178 return String(CFURLGetString(htmlURLRef.get())); 57 179 } 58 180
Note: See TracChangeset
for help on using the changeset viewer.