Diff
Modified: trunk/Source/WebKit/ChangeLog (226535 => 226536)
--- trunk/Source/WebKit/ChangeLog 2018-01-08 21:54:24 UTC (rev 226535)
+++ trunk/Source/WebKit/ChangeLog 2018-01-08 22:01:13 UTC (rev 226536)
@@ -1,3 +1,27 @@
+2018-01-08 Joseph Pecoraro <[email protected]>
+
+ [Cocoa] Web Inspector: Provide a way for clients to check if an NSWindow is a Web Inspector window
+ https://bugs.webkit.org/show_bug.cgi?id=181361
+ <rdar://problem/36332865>
+
+ Reviewed by Darin Adler.
+
+ * WebKit.xcodeproj/project.pbxproj:
+ New files.
+
+ * Shared/API/Cocoa/_WKNSWindowExtras.h: Added.
+ * Shared/API/Cocoa/_WKNSWindowExtras.mm: Added.
+ (-[NSWindow _web_isWebInspectorWindow]):
+ Method to determing if a window is being used for Web Inspector content.
+
+ * UIProcess/mac/WKInspectorWindow.h: Added.
+ * UIProcess/mac/WKInspectorWindow.mm: Added.
+ Named subclass so we can use isKindOfClass.
+
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::WebInspectorProxy::createFrontendWindow):
+ Use the named subclass.
+
2018-01-08 Tim Horton <[email protected]>
Build fix for WKPDFView
Added: trunk/Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.h (0 => 226536)
--- trunk/Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.h (rev 0)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.h 2018-01-08 22:01:13 UTC (rev 226536)
@@ -0,0 +1,40 @@
+/*
+ * 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 <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#if !TARGET_OS_IPHONE
+
+@interface NSWindow (WKExtras)
+
+- (BOOL)_web_isWebInspectorWindow;
+
+@end
+
+#endif // !TARGET_OS_IPHONE
+
+#endif // WK_API_ENABLED
Added: trunk/Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.mm (0 => 226536)
--- trunk/Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.mm (rev 0)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.mm 2018-01-08 22:01:13 UTC (rev 226536)
@@ -0,0 +1,46 @@
+/*
+ * 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 "_WKNSWindowExtras.h"
+
+#if WK_API_ENABLED
+
+#if !TARGET_OS_IPHONE
+
+#import "WKInspectorWindow.h"
+
+@implementation NSWindow (WKExtras)
+
+- (BOOL)_web_isWebInspectorWindow
+{
+ return [self isKindOfClass:[WKInspectorWindow class]];
+}
+
+@end
+
+#endif // !TARGET_OS_IPHONE
+
+#endif // WK_API_ENABLED
Added: trunk/Source/WebKit/UIProcess/mac/WKInspectorWindow.h (0 => 226536)
--- trunk/Source/WebKit/UIProcess/mac/WKInspectorWindow.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/mac/WKInspectorWindow.h 2018-01-08 22:01:13 UTC (rev 226536)
@@ -0,0 +1,33 @@
+/*
+ * 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 <WebKit/WKFoundation.h>
+
+#if PLATFORM(MAC) && WK_API_ENABLED
+
+@interface WKInspectorWindow : NSWindow
+@end
+
+#endif
Added: trunk/Source/WebKit/UIProcess/mac/WKInspectorWindow.mm (0 => 226536)
--- trunk/Source/WebKit/UIProcess/mac/WKInspectorWindow.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/mac/WKInspectorWindow.mm 2018-01-08 22:01:13 UTC (rev 226536)
@@ -0,0 +1,34 @@
+/*
+ * 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 "WKInspectorWindow.h"
+
+#if PLATFORM(MAC) && WK_API_ENABLED
+
+@implementation WKInspectorWindow
+@end
+
+#endif
Modified: trunk/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm (226535 => 226536)
--- trunk/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm 2018-01-08 21:54:24 UTC (rev 226535)
+++ trunk/Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm 2018-01-08 22:01:13 UTC (rev 226536)
@@ -30,6 +30,7 @@
#import "WKInspectorPrivateMac.h"
#import "WKInspectorViewController.h"
+#import "WKInspectorWindow.h"
#import "WKViewInternal.h"
#import "WKWebViewInternal.h"
#import "WebInspectorUIMessages.h"
@@ -190,7 +191,7 @@
RetainPtr<NSWindow> WebInspectorProxy::createFrontendWindow(NSRect savedWindowFrame)
{
NSRect windowFrame = !NSIsEmptyRect(savedWindowFrame) ? savedWindowFrame : NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight);
- auto window = adoptNS([[NSWindow alloc] initWithContentRect:windowFrame styleMask:windowStyleMask backing:NSBackingStoreBuffered defer:NO]);
+ auto window = adoptNS([[WKInspectorWindow alloc] initWithContentRect:windowFrame styleMask:windowStyleMask backing:NSBackingStoreBuffered defer:NO]);
[window setMinSize:NSMakeSize(minimumWindowWidth, minimumWindowHeight)];
[window setReleasedWhenClosed:NO];
[window setCollectionBehavior:([window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary)];
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (226535 => 226536)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-01-08 21:54:24 UTC (rev 226535)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-01-08 22:01:13 UTC (rev 226536)
@@ -1561,6 +1561,10 @@
A55BA8361BA3E70D007CD33D /* WebInspectorFrontendAPIDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A55BA8321BA3E6FA007CD33D /* WebInspectorFrontendAPIDispatcher.cpp */; };
A58B6F0818FCA733008CBA53 /* WKFileUploadPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = A58B6F0618FCA733008CBA53 /* WKFileUploadPanel.h */; };
A58B6F0918FCA733008CBA53 /* WKFileUploadPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = A58B6F0718FCA733008CBA53 /* WKFileUploadPanel.mm */; };
+ A5C0F0A72000654D00536536 /* _WKNSWindowExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C0F0A62000654400536536 /* _WKNSWindowExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A5C0F0A82000655100536536 /* _WKNSWindowExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5C0F0A52000654400536536 /* _WKNSWindowExtras.mm */; };
+ A5C0F0AB2000658200536536 /* WKInspectorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C0F0AA2000656E00536536 /* WKInspectorWindow.h */; };
+ A5C0F0AC2000658500536536 /* WKInspectorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5C0F0A92000656E00536536 /* WKInspectorWindow.mm */; };
A5D3504E1D78F5B3005124A9 /* RemoteWebInspectorProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5D3504D1D78F0D2005124A9 /* RemoteWebInspectorProxyMac.mm */; };
A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
A78CCDDA193AC9F4005ECC25 /* com.apple.WebKit.Databases.sb in CopyFiles */ = {isa = PBXBuildFile; fileRef = A78CCDD7193AC9E3005ECC25 /* com.apple.WebKit.Databases.sb */; };
@@ -3986,6 +3990,10 @@
A55BA8331BA3E6FA007CD33D /* WebInspectorFrontendAPIDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorFrontendAPIDispatcher.h; sourceTree = "<group>"; };
A58B6F0618FCA733008CBA53 /* WKFileUploadPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFileUploadPanel.h; path = ios/forms/WKFileUploadPanel.h; sourceTree = "<group>"; };
A58B6F0718FCA733008CBA53 /* WKFileUploadPanel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFileUploadPanel.mm; path = ios/forms/WKFileUploadPanel.mm; sourceTree = "<group>"; };
+ A5C0F0A52000654400536536 /* _WKNSWindowExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKNSWindowExtras.mm; sourceTree = "<group>"; };
+ A5C0F0A62000654400536536 /* _WKNSWindowExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKNSWindowExtras.h; sourceTree = "<group>"; };
+ A5C0F0A92000656E00536536 /* WKInspectorWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKInspectorWindow.mm; sourceTree = "<group>"; };
+ A5C0F0AA2000656E00536536 /* WKInspectorWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKInspectorWindow.h; sourceTree = "<group>"; };
A5D3504D1D78F0D2005124A9 /* RemoteWebInspectorProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteWebInspectorProxyMac.mm; sourceTree = "<group>"; };
A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageVisibilityTypes.h; sourceTree = "<group>"; };
A72D5D7F1236CBA800A88B15 /* APISerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APISerializedScriptValue.h; sourceTree = "<group>"; };
@@ -6068,6 +6076,8 @@
93A88B3A1BC710D900ABA5C2 /* _WKHitTestResultInternal.h */,
A118A9F11908B8EA00F7C92B /* _WKNSFileManagerExtras.h */,
A118A9F01908B8EA00F7C92B /* _WKNSFileManagerExtras.mm */,
+ A5C0F0A62000654400536536 /* _WKNSWindowExtras.h */,
+ A5C0F0A52000654400536536 /* _WKNSWindowExtras.mm */,
1A9E328B182165A900F5D04C /* _WKRemoteObjectInterface.h */,
1A9E328C182165A900F5D04C /* _WKRemoteObjectInterface.mm */,
1AABFE391829C1ED005B070E /* _WKRemoteObjectInterfaceInternal.h */,
@@ -7926,6 +7936,8 @@
9321D5871A38EE74008052BE /* WKImmediateActionController.mm */,
994BADF11F7D77EA00B571E7 /* WKInspectorViewController.h */,
994BADF21F7D77EB00B571E7 /* WKInspectorViewController.mm */,
+ A5C0F0AA2000656E00536536 /* WKInspectorWindow.h */,
+ A5C0F0A92000656E00536536 /* WKInspectorWindow.mm */,
A518B5D01FE1D55B00F9FA28 /* WKInspectorWKWebView.h */,
A518B5D11FE1D55B00F9FA28 /* WKInspectorWKWebView.mm */,
0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */,
@@ -8518,6 +8530,7 @@
2D790A9D1AD7050D00AB90B3 /* _WKLayoutMode.h in Headers */,
510F59111DDE297000412FF5 /* _WKLinkIconParameters.h in Headers */,
A118A9F31908B8EA00F7C92B /* _WKNSFileManagerExtras.h in Headers */,
+ A5C0F0A72000654D00536536 /* _WKNSWindowExtras.h in Headers */,
9323611E1B015DA800FA9232 /* _WKOverlayScrollbarStyle.h in Headers */,
1A43E82A188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h in Headers */,
7C89D2D71A6C6BE6003A5FDE /* _WKProcessPoolConfigurationInternal.h in Headers */,
@@ -9347,6 +9360,7 @@
A54293A4195A43DA002782C7 /* WKInspectorNodeSearchGestureRecognizer.h in Headers */,
6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */,
994BADF41F7D781400B571E7 /* WKInspectorViewController.h in Headers */,
+ A5C0F0AB2000658200536536 /* WKInspectorWindow.h in Headers */,
A518B5D21FE1D55B00F9FA28 /* WKInspectorWKWebView.h in Headers */,
51A9E10B1315CD18009E7031 /* WKKeyValueStorageManager.h in Headers */,
2D790A9F1AD7164900AB90B3 /* WKLayoutMode.h in Headers */,
@@ -10147,6 +10161,7 @@
93A88B391BC70F3F00ABA5C2 /* _WKHitTestResult.mm in Sources */,
510F59121DDE297700412FF5 /* _WKLinkIconParameters.mm in Sources */,
A118A9F21908B8EA00F7C92B /* _WKNSFileManagerExtras.mm in Sources */,
+ A5C0F0A82000655100536536 /* _WKNSWindowExtras.mm in Sources */,
1A43E829188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm in Sources */,
1A9E328E182165A900F5D04C /* _WKRemoteObjectInterface.mm in Sources */,
1A9E328A1821636900F5D04C /* _WKRemoteObjectRegistry.mm in Sources */,
@@ -10969,6 +10984,7 @@
0F3C725C196F605200AEDD0C /* WKInspectorHighlightView.mm in Sources */,
A54293A5195A43DD002782C7 /* WKInspectorNodeSearchGestureRecognizer.mm in Sources */,
994BADF31F7D781100B571E7 /* WKInspectorViewController.mm in Sources */,
+ A5C0F0AC2000658500536536 /* WKInspectorWindow.mm in Sources */,
A518B5D31FE1D55B00F9FA28 /* WKInspectorWKWebView.mm in Sources */,
51A9E10A1315CD18009E7031 /* WKKeyValueStorageManager.cpp in Sources */,
C98C48A91B6FD5B500145103 /* WKMediaSessionFocusManager.cpp in Sources */,