Title: [164004] trunk/Source/WebKit2
Revision
164004
Author
[email protected]
Date
2014-02-12 17:54:27 -0800 (Wed, 12 Feb 2014)

Log Message

Add relatedWebView property to WKWebViewConfiguration
https://bugs.webkit.org/show_bug.cgi?id=128707

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration relatedWebView]):
(-[WKWebViewConfiguration setRelatedWebView:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm.
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (164003 => 164004)


--- trunk/Source/WebKit2/ChangeLog	2014-02-13 01:40:51 UTC (rev 164003)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-13 01:54:27 UTC (rev 164004)
@@ -1,3 +1,19 @@
+2014-02-12  Anders Carlsson  <[email protected]>
+
+        Add relatedWebView property to WKWebViewConfiguration
+        https://bugs.webkit.org/show_bug.cgi?id=128707
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration copyWithZone:]):
+        (-[WKWebViewConfiguration relatedWebView]):
+        (-[WKWebViewConfiguration setRelatedWebView:]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm.
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2014-02-12  Alexey Proskuryakov  <[email protected]>
 
         [WK2] Add a C API to get WebCrypto master key from a client

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (164003 => 164004)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-02-13 01:40:51 UTC (rev 164003)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-02-13 01:54:27 UTC (rev 164004)
@@ -37,7 +37,7 @@
 #import "WKPreferencesInternal.h"
 #import "WKProcessClassInternal.h"
 #import "WKRemoteObjectRegistryInternal.h"
-#import "WKWebViewConfiguration.h"
+#import "WKWebViewConfigurationPrivate.h"
 #import "WebContext.h"
 #import "WebBackForwardList.h"
 #import "WebPageProxy.h"
@@ -87,6 +87,15 @@
 
     _configuration = adoptNS([configuration copy]);
 
+    if (WKWebView *relatedWebView = [_configuration _relatedWebView]) {
+        WKProcessClass *processClass = [_configuration processClass];
+        WKProcessClass *relatedWebViewProcessClass = [relatedWebView->_configuration processClass];
+        if (processClass && processClass != relatedWebViewProcessClass)
+            [NSException raise:NSInvalidArgumentException format:@"Related web view %@ has process class %@ but configuration specifies a different process class %@", relatedWebView, relatedWebViewProcessClass, configuration.processClass];
+
+        [_configuration setProcessClass:relatedWebViewProcessClass];
+    }
+
     if (![_configuration processClass])
         [_configuration setProcessClass:adoptNS([[WKProcessClass alloc] init]).get()];
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (164003 => 164004)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2014-02-13 01:40:51 UTC (rev 164003)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2014-02-13 01:54:27 UTC (rev 164004)
@@ -24,15 +24,17 @@
  */
 
 #import "config.h"
-#import "WKWebViewConfiguration.h"
+#import "WKWebViewConfigurationPrivate.h"
 
 #if WK_API_ENABLED
 
+#import "WeakObjCPtr.h"
 #import <wtf/RetainPtr.h>
 
 @implementation WKWebViewConfiguration {
     RetainPtr<WKProcessClass> _processClass;
     RetainPtr<WKPreferences> _preferences;
+    WebKit::WeakObjCPtr<WKWebView> _relatedWebView;
 }
 
 - (id)copyWithZone:(NSZone *)zone
@@ -41,6 +43,7 @@
 
     configuration.processClass = _processClass.get();
     configuration.preferences = _preferences.get();
+    configuration._relatedWebView = _relatedWebView.get().get();
 
     return configuration;
 }
@@ -65,6 +68,16 @@
     _preferences = preferences;
 }
 
+- (WKWebView *)_relatedWebView
+{
+    return _relatedWebView.getAutoreleased();
+}
+
+- (void)_setRelatedWebView:(WKWebView *)relatedWebView
+{
+    _relatedWebView = relatedWebView;
+}
+
 @end
 
 #endif // WK_API_ENABLED

Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (from rev 164001, trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm) (0 => 164004)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	2014-02-13 01:54:27 UTC (rev 164004)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 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 <WebKit2/WKWebViewConfiguration.h>
+
+#if WK_API_ENABLED
+
+@class WKWebView;
+
+@interface WKWebViewConfiguration (WKPrivate)
+
+@property (nonatomic, weak, setter=_setRelatedWebView:) WKWebView *_relatedWebView;
+
+@end
+
+#endif

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (164003 => 164004)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-02-13 01:40:51 UTC (rev 164003)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-02-13 01:54:27 UTC (rev 164004)
@@ -315,6 +315,7 @@
 		1AC1338018590AE400F3EC05 /* RemoteObjectRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC1337E18590AE400F3EC05 /* RemoteObjectRegistry.h */; };
 		1AC1338518590C4600F3EC05 /* RemoteObjectRegistryMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC1338318590C4600F3EC05 /* RemoteObjectRegistryMessageReceiver.cpp */; };
 		1AC1338618590C4600F3EC05 /* RemoteObjectRegistryMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC1338418590C4600F3EC05 /* RemoteObjectRegistryMessages.h */; };
+		1AC1415118AC47EE006C602C /* WKWebViewConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC1415018AC47EE006C602C /* WKWebViewConfigurationPrivate.h */; };
 		1AC25FC212A48F6000BD2671 /* PluginProcessShim.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */; };
 		1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC4C82816B876A90069DCCD /* MessageFlags.h */; };
 		1AC5FFC2174BFD1B0001483D /* PluginProcessAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC5FFC1174BFD1B0001483D /* PluginProcessAttributes.h */; };
@@ -1997,6 +1998,7 @@
 		1AC1338118590B0500F3EC05 /* RemoteObjectRegistry.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RemoteObjectRegistry.messages.in; sourceTree = "<group>"; };
 		1AC1338318590C4600F3EC05 /* RemoteObjectRegistryMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteObjectRegistryMessageReceiver.cpp; sourceTree = "<group>"; };
 		1AC1338418590C4600F3EC05 /* RemoteObjectRegistryMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteObjectRegistryMessages.h; sourceTree = "<group>"; };
+		1AC1415018AC47EE006C602C /* WKWebViewConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewConfigurationPrivate.h; sourceTree = "<group>"; };
 		1AC25F8912A48E0300BD2671 /* PluginProcessShim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessShim.h; sourceTree = "<group>"; };
 		1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessShim.mm; sourceTree = "<group>"; };
 		1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = PluginProcessShim.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -4388,6 +4390,7 @@
 				1A3CC16418906ACF001E6ED8 /* WKWebView.mm */,
 				1ADF59191890528E0043C145 /* WKWebViewConfiguration.h */,
 				1ADF59181890528E0043C145 /* WKWebViewConfiguration.mm */,
+				1AC1415018AC47EE006C602C /* WKWebViewConfigurationPrivate.h */,
 				1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */,
 				26F9A83A18A3463F00AEB88A /* WKWebViewPrivate.h */,
 			);
@@ -6298,6 +6301,7 @@
 				37C4E9F6131C6E7E0029BD5A /* config.h in Headers */,
 				BC032DAB10F437D10058C15A /* Connection.h in Headers */,
 				5136183E163126DA00A99DDE /* ConnectionStack.h in Headers */,
+				1AC1415118AC47EE006C602C /* WKWebViewConfigurationPrivate.h in Headers */,
 				CDC3830C17212282008A2FC3 /* CookieStorageShimLibrary.h in Headers */,
 				515E7730184015800007203F /* UniqueIDBDatabase.h in Headers */,
 				B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to