Title: [223647] trunk
- Revision
- 223647
- Author
- [email protected]
- Date
- 2017-10-18 18:39:14 -0700 (Wed, 18 Oct 2017)
Log Message
[iOS] Use new class name from UIKit when checking UITextSuggestion type
https://bugs.webkit.org/show_bug.cgi?id=178416
Source/WebKit:
<rdar://problem/35010840>
Reviewed by Tim Horton.
Here we start using UITextAutofillSuggestion instead of the old name that was being used for
AutoFill text suggestions.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView insertTextSuggestion:]): Use UITextAutofillSuggestion when checking the class
and when casting instead of UIKeyboardLoginCredentialsSuggestion.
Tools:
Reviewed by Tim Horton.
This updates our test using/mocking out UITextAutofillSuggestion instead of UIKeyboardLoginCredentialsSuggestion.
* TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:
(-[UITextAutofillSuggestion initWithUsername:password:]): Copied from UIKit's implementation. This will serve as
a mock of this method for builds not containingit.
(+[UITextAutofillSuggestion autofillSuggestionWithUsername:password:]): Ditto.
(TestWebKitAPI::TEST): Use +[UITextAutofillSuggestion autofillSuggestionWithUsername:password:] inline instead of
helper function for creating a new suggestion.
(newUIKeyboardLoginCredentialsSuggestion): Deleted.
* TestWebKitAPI/ios/UIKitSPI.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (223646 => 223647)
--- trunk/Source/WebKit/ChangeLog 2017-10-19 01:22:57 UTC (rev 223646)
+++ trunk/Source/WebKit/ChangeLog 2017-10-19 01:39:14 UTC (rev 223647)
@@ -1,3 +1,19 @@
+2017-10-18 Chelsea Pugh <[email protected]>
+
+ [iOS] Use new class name from UIKit when checking UITextSuggestion type
+ https://bugs.webkit.org/show_bug.cgi?id=178416
+ <rdar://problem/35010840>
+
+ Reviewed by Tim Horton.
+
+ Here we start using UITextAutofillSuggestion instead of the old name that was being used for
+ AutoFill text suggestions.
+
+ * Platform/spi/ios/UIKitSPI.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView insertTextSuggestion:]): Use UITextAutofillSuggestion when checking the class
+ and when casting instead of UIKeyboardLoginCredentialsSuggestion.
+
2017-10-17 Jiewen Tan <[email protected]>
Replace some stack raw pointers with RefPtrs within WebCore/html
Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (223646 => 223647)
--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2017-10-19 01:22:57 UTC (rev 223646)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2017-10-19 01:39:14 UTC (rev 223647)
@@ -954,10 +954,10 @@
- (UIResponder *)firstResponder;
@end
-#if __has_include(<UIKit/UIKeyboardLoginCredentialsSuggestion.h>)
-#import <UIKit/UIKeyboardLoginCredentialsSuggestion.h>
+#if __has_include(<UIKit/UITextAutofillSuggestion.h>)
+#import <UIKit/UITextAutofillSuggestion.h>
#else
-@interface UIKeyboardLoginCredentialsSuggestion : UITextSuggestion
+@interface UITextAutofillSuggestion : UITextSuggestion
@property (nonatomic, assign) NSString *username;
@property (nonatomic, assign) NSString *password;
@end
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (223646 => 223647)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2017-10-19 01:22:57 UTC (rev 223646)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2017-10-19 01:39:14 UTC (rev 223647)
@@ -2985,8 +2985,8 @@
- (void)insertTextSuggestion:(UITextSuggestion *)textSuggestion
{
// FIXME: Replace NSClassFromString with actual class as soon as UIKit submitted the new class into the iOS SDK.
- if ([textSuggestion isKindOfClass:NSClassFromString(@"UIKeyboardLoginCredentialsSuggestion")]) {
- _page->autofillLoginCredentials([(UIKeyboardLoginCredentialsSuggestion *)textSuggestion username], [(UIKeyboardLoginCredentialsSuggestion *)textSuggestion password]);
+ if ([textSuggestion isKindOfClass:NSClassFromString(@"UITextAutofillSuggestion")]) {
+ _page->autofillLoginCredentials([(UITextAutofillSuggestion *)textSuggestion username], [(UITextAutofillSuggestion *)textSuggestion password]);
return;
}
id <_WKInputDelegate> inputDelegate = [_webView _inputDelegate];
Modified: trunk/Tools/ChangeLog (223646 => 223647)
--- trunk/Tools/ChangeLog 2017-10-19 01:22:57 UTC (rev 223646)
+++ trunk/Tools/ChangeLog 2017-10-19 01:39:14 UTC (rev 223647)
@@ -1,3 +1,22 @@
+2017-10-18 Chelsea Pugh <[email protected]>
+
+ [iOS] Use new class name from UIKit when checking UITextSuggestion type
+ https://bugs.webkit.org/show_bug.cgi?id=178416
+
+ Reviewed by Tim Horton.
+
+ This updates our test using/mocking out UITextAutofillSuggestion instead of UIKeyboardLoginCredentialsSuggestion.
+
+ * TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:
+ (-[UITextAutofillSuggestion initWithUsername:password:]): Copied from UIKit's implementation. This will serve as
+ a mock of this method for builds not containingit.
+ (+[UITextAutofillSuggestion autofillSuggestionWithUsername:password:]): Ditto.
+ (TestWebKitAPI::TEST): Use +[UITextAutofillSuggestion autofillSuggestionWithUsername:password:] inline instead of
+ helper function for creating a new suggestion.
+ (newUIKeyboardLoginCredentialsSuggestion): Deleted.
+
+ * TestWebKitAPI/ios/UIKitSPI.h:
+
2017-10-18 Fujii Hironori <[email protected]>
update-webkit-auxiliary-libs can't download WebKitAuxiliaryLibrary.zip due to 403 Forbidden
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm (223646 => 223647)
--- trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm 2017-10-19 01:22:57 UTC (rev 223646)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm 2017-10-19 01:39:14 UTC (rev 223647)
@@ -35,19 +35,25 @@
#import <WebKit/_WKInputDelegate.h>
#import <wtf/BlockPtr.h>
-#if !__has_include(<UIKit/UIKeyboardLoginCredentialsSuggestion.h>)
+#if !__has_include(<UIKit/UITextAutofillSuggestion.h>)
// FIXME: This can be safely removed once <rdar://problem/34583628> lands in the SDK.
-@implementation UIKeyboardLoginCredentialsSuggestion
-@end
-#endif
+@implementation UITextAutofillSuggestion
+- (instancetype)initWithUsername:(NSString *)username password:(NSString *)password
+{
+ self = [super init];
+ if (self) {
+ _username = username;
+ _password = password;
+ }
+ return self;
+}
-static UIKeyboardLoginCredentialsSuggestion *newUIKeyboardLoginCredentialsSuggestion(NSString *username, NSString *password)
++ (instancetype)autofillSuggestionWithUsername:(NSString *)username password:(NSString *)password
{
- UIKeyboardLoginCredentialsSuggestion *suggestion = [UIKeyboardLoginCredentialsSuggestion new];
- suggestion.username = username;
- suggestion.password = password;
- return suggestion;
+ return [[self alloc] initWithUsername:username password:password];
}
+@end
+#endif
typedef UIView <UITextInputTraits_Private_Proposed_SPI_34583628> AutofillInputView;
@@ -119,8 +125,8 @@
[webView stringByEvaluatingJavaScript:@"password.focus()"];
EXPECT_TRUE([webView textInputHasAutofillContext]);
- auto credentialSuggestion = adoptNS(newUIKeyboardLoginCredentialsSuggestion(@"frederik", @"famos"));
- [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion.get()];
+ auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
+ [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion];
EXPECT_WK_STREQ("famos", [webView stringByEvaluatingJavaScript:@"password.value"]);
@@ -138,8 +144,8 @@
[webView stringByEvaluatingJavaScript:@"password.focus()"];
EXPECT_TRUE([webView textInputHasAutofillContext]);
- auto credentialSuggestion = adoptNS(newUIKeyboardLoginCredentialsSuggestion(@"frederik", @"famos"));
- [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion.get()];
+ auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
+ [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion];
EXPECT_WK_STREQ("frederik", [webView stringByEvaluatingJavaScript:@"user.value"]);
EXPECT_WK_STREQ("famos", [webView stringByEvaluatingJavaScript:@"password.value"]);
@@ -166,8 +172,8 @@
[webView stringByEvaluatingJavaScript:@"password.focus()"];
EXPECT_TRUE([webView textInputHasAutofillContext]);
- auto credentialSuggestion = adoptNS(newUIKeyboardLoginCredentialsSuggestion(@"frederik", @"famos"));
- [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion.get()];
+ auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
+ [[webView _autofillInputView] insertTextSuggestion:credentialSuggestion];
EXPECT_WK_STREQ("famos", [webView stringByEvaluatingJavaScript:@"password.value"]);
Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (223646 => 223647)
--- trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2017-10-19 01:22:57 UTC (rev 223646)
+++ trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h 2017-10-19 01:39:14 UTC (rev 223647)
@@ -73,13 +73,17 @@
- (void)_dragInteraction:(UIDragInteraction *)interaction itemsForAddingToSession:(id <UIDragSession>)session withTouchAtPoint:(CGPoint)point completion:(void(^)(NSArray<UIDragItem *> *))completion;
@end
-#if __has_include(<UIKit/UIKeyboardLoginCredentialsSuggestion.h>)
+#if __has_include(<UIKit/UITextAutofillSuggestion.h>)
// FIXME: Move this import under USE(APPLE_INTERNAL_SDK) once <rdar://problem/34583628> lands in the SDK.
-#import <UIKit/UIKeyboardLoginCredentialsSuggestion.h>
+#import <UIKit/UITextAutofillSuggestion.h>
+@interface UITextAutofillSuggestion ()
++ (instancetype)autofillSuggestionWithUsername:(NSString *)username password:(NSString *)password;
+@end
#else
-@interface UIKeyboardLoginCredentialsSuggestion : UITextSuggestion
+@interface UITextAutofillSuggestion : UITextSuggestion
@property (nonatomic, assign) NSString *username;
@property (nonatomic, assign) NSString *password;
++ (instancetype)autofillSuggestionWithUsername:(NSString *)username password:(NSString *)password;
@end
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes