WebKit Bugzilla
Attachment 371633 Details for
Bug 198631
: Allow clients to vend custom -inputView and -inputAccessoryView by overriding WKWebView methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198631-20190607171558.patch (text/plain), 7.07 KB, created by
Wenson Hsieh
on 2019-06-07 17:15:59 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-06-07 17:15:59 PDT
Size:
7.07 KB
patch
obsolete
>Subversion Revision: 246186 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index f00bba0f4b0b77ead4a1ae32b6da921aa515ab32..8d27a3455e5f67319967c89aefc1d5c92222803f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,24 @@ >+2019-06-07 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Allow clients to vend custom -inputView and -inputAccessoryView by overriding WKWebView methods >+ https://bugs.webkit.org/show_bug.cgi?id=198631 >+ <rdar://problem/51505431> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Allow WKWebView API clients to override WKContentView's default input view and/or input accessory view by >+ subclassing WKWebView and implementing -inputView or -inputAccessoryView. >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView inputAccessoryView]): >+ (-[WKWebView inputView]): >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView inputView]): >+ (-[WKContentView inputViewForWebView]): >+ (-[WKContentView inputAccessoryView]): >+ (-[WKContentView inputAccessoryViewForWebView]): >+ > 2019-06-06 Youenn Fablet <youenn@apple.com> > > Use an enumeration in UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo callback >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index fe8ed889272a2deb5438cc5a1ea00bb29899b41f..fa221ba21680e3e97ac4c9497d6af2af89093191 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -4585,6 +4585,16 @@ - (void)_setTextColor:(UIColor *)color sender:(id)sender > [_contentView _setTextColorForWebView:color sender:sender]; > } > >+- (UIView *)inputAccessoryView >+{ >+ return [_contentView inputAccessoryViewForWebView]; >+} >+ >+- (UIView *)inputView >+{ >+ return [_contentView inputViewForWebView]; >+} >+ > #endif // PLATFORM(IOS_FAMILY) > > - (BOOL)_isEditable >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index e4bc469d28ff560b2376c6cb606380abc247556a..6690cd198bdaf458271d4abb98da654a180f050d 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -383,6 +383,8 @@ struct WKAutoCorrectionData { > @property (nonatomic, readonly) const WebKit::FocusedElementInformation& focusedElementInformation; > @property (nonatomic, readonly) UIWebFormAccessory *formAccessoryView; > @property (nonatomic, readonly) UITextInputAssistantItem *inputAssistantItemForWebView; >+@property (nonatomic, readonly) UIView *inputViewForWebView; >+@property (nonatomic, readonly) UIView *inputAccessoryViewForWebView; > #if ENABLE(POINTER_EVENTS) > @property (nonatomic, readonly) BOOL preventsPanningInXAxis; > @property (nonatomic, readonly) BOOL preventsPanningInYAxis; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 9a6d214e4bc98eaf2ad3c30dda8d8c92a7fe555c..172658557deea85d35e7f554bfffe5729e954149 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -1713,6 +1713,11 @@ - (void)_zoomToRevealFocusedElement > } > > - (UIView *)inputView >+{ >+ return [_webView inputView]; >+} >+ >+- (UIView *)inputViewForWebView > { > if (!hasFocusedElement(_focusedElementInformation)) > return nil; >@@ -2571,6 +2576,11 @@ - (UITextInputAssistantItem *)inputAssistantItemForWebView > } > > - (UIView *)inputAccessoryView >+{ >+ return [_webView inputAccessoryView]; >+} >+ >+- (UIView *)inputAccessoryViewForWebView > { > if (![self requiresAccessoryView]) > return nil; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index b7156c2e430d3589ce6a4af8e709aa1aa98e9b9e..8826e58a45713b4062ba808f3ebfb88e5dd36821 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,19 @@ >+2019-06-07 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Allow clients to vend custom -inputView and -inputAccessoryView by overriding WKWebView methods >+ https://bugs.webkit.org/show_bug.cgi?id=198631 >+ <rdar://problem/51505431> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add an API test that overrides -[WKWebView inputView] and -[WKWebView inputAccessoryView]. >+ >+ * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: >+ (-[CustomInputWebView initWithFrame:configuration:inputView:inputAccessoryView:]): >+ (-[CustomInputWebView inputView]): >+ (-[CustomInputWebView inputAccessoryView]): >+ (TestWebKitAPI::TEST): >+ > 2019-06-06 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] At least 6 API tests are failing due to an exception when writing NSAttributedString to the pasteboard >diff --git a/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm b/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm >index fe3b01d57e0a2d4f3df5cc04f0a5ca9c37dfdd04..6cba2aa5e326e5caee8b1b350df4c8bfc52e7128 100644 >--- a/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm >+++ b/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm >@@ -148,6 +148,36 @@ - (UIBarButtonItemGroup *)lastTrailingBarButtonGroup > > @end > >+@interface CustomInputWebView : TestWKWebView >+- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration inputView:(UIView *)inputView inputAccessoryView:(UIView *)inputAccessoryView; >+@end >+ >+@implementation CustomInputWebView { >+ RetainPtr<UIView> _customInputView; >+ RetainPtr<UIView> _customInputAccessoryView; >+} >+ >+- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration inputView:(UIView *)inputView inputAccessoryView:(UIView *)inputAccessoryView >+{ >+ if (self = [super initWithFrame:frame configuration:configuration]) { >+ _customInputView = inputView; >+ _customInputAccessoryView = inputAccessoryView; >+ } >+ return self; >+} >+ >+- (UIView *)inputView >+{ >+ return _customInputView.get(); >+} >+ >+- (UIView *)inputAccessoryView >+{ >+ return _customInputAccessoryView.get(); >+} >+ >+@end >+ > static RetainPtr<TestWKWebView> webViewWithAutofocusedInput(const RetainPtr<TestInputDelegate>& inputDelegate) > { > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); >@@ -431,6 +461,18 @@ TEST(KeyboardInputTests, KeyboardTypeForInput) > } > } > >+TEST(KeyboardInputTests, OverrideInputViewAndInputAccessoryView) >+{ >+ auto inputView = adoptNS([[UIView alloc] init]); >+ auto inputAccessoryView = adoptNS([[UIView alloc] init]); >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ auto webView = adoptNS([[CustomInputWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 568) configuration:configuration.get() inputView:inputView.get() inputAccessoryView:inputAccessoryView.get()]); >+ auto contentView = [webView textInputContentView]; >+ >+ EXPECT_EQ(inputAccessoryView.get(), [contentView inputAccessoryView]); >+ EXPECT_EQ(inputView.get(), [contentView inputView]); >+} >+ > } // namespace TestWebKitAPI > > #endif // PLATFORM(IOS_FAMILY)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198631
: 371633