[WinCairo] Support display of webinspector ui on non-legacy minibrowser
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jul 2018 18:22:15 +0000 (18:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jul 2018 18:22:15 +0000 (18:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187415

Patch by Stephan Szabo <stephan.szabo@sony.com> on 2018-07-10
Reviewed by Brian Burg.

Source/WebKit:

* UIProcess/WebInspectorProxy.h:
* UIProcess/win/WebInspectorProxyWin.cpp:
(WebKit::getInspectedWindowInfo):
(WebKit::WebInspectorProxy::windowReceivedMessage):
(WebKit::WebInspectorProxy::wndProc):
(WebKit::WebInspectorProxy::registerWindowClass):
(WebKit::decidePolicyForNavigationAction):
(WebKit::webProcessDidCrash):
(WebKit::WebInspectorProxy::platformCreateFrontendPage):
(WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
(WebKit::WebInspectorProxy::inspectorPageURL):
(WebKit::WebInspectorProxy::inspectorTestPageURL):
(WebKit::WebInspectorProxy::inspectorBaseURL):
(WebKit::WebInspectorProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorProxy::platformAttach):
(WebKit::WebInspectorProxy::platformDetach):
(WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
(WebKit::WebInspectorProxy::platformIsFront):
(WebKit::WebInspectorProxy::platformHide):
(WebKit::WebInspectorProxy::platformBringToFront):
(WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
(WebKit::WebInspectorProxy::platformInspectedURLChanged):
(WebKit::WebInspectorProxy::platformCreateFrontendWindow):
(WebKit::WebInspectorProxy::platformDidCloseForCrash):
(WebKit::WebInspectorProxy::platformInvalidate):
(WebKit::WebInspectorProxy::platformStartWindowDrag):
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::openFrontendConnection):
* WebProcess/WebPage/win/WebInspectorUIWin.cpp:
(WebKit::WebInspectorUI::localizedStringsURL):
(WebKit::RemoteWebInspectorUI::localizedStringsURL):

Tools:

* MiniBrowser/win/WebKitBrowserWindow.cpp:
(WebKitBrowserWindow::WebKitBrowserWindow):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebInspectorProxy.h
Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp
Source/WebKit/WebProcess/WebPage/WebInspector.cpp
Source/WebKit/WebProcess/WebPage/win/WebInspectorUIWin.cpp
Tools/ChangeLog
Tools/MiniBrowser/win/WebKitBrowserWindow.cpp

index 2ec70fc..c7ac807 100644 (file)
@@ -1,3 +1,44 @@
+2018-07-10  Stephan Szabo  <stephan.szabo@sony.com>
+
+        [WinCairo] Support display of webinspector ui on non-legacy minibrowser
+        https://bugs.webkit.org/show_bug.cgi?id=187415
+
+        Reviewed by Brian Burg.
+
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/win/WebInspectorProxyWin.cpp:
+        (WebKit::getInspectedWindowInfo):
+        (WebKit::WebInspectorProxy::windowReceivedMessage):
+        (WebKit::WebInspectorProxy::wndProc):
+        (WebKit::WebInspectorProxy::registerWindowClass):
+        (WebKit::decidePolicyForNavigationAction):
+        (WebKit::webProcessDidCrash):
+        (WebKit::WebInspectorProxy::platformCreateFrontendPage):
+        (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
+        (WebKit::WebInspectorProxy::inspectorPageURL):
+        (WebKit::WebInspectorProxy::inspectorTestPageURL):
+        (WebKit::WebInspectorProxy::inspectorBaseURL):
+        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
+        (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
+        (WebKit::WebInspectorProxy::platformAttach):
+        (WebKit::WebInspectorProxy::platformDetach):
+        (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
+        (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
+        (WebKit::WebInspectorProxy::platformIsFront):
+        (WebKit::WebInspectorProxy::platformHide):
+        (WebKit::WebInspectorProxy::platformBringToFront):
+        (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
+        (WebKit::WebInspectorProxy::platformInspectedURLChanged):
+        (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
+        (WebKit::WebInspectorProxy::platformDidCloseForCrash):
+        (WebKit::WebInspectorProxy::platformInvalidate):
+        (WebKit::WebInspectorProxy::platformStartWindowDrag):
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::openFrontendConnection):
+        * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
+        (WebKit::WebInspectorUI::localizedStringsURL):
+        (WebKit::RemoteWebInspectorUI::localizedStringsURL):
+
 2018-07-10  John Wilander  <wilander@apple.com>
 
         Resource Load Statistics: Make testRunner.statisticsResetToConsistentState() take a completion handler
index 31d9ab4..84420a1 100644 (file)
@@ -46,6 +46,8 @@ OBJC_CLASS NSView;
 OBJC_CLASS NSWindow;
 OBJC_CLASS WKWebInspectorProxyObjCAdapter;
 OBJC_CLASS WKInspectorViewController;
+#elif PLATFORM(WIN)
+#include "WebView.h"
 #endif
 
 namespace WebCore {
@@ -65,7 +67,13 @@ enum class AttachmentSide {
     Left,
 };
 
-class WebInspectorProxy : public API::ObjectImpl<API::Object::Type::Inspector>, public IPC::MessageReceiver {
+class WebInspectorProxy
+    : public API::ObjectImpl<API::Object::Type::Inspector>
+    , public IPC::MessageReceiver
+#if PLATFORM(WIN)
+    , public WebCore::WindowMessageListener
+#endif
+{
 public:
     static Ref<WebInspectorProxy> create(WebPageProxy* inspectedPage)
     {
@@ -213,6 +221,12 @@ private:
     void updateInspectorWindowTitle() const;
 #endif
 
+#if PLATFORM(WIN)
+    static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
+    bool registerWindowClass();
+    void windowReceivedMessage(HWND, UINT, WPARAM, LPARAM) override;
+#endif
+
     WebPageProxy* m_inspectedPage { nullptr };
     WebPageProxy* m_inspectorPage { nullptr };
 
@@ -244,6 +258,12 @@ private:
     GtkWidget* m_inspectorWindow { nullptr };
     GtkWidget* m_headerBar { nullptr };
     String m_inspectedURLString;
+#elif PLATFORM(WIN)
+    HWND m_inspectedViewWindow { nullptr };
+    HWND m_inspectedViewParentWindow { nullptr };
+    HWND m_inspectorViewWindow { nullptr };
+    HWND m_inspectorDetachWindow { nullptr };
+    RefPtr<WebView> m_inspectorView;
 #endif
 };
 
index 34cea34..7941e53 100644 (file)
 #include "config.h"
 #include "WebInspectorProxy.h"
 
+#include "APINavigationAction.h"
+#include "APIPageConfiguration.h"
+#include "CFURLExtras.h"
+#include "PageClientImpl.h"
+#include "WebFramePolicyListenerProxy.h"
+#include "WebPageGroup.h"
+#include "WebPageProxy.h"
+#include "WebPreferences.h"
+#include "WebProcessPool.h"
+#include "WebView.h"
+#include <WebCore/InspectorFrontendClientLocal.h>
 #include <WebCore/NotImplemented.h>
+#include <WebCore/WebCoreBundleWin.h>
+#include <WebCore/WebCoreInstanceHandle.h>
+#include <WebCore/WindowMessageBroadcaster.h>
+#include <WebKit/WKPage.h>
 
 namespace WebKit {
 
-WebPageProxy* WebInspectorProxy::platformCreateFrontendPage()
-{
-    notImplemented();
-    return nullptr;
-}
+static const LPCWSTR WebInspectorProxyPointerProp = L"WebInspectorProxyPointer";
+static const LPCWSTR WebInspectorProxyClassName = L"WebInspectorProxyClass";
 
-void WebInspectorProxy::platformCreateFrontendWindow()
-{
-    notImplemented();
-}
+struct InspectedWindowInfo {
+    int left;
+    int top;
+    int viewWidth;
+    int viewHeight;
+    int parentWidth;
+    int parentHeight;
+};
 
-void WebInspectorProxy::platformCloseFrontendPageAndWindow()
+static InspectedWindowInfo getInspectedWindowInfo(HWND inspectedWindow, HWND parentWindow)
 {
-    notImplemented();
+    RECT rect;
+    ::GetClientRect(inspectedWindow, &rect);
+    ::MapWindowPoints(inspectedWindow, parentWindow, (LPPOINT)&rect, 2);
+
+    RECT parentRect;
+    ::GetClientRect(parentWindow, &parentRect);
+    return { rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, parentRect.right - parentRect.left, parentRect.bottom - parentRect.top };
 }
 
-void WebInspectorProxy::platformDidCloseForCrash()
+void WebInspectorProxy::windowReceivedMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
 {
-    notImplemented();
+    switch (msg) {
+    case WM_WINDOWPOSCHANGING: {
+        if (!m_isAttached)
+            return;
+
+        auto windowPos = reinterpret_cast<WINDOWPOS*>(lParam);
+
+        if (windowPos->flags & SWP_NOSIZE)
+            return;
+
+        HWND parent = GetParent(hwnd);
+        RECT parentRect;
+        GetClientRect(parent, &parentRect);
+
+        RECT inspectorRect;
+        GetClientRect(m_inspectorViewWindow, &inspectorRect);
+
+        switch (m_attachmentSide) {
+        case AttachmentSide::Bottom: {
+            unsigned inspectorHeight = WebCore::InspectorFrontendClientLocal::constrainedAttachedWindowHeight(inspectorRect.bottom - inspectorRect.top, windowPos->cy);
+            windowPos->cy -= inspectorHeight;
+            ::SetWindowPos(m_inspectorViewWindow, 0, windowPos->x, windowPos->y + windowPos->cy, windowPos->cx, inspectorHeight, SWP_NOZORDER);
+            break;
+        }
+        case AttachmentSide::Left:
+        case AttachmentSide::Right: {
+            unsigned inspectorWidth = WebCore::InspectorFrontendClientLocal::constrainedAttachedWindowWidth(inspectorRect.right - inspectorRect.left, windowPos->cx);
+            windowPos->cx -= inspectorWidth;
+            ::SetWindowPos(m_inspectorViewWindow, 0, windowPos->x + windowPos->cx, windowPos->y, inspectorWidth, windowPos->cy, SWP_NOZORDER);
+            break;
+        }
+        default:
+            break;
+        }
+        break;
+    }
+    default:
+        break;
+    }
 }
 
-void WebInspectorProxy::platformInvalidate()
+LRESULT CALLBACK WebInspectorProxy::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    notImplemented();
+    WebInspectorProxy* client = reinterpret_cast<WebInspectorProxy*>(::GetProp(hwnd, WebInspectorProxyPointerProp));
+    switch (msg) {
+    case WM_SIZE:
+        ::SetWindowPos(client->m_inspectorViewWindow, 0, 0, 0, LOWORD(lParam), HIWORD(lParam), SWP_NOZORDER);
+        return 0;
+    case WM_CLOSE:
+        client->close();
+        return 0;
+    default:
+        break;
+    }
+    return ::DefWindowProc(hwnd, msg, wParam, lParam);
 }
 
-void WebInspectorProxy::platformHide()
+bool WebInspectorProxy::registerWindowClass()
 {
-    notImplemented();
+    static bool haveRegisteredWindowClass = false;
+
+    if (haveRegisteredWindowClass)
+        return true;
+    haveRegisteredWindowClass = true;
+
+    WNDCLASSEX wcex;
+    wcex.cbSize = sizeof(WNDCLASSEX);
+    wcex.style = 0;
+    wcex.lpfnWndProc = wndProc;
+    wcex.cbClsExtra = 0;
+    wcex.cbWndExtra = 0;
+    wcex.hInstance = WebCore::instanceHandle();
+    wcex.hIcon = 0;
+    wcex.hCursor = LoadCursor(0, IDC_ARROW);
+    wcex.hbrBackground = 0;
+    wcex.lpszMenuName = 0;
+    wcex.lpszClassName = WebInspectorProxyClassName;
+    wcex.hIconSm = 0;
+    return ::RegisterClassEx(&wcex);
 }
 
-void WebInspectorProxy::platformBringToFront()
+static void decidePolicyForNavigationAction(WKPageRef pageRef, WKNavigationActionRef navigationActionRef, WKFramePolicyListenerRef listenerRef, WKTypeRef, const void* clientInfo)
 {
-    notImplemented();
+    // Allow non-main frames to navigate anywhere.
+    API::FrameInfo* sourceFrame = toImpl(navigationActionRef)->sourceFrame();
+    if (sourceFrame && !sourceFrame->isMainFrame()) {
+        toImpl(listenerRef)->use({ });
+        return;
+    }
+
+    const WebInspectorProxy* webInspectorProxy = static_cast<const WebInspectorProxy*>(clientInfo);
+    ASSERT(webInspectorProxy);
+
+    WebCore::ResourceRequest request = toImpl(navigationActionRef)->request();
+
+    // Allow loading of the main inspector file.
+    if (WebInspectorProxy::isMainOrTestInspectorPage(request.url())) {
+        toImpl(listenerRef)->use({ });
+        return;
+    }
+
+    // Prevent everything else from loading in the inspector's page.
+    toImpl(listenerRef)->ignore();
+
+    // And instead load it in the inspected page.
+    webInspectorProxy->inspectedPage()->loadRequest(WTFMove(request));
 }
 
-void WebInspectorProxy::platformBringInspectedPageToFront()
+static void webProcessDidCrash(WKPageRef, const void* clientInfo)
 {
-    notImplemented();
+    WebInspectorProxy* webInspectorProxy = static_cast<WebInspectorProxy*>(const_cast<void*>(clientInfo));
+    ASSERT(webInspectorProxy);
+    webInspectorProxy->closeForCrash();
 }
 
-bool WebInspectorProxy::platformIsFront()
+WebPageProxy* WebInspectorProxy::platformCreateFrontendPage()
 {
-    notImplemented();
-    return false;
+    ASSERT(inspectedPage());
+
+    RefPtr<WebPreferences> preferences = WebPreferences::create(String(), "WebKit2.", "WebKit2.");
+#if ENABLE(DEVELOPER_MODE)
+    // Allow developers to inspect the Web Inspector in debug builds without changing settings.
+    preferences->setDeveloperExtrasEnabled(true);
+    preferences->setLogsPageMessagesToSystemConsoleEnabled(true);
+#endif
+    preferences->setAllowFileAccessFromFileURLs(true);
+    preferences->setJavaScriptRuntimeFlags({ });
+    RefPtr<WebPageGroup> pageGroup = WebPageGroup::create(inspectorPageGroupIdentifierForPage(inspectedPage()), false, false);
+    auto pageConfiguration = API::PageConfiguration::create();
+    pageConfiguration->setProcessPool(&inspectorProcessPool(inspectionLevel()));
+    pageConfiguration->setPreferences(preferences.get());
+    pageConfiguration->setPageGroup(pageGroup.get());
+
+    WKPageNavigationClientV0 navigationClient = {
+        { 0, this },
+        decidePolicyForNavigationAction,
+        nullptr, // decidePolicyForNavigationResponse
+        nullptr, // decidePolicyForPluginLoad
+        nullptr, // didStartProvisionalNavigation
+        nullptr, // didReceiveServerRedirectForProvisionalNavigation
+        nullptr, // didFailProvisionalNavigation
+        nullptr, // didCommitNavigation
+        nullptr, // didFinishNavigation
+        nullptr, // didFailNavigation
+        nullptr, // didFailProvisionalLoadInSubframe
+        nullptr, // didFinishDocumentLoad
+        nullptr, // didSameDocumentNavigation
+        nullptr, // renderingProgressDidChange
+        nullptr, // canAuthenticateAgainstProtectionSpace
+        nullptr, // didReceiveAuthenticationChallenge
+        webProcessDidCrash,
+        nullptr, // copyWebCryptoMasterKey
+
+        nullptr, // didBeginNavigationGesture
+        nullptr, // willEndNavigationGesture
+        nullptr, // didEndNavigationGesture
+        nullptr, // didRemoveNavigationGestureSnapshot
+    };
+
+    RECT r = { 0, 0, initialWindowWidth, initialWindowHeight };
+    auto page = inspectedPage();
+    m_inspectedViewWindow = page->viewWidget();
+    m_inspectedViewParentWindow = ::GetParent(m_inspectedViewWindow);
+    auto view = WebView::create(r, pageConfiguration, m_inspectedViewParentWindow);
+    m_inspectorView = &view.leakRef();
+    auto inspectorPage = m_inspectorView->page();
+    m_inspectorViewWindow = inspectorPage->viewWidget();
+    WKPageSetPageNavigationClient(toAPI(inspectorPage), &navigationClient.base);
+
+    return inspectorPage;
 }
 
-void WebInspectorProxy::platformInspectedURLChanged(const String& /* url */)
+void WebInspectorProxy::platformCloseFrontendPageAndWindow()
 {
-    notImplemented();
+    WebCore::WindowMessageBroadcaster::removeListener(m_inspectedViewWindow, this);
+    m_inspectorView = nullptr;
+    m_inspectorPage = nullptr;
+    if (m_inspectorViewWindow) {
+        ::DestroyWindow(m_inspectorViewWindow);
+        m_inspectorViewWindow = nullptr;
+    }
+    if (m_inspectorDetachWindow) {
+        ::RemoveProp(m_inspectorDetachWindow, WebInspectorProxyPointerProp);
+        ::DestroyWindow(m_inspectorDetachWindow);
+        m_inspectorDetachWindow = nullptr;
+    }
+    m_inspectedViewWindow = nullptr;
+    m_inspectedViewParentWindow = nullptr;
 }
 
 String WebInspectorProxy::inspectorPageURL()
 {
-    return String();
+    RetainPtr<CFURLRef> htmlURLRef = adoptCF(CFBundleCopyResourceURL(WebCore::webKitBundle(), CFSTR("Main"), CFSTR("html"), CFSTR("WebInspectorUI")));
+    return CFURLGetString(htmlURLRef.get());
 }
 
 String WebInspectorProxy::inspectorTestPageURL()
 {
-    return String();
+    RetainPtr<CFURLRef> htmlURLRef = adoptCF(CFBundleCopyResourceURL(WebCore::webKitBundle(), CFSTR("Test"), CFSTR("html"), CFSTR("WebInspectorUI")));
+    return CFURLGetString(htmlURLRef.get());
 }
 
 String WebInspectorProxy::inspectorBaseURL()
 {
-    return String();
+    RetainPtr<CFURLRef> baseURLRef = adoptCF(CFBundleCopyResourceURL(WebCore::webKitBundle(), CFSTR("WebInspectorUI"), nullptr, nullptr));
+    return CFURLGetString(baseURLRef.get());
 }
 
 unsigned WebInspectorProxy::platformInspectedWindowHeight()
 {
-    return 0;
+    RECT rect;
+    ::GetClientRect(m_inspectedViewWindow, &rect);
+    return rect.bottom - rect.top;
 }
 
 unsigned WebInspectorProxy::platformInspectedWindowWidth()
 {
-    return 0;
+    RECT rect;
+    ::GetClientRect(m_inspectedViewWindow, &rect);
+    return rect.right - rect.left;
 }
 
 void WebInspectorProxy::platformAttach()
 {
-    notImplemented();
+    static const unsigned defaultAttachedSize = 300;
+    static const unsigned minimumAttachedWidth = 750;
+    static const unsigned minimumAttachedHeight = 250;
+
+    unsigned inspectedHeight = platformInspectedWindowHeight();
+    unsigned inspectedWidth = platformInspectedWindowWidth();
+
+    if (m_inspectorDetachWindow && ::GetParent(m_inspectorViewWindow) == m_inspectorDetachWindow) {
+        ::SetParent(m_inspectorViewWindow, m_inspectedViewParentWindow);
+        ::ShowWindow(m_inspectorDetachWindow, SW_HIDE);
+    }
+
+    WebCore::WindowMessageBroadcaster::addListener(m_inspectedViewWindow, this);
+
+    if (m_attachmentSide == AttachmentSide::Bottom) {
+        unsigned maximumAttachedHeight = platformInspectedWindowHeight() * 3 / 4;
+        platformSetAttachedWindowHeight(std::max(minimumAttachedHeight, std::min(defaultAttachedSize, maximumAttachedHeight)));
+    } else {
+        unsigned maximumAttachedWidth = platformInspectedWindowWidth() * 3 / 4;
+        platformSetAttachedWindowWidth(std::max(minimumAttachedWidth, std::min(defaultAttachedSize, maximumAttachedWidth)));
+    }
+    ::ShowWindow(m_inspectorViewWindow, SW_SHOW);
 }
 
 void WebInspectorProxy::platformDetach()
 {
+    if (!inspectedPage()->isValid())
+        return;
+
+    if (!m_inspectorDetachWindow) {
+        static bool haveRegisteredClass = false;
+        registerWindowClass();
+        m_inspectorDetachWindow = ::CreateWindowEx(0, WebInspectorProxyClassName, 0, WS_OVERLAPPEDWINDOW,
+            CW_USEDEFAULT, CW_USEDEFAULT, initialWindowWidth, initialWindowHeight,
+            0, 0, WebCore::instanceHandle(), 0);
+        ::SetProp(m_inspectorDetachWindow, WebInspectorProxyPointerProp, reinterpret_cast<HANDLE>(this));
+    }
+
+    WebCore::WindowMessageBroadcaster::removeListener(m_inspectedViewWindow, this);
+
+    RECT rect;
+    ::GetClientRect(m_inspectorDetachWindow, &rect);
+    auto windowInfo = getInspectedWindowInfo(m_inspectedViewWindow, m_inspectedViewParentWindow);
+    ::SetParent(m_inspectorViewWindow, m_inspectorDetachWindow);
+    ::SetWindowPos(m_inspectorViewWindow, 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
+    ::SetWindowPos(m_inspectedViewWindow, 0, windowInfo.left, windowInfo.top, windowInfo.parentWidth - windowInfo.left, windowInfo.parentHeight - windowInfo.top, SWP_NOZORDER);
+
+    if (m_isVisible)
+        ::ShowWindow(m_inspectorDetachWindow, SW_SHOW);
+}
+
+void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned height)
+{
+    auto windowInfo = getInspectedWindowInfo(m_inspectedViewWindow, m_inspectedViewParentWindow);
+    ::SetWindowPos(m_inspectorViewWindow, 0, windowInfo.left, windowInfo.parentHeight - height, windowInfo.parentWidth - windowInfo.left, height, SWP_NOZORDER);
+    ::SetWindowPos(m_inspectedViewWindow, 0, windowInfo.left, windowInfo.top, windowInfo.parentWidth - windowInfo.left, windowInfo.parentHeight - windowInfo.top, SWP_NOZORDER);
+}
+
+void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned width)
+{
+    auto windowInfo = getInspectedWindowInfo(m_inspectedViewWindow, m_inspectedViewParentWindow);
+    ::SetWindowPos(m_inspectorViewWindow, 0, windowInfo.parentWidth - width, windowInfo.top, width, windowInfo.parentHeight - windowInfo.top, SWP_NOZORDER);
+    ::SetWindowPos(m_inspectedViewWindow, 0, windowInfo.left, windowInfo.top, windowInfo.parentWidth - windowInfo.left, windowInfo.parentHeight - windowInfo.top, SWP_NOZORDER);
+}
+
+bool WebInspectorProxy::platformIsFront()
+{
     notImplemented();
+    return false;
 }
 
-void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned /* height */)
+void WebInspectorProxy::platformHide()
 {
     notImplemented();
 }
 
-void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned /* width */)
+void WebInspectorProxy::platformBringToFront()
 {
     notImplemented();
 }
 
-void WebInspectorProxy::platformStartWindowDrag()
+void WebInspectorProxy::platformBringInspectedPageToFront()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformInspectedURLChanged(const String& /* url */)
 {
     notImplemented();
 }
@@ -148,4 +401,24 @@ void WebInspectorProxy::platformAttachAvailabilityChanged(bool /* available */)
     notImplemented();
 }
 
-} // namespace WebKit
+void WebInspectorProxy::platformCreateFrontendWindow()
+{
+    platformDetach();
+}
+
+void WebInspectorProxy::platformDidCloseForCrash()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformInvalidate()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformStartWindowDrag()
+{
+    notImplemented();
+}
+
+}
index e67930a..004f2ff 100644 (file)
@@ -88,13 +88,16 @@ void WebInspector::openFrontendConnection(bool underTest)
 
     IPC::Connection::Identifier connectionIdentifier(listeningPort);
     IPC::Attachment connectionClientPort(listeningPort, MACH_MSG_TYPE_MOVE_SEND);
-
+#elif PLATFORM(WIN)
+    IPC::Connection::Identifier connectionIdentifier, connClient;
+    IPC::Connection::createServerAndClientIdentifiers(connectionIdentifier, connClient);
+    IPC::Attachment connectionClientPort(connClient);
 #else
     notImplemented();
     return;
 #endif
 
-#if USE(UNIX_DOMAIN_SOCKETS) || OS(DARWIN)
+#if USE(UNIX_DOMAIN_SOCKETS) || OS(DARWIN) || PLATFORM(WIN)
     m_frontendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
     m_frontendConnection->open();
 
index b53b0ce..6a7af3c 100644 (file)
@@ -29,6 +29,7 @@
 #include "RemoteWebInspectorUI.h"
 
 #include <WebCore/FileSystem.h>
+#include <WebCore/WebCoreBundleWin.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebKit {
@@ -40,12 +41,14 @@ bool WebInspectorUI::canSave()
 
 String WebInspectorUI::localizedStringsURL()
 {
-    return String();
+    RetainPtr<CFURLRef> stringsURLRef = adoptCF(CFBundleCopyResourceURL(WebCore::webKitBundle(), CFSTR("localizedStrings"), CFSTR("js"), CFSTR("WebInspectorUI")));
+    return CFURLGetString(stringsURLRef.get());
 }
 
 String RemoteWebInspectorUI::localizedStringsURL()
 {
-    return String();
+    RetainPtr<CFURLRef> stringsURLRef = adoptCF(CFBundleCopyResourceURL(WebCore::webKitBundle(), CFSTR("localizedStrings"), CFSTR("js"), CFSTR("WebInspectorUI")));
+    return CFURLGetString(stringsURLRef.get());
 }
 
 } // namespace WebKit
index 8d06969..49bea41 100644 (file)
@@ -1,3 +1,13 @@
+2018-07-10  Stephan Szabo  <stephan.szabo@sony.com>
+
+        [WinCairo] Support display of webinspector ui on non-legacy minibrowser
+        https://bugs.webkit.org/show_bug.cgi?id=187415
+
+        Reviewed by Brian Burg.
+
+        * MiniBrowser/win/WebKitBrowserWindow.cpp:
+        (WebKitBrowserWindow::WebKitBrowserWindow):
+
 2018-07-10  John Wilander  <wilander@apple.com>
 
         Resource Load Statistics: Make testRunner.statisticsResetToConsistentState() take a completion handler
index 1f2ac36..cd69795 100644 (file)
@@ -80,6 +80,11 @@ WebKitBrowserWindow::WebKitBrowserWindow(HWND mainWnd, HWND urlBarWnd)
 {
     RECT rect = { };
     auto conf = adoptWK(WKPageConfigurationCreate());
+
+    auto prefs = WKPreferencesCreate();
+    WKPreferencesSetDeveloperExtrasEnabled(prefs, true);
+    WKPageConfigurationSetPreferences(conf.get(), prefs);
+
     auto context = adoptWK(WKContextCreate());
     WKPageConfigurationSetContext(conf.get(), context.get());