Title: [179573] trunk/Source/WebKit2
Revision
179573
Author
[email protected]
Date
2015-02-03 15:21:47 -0800 (Tue, 03 Feb 2015)

Log Message

Convert WebInspectorProxy to use WKWebView API for the inspector view
https://bugs.webkit.org/show_bug.cgi?id=141037

Reviewed by Timothy Hatcher.

Use the newer API for PLATFORM(MAC). The main difference is that the
WKWebView's page group cannot be set directly; instead, the group identifier
is passed. Also add some preference setters needed for the inspector.

Refactor some code to not use page groups directly. In a future patch,
the PageGroup-based inspector level system will be simplified. It is
it is no longer necessary to keep a static map of PageGroup instances,
since they are only used to save inspector window preferences. (These used
to prevent all levels of inspector from pausing together when a second-level
inspector hit a breakpoint. This is not necessary with multi-process
web inspectors.)

Also, adjust window resizing behavior when the inspector is docked to
the right. Window width resizes should not affect the width of the inspector
frame. This matches the behavior of height changes when docked to the bottom.

To support 32-bit Mac builds where WKWebView is not defined, share the stub
platformFoo() implementations with PLATFORM(IOS). The stubs are now located
in the platform-independent WebInspectorProxy.cpp.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _logsPageMessagesToSystemConsoleEnabled]): Added.
(-[WKPreferences _setLogsPageMessagesToSystemConsoleEnabled:]): Added.
(-[WKPreferences _allowFileAccessFromFileURLs]): Added.
(-[WKPreferences _setAllowFileAccessFromFileURLs:]): Added.
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::WebInspectorProxy):
(WebKit::WebInspectorProxy::inspectorPagePreferences):
(WebKit::WebInspectorProxy::attach):
(WebKit::WebInspectorProxy::detach):
(WebKit::WebInspectorProxy::setAttachedWindowHeight):
(WebKit::WebInspectorProxy::setAttachedWindowWidth):
(WebKit::WebInspectorProxy::createInspectorPage):
(WebKit::WebInspectorProxy::shouldOpenAttached):
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
(WebKit::WebInspectorProxy::platformOpen):
(WebKit::WebInspectorProxy::platformDidClose):
(WebKit::WebInspectorProxy::platformInvalidate):
(WebKit::WebInspectorProxy::platformBringToFront):
(WebKit::WebInspectorProxy::platformHide):
(WebKit::WebInspectorProxy::platformIsFront):
(WebKit::WebInspectorProxy::platformInspectedURLChanged):
(WebKit::WebInspectorProxy::platformSave):
(WebKit::WebInspectorProxy::platformAppend):
(WebKit::WebInspectorProxy::platformInspectedWindowHeight):
(WebKit::WebInspectorProxy::platformInspectedWindowWidth):
(WebKit::WebInspectorProxy::platformAttach):
(WebKit::WebInspectorProxy::platformDetach):
(WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorProxy::platformSetToolbarHeight):
(WebKit::WebInspectorProxy::inspectorPageURL):
(WebKit::WebInspectorProxy::inspectorTestPageURL):
(WebKit::WebInspectorProxy::inspectorBaseURL):
(WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
(WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
* UIProcess/WebInspectorProxy.h:
* UIProcess/ios/WebInspectorProxyIOS.mm: Removed.
* UIProcess/mac/WebInspectorProxyMac.mm:
(-[WKWebInspectorWKWebView _didRelaunchProcess]):
WKWebView doesn't implement this, so remove the super call.
(WebKit::WebInspectorProxy::closeTimerFired):
(WebKit::createDockButton):
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
(WebKit::WebInspectorProxy::platformAttach):
(-[WKWebInspectorWKView _didRelaunchProcess]): Deleted.
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (179572 => 179573)


--- trunk/Source/WebKit2/ChangeLog	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-03 23:21:47 UTC (rev 179573)
@@ -1,3 +1,78 @@
+2015-02-03  Brian J. Burg  <[email protected]>
+
+        Convert WebInspectorProxy to use WKWebView API for the inspector view
+        https://bugs.webkit.org/show_bug.cgi?id=141037
+
+        Reviewed by Timothy Hatcher.
+
+        Use the newer API for PLATFORM(MAC). The main difference is that the
+        WKWebView's page group cannot be set directly; instead, the group identifier
+        is passed. Also add some preference setters needed for the inspector.
+
+        Refactor some code to not use page groups directly. In a future patch,
+        the PageGroup-based inspector level system will be simplified. It is
+        it is no longer necessary to keep a static map of PageGroup instances,
+        since they are only used to save inspector window preferences. (These used
+        to prevent all levels of inspector from pausing together when a second-level
+        inspector hit a breakpoint. This is not necessary with multi-process
+        web inspectors.)
+
+        Also, adjust window resizing behavior when the inspector is docked to
+        the right. Window width resizes should not affect the width of the inspector
+        frame. This matches the behavior of height changes when docked to the bottom.
+
+        To support 32-bit Mac builds where WKWebView is not defined, share the stub
+        platformFoo() implementations with PLATFORM(IOS). The stubs are now located
+        in the platform-independent WebInspectorProxy.cpp.
+
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _logsPageMessagesToSystemConsoleEnabled]): Added.
+        (-[WKPreferences _setLogsPageMessagesToSystemConsoleEnabled:]): Added.
+        (-[WKPreferences _allowFileAccessFromFileURLs]): Added.
+        (-[WKPreferences _setAllowFileAccessFromFileURLs:]): Added.
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::WebInspectorProxy):
+        (WebKit::WebInspectorProxy::inspectorPagePreferences):
+        (WebKit::WebInspectorProxy::attach):
+        (WebKit::WebInspectorProxy::detach):
+        (WebKit::WebInspectorProxy::setAttachedWindowHeight):
+        (WebKit::WebInspectorProxy::setAttachedWindowWidth):
+        (WebKit::WebInspectorProxy::createInspectorPage):
+        (WebKit::WebInspectorProxy::shouldOpenAttached):
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        (WebKit::WebInspectorProxy::platformOpen):
+        (WebKit::WebInspectorProxy::platformDidClose):
+        (WebKit::WebInspectorProxy::platformInvalidate):
+        (WebKit::WebInspectorProxy::platformBringToFront):
+        (WebKit::WebInspectorProxy::platformHide):
+        (WebKit::WebInspectorProxy::platformIsFront):
+        (WebKit::WebInspectorProxy::platformInspectedURLChanged):
+        (WebKit::WebInspectorProxy::platformSave):
+        (WebKit::WebInspectorProxy::platformAppend):
+        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
+        (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
+        (WebKit::WebInspectorProxy::platformAttach):
+        (WebKit::WebInspectorProxy::platformDetach):
+        (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
+        (WebKit::WebInspectorProxy::platformSetToolbarHeight):
+        (WebKit::WebInspectorProxy::inspectorPageURL):
+        (WebKit::WebInspectorProxy::inspectorTestPageURL):
+        (WebKit::WebInspectorProxy::inspectorBaseURL):
+        (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
+        (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/ios/WebInspectorProxyIOS.mm: Removed.
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (-[WKWebInspectorWKWebView _didRelaunchProcess]):
+        WKWebView doesn't implement this, so remove the super call.
+        (WebKit::WebInspectorProxy::closeTimerFired):
+        (WebKit::createDockButton):
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+        (WebKit::WebInspectorProxy::platformAttach):
+        (-[WKWebInspectorWKView _didRelaunchProcess]): Deleted.
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-02-03  Antti Koivisto  <[email protected]>
 
         Memory cache for resources pending disk write

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm (179572 => 179573)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm	2015-02-03 23:21:47 UTC (rev 179573)
@@ -247,6 +247,26 @@
     _preferences->setDeveloperExtrasEnabled(developerExtrasEnabled);
 }
 
+- (BOOL)_logsPageMessagesToSystemConsoleEnabled
+{
+    return _preferences->logsPageMessagesToSystemConsoleEnabled();
+}
+
+- (void)_setLogsPageMessagesToSystemConsoleEnabled:(BOOL)logsPageMessagesToSystemConsoleEnabled
+{
+    _preferences->setLogsPageMessagesToSystemConsoleEnabled(logsPageMessagesToSystemConsoleEnabled);
+}
+
+- (BOOL)_allowFileAccessFromFileURLs
+{
+    return _preferences->allowFileAccessFromFileURLs();
+}
+
+- (void)_setAllowFileAccessFromFileURLs:(BOOL)allowFileAccessFromFileURLs
+{
+    _preferences->setAllowFileAccessFromFileURLs(allowFileAccessFromFileURLs);
+}
+
 - (BOOL)_isStandalone
 {
     return _preferences->standalone();

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h (179572 => 179573)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2015-02-03 23:21:47 UTC (rev 179573)
@@ -56,6 +56,10 @@
 
 @property (nonatomic, setter=_setDeveloperExtrasEnabled:) BOOL _developerExtrasEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
+@property (nonatomic, setter=_setLogsPageMessagesToSystemConsoleEnabled:) BOOL _logsPageMessagesToSystemConsoleEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
+@property (nonatomic, setter=_setAllowFileAccessFromFileURLs:) BOOL _allowFileAccessFromFileURLs WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
 @property (nonatomic, setter=_setStandalone:, getter=_isStandalone) BOOL _standalone WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
 @property (nonatomic, setter=_setDiagnosticLoggingEnabled:) BOOL _diagnosticLoggingEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (179572 => 179573)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2015-02-03 23:21:47 UTC (rev 179573)
@@ -39,6 +39,7 @@
 #include "WebPreferences.h"
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
+#include <WebCore/NotImplemented.h>
 #include <WebCore/SchemeRegistry.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringBuilder.h>
@@ -121,29 +122,9 @@
 
 WebInspectorProxy::WebInspectorProxy(WebPageProxy* page)
     : m_page(page)
-    , m_inspectorPage(nullptr)
-    , m_underTest(false)
-    , m_isVisible(false)
-    , m_isAttached(false)
-    , m_canAttach(false)
-    , m_isProfilingPage(false)
-    , m_showMessageSent(false)
-    , m_ignoreFirstBringToFront(false)
-    , m_attachmentSide(AttachmentSideBottom)
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && WK_API_ENABLED
     , m_closeTimer(RunLoop::main(), this, &WebInspectorProxy::closeTimerFired)
-#elif PLATFORM(GTK) || PLATFORM(EFL)
-    , m_inspectorView(nullptr)
-    , m_inspectorWindow(nullptr)
-#if PLATFORM(GTK)
-    , m_headerBar(nullptr)
-    , m_dockBottomButton(nullptr)
-    , m_dockRightButton(nullptr)
 #endif
-#endif
-#if ENABLE(INSPECTOR_SERVER)
-    , m_remoteInspectionPageId(0)
-#endif
 {
     m_level = WebInspectorPageGroups::singleton().inspectorLevel(m_page->pageGroup());
     m_page->process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_page->pageID(), *this);
@@ -158,6 +139,11 @@
     return WebInspectorPageGroups::singleton().inspectorPageGroupForLevel(m_level);
 }
 
+WebPreferences& WebInspectorProxy::inspectorPagePreferences() const
+{
+    return inspectorPageGroup()->preferences();
+}
+
 void WebInspectorProxy::invalidate()
 {
 #if ENABLE(INSPECTOR_SERVER)
@@ -293,10 +279,10 @@
     m_isAttached = true;
     m_attachmentSide = side;
 
-    inspectorPageGroup()->preferences().setInspectorAttachmentSide(side);
+    inspectorPagePreferences().setInspectorAttachmentSide(side);
 
     if (m_isVisible)
-        inspectorPageGroup()->preferences().setInspectorStartsAttached(true);
+        inspectorPagePreferences().setInspectorStartsAttached(true);
 
     m_page->process().send(Messages::WebInspector::SetAttached(true), m_page->pageID());
 
@@ -321,7 +307,7 @@
     m_isAttached = false;
 
     if (m_isVisible)
-        inspectorPageGroup()->preferences().setInspectorStartsAttached(false);
+        inspectorPagePreferences().setInspectorStartsAttached(false);
 
     m_page->process().send(Messages::WebInspector::SetAttached(false), m_page->pageID());
     m_inspectorPage->process().send(Messages::WebInspectorUI::Detached(), m_inspectorPage->pageID());
@@ -331,13 +317,13 @@
 
 void WebInspectorProxy::setAttachedWindowHeight(unsigned height)
 {
-    inspectorPageGroup()->preferences().setInspectorAttachedHeight(height);
+    inspectorPagePreferences().setInspectorAttachedHeight(height);
     platformSetAttachedWindowHeight(height);
 }
 
 void WebInspectorProxy::setAttachedWindowWidth(unsigned width)
 {
-    inspectorPageGroup()->preferences().setInspectorAttachedWidth(width);
+    inspectorPagePreferences().setInspectorAttachedWidth(width);
     platformSetAttachedWindowWidth(width);
 }
 
@@ -539,7 +525,7 @@
     if (!m_underTest) {
         m_canAttach = canAttach;
         m_isAttached = shouldOpenAttached();
-        m_attachmentSide = static_cast<AttachmentSide>(inspectorPageGroup()->preferences().inspectorAttachmentSide());
+        m_attachmentSide = static_cast<AttachmentSide>(inspectorPagePreferences().inspectorAttachmentSide());
 
         m_page->process().send(Messages::WebInspector::SetAttached(m_isAttached), m_page->pageID());
 
@@ -633,7 +619,7 @@
 
 bool WebInspectorProxy::shouldOpenAttached()
 {
-    return inspectorPageGroup()->preferences().inspectorStartsAttached() && canAttach();
+    return inspectorPagePreferences().inspectorStartsAttached() && canAttach();
 }
 
 #if ENABLE(INSPECTOR_SERVER)
@@ -644,4 +630,122 @@
 }
 #endif
 
+// Unsupported configurations can use the stubs provided here.
+
+#if PLATFORM(IOS) || (PLATFORM(MAC) && !WK_API_ENABLED)
+
+WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
+{
+    notImplemented();
+    return nullptr;
+}
+
+void WebInspectorProxy::platformOpen()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformDidClose()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformInvalidate()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformBringToFront()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformHide()
+{
+    notImplemented();
+}
+
+bool WebInspectorProxy::platformIsFront()
+{
+    notImplemented();
+    return false;
+}
+
+void WebInspectorProxy::platformInspectedURLChanged(const String&)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformSave(const String& suggestedURL, const String& content, bool base64Encoded, bool forceSaveDialog)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformAppend(const String& suggestedURL, const String& content)
+{
+    notImplemented();
+}
+
+unsigned WebInspectorProxy::platformInspectedWindowHeight()
+{
+    notImplemented();
+    return 0;
+}
+
+unsigned WebInspectorProxy::platformInspectedWindowWidth()
+{
+    notImplemented();
+    return 0;
+}
+
+void WebInspectorProxy::platformAttach()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformDetach()
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformSetToolbarHeight(unsigned)
+{
+    notImplemented();
+}
+
+String WebInspectorProxy::inspectorPageURL() const
+{
+    notImplemented();
+    return String();
+}
+
+String WebInspectorProxy::inspectorTestPageURL() const
+{
+    notImplemented();
+    return String();
+}
+
+String WebInspectorProxy::inspectorBaseURL() const
+{
+    notImplemented();
+    return String();
+}
+
+void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned)
+{
+    notImplemented();
+}
+
+void WebInspectorProxy::platformAttachAvailabilityChanged(bool)
+{
+    notImplemented();
+}
+
+#endif // PLATFORM(IOS) || (PLATFORM(MAC) && !WK_API_ENABLED)
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (179572 => 179573)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h	2015-02-03 23:21:47 UTC (rev 179573)
@@ -31,7 +31,6 @@
 #include "Attachment.h"
 #include "MessageReceiver.h"
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
 
@@ -45,7 +44,7 @@
 OBJC_CLASS NSURL;
 OBJC_CLASS NSWindow;
 OBJC_CLASS WKWebInspectorProxyObjCAdapter;
-OBJC_CLASS WKWebInspectorWKView;
+OBJC_CLASS WKWebInspectorWKWebView;
 #endif
 
 #if PLATFORM(GTK)
@@ -62,6 +61,7 @@
 class WebFrameProxy;
 class WebPageGroup;
 class WebPageProxy;
+class WebPreferences;
 class WebProcessPool;
 
 enum AttachmentSide {
@@ -94,8 +94,8 @@
     void close();
 
     void didRelaunchInspectorPageProcess();
-    
-#if PLATFORM(MAC)
+
+#if PLATFORM(MAC) && WK_API_ENABLED
     void createInspectorWindow();
     void updateInspectorWindowTitle() const;
     void inspectedViewFrameDidChange(CGFloat = 0);
@@ -192,7 +192,10 @@
 
     void open();
 
+    // FIXME: this should return the page group identifier, not an instance. The Mac port cannot
+    // directly provide a page group instance, and instances are not necessary to compute levels.
     WebPageGroup* inspectorPageGroup() const;
+    WebPreferences& inspectorPagePreferences() const;
 
 #if PLATFORM(GTK) || PLATFORM(EFL)
     void createInspectorWindow();
@@ -209,16 +212,16 @@
     static const unsigned initialWindowWidth;
     static const unsigned initialWindowHeight;
 
-    WebPageProxy* m_page;
-    WebPageProxy* m_inspectorPage;
+    WebPageProxy* m_page {nullptr};
+    WebPageProxy* m_inspectorPage {nullptr};
 
-    bool m_underTest;
-    bool m_isVisible;
-    bool m_isAttached;
-    bool m_canAttach;
-    bool m_isProfilingPage;
-    bool m_showMessageSent;
-    bool m_ignoreFirstBringToFront;
+    bool m_underTest {false};
+    bool m_isVisible {false};
+    bool m_isAttached {false};
+    bool m_canAttach {false};
+    bool m_isProfilingPage {false};
+    bool m_showMessageSent {false};
+    bool m_ignoreFirstBringToFront {false};
 
     // The debugger stops all the pages in the same PageGroup. Having
     // all the inspectors in the same group will make it impossible to debug
@@ -227,10 +230,10 @@
     
     IPC::Attachment m_connectionIdentifier;
 
-    AttachmentSide m_attachmentSide;
+    AttachmentSide m_attachmentSide {AttachmentSideBottom};
 
-#if PLATFORM(MAC)
-    RetainPtr<WKWebInspectorWKView> m_inspectorView;
+#if PLATFORM(MAC) && WK_API_ENABLED
+    RetainPtr<WKWebInspectorWKWebView> m_inspectorView;
     RetainPtr<NSWindow> m_inspectorWindow;
     RetainPtr<NSButton> m_dockBottomButton;
     RetainPtr<NSButton> m_dockRightButton;
@@ -240,18 +243,18 @@
     String m_urlString;
 #elif PLATFORM(GTK)
     WebInspectorClientGtk m_client;
-    GtkWidget* m_inspectorView;
-    GtkWidget* m_inspectorWindow;
-    GtkWidget* m_headerBar;
-    GtkWidget* m_dockBottomButton;
-    GtkWidget* m_dockRightButton;
+    GtkWidget* m_inspectorView {nullptr};
+    GtkWidget* m_inspectorWindow {nullptr};
+    GtkWidget* m_headerBar {nullptr};
+    GtkWidget* m_dockBottomButton {nullptr};
+    GtkWidget* m_dockRightButton {nullptr};
     String m_inspectedURLString;
 #elif PLATFORM(EFL)
-    Evas_Object* m_inspectorView;
-    Ecore_Evas* m_inspectorWindow;
+    Evas_Object* m_inspectorView {nullptr};
+    Ecore_Evas* m_inspectorWindow {nullptr};
 #endif
 #if ENABLE(INSPECTOR_SERVER)
-    int m_remoteInspectionPageId;
+    int m_remoteInspectionPageId {0};
 #endif
 };
 

Deleted: trunk/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm (179572 => 179573)


--- trunk/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm	2015-02-03 23:21:47 UTC (rev 179573)
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WebInspectorProxy.h"
-
-#if PLATFORM(IOS)
-
-#import <WebCore/NotImplemented.h>
-
-namespace WebKit {
-
-WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
-{
-    notImplemented();
-    return 0;
-}
-
-void WebInspectorProxy::platformOpen()
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformDidClose()
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformInvalidate()
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformBringToFront()
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformHide()
-{
-    notImplemented();
-}
-
-bool WebInspectorProxy::platformIsFront()
-{
-    notImplemented();
-    return false;
-}
-
-void WebInspectorProxy::platformInspectedURLChanged(const String&)
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformSave(const String& suggestedURL, const String& content, bool base64Encoded, bool forceSaveDialog)
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformAppend(const String& suggestedURL, const String& content)
-{
-    notImplemented();
-}
-
-unsigned WebInspectorProxy::platformInspectedWindowHeight()
-{
-    notImplemented();
-    return 0;
-}
-
-unsigned WebInspectorProxy::platformInspectedWindowWidth()
-{
-    notImplemented();
-    return 0;
-}
-
-void WebInspectorProxy::platformAttach()
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformDetach()
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned)
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformSetToolbarHeight(unsigned height)
-{
-    notImplemented();
-}
-
-String WebInspectorProxy::inspectorPageURL() const
-{
-    notImplemented();
-    return String();
-}
-
-String WebInspectorProxy::inspectorTestPageURL() const
-{
-    notImplemented();
-    return String();
-}
-
-String WebInspectorProxy::inspectorBaseURL() const
-{
-    notImplemented();
-    return String();
-}
-
-void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned)
-{
-    notImplemented();
-}
-
-void WebInspectorProxy::platformAttachAvailabilityChanged(bool available)
-{
-    notImplemented();
-}
-
-} // namespace WebKit
-
-#endif // PLATFORM(IOS)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (179572 => 179573)


--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2015-02-03 23:21:47 UTC (rev 179573)
@@ -26,22 +26,25 @@
 #import "config.h"
 #import "WebInspectorProxy.h"
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && WK_API_ENABLED
 
 #import "WKAPICast.h"
 #import "WKInspectorPrivateMac.h"
 #import "WKMutableArray.h"
 #import "WKOpenPanelParameters.h"
 #import "WKOpenPanelResultListener.h"
+#import "WKPreferencesInternal.h"
+#import "WKProcessPoolInternal.h"
 #import "WKRetainPtr.h"
 #import "WKURLCF.h"
 #import "WKViewInternal.h"
+#import "WKWebViewConfigurationPrivate.h"
+#import "WKWebViewInternal.h"
 #import "WebInspectorMessages.h"
 #import "WebInspectorUIMessages.h"
 #import "WebPageGroup.h"
 #import "WebPageProxy.h"
 #import "WebPreferences.h"
-#import "WebProcessPool.h"
 #import "WebProcessProxy.h"
 #import <QuartzCore/CoreAnimation.h>
 #import <WebCore/InspectorFrontendClientLocal.h>
@@ -170,7 +173,7 @@
 
 @end
 
-@interface WKWebInspectorWKView : WKView {
+@interface WKWebInspectorWKWebView : WKWebView {
 @private
     WKWebInspectorProxyObjCAdapter *_inspectorProxyObjCAdapter;
 }
@@ -178,7 +181,7 @@
 @property (nonatomic, assign) WKWebInspectorProxyObjCAdapter *inspectorProxyObjCAdapter;
 @end
 
-@implementation WKWebInspectorWKView
+@implementation WKWebInspectorWKWebView
 
 @synthesize inspectorProxyObjCAdapter = _inspectorProxyObjCAdapter;
 
@@ -189,8 +192,6 @@
 
 - (void)_didRelaunchProcess
 {
-    [super _didRelaunchProcess];
-
     [self.inspectorProxyObjCAdapter didRelaunchProcess];
 }
 
@@ -312,8 +313,7 @@
         return;
 
     if (m_inspectorView) {
-        WebPageProxy* inspectorPage = toImpl(m_inspectorView.get().pageRef);
-        inspectorPage->close();
+        m_inspectorView->_page->close();
         [m_inspectorView setInspectorProxyObjCAdapter:nil];
         m_inspectorView = nil;
     }
@@ -331,7 +331,7 @@
     dockButton.autoresizingMask = NSViewMinXMargin | NSViewMinYMargin;
 
     // Get the dock image and make it a template so the button cell effects will apply.
-    NSImage *dockImage = [[NSBundle bundleForClass:[WKWebInspectorWKView class]] imageForResource:imageName];
+    NSImage *dockImage = [[NSBundle bundleForClass:[WKWebInspectorWKWebView class]] imageForResource:imageName];
     [dockImage setTemplate:YES];
 
     // Set the dock image on the button cell.
@@ -453,7 +453,7 @@
 
     if (m_inspectorView) {
         ASSERT(m_inspectorProxyObjCAdapter);
-        return toImpl(m_inspectorView.get().pageRef);
+        return m_inspectorView->_page.get();
     }
 
     ASSERT(!m_inspectorView);
@@ -465,10 +465,10 @@
 
         switch (m_attachmentSide) {
         case AttachmentSideBottom:
-            initialRect = NSMakeRect(0, 0, NSWidth(inspectedViewFrame), inspectorPageGroup()->preferences().inspectorAttachedHeight());
+            initialRect = NSMakeRect(0, 0, NSWidth(inspectedViewFrame), inspectorPagePreferences().inspectorAttachedHeight());
             break;
         case AttachmentSideRight:
-            initialRect = NSMakeRect(0, 0, inspectorPageGroup()->preferences().inspectorAttachedWidth(), NSHeight(inspectedViewFrame));
+            initialRect = NSMakeRect(0, 0, inspectorPagePreferences().inspectorAttachedWidth(), NSHeight(inspectedViewFrame));
             break;
         }
     } else {
@@ -480,11 +480,24 @@
             initialRect = [NSWindow contentRectForFrameRect:windowFrame styleMask:windowStyleMask];
     }
 
-    m_inspectorView = adoptNS([[WKWebInspectorWKView alloc] initWithFrame:initialRect contextRef:toAPI(&inspectorProcessPool()) pageGroupRef:toAPI(inspectorPageGroup()) relatedToPage:nullptr]);
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    WKPreferences *preferences = [configuration preferences];
+#ifndef NDEBUG
+    // Allow developers to inspect the Web Inspector in debug builds without changing settings.
+    preferences._developerExtrasEnabled = YES;
+    preferences._logsPageMessagesToSystemConsoleEnabled = YES;
+#endif
+    preferences._allowFileAccessFromFileURLs = YES;
+    [configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool())];
+    [configuration _setGroupIdentifier:inspectorPageGroup()->identifier()];
+
+    m_inspectorView = adoptNS([[WKWebInspectorWKWebView alloc] initWithFrame:initialRect configuration:configuration.get()]);
     ASSERT(m_inspectorView);
 
-#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
-    [m_inspectorView setDrawsBackground:NO];
+    [m_inspectorView _setDrawsTransparentBackground:YES];
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+    [m_inspectorView _setAutomaticallyAdjustsContentInsets:NO];
 #endif
 
     m_inspectorProxyObjCAdapter = adoptNS([[WKWebInspectorProxyObjCAdapter alloc] initWithWebInspectorProxy:this]);
@@ -492,7 +505,7 @@
 
     [m_inspectorView setInspectorProxyObjCAdapter:m_inspectorProxyObjCAdapter.get()];
 
-    WebPageProxy* inspectorPage = toImpl(m_inspectorView.get().pageRef);
+    WebPageProxy* inspectorPage = m_inspectorView->_page.get();
     ASSERT(inspectorPage);
 
     WKPageUIClientV2 uiClient = {
@@ -789,16 +802,16 @@
 
     [m_inspectorView removeFromSuperview];
 
-    [m_inspectorView setAutoresizingMask:NSViewWidthSizable | NSViewMaxYMargin];
-
     CGFloat currentDimension;
 
     switch (m_attachmentSide) {
     case AttachmentSideBottom:
-        currentDimension = inspectorPageGroup()->preferences().inspectorAttachedHeight();
+        [m_inspectorView setAutoresizingMask:NSViewWidthSizable | NSViewMaxYMargin];
+        currentDimension = inspectorPagePreferences().inspectorAttachedHeight();
         break;
     case AttachmentSideRight:
-        currentDimension = inspectorPageGroup()->preferences().inspectorAttachedWidth();
+        [m_inspectorView setAutoresizingMask:NSViewHeightSizable | NSViewMinXMargin];
+        currentDimension = inspectorPagePreferences().inspectorAttachedWidth();
         break;
     }
 
@@ -892,4 +905,4 @@
 
 } // namespace WebKit
 
-#endif // PLATFORM(MAC)
+#endif // PLATFORM(MAC) && WK_API_ENABLED

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (179572 => 179573)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-02-03 23:02:40 UTC (rev 179572)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-02-03 23:21:47 UTC (rev 179573)
@@ -633,7 +633,6 @@
 		2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA9449D1884E4F000ED86DB /* GestureTypes.h */; };
 		2DA944A71884E94800ED86DB /* DownloadIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944A61884E94800ED86DB /* DownloadIOS.mm */; };
 		2DA944AD1884E9BA00ED86DB /* TextCheckerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */; };
-		2DA944AE1884E9BA00ED86DB /* WebInspectorProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */; };
 		2DA944AF1884E9BA00ED86DB /* WebPageProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */; };
 		2DA944B01884E9BA00ED86DB /* WebProcessProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */; };
 		2DA944B91884EA3900ED86DB /* WebBackForwardListProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */; };
@@ -2744,7 +2743,6 @@
 		2DA9449D1884E4F000ED86DB /* GestureTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GestureTypes.h; path = ios/GestureTypes.h; sourceTree = "<group>"; };
 		2DA944A61884E94800ED86DB /* DownloadIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DownloadIOS.mm; path = Downloads/ios/DownloadIOS.mm; sourceTree = "<group>"; };
 		2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TextCheckerIOS.mm; path = ios/TextCheckerIOS.mm; sourceTree = "<group>"; };
-		2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorProxyIOS.mm; path = ios/WebInspectorProxyIOS.mm; sourceTree = "<group>"; };
 		2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageProxyIOS.mm; path = ios/WebPageProxyIOS.mm; sourceTree = "<group>"; };
 		2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebProcessProxyIOS.mm; path = ios/WebProcessProxyIOS.mm; sourceTree = "<group>"; };
 		2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebBackForwardListProxyIOS.mm; path = ios/WebBackForwardListProxyIOS.mm; sourceTree = "<group>"; };
@@ -5046,7 +5044,6 @@
 				2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */,
 				2DA944A91884E9BA00ED86DB /* TextCheckerIOS.mm */,
 				2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */,
-				2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */,
 				2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */,
 				2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.mm */,
 				2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */,
@@ -9632,7 +9629,6 @@
 				BC111A60112F4FBB00337BAB /* WebInspectorClient.cpp in Sources */,
 				1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */,
 				1C8E28351275D73800BC7BD0 /* WebInspectorProxy.cpp in Sources */,
-				2DA944AE1884E9BA00ED86DB /* WebInspectorProxyIOS.mm in Sources */,
 				1CA8B936127C774E00576C2B /* WebInspectorProxyMac.mm in Sources */,
 				1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */,
 				1C891D6519B124FF00BA79DD /* WebInspectorUI.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to