WebKit Bugzilla
Attachment 360521 Details for
Bug 193987
: [iOS] REGRESSION (r238635): Text area fails to re-focus after dismissal of keyboard on support.apple.com
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193987-20190129162709.patch (text/plain), 6.45 KB, created by
Daniel Bates
on 2019-01-29 16:27:10 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-01-29 16:27:10 PST
Size:
6.45 KB
patch
obsolete
>Subversion Revision: 240610 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d220317177164d995e23fa7b3ecf4ac9e435675e..e8b489e296556d87703312c8d258080a69d6a92a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,37 @@ >+2019-01-29 Daniel Bates <dabates@apple.com> >+ >+ [iOS] REGRESSION (r238635): Text area fails to re-focus after dismissal of keyboard on support.apple.com >+ https://bugs.webkit.org/show_bug.cgi?id=193987 >+ <rdar://problem/47230785> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It is unncessary to relinquish first responder status when a user explicitly dismissing >+ the keyboard. Moreover, doing so prevents key commands from being intercepted when a >+ hardware keyboard is subsequently attached. >+ >+ Following r238635 a page becomes focused (accepting of keyboard input) and defocused >+ when the WKContentView becomes first responder and resigns first responder, respectively. >+ When a user explicitly dismisses the keyboard by tapping Done (iPhone) or the hide keyboard >+ button (iPad) then UIKit tells WKContentView to resign its first responder status only >+ to make its superview, WKWebView, first responder. When a person subsequently taps on the >+ page again, the WKContentView requests to become the first responder. However changes to >+ page focus are not guaranteed to be sent to the WebProcess immediately (WebPageProxy::activityStateDidChange() >+ will schedule an update). In particular, they are not guaranteed to be sent before the >+ WebProcess is told about a tap. Therefore, the WebProcess has out-of-date information on >+ focus state of the page. Instead we should detect when WKWebView is being asked to resign >+ as a result of the keyboard dismissal and refuse the request, taking care to end the current >+ editing session, blur the focused element, and dismiss the on-screen keyboard. >+ >+ * Platform/spi/ios/UIKitSPI.h: Expose some SPI. >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView setupInteraction]): Register to receive notifications whenever a user >+ explicitly dismisses the keyboard. >+ (-[WKContentView resignFirstResponderForWebView]): If we are being asked to resign as a >+ result of a user explicitly dismissing the keyboard then refuse to resign. >+ (-[WKContentView _keyboardDidRequestDismissal:]): Update state, if applicable. >+ > 2019-01-23 Daniel Bates <dabates@apple.com> > > [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element >diff --git a/Source/WebKit/Platform/spi/ios/UIKitSPI.h b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >index d4479068b853b938ebbd300ccb223b0bea36e9fc..53f3ff71e1e8900b02a87b351e5299365c7f99ba 100644 >--- a/Source/WebKit/Platform/spi/ios/UIKitSPI.h >+++ b/Source/WebKit/Platform/spi/ios/UIKitSPI.h >@@ -1145,6 +1145,8 @@ extern NSString * const UIWindowDidRotateNotification; > extern NSString * const UIWindowNewScreenUserInfoKey; > extern NSString * const UIWindowWillRotateNotification; > >+extern NSString * const UIKeyboardPrivateDidRequestDismissalNotification; >+ > extern NSString * const UIKeyboardIsLocalUserInfoKey; > > extern UIApplication *UIApp; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index b5e6ae2a5735043a23a335a9d68c5a38ae5fcd90..af2f109f72230fa1f1b86132e1e8e45c0b5e255d 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -306,6 +306,8 @@ struct WKAutoCorrectionData { > BOOL _showDebugTapHighlightsForFastClicking; > BOOL _isZoomingToRevealFocusedElement; > >+ BOOL _keyboardDidRequestDismissal; >+ > BOOL _becomingFirstResponder; > BOOL _resigningFirstResponder; > BOOL _needsDeferredEndScrollingSelectionUpdate; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index d4f1c529326ee18a35279884ea082322b2855efa..d7001687e07eaad6be0b91f99411ab4fce32bb56 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -734,7 +734,10 @@ - (void)setupInteraction > [self _registerPreview]; > #endif > >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_resetShowingTextStyle:) name:UIMenuControllerDidHideMenuNotification object:nil]; >+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; >+ [center addObserver:self selector:@selector(_resetShowingTextStyle:) name:UIMenuControllerDidHideMenuNotification object:nil]; >+ [center addObserver:self selector:@selector(_keyboardDidRequestDismissal:) name:UIKeyboardPrivateDidRequestDismissalNotification object:nil]; >+ > _showingTextStyleOptions = NO; > > // FIXME: This should be called when we get notified that loading has completed. >@@ -1108,7 +1111,8 @@ - (BOOL)resignFirstResponderForWebView > // FIXME: Maybe we should call resignFirstResponder on the superclass > // and do nothing if the return value is NO. > >- _resigningFirstResponder = YES; >+ SetForScope<BOOL> resigningFirstResponderScope { _resigningFirstResponder, YES }; >+ > if (!_webView._retainingActiveFocusedState) { > // We need to complete the editing operation before we blur the element. > [self _endEditing]; >@@ -1120,13 +1124,18 @@ - (BOOL)resignFirstResponderForWebView > > _inputViewUpdateDeferrer = nullptr; > >+ // If the user explicitly dismissed the keyboard then we will lose first responder >+ // status only to gain it back again. Just don't resign in that case. >+ if (_keyboardDidRequestDismissal) { >+ _keyboardDidRequestDismissal = NO; >+ return NO; >+ } >+ > bool superDidResign = [super resignFirstResponder]; > > if (superDidResign) > _page->activityStateDidChange(WebCore::ActivityState::IsFocused); > >- _resigningFirstResponder = NO; >- > return superDidResign; > } > >@@ -2782,6 +2791,13 @@ - (void)_resetShowingTextStyle:(NSNotification *)notification > [_textSelectionAssistant hideTextStyleOptions]; > } > >+- (void)_keyboardDidRequestDismissal:(NSNotification *)notification >+{ >+ if (![self isFirstResponder]) >+ return; >+ _keyboardDidRequestDismissal = YES; >+} >+ > - (void)copyForWebView:(id)sender > { > _page->executeEditCommand("copy"_s);
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
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193987
: 360521