Title: [187326] branches/safari-601.1-branch/Source/WebKit2
Revision
187326
Author
[email protected]
Date
2015-07-24 00:54:47 -0700 (Fri, 24 Jul 2015)

Log Message

Merge r187266. rdar://problem/21910578

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187325 => 187326)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 07:54:45 UTC (rev 187325)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 07:54:47 UTC (rev 187326)
@@ -1,5 +1,21 @@
 2015-07-24  Matthew Hanson  <[email protected]>
 
+        Merge r187266. rdar://problem/21910578
+
+    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-24  Matthew Hanson  <[email protected]>
+
         Merge r187255. rdar://problem/21875510
 
     2015-07-23  Yongjun Zhang  <[email protected]>

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (187325 => 187326)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-07-24 07:54:45 UTC (rev 187325)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-07-24 07:54:47 UTC (rev 187326)
@@ -2639,10 +2639,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;
@@ -2691,15 +2690,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;
         }
@@ -2711,7 +2713,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;
@@ -2723,7 +2725,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

Reply via email to