Title: [187266] trunk/Source/WebKit2
- Revision
- 187266
- Author
- [email protected]
- Date
- 2015-07-23 16:06:44 -0700 (Thu, 23 Jul 2015)
Log Message
<rdar://problem/21910578> Second pass at [iOS] Keyboard shortcuts that take focus away from the web view end up typing a letter into the newly focused field
https://bugs.webkit.org/show_bug.cgi?id=146732
Reviewed by Darin Adler.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _interpretKeyEvent:isCharEvent:]): Rather than checking if the view is
first responder, which it might still be when the Web Content processes invokes this
callback, check if we are in editable content before forwarding the event to the keyboard.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (187265 => 187266)
--- trunk/Source/WebKit2/ChangeLog 2015-07-23 22:53:12 UTC (rev 187265)
+++ trunk/Source/WebKit2/ChangeLog 2015-07-23 23:06:44 UTC (rev 187266)
@@ -1,3 +1,15 @@
+2015-07-23 Dan Bernstein <[email protected]>
+
+ <rdar://problem/21910578> Second pass at [iOS] Keyboard shortcuts that take focus away from the web view end up typing a letter into the newly focused field
+ https://bugs.webkit.org/show_bug.cgi?id=146732
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _interpretKeyEvent:isCharEvent:]): Rather than checking if the view is
+ first responder, which it might still be when the Web Content processes invokes this
+ callback, check if we are in editable content before forwarding the event to the keyboard.
+
2015-07-23 Jer Noble <[email protected]>
Unreviewed build fix after r187251; rename flag -> allows.
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (187265 => 187266)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2015-07-23 22:53:12 UTC (rev 187265)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2015-07-23 23:06:44 UTC (rev 187266)
@@ -2649,10 +2649,9 @@
static const unsigned kWebDeleteForwardKey = 0xF728;
static const unsigned kWebSpaceKey = 0x20;
- if (!self.isFirstResponder)
- return NO;
+ BOOL contentEditable = _page->editorState().isContentEditable;
- if (!_page->editorState().isContentEditable && event.isTabKey)
+ if (!contentEditable && event.isTabKey)
return NO;
BOOL shift = event.modifierFlags & WebEventFlagMaskShift;
@@ -2701,15 +2700,18 @@
switch ([characters characterAtIndex:0]) {
case kWebBackspaceKey:
case kWebDeleteKey:
- // FIXME: remove deleteFromInput once UIKit adopts deleteFromInputWithFlags
- if ([keyboard respondsToSelector:@selector(deleteFromInputWithFlags:)])
- [keyboard deleteFromInputWithFlags:event.keyboardFlags];
- else
- [keyboard deleteFromInput];
- return YES;
+ if (contentEditable) {
+ // FIXME: remove deleteFromInput once UIKit adopts deleteFromInputWithFlags
+ if ([keyboard respondsToSelector:@selector(deleteFromInputWithFlags:)])
+ [keyboard deleteFromInputWithFlags:event.keyboardFlags];
+ else
+ [keyboard deleteFromInput];
+ return YES;
+ }
+ break;
case kWebSpaceKey:
- if (!_page->editorState().isContentEditable) {
+ if (!contentEditable) {
[_webView _scrollByOffset:FloatPoint(0, shift ? -_page->unobscuredContentRect().height() : _page->unobscuredContentRect().height())];
return YES;
}
@@ -2721,7 +2723,7 @@
case kWebEnterKey:
case kWebReturnKey:
- if (isCharEvent) {
+ if (contentEditable && isCharEvent) {
// Map \r from HW keyboard to \n to match the behavior of the soft keyboard.
[keyboard addInputString:@"\n" withFlags:0];
return YES;
@@ -2733,7 +2735,7 @@
return YES;
default:
- if (isCharEvent) {
+ if (contentEditable && isCharEvent) {
[keyboard addInputString:event.characters withFlags:event.keyboardFlags];
return YES;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes