Title: [195602] trunk/Source/WebKit2
- Revision
- 195602
- Author
- [email protected]
- Date
- 2016-01-26 11:12:37 -0800 (Tue, 26 Jan 2016)
Log Message
REGRESSION (r194557): Keyboard shortcuts stop working after the WKWebView is unparented and reparented
https://bugs.webkit.org/show_bug.cgi?id=153492
<rdar://problem/24138989>
Reviewed by Dan Bernstein.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canBecomeFirstResponder]):
(-[WKContentView becomeFirstResponder]):
(-[WKContentView resignFirstResponder]):
When WKWebView is unparented, WKContentView will attempt to resignFirstResponder upwards,
first asking WKWebView. After r194557, WKWebView will accept first responder and forward
it on to the WKContentView, which will happily accept it again, despite being the view
that's trying to resign. This will cause us to completely lose first responder,
where it was actually supposed to propagate up above WKWebView to the client.
Keep track of when WKContentView is resigning first responder, and don't
let it become first responder while it is doing so, breaking the cycle.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (195601 => 195602)
--- trunk/Source/WebKit2/ChangeLog 2016-01-26 19:02:40 UTC (rev 195601)
+++ trunk/Source/WebKit2/ChangeLog 2016-01-26 19:12:37 UTC (rev 195602)
@@ -1,3 +1,25 @@
+2016-01-26 Tim Horton <[email protected]>
+
+ REGRESSION (r194557): Keyboard shortcuts stop working after the WKWebView is unparented and reparented
+ https://bugs.webkit.org/show_bug.cgi?id=153492
+ <rdar://problem/24138989>
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView canBecomeFirstResponder]):
+ (-[WKContentView becomeFirstResponder]):
+ (-[WKContentView resignFirstResponder]):
+ When WKWebView is unparented, WKContentView will attempt to resignFirstResponder upwards,
+ first asking WKWebView. After r194557, WKWebView will accept first responder and forward
+ it on to the WKContentView, which will happily accept it again, despite being the view
+ that's trying to resign. This will cause us to completely lose first responder,
+ where it was actually supposed to propagate up above WKWebView to the client.
+
+ Keep track of when WKContentView is resigning first responder, and don't
+ let it become first responder while it is doing so, breaking the cycle.
+
2016-01-25 Ada Chan <[email protected]>
Move WebVideoFullscreenManager and related classes from iOS specific folders to cocoa folders
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (195601 => 195602)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h 2016-01-26 19:02:40 UTC (rev 195601)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h 2016-01-26 19:12:37 UTC (rev 195602)
@@ -161,6 +161,8 @@
BOOL _didAccessoryTabInitiateFocus;
BOOL _isExpectingFastSingleTapCommit;
BOOL _showDebugTapHighlightsForFastClicking;
+
+ BOOL _isResigningFirstResponder;
}
@end
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (195601 => 195602)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-01-26 19:02:40 UTC (rev 195601)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-01-26 19:12:37 UTC (rev 195602)
@@ -669,6 +669,8 @@
- (BOOL)canBecomeFirstResponder
{
+ if (_isResigningFirstResponder)
+ return NO;
// We might want to return something else
// if we decide to enable/disable interaction programmatically.
return YES;
@@ -676,6 +678,8 @@
- (BOOL)becomeFirstResponder
{
+ if (_isResigningFirstResponder)
+ return NO;
BOOL didBecomeFirstResponder = [super becomeFirstResponder];
if (didBecomeFirstResponder)
[_textSelectionAssistant activateSelection];
@@ -688,6 +692,8 @@
// FIXME: Maybe we should call resignFirstResponder on the superclass
// and do nothing if the return value is NO.
+ _isResigningFirstResponder = YES;
+
if (!_webView->_activeFocusedStateRetainCount) {
// We need to complete the editing operation before we blur the element.
[_inputPeripheral endEditing];
@@ -698,7 +704,11 @@
[_webSelectionAssistant resignedFirstResponder];
[_textSelectionAssistant deactivateSelection];
- return [super resignFirstResponder];
+ bool superDidResign = [super resignFirstResponder];
+
+ _isResigningFirstResponder = NO;
+
+ return superDidResign;
}
#if ENABLE(TOUCH_EVENTS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes