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

bweinstein at apple.com bweinstein at apple.com
Wed Dec 22 18:29:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 67a46dba0de7f1ed87b39a9cf01e4e138ef2ac7a
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Dec 12 20:15:51 2010 +0000

    Web Inspector: Make inspector on Windows show and be usable in WebKit2
    https://bugs.webkit.org/show_bug.cgi?id=50877
    
    Reviewed by Sam Weinig.
    
    Hook up the unimplemented methods in WebInspectorProxyWin to get the web inspector
    showing and usable in WebKit2 on Windows.
    
    * UIProcess/WebInspectorProxy.cpp:
    (WebKit::WebInspectorProxy::WebInspectorProxy): Initialize Windows-specific variables to 0.
    * UIProcess/WebInspectorProxy.h:
    * UIProcess/win/WebInspectorProxyWin.cpp:
    (WebKit::WebInspectorProxy::registerInspectorViewWindowClass): Sets up the inspector view class.
    (WebKit::WebInspectorProxy::InspectorViewWndProc): Calls through to the WebInspectorProxy's non-static
        WndProc.
    (WebKit::WebInspectorProxy::wndProc): Handles WM_SIZE, WM_CLOSE, and WM_GETMINMAXINFO, the rest go to
        ::DefWindowProc.
    (WebKit::WebInspectorProxy::onSizeEvent): Resize the WKView that has the inspector page to match the
        outer window that was just resized.
    (WebKit::WebInspectorProxy::onMinMaxInfoEvent): Set the minimum size the window can be resized to.
    (WebKit::WebInspectorProxy::onCloseEvent): Hide the window, and call WebInspectorProxy::close.
    (WebKit::WebInspectorProxy::platformCreateInspectorPage): Create a WKView and return its page.
    (WebKit::WebInspectorProxy::platformOpen): Create an HWND for the inspector, put the inspector's WKView
        inside of it, and show the window.
    (WebKit::WebInspectorProxy::platformClose): Destroy the inspector's window (which destroys the child WKView),
        and 0 out instance variables.
    (WebKit::WebInspectorProxy::inspectorPageURL): Finds inspector/inspector.html in the WebKit bundle.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73877 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 9ed6443..14f5f0d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,33 @@
+2010-12-11  Brian Weinstein  <bweinstein at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Web Inspector: Make inspector on Windows show and be usable in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=50877
+        
+        Hook up the unimplemented methods in WebInspectorProxyWin to get the web inspector
+        showing and usable in WebKit2 on Windows.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::WebInspectorProxy): Initialize Windows-specific variables to 0.
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/win/WebInspectorProxyWin.cpp:
+        (WebKit::WebInspectorProxy::registerInspectorViewWindowClass): Sets up the inspector view class.
+        (WebKit::WebInspectorProxy::InspectorViewWndProc): Calls through to the WebInspectorProxy's non-static
+            WndProc.
+        (WebKit::WebInspectorProxy::wndProc): Handles WM_SIZE, WM_CLOSE, and WM_GETMINMAXINFO, the rest go to 
+            ::DefWindowProc.
+        (WebKit::WebInspectorProxy::onSizeEvent): Resize the WKView that has the inspector page to match the
+            outer window that was just resized.
+        (WebKit::WebInspectorProxy::onMinMaxInfoEvent): Set the minimum size the window can be resized to.
+        (WebKit::WebInspectorProxy::onCloseEvent): Hide the window, and call WebInspectorProxy::close.
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage): Create a WKView and return its page.
+        (WebKit::WebInspectorProxy::platformOpen): Create an HWND for the inspector, put the inspector's WKView
+            inside of it, and show the window.
+        (WebKit::WebInspectorProxy::platformClose): Destroy the inspector's window (which destroys the child WKView), 
+            and 0 out instance variables.
+        (WebKit::WebInspectorProxy::inspectorPageURL): Finds inspector/inspector.html in the WebKit bundle.
+
 2010-12-12  Balazs Kelemen  <kbalazs at webkit.org>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit2/UIProcess/WebInspectorProxy.cpp b/WebKit2/UIProcess/WebInspectorProxy.cpp
index 62b4bd2..970305e 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -53,6 +53,10 @@ WebInspectorProxy::WebInspectorProxy(WebPageProxy* page)
     , m_isDebuggingJavaScript(false)
     , m_isProfilingJavaScript(false)
     , m_isProfilingPage(false)
+#if PLATFORM(WIN)
+    , m_inspectorWindow(0)
+    , m_inspectorView(0)
+#endif
 {
 }
 
diff --git a/WebKit2/UIProcess/WebInspectorProxy.h b/WebKit2/UIProcess/WebInspectorProxy.h
index 19e7a7b..c0f5619 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.h
+++ b/WebKit2/UIProcess/WebInspectorProxy.h
@@ -52,6 +52,10 @@ class WebPageGroup;
 class WebPageProxy;
 struct WebPageCreationParameters;
 
+#if PLATFORM(WIN)
+class WebView;
+#endif
+
 class WebInspectorProxy : public APIObject {
 public:
     static const Type APIType = TypeInspector;
@@ -112,6 +116,16 @@ private:
 
     static WebPageGroup* inspectorPageGroup();
 
+#if PLATFORM(WIN)
+    static bool registerInspectorViewWindowClass();
+    static LRESULT CALLBACK InspectorViewWndProc(HWND, UINT, WPARAM, LPARAM);
+    LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+    LRESULT onSizeEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+    LRESULT onMinMaxInfoEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+    LRESULT onCloseEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+#endif
+
     static const unsigned minimumWindowWidth = 500;
     static const unsigned minimumWindowHeight = 400;
 
@@ -130,6 +144,9 @@ private:
     RetainPtr<WKView> m_inspectorView;
     RetainPtr<NSWindow> m_inspectorWindow;
     RetainPtr<WebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter;
+#elif PLATFORM(WIN)
+    HWND m_inspectorWindow;
+    WebView* m_inspectorView;
 #endif
 };
 
diff --git a/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
index c04bd99..956905a 100644
--- a/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
+++ b/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
@@ -27,33 +27,155 @@
 
 #if ENABLE(INSPECTOR)
 
+#include "WebPageProxy.h"
+#include "WebView.h"
+#include <WebCore/WebCoreInstanceHandle.h>
+#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
-#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
+using namespace WebCore;
 
 namespace WebKit {
 
-WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
+static const LPCWSTR kWebKit2InspectorWindowClassName = L"WebKit2InspectorWindowClass";
+
+bool WebInspectorProxy::registerInspectorViewWindowClass()
+{
+    static bool haveRegisteredWindowClass = false;
+    if (haveRegisteredWindowClass)
+        return true;
+    haveRegisteredWindowClass = true;
+
+    WNDCLASSEX wcex;
+
+    wcex.cbSize = sizeof(WNDCLASSEX);
+    wcex.style          = CS_DBLCLKS;
+    wcex.lpfnWndProc    = WebInspectorProxy::InspectorViewWndProc;
+    wcex.cbClsExtra     = 0;
+    wcex.cbWndExtra     = sizeof(WebInspectorProxy*);
+    wcex.hInstance      = instanceHandle();
+    wcex.hIcon          = 0;
+    wcex.hCursor        = ::LoadCursor(0, IDC_ARROW);
+    wcex.hbrBackground  = 0;
+    wcex.lpszMenuName   = 0;
+    wcex.lpszClassName  = kWebKit2InspectorWindowClassName;
+    wcex.hIconSm        = 0;
+
+    return !!::RegisterClassEx(&wcex);
+}
+
+LRESULT CALLBACK WebInspectorProxy::InspectorViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0);
+    
+    if (WebInspectorProxy* inspectorView = reinterpret_cast<WebInspectorProxy*>(longPtr))
+        return inspectorView->wndProc(hWnd, message, wParam, lParam);
+
+    if (message == WM_CREATE) {
+        LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam);
+
+        // Associate the WebInspectorProxy with the window.
+        ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams);
+        return 0;
+    }
+
+    return ::DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+LRESULT WebInspectorProxy::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    LRESULT lResult = 0;
+    bool handled = true;
+
+    switch (message) {
+    case WM_SIZE:
+        lResult = onSizeEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_GETMINMAXINFO:
+        lResult = onMinMaxInfoEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_CLOSE:
+        lResult = onCloseEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    default:
+        handled = false;
+        break;
+    }
+
+    if (!handled)
+        lResult = ::DefWindowProc(hWnd, message, wParam, lParam);
+
+    return lResult;
+}
+
+LRESULT WebInspectorProxy::onSizeEvent(HWND, UINT, WPARAM, LPARAM, bool&)
+{
+    RECT rect;
+    ::GetClientRect(m_inspectorWindow, &rect);
+
+    ::SetWindowPos(m_inspectorView->window(), 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
+
+    return 0;
+}
+
+LRESULT WebInspectorProxy::onMinMaxInfoEvent(HWND, UINT, WPARAM, LPARAM lParam, bool&)
 {
-    notImplemented();
+    MINMAXINFO* info = reinterpret_cast<MINMAXINFO*>(lParam);
+    POINT size = {minimumWindowWidth, minimumWindowHeight};
+    info->ptMinTrackSize = size;
+
+    return 0;
+}
+
+LRESULT WebInspectorProxy::onCloseEvent(HWND, UINT, WPARAM, LPARAM, bool&)
+{
+    ::ShowWindow(m_inspectorWindow, SW_HIDE);
+    close();
+
     return 0;
 }
 
+WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
+{
+    ASSERT(!m_inspectorView);
+    ASSERT(!m_inspectorWindow);
+
+    RECT emptyRect = {0};
+    m_inspectorView = WebView::create(emptyRect, m_page->pageNamespace(), inspectorPageGroup(), 0).leakRef();
+    
+    return m_inspectorView->page();
+}
+
 void WebInspectorProxy::platformOpen()
 {
-    notImplemented();
+    registerInspectorViewWindowClass();
+
+    m_inspectorWindow = ::CreateWindowEx(0, kWebKit2InspectorWindowClassName, 0, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+        0, 0, initialWindowWidth, initialWindowHeight, 0, 0, instanceHandle(), this);
+    ASSERT(::IsWindow(m_inspectorWindow));
+
+    m_inspectorView->setParentWindow(m_inspectorWindow);
+    ::ShowWindow(m_inspectorWindow, SW_SHOW);
 }
 
 void WebInspectorProxy::platformClose()
 {
-    notImplemented();
+    ASSERT(m_inspectorWindow);
+    ASSERT(m_inspectorView);
+
+    ::DestroyWindow(m_inspectorWindow);
+
+    m_inspectorWindow = 0;
+    m_inspectorView = 0;
 }
 
 String WebInspectorProxy::inspectorPageURL() const
 {
-    notImplemented();
-    return String();
+    RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
+    if (!htmlURLRef)
+        return String();
+
+    return String(CFURLGetString(htmlURLRef.get()));
 }
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list