Title: [235323] trunk
Revision
235323
Author
[email protected]
Date
2018-08-24 11:41:19 -0700 (Fri, 24 Aug 2018)

Log Message

Introduce _WKInspector
https://bugs.webkit.org/show_bug.cgi?id=188923
<rdar://problem/34657861>

Reviewed by Brian Burg.

Source/WebKit:

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _inspector]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKInspector.h: Added.
* UIProcess/API/Cocoa/_WKInspector.mm: Added.
(-[_WKInspector webView]):
(-[_WKInspector isConnected]):
(-[_WKInspector isVisible]):
(-[_WKInspector isFront]):
(-[_WKInspector isProfilingPage]):
(-[_WKInspector isElementSelectionActive]):
(-[_WKInspector connect]):
(-[_WKInspector show]):
(-[_WKInspector hide]):
(-[_WKInspector close]):
(-[_WKInspector showConsole]):
(-[_WKInspector showResources]):
(-[_WKInspector showMainResourceForFrame:]):
(-[_WKInspector attach]):
(-[_WKInspector detach]):
(-[_WKInspector showTimelines]):
(-[_WKInspector togglePageProfiling]):
(-[_WKInspector toggleElementSelection]):
(-[_WKInspector printErrorToConsole:]):
(-[_WKInspector _apiObject]):
* UIProcess/API/Cocoa/_WKInspectorInternal.h: Added.
* WebKit.xcodeproj/project.pbxproj:

Tools:

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController validateMenuItem:]):
(-[WK2BrowserWindowController showHideWebInspector:]):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235322 => 235323)


--- trunk/Source/WebKit/ChangeLog	2018-08-24 18:22:29 UTC (rev 235322)
+++ trunk/Source/WebKit/ChangeLog	2018-08-24 18:41:19 UTC (rev 235323)
@@ -1,3 +1,41 @@
+2018-08-24  Alex Christensen  <[email protected]>
+
+        Introduce _WKInspector
+        https://bugs.webkit.org/show_bug.cgi?id=188923
+        <rdar://problem/34657861>
+
+        Reviewed by Brian Burg.
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _inspector]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/Cocoa/_WKInspector.h: Added.
+        * UIProcess/API/Cocoa/_WKInspector.mm: Added.
+        (-[_WKInspector webView]):
+        (-[_WKInspector isConnected]):
+        (-[_WKInspector isVisible]):
+        (-[_WKInspector isFront]):
+        (-[_WKInspector isProfilingPage]):
+        (-[_WKInspector isElementSelectionActive]):
+        (-[_WKInspector connect]):
+        (-[_WKInspector show]):
+        (-[_WKInspector hide]):
+        (-[_WKInspector close]):
+        (-[_WKInspector showConsole]):
+        (-[_WKInspector showResources]):
+        (-[_WKInspector showMainResourceForFrame:]):
+        (-[_WKInspector attach]):
+        (-[_WKInspector detach]):
+        (-[_WKInspector showTimelines]):
+        (-[_WKInspector togglePageProfiling]):
+        (-[_WKInspector toggleElementSelection]):
+        (-[_WKInspector printErrorToConsole:]):
+        (-[_WKInspector _apiObject]):
+        * UIProcess/API/Cocoa/_WKInspectorInternal.h: Added.
+        * WebKit.xcodeproj/project.pbxproj:
+
 2018-08-24  Sihui Liu  <[email protected]>
 
         Don't launch network process in WebCookieManagerProxy::setHTTPCookieAcceptPolicy

Modified: trunk/Source/WebKit/Shared/Cocoa/APIObject.mm (235322 => 235323)


--- trunk/Source/WebKit/Shared/Cocoa/APIObject.mm	2018-08-24 18:22:29 UTC (rev 235322)
+++ trunk/Source/WebKit/Shared/Cocoa/APIObject.mm	2018-08-24 18:41:19 UTC (rev 235323)
@@ -75,6 +75,7 @@
 #import "_WKFrameHandleInternal.h"
 #import "_WKGeolocationPositionInternal.h"
 #import "_WKHitTestResultInternal.h"
+#import "_WKInspectorInternal.h"
 #import "_WKProcessPoolConfigurationInternal.h"
 #import "_WKUserContentWorldInternal.h"
 #import "_WKUserInitiatedActionInternal.h"
@@ -233,6 +234,10 @@
         break;
 #endif
 
+    case Type::Inspector:
+        wrapper = [_WKInspector alloc];
+        break;
+        
     case Type::Navigation:
         wrapper = [WKNavigation alloc];
         break;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (235322 => 235323)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-08-24 18:22:29 UTC (rev 235322)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-08-24 18:41:19 UTC (rev 235323)
@@ -89,6 +89,7 @@
 #import "_WKFullscreenDelegate.h"
 #import "_WKHitTestResultInternal.h"
 #import "_WKInputDelegate.h"
+#import "_WKInspectorInternal.h"
 #import "_WKRemoteObjectRegistryInternal.h"
 #import "_WKSessionStateInternal.h"
 #import "_WKVisitedLinkStoreInternal.h"
@@ -6476,6 +6477,13 @@
     _page->setDefersLoadingForTesting(defersLoading);
 }
 
+- (_WKInspector *)_inspector
+{
+    if (auto* inspector = _page->inspector())
+        return wrapper(*inspector);
+    return nil;
+}
+
 - (void)_denyNextUserMediaRequest
 {
 #if ENABLE(MEDIA_STREAM)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (235322 => 235323)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-08-24 18:22:29 UTC (rev 235322)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-08-24 18:41:19 UTC (rev 235323)
@@ -101,6 +101,7 @@
 @class _WKFrameHandle;
 @class _WKHitTestResult;
 @class _WKIconLoadingDelegate;
+@class _WKInspector;
 @class _WKRemoteObjectRegistry;
 @class _WKSessionState;
 @class _WKThumbnailView;
@@ -468,6 +469,8 @@
 - (BOOL)_completeBackSwipeForTesting;
 - (void)_setDefersLoadingForTesting:(BOOL)defersLoading;
 
+@property (nonatomic, readonly) _WKInspector *_inspector WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 @end
 
 #endif

Added: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.h (0 => 235323)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.h	2018-08-24 18:41:19 UTC (rev 235323)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 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 <Foundation/Foundation.h>
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+@class WKWebView;
+@class _WKFrameHandle;
+
+NS_ASSUME_NONNULL_BEGIN
+
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface _WKInspector : NSObject
+
+- (instancetype)init NS_UNAVAILABLE;
+
+@property (nonatomic, readonly) WKWebView *webView;
+@property (nonatomic, readonly) BOOL isConnected;
+@property (nonatomic, readonly) BOOL isVisible;
+@property (nonatomic, readonly) BOOL isFront;
+@property (nonatomic, readonly) BOOL isProfilingPage;
+@property (nonatomic, readonly) BOOL isElementSelectionActive;
+
+- (void)connect;
+- (void)show;
+- (void)hide;
+- (void)close;
+- (void)showConsole;
+- (void)showResources;
+- (void)showMainResourceForFrame:(_WKFrameHandle *)frame;
+- (void)attach;
+- (void)detach;
+- (void)showTimelines;
+- (void)togglePageProfiling;
+- (void)toggleElementSelection;
+- (void)printErrorToConsole:(NSString *)error;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif

Added: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm (0 => 235323)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm	2018-08-24 18:41:19 UTC (rev 235323)
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2018 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 "_WKInspector.h"
+
+#if WK_API_ENABLED
+
+#import "WKWebViewInternal.h"
+#import "WebProcessProxy.h"
+#import "_WKFrameHandleInternal.h"
+#import "_WKInspectorInternal.h"
+#import <wtf/RetainPtr.h>
+
+@implementation _WKInspector
+
+- (WKWebView *)webView
+{
+    if (auto* page = _inspector->inspectedPage())
+        return fromWebPageProxy(*page);
+    return nil;
+}
+
+- (BOOL)isConnected
+{
+    return _inspector->isConnected();
+}
+
+- (BOOL)isVisible
+{
+    return _inspector->isVisible();
+}
+
+- (BOOL)isFront
+{
+    return _inspector->isFront();
+}
+
+- (BOOL)isProfilingPage
+{
+    return _inspector->isProfilingPage();
+}
+
+- (BOOL)isElementSelectionActive
+{
+    return _inspector->isElementSelectionActive();
+}
+
+- (void)connect
+{
+    _inspector->connect();
+}
+
+- (void)show
+{
+    _inspector->show();
+}
+
+- (void)hide
+{
+    _inspector->hide();
+}
+
+- (void)close
+{
+    _inspector->close();
+}
+
+- (void)showConsole
+{
+    _inspector->showConsole();
+}
+
+- (void)showResources
+{
+    _inspector->showResources();
+}
+
+- (void)showMainResourceForFrame:(_WKFrameHandle *)frame
+{
+    if (auto* page = _inspector->inspectedPage())
+        _inspector->showMainResourceForFrame(page->process().webFrame(frame._frameID));
+}
+
+- (void)attach
+{
+    _inspector->attach();
+}
+
+- (void)detach
+{
+    _inspector->detach();
+}
+
+- (void)showTimelines
+{
+    _inspector->showTimelines();
+}
+
+- (void)togglePageProfiling
+{
+    _inspector->togglePageProfiling();
+}
+
+- (void)toggleElementSelection
+{
+    _inspector->toggleElementSelection();
+}
+
+- (void)printErrorToConsole:(NSString *)error
+{
+    // FIXME: This should use a new message source rdar://problem/34658378
+    [self.webView evaluateJavaScript:[NSString stringWithFormat:@"console.error(\"%@\");", error] completionHandler:nil];
+}
+
+- (API::Object&)_apiObject
+{
+    return *_inspector;
+}
+
+@end
+
+#endif

Added: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorInternal.h (0 => 235323)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorInternal.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorInternal.h	2018-08-24 18:41:19 UTC (rev 235323)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018 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 "_WKInspector.h"
+
+#if WK_API_ENABLED
+
+#import "WKObject.h"
+#import "WebInspectorProxy.h"
+
+namespace WebKit {
+
+template<> struct WrapperTraits<WebInspectorProxy> {
+    using WrapperClass = _WKInspector;
+};
+
+}
+
+@interface _WKInspector () <WKObject> {
+@package
+    API::ObjectStorage<WebKit::WebInspectorProxy> _inspector;
+}
+@end
+
+#endif // WK_API_ENABLED

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (235322 => 235323)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-08-24 18:22:29 UTC (rev 235322)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-08-24 18:41:19 UTC (rev 235323)
@@ -1165,6 +1165,9 @@
 		5C9E56821DF7F1AB00C9EE33 /* WKWebsitePolicies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9E56801DF7F05500C9EE33 /* WKWebsitePolicies.cpp */; };
 		5C9E56831DF7F1B300C9EE33 /* WKWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5CA9854A210BEB640057EB6B /* SafeBrowsingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CA98549210BEB5A0057EB6B /* SafeBrowsingResult.h */; };
+		5CAFDE452130846300B1F7E1 /* _WKInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CAFDE422130843500B1F7E1 /* _WKInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		5CAFDE462130846800B1F7E1 /* _WKInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CAFDE432130843600B1F7E1 /* _WKInspector.mm */; };
+		5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */; };
 		5CB2378B1DF0DE5300117AA3 /* _WKWebsitePolicies.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */; };
 		5CB2378C1DF0DE6E00117AA3 /* _WKWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB237891DF0DD4300117AA3 /* _WKWebsitePolicies.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5CB2378E1DF0E0D300117AA3 /* _WKWebsitePoliciesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */; };
@@ -3651,6 +3654,9 @@
 		5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsitePolicies.h; sourceTree = "<group>"; };
 		5CA98549210BEB5A0057EB6B /* SafeBrowsingResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafeBrowsingResult.h; sourceTree = "<group>"; };
 		5CA9854B210BEB730057EB6B /* SafeBrowsingResultCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SafeBrowsingResultCocoa.mm; sourceTree = "<group>"; };
+		5CAFDE422130843500B1F7E1 /* _WKInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspector.h; sourceTree = "<group>"; };
+		5CAFDE432130843600B1F7E1 /* _WKInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInspector.mm; sourceTree = "<group>"; };
+		5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorInternal.h; sourceTree = "<group>"; };
 		5CB237891DF0DD4300117AA3 /* _WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsitePolicies.h; sourceTree = "<group>"; };
 		5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebsitePolicies.mm; sourceTree = "<group>"; };
 		5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsitePoliciesInternal.h; sourceTree = "<group>"; };
@@ -6156,6 +6162,9 @@
 				63C32C271E98119000699BD0 /* _WKGeolocationPositionInternal.h */,
 				5143B25E1DDCDFD10014FAC6 /* _WKIconLoadingDelegate.h */,
 				37A64E5418F38E3C00EB30F1 /* _WKInputDelegate.h */,
+				5CAFDE422130843500B1F7E1 /* _WKInspector.h */,
+				5CAFDE432130843600B1F7E1 /* _WKInspector.mm */,
+				5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */,
 				2D790A9C1AD7050D00AB90B3 /* _WKLayoutMode.h */,
 				51C0C9791DDD78540032CAD3 /* _WKLinkIconParameters.h */,
 				51C0C97A1DDD78540032CAD3 /* _WKLinkIconParameters.mm */,
@@ -8939,6 +8948,8 @@
 				93A88B3B1BC710D900ABA5C2 /* _WKHitTestResultInternal.h in Headers */,
 				510F59101DDE296900412FF5 /* _WKIconLoadingDelegate.h in Headers */,
 				37A64E5518F38E3C00EB30F1 /* _WKInputDelegate.h in Headers */,
+				5CAFDE452130846300B1F7E1 /* _WKInspector.h in Headers */,
+				5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */,
 				2D790A9D1AD7050D00AB90B3 /* _WKLayoutMode.h in Headers */,
 				510F59111DDE297000412FF5 /* _WKLinkIconParameters.h in Headers */,
 				A118A9F31908B8EA00F7C92B /* _WKNSFileManagerExtras.h in Headers */,
@@ -10847,6 +10858,7 @@
 				373D122218A473010066D9CC /* _WKFrameHandle.mm in Sources */,
 				63C32C251E9810D900699BD0 /* _WKGeolocationPosition.mm in Sources */,
 				93A88B391BC70F3F00ABA5C2 /* _WKHitTestResult.mm in Sources */,
+				5CAFDE462130846800B1F7E1 /* _WKInspector.mm in Sources */,
 				510F59121DDE297700412FF5 /* _WKLinkIconParameters.mm in Sources */,
 				A118A9F21908B8EA00F7C92B /* _WKNSFileManagerExtras.mm in Sources */,
 				A5C0F0A82000655100536536 /* _WKNSWindowExtras.mm in Sources */,

Modified: trunk/Tools/ChangeLog (235322 => 235323)


--- trunk/Tools/ChangeLog	2018-08-24 18:22:29 UTC (rev 235322)
+++ trunk/Tools/ChangeLog	2018-08-24 18:41:19 UTC (rev 235323)
@@ -1,3 +1,15 @@
+2018-08-24  Alex Christensen  <[email protected]>
+
+        Introduce _WKInspector
+        https://bugs.webkit.org/show_bug.cgi?id=188923
+        <rdar://problem/34657861>
+
+        Reviewed by Brian Burg.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController validateMenuItem:]):
+        (-[WK2BrowserWindowController showHideWebInspector:]):
+
 2018-08-24  Jonathan Bedard  <[email protected]>
 
         Fix handling of iOS minor versions in default_baseline_search_path

Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (235322 => 235323)


--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2018-08-24 18:22:29 UTC (rev 235322)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2018-08-24 18:41:19 UTC (rev 235323)
@@ -31,7 +31,6 @@
 #import "AppKitCompatibilityDeclarations.h"
 #import "SettingsController.h"
 #import <WebKit/WKFrameInfo.h>
-#import <WebKit/WKInspector.h>
 #import <WebKit/WKNavigationActionPrivate.h>
 #import <WebKit/WKNavigationDelegate.h>
 #import <WebKit/WKPage.h>
@@ -43,6 +42,7 @@
 #import <WebKit/WKWebsiteDataStorePrivate.h>
 #import <WebKit/WebNSURLExtras.h>
 #import <WebKit/_WKIconLoadingDelegate.h>
+#import <WebKit/_WKInspector.h>
 #import <WebKit/_WKLinkIconParameters.h>
 #import <WebKit/_WKUserInitiatedAction.h>
 
@@ -209,7 +209,7 @@
     else if (action == @selector(toggleEditable:))
         [menuItem setState:self.isEditable ? NSControlStateValueOn : NSControlStateValueOff];
     else if (action == @selector(showHideWebInspector:))
-        [menuItem setTitle:WKInspectorIsVisible(WKPageGetInspector(_webView._pageRefForTransitionToWKWebView)) ? @"Close Web Inspector" : @"Show Web Inspector"];
+        [menuItem setTitle:_webView._inspector.isVisible ? @"Close Web Inspector" : @"Show Web Inspector"];
     else if (action == @selector(toggleAlwaysShowsHorizontalScroller:))
         menuItem.state = _webView._alwaysShowsHorizontalScroller ? NSControlStateValueOn : NSControlStateValueOff;
     else if (action == @selector(toggleAlwaysShowsVerticalScroller:))
@@ -289,11 +289,11 @@
 
 - (IBAction)showHideWebInspector:(id)sender
 {
-    WKInspectorRef inspectorRef = WKPageGetInspector(_webView._pageRefForTransitionToWKWebView);
-    if (WKInspectorIsVisible(inspectorRef))
-        WKInspectorHide(inspectorRef);
+    _WKInspector *inspector = _webView._inspector;
+    if (inspector.isVisible)
+        [inspector hide];
     else
-        WKInspectorShow(inspectorRef);
+        [inspector show];
 }
 
 - (IBAction)toggleAlwaysShowsHorizontalScroller:(id)sender
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to