Title: [196990] trunk
- Revision
- 196990
- Author
- [email protected]
- Date
- 2016-02-23 13:17:18 -0800 (Tue, 23 Feb 2016)
Log Message
WKWebViewConfiguration should conform to NSCoding
https://bugs.webkit.org/show_bug.cgi?id=154602
Reviewed by Beth Dakin.
Source/WebKit2:
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration encodeWithCoder:]):
(-[WKWebViewConfiguration initWithCoder:]):
Tools:
* TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (196989 => 196990)
--- trunk/Source/WebKit2/ChangeLog 2016-02-23 20:38:37 UTC (rev 196989)
+++ trunk/Source/WebKit2/ChangeLog 2016-02-23 21:17:18 UTC (rev 196990)
@@ -1,5 +1,17 @@
2016-02-23 Anders Carlsson <[email protected]>
+ WKWebViewConfiguration should conform to NSCoding
+ https://bugs.webkit.org/show_bug.cgi?id=154602
+
+ Reviewed by Beth Dakin.
+
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration encodeWithCoder:]):
+ (-[WKWebViewConfiguration initWithCoder:]):
+
+2016-02-23 Anders Carlsson <[email protected]>
+
WKPreferences should conform to NSCoding
https://bugs.webkit.org/show_bug.cgi?id=154597
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (196989 => 196990)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-02-23 20:38:37 UTC (rev 196989)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-02-23 21:17:18 UTC (rev 196990)
@@ -75,7 +75,7 @@
@helps Contains properties used to configure a @link WKWebView @/link.
*/
WK_CLASS_AVAILABLE(10_10, 8_0)
-@interface WKWebViewConfiguration : NSObject <NSCopying>
+@interface WKWebViewConfiguration : NSObject <NSCoding, NSCopying>
/*! @abstract The process pool from which to obtain the view's web content
process.
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (196989 => 196990)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-02-23 20:38:37 UTC (rev 196989)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-02-23 21:17:18 UTC (rev 196990)
@@ -156,6 +156,46 @@
return [NSString stringWithFormat:@"<%@: %p; processPool = %@; preferences = %@>", NSStringFromClass(self.class), self, self.processPool, self.preferences];
}
+// FIXME: Encode the process pool, user content controller and website data store.
+
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+ [coder encodeObject:self.preferences forKey:@"preferences"];
+
+ [coder encodeBool:self.suppressesIncrementalRendering forKey:@"suppressesIncrementalRendering"];
+ [coder encodeObject:self.applicationNameForUserAgent forKey:@"applicationNameForUserAgent"];
+ [coder encodeBool:self.allowsAirPlayForMediaPlayback forKey:@"allowsAirPlayForMediaPlayback"];
+ [coder encodeInteger:self.dataDetectorTypes forKey:@"dataDetectorTypes"];
+
+#if PLATFORM(IOS)
+ [coder encodeBool:self.allowsInlineMediaPlayback forKey:@"allowsInlineMediaPlayback"];
+ [coder encodeBool:self.requiresUserActionForMediaPlayback forKey:@"requiresUserActionForMediaPlayback"];
+ [coder encodeInteger:self.selectionGranularity forKey:@"selectionGranularity"];
+ [coder encodeBool:self.allowsPictureInPictureMediaPlayback forKey:@"allowsPictureInPictureMediaPlayback"];
+#endif
+}
+
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+ if (!(self = [self init]))
+ return nil;
+
+ self.preferences = [coder decodeObjectForKey:@"preferences"];
+ self.suppressesIncrementalRendering = [coder decodeBoolForKey:@"suppressesIncrementalRendering"];
+ self.applicationNameForUserAgent = [coder decodeObjectForKey:@"applicationNameForUserAgent"];
+ self.allowsAirPlayForMediaPlayback = [coder decodeBoolForKey:@"allowsAirPlayForMediaPlayback"];
+ self.dataDetectorTypes = [coder decodeIntegerForKey:@"dataDetectorTypes"];
+
+#if PLATFORM(IOS)
+ self.allowsInlineMediaPlayback = [coder decodeBoolForKey:@"allowsInlineMediaPlayback"];
+ self.requiresUserActionForMediaPlayback = [coder decodeBoolForKey:@"requiresUserActionForMediaPlayback"];
+ self.selectionGranularity = [coder decodeIntegerForKey:@"selectionGranularity"];
+ self.allowsPictureInPictureMediaPlayback = [coder decodeBoolForKey:@"allowsPictureInPictureMediaPlayback"];
+#endif
+
+ return self;
+}
+
- (id)copyWithZone:(NSZone *)zone
{
WKWebViewConfiguration *configuration = [(WKWebViewConfiguration *)[[self class] allocWithZone:zone] init];
Modified: trunk/Tools/ChangeLog (196989 => 196990)
--- trunk/Tools/ChangeLog 2016-02-23 20:38:37 UTC (rev 196989)
+++ trunk/Tools/ChangeLog 2016-02-23 21:17:18 UTC (rev 196990)
@@ -1,5 +1,15 @@
2016-02-23 Anders Carlsson <[email protected]>
+ WKWebViewConfiguration should conform to NSCoding
+ https://bugs.webkit.org/show_bug.cgi?id=154602
+
+ Reviewed by Beth Dakin.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm:
+ (TEST):
+
+2016-02-23 Anders Carlsson <[email protected]>
+
WKPreferences should conform to NSCoding
https://bugs.webkit.org/show_bug.cgi?id=154597
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm (196989 => 196990)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm 2016-02-23 20:38:37 UTC (rev 196989)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm 2016-02-23 21:17:18 UTC (rev 196990)
@@ -65,4 +65,35 @@
#endif
}
+TEST(Coding, WKWebViewConfiguration)
+{
+ auto a = adoptNS([[WKWebViewConfiguration alloc] init]);
+
+ // Change all defaults to something else.
+ [a setSuppressesIncrementalRendering:YES];
+ [a setApplicationNameForUserAgent:@"Application Name"];
+ [a setAllowsAirPlayForMediaPlayback:NO];
+ [a setDataDetectorTypes:WKDataDetectorTypeAll];
+
+#if PLATFORM(IOS)
+ [a setAllowsInlineMediaPlayback:YES];
+ [a setRequiresUserActionForMediaPlayback:NO];
+ [a setSelectionGranularity:WKSelectionGranularityCharacter];
+ [a setAllowsPictureInPictureMediaPlayback:NO];
#endif
+
+ auto b = encodeAndDecode(a.get());
+
+ EXPECT_EQ([a suppressesIncrementalRendering], [b suppressesIncrementalRendering]);
+ EXPECT_TRUE([[a applicationNameForUserAgent] isEqualToString:[b applicationNameForUserAgent]]);
+ EXPECT_EQ([a allowsAirPlayForMediaPlayback], [b allowsAirPlayForMediaPlayback]);
+ EXPECT_EQ([a dataDetectorTypes], [b dataDetectorTypes]);
+
+#if PLATFORM(IOS)
+ EXPECT_EQ([a allowsInlineMediaPlayback], [b allowsInlineMediaPlayback]);
+ EXPECT_EQ([a requiresUserActionForMediaPlayback], [b requiresUserActionForMediaPlayback]);
+ EXPECT_EQ([a selectionGranularity], [b selectionGranularity]);
+ EXPECT_EQ([a allowsPictureInPictureMediaPlayback], [b allowsPictureInPictureMediaPlayback]);
+#endif
+}
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes