Diff
Modified: trunk/Source/WebCore/ChangeLog (243115 => 243116)
--- trunk/Source/WebCore/ChangeLog 2019-03-18 23:51:42 UTC (rev 243115)
+++ trunk/Source/WebCore/ChangeLog 2019-03-18 23:54:38 UTC (rev 243116)
@@ -1,3 +1,13 @@
+2019-03-18 Timothy Hatcher <[email protected]>
+
+ WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
+ https://bugs.webkit.org/show_bug.cgi?id=195916
+
+ Reviewed by Tim Horton.
+
+ * WebCore.xcodeproj/project.pbxproj: Make ColorIOS.h a private header.
+ * platform/ios/ColorIOS.h: Export colorFromUIColor.
+
2019-03-18 Said Abou-Hallawa <[email protected]>
Define the type of SVGPropertyOwnerRegistry for all SVG elements
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (243115 => 243116)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-18 23:51:42 UTC (rev 243115)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-18 23:54:38 UTC (rev 243116)
@@ -4235,7 +4235,7 @@
CE08C3D2152B599A0021B8C2 /* AlternativeTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE08C3D0152B599A0021B8C2 /* AlternativeTextController.h */; settings = {ATTRIBUTES = (); }; };
CE1866451F72E5B400A0CAB6 /* MarkedText.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1866431F72E5B400A0CAB6 /* MarkedText.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE2849871CA360DF00B4A57F /* ContentSecurityPolicyDirectiveNames.h in Headers */ = {isa = PBXBuildFile; fileRef = CE2849861CA360DF00B4A57F /* ContentSecurityPolicyDirectiveNames.h */; };
- CE5169E721F1B84700EA4F78 /* ColorIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5169E521F1B84700EA4F78 /* ColorIOS.h */; };
+ CE5169E721F1B84700EA4F78 /* ColorIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5169E521F1B84700EA4F78 /* ColorIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE5FA255209E48C50051D700 /* ContentSecurityPolicyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5FA253209E48C50051D700 /* ContentSecurityPolicyClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE6DADFA1C591E6A003F6A88 /* ContentSecurityPolicyResponseHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = CE6DADF81C591E6A003F6A88 /* ContentSecurityPolicyResponseHeaders.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE799F981C6A46BC0097B518 /* ContentSecurityPolicySourceList.h in Headers */ = {isa = PBXBuildFile; fileRef = CE799F961C6A46BC0097B518 /* ContentSecurityPolicySourceList.h */; };
Modified: trunk/Source/WebCore/platform/ios/ColorIOS.h (243115 => 243116)
--- trunk/Source/WebCore/platform/ios/ColorIOS.h 2019-03-18 23:51:42 UTC (rev 243115)
+++ trunk/Source/WebCore/platform/ios/ColorIOS.h 2019-03-18 23:54:38 UTC (rev 243116)
@@ -33,7 +33,7 @@
namespace WebCore {
-Color colorFromUIColor(UIColor *);
+WEBCORE_EXPORT Color colorFromUIColor(UIColor *);
} // namespace WebCore
Modified: trunk/Source/WebKit/ChangeLog (243115 => 243116)
--- trunk/Source/WebKit/ChangeLog 2019-03-18 23:51:42 UTC (rev 243115)
+++ trunk/Source/WebKit/ChangeLog 2019-03-18 23:54:38 UTC (rev 243116)
@@ -1,5 +1,23 @@
2019-03-18 Timothy Hatcher <[email protected]>
+ WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
+ https://bugs.webkit.org/show_bug.cgi?id=195916
+
+ Reviewed by Tim Horton.
+
+ Add direct support for UIColor so it does not try to use the NSSecureCoding path.
+ This avoids needs to list the classes when decoding the attributes NSDictionary
+ and matches the macOS NSColor encoder/decoder.
+
+ * Shared/Cocoa/ArgumentCodersCocoa.mm:
+ (IPC::typeFromObject):
+ (IPC::encodeColorInternal):
+ (IPC::decodeColorInternal):
+ (IPC::encodeObject):
+ (IPC::decodeObject):
+
+2019-03-18 Timothy Hatcher <[email protected]>
+
Add new NSAttributedString API for converting HTML.
https://bugs.webkit.org/show_bug.cgi?id=195636
rdar://problem/45055697
Modified: trunk/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm (243115 => 243116)
--- trunk/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm 2019-03-18 23:51:42 UTC (rev 243115)
+++ trunk/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm 2019-03-18 23:54:38 UTC (rev 243116)
@@ -36,17 +36,22 @@
#if USE(APPKIT)
#import <WebCore/ColorMac.h>
+#else
+#import <WebCore/ColorIOS.h>
#endif
#if PLATFORM(IOS_FAMILY)
+#import <UIKit/UIColor.h>
#import <UIKit/UIFont.h>
#import <UIKit/UIFontDescriptor.h>
#endif
#if USE(APPKIT)
+using PlatformColor = NSColor;
using PlatformFont = NSFont;
using PlatformFontDescriptor = NSFontDescriptor;
#else
+using PlatformColor = UIColor;
using PlatformFont = UIFont;
using PlatformFontDescriptor = UIFontDescriptor;
#endif
@@ -58,9 +63,7 @@
enum class NSType {
Array,
-#if USE(APPKIT)
Color,
-#endif
Data,
Date,
Dictionary,
@@ -81,10 +84,8 @@
// Specific classes handled.
if ([object isKindOfClass:[NSArray class]])
return NSType::Array;
-#if USE(APPKIT)
- if ([object isKindOfClass:[NSColor class]])
+ if ([object isKindOfClass:[PlatformColor class]])
return NSType::Color;
-#endif
if ([object isKindOfClass:[NSData class]])
return NSType::Data;
if ([object isKindOfClass:[NSDate class]])
@@ -170,7 +171,7 @@
return { array };
}
-#pragma mark - NSColor
+#pragma mark - NSColor / UIColor
#if USE(APPKIT)
static inline void encodeColorInternal(Encoder& encoder, NSColor *color)
@@ -185,6 +186,19 @@
return WTF::nullopt;
return { nsColor(color) };
}
+#else
+static inline void encodeColorInternal(Encoder& encoder, UIColor *color)
+{
+ encoder << colorFromUIColor(color);
+}
+
+static inline Optional<RetainPtr<id>> decodeColorInternal(Decoder& decoder)
+{
+ Color color;
+ if (!decoder.decode(color))
+ return WTF::nullopt;
+ return { adoptNS([[UIColor alloc] initWithCGColor:cachedCGColor(color)]) };
+}
#endif
#pragma mark - NSData
@@ -384,11 +398,9 @@
case NSType::Array:
encodeArrayInternal(encoder, static_cast<NSArray *>(object));
return;
-#if USE(APPKIT)
case NSType::Color:
- encodeColorInternal(encoder, static_cast<NSColor *>(object));
+ encodeColorInternal(encoder, static_cast<PlatformColor *>(object));
return;
-#endif
case NSType::Dictionary:
encodeDictionaryInternal(encoder, static_cast<NSDictionary *>(object));
return;
@@ -435,10 +447,8 @@
switch (type) {
case NSType::Array:
return decodeArrayInternal(decoder, allowedClasses);
-#if USE(APPKIT)
case NSType::Color:
return decodeColorInternal(decoder);
-#endif
case NSType::Dictionary:
return decodeDictionaryInternal(decoder, allowedClasses);
case NSType::Font:
@@ -470,9 +480,7 @@
using values = EnumValues<
IPC::NSType,
IPC::NSType::Array,
-#if USE(APPKIT)
IPC::NSType::Color,
-#endif
IPC::NSType::Data,
IPC::NSType::Date,
IPC::NSType::Dictionary,
Modified: trunk/Tools/ChangeLog (243115 => 243116)
--- trunk/Tools/ChangeLog 2019-03-18 23:51:42 UTC (rev 243115)
+++ trunk/Tools/ChangeLog 2019-03-18 23:54:38 UTC (rev 243116)
@@ -1,3 +1,13 @@
+2019-03-18 Timothy Hatcher <[email protected]>
+
+ WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
+ https://bugs.webkit.org/show_bug.cgi?id=195916
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm:
+ (TEST(WKWebView, GetContentsShouldReturnAttributedString): Fix iOS code path to pass.
+
2019-03-18 Alexey Proskuryakov <[email protected]>
Add a secondary e-mail address for Fujii Hironori to make tools happier.
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm (243115 => 243116)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm 2019-03-18 23:51:42 UTC (rev 243115)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewGetContents.mm 2019-03-18 23:54:38 UTC (rev 243116)
@@ -57,14 +57,6 @@
__block bool finished = false;
-#if USE(APPKIT)
- using PlatformFont = NSFont;
- using PlatformColor = NSColor;
-#else
- using PlatformFont = UIFont;
- using PlatformColor = UIColor;
-#endif
-
[webView _getContentsAsAttributedStringWithCompletionHandler:^(NSAttributedString *attributedString, NSDictionary<NSAttributedStringDocumentAttributeKey, id> *documentAttributes, NSError *error) {
EXPECT_NOT_NULL(attributedString);
EXPECT_NOT_NULL(documentAttributes);
@@ -76,10 +68,18 @@
if (!i) {
EXPECT_WK_STREQ(@"Hello ", substring.string);
- EXPECT_WK_STREQ(@"Times-Roman", dynamic_objc_cast<PlatformFont>(attributes[NSFontAttributeName]).fontName);
+#if USE(APPKIT)
+ EXPECT_WK_STREQ(@"Times-Roman", dynamic_objc_cast<NSFont>(attributes[NSFontAttributeName]).fontName);
+#else
+ EXPECT_WK_STREQ(@"TimesNewRomanPSMT", dynamic_objc_cast<UIFont>(attributes[NSFontAttributeName]).fontName);
+#endif
} else if (i == 1) {
EXPECT_WK_STREQ(@"World!", substring.string);
- EXPECT_WK_STREQ(@"Times-Bold", dynamic_objc_cast<PlatformFont>(attributes[NSFontAttributeName]).fontName);
+#if USE(APPKIT)
+ EXPECT_WK_STREQ(@"Times-Bold", dynamic_objc_cast<NSFont>(attributes[NSFontAttributeName]).fontName);
+#else
+ EXPECT_WK_STREQ(@"TimesNewRomanPS-BoldMT", dynamic_objc_cast<UIFont>(attributes[NSFontAttributeName]).fontName);
+#endif
} else
ASSERT_NOT_REACHED();
@@ -86,7 +86,11 @@
++i;
}];
- EXPECT_WK_STREQ(@"sRGB IEC61966-2.1 colorspace 1 0 0 1", dynamic_objc_cast<PlatformColor>(documentAttributes[NSBackgroundColorDocumentAttribute]).description);
+#if USE(APPKIT)
+ EXPECT_WK_STREQ(@"sRGB IEC61966-2.1 colorspace 1 0 0 1", dynamic_objc_cast<NSColor>(documentAttributes[NSBackgroundColorDocumentAttribute]).description);
+#else
+ EXPECT_WK_STREQ(@"kCGColorSpaceModelRGB 1 0 0 1 ", dynamic_objc_cast<UIColor>(documentAttributes[NSBackgroundColorDocumentAttribute]).description);
+#endif
finished = true;
}];