Title: [93838] trunk/Source/WebKit2
Revision
93838
Author
[email protected]
Date
2011-08-25 17:06:52 -0700 (Thu, 25 Aug 2011)

Log Message

Factor code to send a key-down event to the plug-in out into a new function
https://bugs.webkit.org/show_bug.cgi?id=66999

Reviewed by Darin Adler.

* UIProcess/API/mac/WKView.mm:
(-[WKView _handlePluginComplexTextInputKeyDown:]):
(-[WKView _tryHandlePluginComplexTextInputKeyDown:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (93837 => 93838)


--- trunk/Source/WebKit2/ChangeLog	2011-08-25 23:39:57 UTC (rev 93837)
+++ trunk/Source/WebKit2/ChangeLog	2011-08-26 00:06:52 UTC (rev 93838)
@@ -1,5 +1,16 @@
 2011-08-25  Anders Carlsson  <[email protected]>
 
+        Factor code to send a key-down event to the plug-in out into a new function
+        https://bugs.webkit.org/show_bug.cgi?id=66999
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _handlePluginComplexTextInputKeyDown:]):
+        (-[WKView _tryHandlePluginComplexTextInputKeyDown:]):
+
+2011-08-25  Anders Carlsson  <[email protected]>
+
         WKView should keep track of the plug-in complex text input state
         https://bugs.webkit.org/show_bug.cgi?id=66990
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (93837 => 93838)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-08-25 23:39:57 UTC (rev 93837)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-08-26 00:06:52 UTC (rev 93838)
@@ -1257,22 +1257,35 @@
     _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self));
 }
 
-- (BOOL)_tryHandlePluginComplexTextInputKeyDown:(NSEvent *)event
+- (BOOL)_handlePluginComplexTextInputKeyDown:(NSEvent *)event
 {
-    if (!_data->_pluginComplexTextInputIdentifier)
-        return NO;
+    ASSERT(_data->_pluginComplexTextInputIdentifier);
+    ASSERT(_data->_pluginComplexTextInputState != PluginComplexTextInputDisabled);
 
-    // Try feeding the keyboard event directly to the plug-in.
+    BOOL usingLegacyCocoaTextInput = _data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy;
+
     NSString *string = nil;
-    if ([[WKTextInputWindowController sharedTextInputWindowController] interpretKeyEvent:event usingLegacyCocoaTextInput:YES string:&string]) {
-        if (string)
-            _data->_page->sendComplexTextInputToPlugin(_data->_pluginComplexTextInputIdentifier, string);
-        return YES;
+    BOOL didHandleEvent = [[WKTextInputWindowController sharedTextInputWindowController] interpretKeyEvent:event usingLegacyCocoaTextInput:usingLegacyCocoaTextInput string:&string];
+
+    if (string) {
+        _data->_page->sendComplexTextInputToPlugin(_data->_pluginComplexTextInputIdentifier, string);
+
+        if (!usingLegacyCocoaTextInput)
+            _data->_pluginComplexTextInputState = PluginComplexTextInputDisabled;
     }
 
-    return NO;
+    return didHandleEvent;
 }
 
+- (BOOL)_tryHandlePluginComplexTextInputKeyDown:(NSEvent *)event
+{
+    if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled)
+        return NO;
+
+    // Try feeding the keyboard event directly to the plug-in.
+    return [self _handlePluginComplexTextInputKeyDown:event];
+}
+
 - (void)keyDown:(NSEvent *)theEvent
 {
     // There's a chance that responding to this event will run a nested event loop, and
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to