Need to notify the keyboard about every KeyDown event.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 May 2014 21:47:50 +0000 (21:47 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 May 2014 21:47:50 +0000 (21:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133383
<rdar://problem/16633975>

Reviewed by Benjamin Poulain.

A key down will generate most of the time a call to the keyboard to add input or delete.
But the event could be handled by JavaScript and its default prevented.
We need to notify the keyboard in every case to allow updating its internal state about what has been typed.

* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::doneWithKeyEvent):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didHandleKeyEvent:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169466 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

index 80238dc..199c44c 100644 (file)
@@ -1,3 +1,21 @@
+2014-05-29  Enrica Casucci  <enrica@apple.com>
+
+        Need to notify the keyboard about every KeyDown event.
+        https://bugs.webkit.org/show_bug.cgi?id=133383
+        <rdar://problem/16633975>
+
+        Reviewed by Benjamin Poulain.
+        
+        A key down will generate most of the time a call to the keyboard to add input or delete.
+        But the event could be handled by JavaScript and its default prevented.
+        We need to notify the keyboard in every case to allow updating its internal state about what has been typed.
+
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::doneWithKeyEvent):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _didHandleKeyEvent:]):
+
 2014-05-29  Matthew Hanson  <matthew_hanson@apple.com>
 
         Roll out r169439. <rdar://problem/17069364>
index b2c870b..1a58a6e 100644 (file)
@@ -341,9 +341,9 @@ IntRect PageClientImpl::rootViewToAccessibilityScreen(const IntRect& rect)
     return enclosingIntRect(rootViewRect);
 }
     
-void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool)
+void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool)
 {
-    notImplemented();
+    [m_contentView _didHandleKeyEvent:event.nativeEvent()];
 }
 
 #if ENABLE(TOUCH_EVENTS)
index 614a431..b202dd8 100644 (file)
@@ -172,6 +172,7 @@ struct WKAutoCorrectionData {
 - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect;
 - (void)_showRunOpenPanel:(WebKit::WebOpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener;
 - (void)accessoryDone;
+- (void)_didHandleKeyEvent:(WebIOSEvent *)event;
 - (Vector<WebKit::WKOptionItem>&) assistedNodeSelectOptions;
 @end
 
index 4231b73..492c546 100644 (file)
@@ -130,6 +130,10 @@ static const float tapAndHoldDelay  = 0.75;
 - (void)scheduleChineseTransliterationForText:(NSString *)text;
 @end
 
+@interface UIKeyboardImpl (StagingToRemove)
+- (void)didHandleWebKeyEvent;
+@end
+
 @interface WKFormInputSession : NSObject <_WKFormInputSession>
 
 - (instancetype)initWithContentView:(WKContentView *)view userObject:(NSObject <NSSecureCoding> *)userObject;
@@ -1898,6 +1902,15 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
     _page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent));
 }
 
+- (void)_didHandleKeyEvent:(WebIOSEvent *)event
+{
+    if (event.type == WebEventKeyDown) {
+        // FIXME: This is only for staging purposes.
+        if ([[UIKeyboardImpl sharedInstance] respondsToSelector:@selector(didHandleWebKeyEvent)])
+            [[UIKeyboardImpl sharedInstance] didHandleWebKeyEvent];
+    }
+}
+
 - (BOOL)_interpretKeyEvent:(WebIOSEvent *)event isCharEvent:(BOOL)isCharEvent
 {
     static const unsigned kWebEnterKey = 0x0003;