Title: [169167] trunk/Source/WebKit2
Revision
169167
Author
[email protected]
Date
2014-05-21 10:04:12 -0700 (Wed, 21 May 2014)

Log Message

[Mac] REGRESSION (Async text input): Asian text input doesn't work in Flash
https://bugs.webkit.org/show_bug.cgi?id=133128
<rdar://problem/16890920>

Reviewed by Anders Carlsson.

* UIProcess/API/mac/WKView.mm:
(-[WKView _interpretKeyEvent:completionHandler:]): Added a separate code path for
plug-in input. Before async text input, we used to provide a nil input context due
to having _data->_interpretKeyEventsParameters while this function was executing,
and thus took a shortcut. The new behavior is different from pre-async in that
we don't collect commands at all, but I couldn't find any case where that mattered.
(-[WKView inputContext]): The _collectedKeypressCommands check was not a correct
replacement for _interpretKeyEventsParameters one, because this variable is not
always set within -_interpretKeyEvent:completionHandler:.

* UIProcess/mac/WKTextInputWindowController.mm:
(-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]):
While at it, fixed a separate issue with Cangjie predictive input. We shouldn't
keep prediction pop-up on screen after hiding the bottom input window.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (169166 => 169167)


--- trunk/Source/WebKit2/ChangeLog	2014-05-21 16:56:40 UTC (rev 169166)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-21 17:04:12 UTC (rev 169167)
@@ -1,3 +1,26 @@
+2014-05-21  Alexey Proskuryakov  <[email protected]>
+
+        [Mac] REGRESSION (Async text input): Asian text input doesn't work in Flash
+        https://bugs.webkit.org/show_bug.cgi?id=133128
+        <rdar://problem/16890920>
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _interpretKeyEvent:completionHandler:]): Added a separate code path for
+        plug-in input. Before async text input, we used to provide a nil input context due
+        to having _data->_interpretKeyEventsParameters while this function was executing,
+        and thus took a shortcut. The new behavior is different from pre-async in that
+        we don't collect commands at all, but I couldn't find any case where that mattered.
+        (-[WKView inputContext]): The _collectedKeypressCommands check was not a correct
+        replacement for _interpretKeyEventsParameters one, because this variable is not
+        always set within -_interpretKeyEvent:completionHandler:.
+
+        * UIProcess/mac/WKTextInputWindowController.mm:
+        (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]):
+        While at it, fixed a separate issue with Cangjie predictive input. We shouldn't
+        keep prediction pop-up on screen after hiding the bottom input window.
+
 2014-05-16  Martin Robinson  <[email protected]>
 
         [CMake] Improve handling of LIB_INSTALL_DIR, EXEC_INSTALL_DIR, and LIBEXEC_INSTALL_DIR

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


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-05-21 16:56:40 UTC (rev 169166)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-05-21 17:04:12 UTC (rev 169167)
@@ -1343,6 +1343,13 @@
 
 - (void)_interpretKeyEvent:(NSEvent *)event completionHandler:(void(^)(BOOL handled, const Vector<KeypressCommand>& commands))completionHandler
 {
+    // For regular Web content, input methods run before passing a keydown to DOM, but plug-ins get an opportunity to handle the event first.
+    // There is no need to collect commands, as the plug-in cannot execute them.
+    if (_data->_pluginComplexTextInputIdentifier) {
+        completionHandler(NO, Vector<KeypressCommand>());
+        return;
+    }
+
     if (![self inputContext]) {
         Vector<KeypressCommand> commands;
         [self _collectKeyboardLayoutCommandsForEvent:event to:commands];
@@ -1578,10 +1585,10 @@
 
 - (NSTextInputContext *)inputContext
 {
-    bool collectingKeypressCommands = _data->_collectedKeypressCommands;
-
-    if (_data->_pluginComplexTextInputIdentifier && !collectingKeypressCommands)
+    if (_data->_pluginComplexTextInputIdentifier) {
+        ASSERT(!_data->_collectedKeypressCommands); // Should not get here from -_interpretKeyEvent:completionHandler:, we only use WKTextInputWindowController after giving the plug-in a chance to handle keydown natively.
         return [[WKTextInputWindowController sharedTextInputWindowController] inputContext];
+    }
 
     // Disable text input machinery when in non-editable content. An invisible inline input area affects performance, and can prevent Expose from working.
     if (!_data->_page->editorState().isContentEditable)

Modified: trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.mm (169166 => 169167)


--- trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.mm	2014-05-21 16:56:40 UTC (rev 169166)
+++ trunk/Source/WebKit2/UIProcess/mac/WKTextInputWindowController.mm	2014-05-21 17:04:12 UTC (rev 169167)
@@ -141,6 +141,7 @@
         shouldReturnTextString = true;
 
     if (shouldReturnTextString) {
+        [[_inputTextView inputContext] discardMarkedText]; // Don't show Cangjie predictive candidates, cf. <rdar://14458297>.
         [self orderOut:nil];
 
         NSString *text = [[_inputTextView textStorage] string];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to