- Source/WebKit2/ChangeLog +28 lines
Lines 1-3 Source/WebKit2/ChangeLog_sec1
1
2011-08-25  Anders Carlsson  <andersca@apple.com>
2
3
        Handle key-down events in the updated Cocoa text input model
4
        https://bugs.webkit.org/show_bug.cgi?id=67001
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * UIProcess/API/mac/WKView.mm:
9
        (-[WKView performKeyEquivalent:]):
10
        Call _disableComplexTextInputIfNecessary so that we'll inform the plug-in that complex text
11
        input has been disabled.
12
13
        (-[WKView _disableComplexTextInputIfNecessary]):
14
        If the plug-in is using the updated Cocoa text input model specification, disable text input
15
        if the text input window has been dismissed for whatever reason.
16
17
        (-[WKView _tryHandlePluginComplexTextInputKeyDown:]):
18
        Call _disableComplexTextInputIfNecessary so that we'll inform the plug-in that complex text
19
        input has been disabled.
20
        
21
        (-[WKView _tryPostProcessPluginComplexTextInputKeyDown:]):
22
        If the plug-in is using the updated Cocoa text input model specification, let the input methods
23
        have a go at the keyboard event.
24
25
        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
26
        (WebKit::NetscapePlugin::setComplexTextInputEnabled):
27
        Actually set m_isComplexTextInputEnabled to the right value.
28
1
2011-08-25  Anders Carlsson  <andersca@apple.com>
29
2011-08-25  Anders Carlsson  <andersca@apple.com>
2
30
3
        Factor code to send a key-down event to the plug-in out into a new function
31
        Factor code to send a key-down event to the plug-in out into a new function
- Source/WebKit2/UIProcess/API/mac/WKView.mm -3 / +30 lines
Lines 113-118 @interface WKView () Source/WebKit2/UIProcess/API/mac/WKView.mm_sec1
113
- (float)_deviceScaleFactor;
113
- (float)_deviceScaleFactor;
114
- (void)_setDrawingAreaSize:(NSSize)size;
114
- (void)_setDrawingAreaSize:(NSSize)size;
115
- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState;
115
- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState;
116
- (void)_disableComplexTextInputIfNecessary;
116
@end
117
@end
117
118
118
@interface WKViewData : NSObject {
119
@interface WKViewData : NSObject {
Lines 1240-1245 - (BOOL)performKeyEquivalent:(NSEvent *) Source/WebKit2/UIProcess/API/mac/WKView.mm_sec2
1240
    
1241
    
1241
    BOOL eventWasSentToWebCore = (_data->_keyDownEventBeingResent == event);
1242
    BOOL eventWasSentToWebCore = (_data->_keyDownEventBeingResent == event);
1242
1243
1244
    if (!eventWasSentToWebCore)
1245
        [self _disableComplexTextInputIfNecessary];
1246
1243
    // Pass key combos through WebCore if there is a key binding available for
1247
    // Pass key combos through WebCore if there is a key binding available for
1244
    // this event. This lets web pages have a crack at intercepting key-modified keypresses.
1248
    // this event. This lets web pages have a crack at intercepting key-modified keypresses.
1245
    // But don't do it if we have already handled the event.
1249
    // But don't do it if we have already handled the event.
Lines 1257-1262 - (void)keyUp:(NSEvent *)theEvent Source/WebKit2/UIProcess/API/mac/WKView.mm_sec3
1257
    _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self));
1261
    _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self));
1258
}
1262
}
1259
1263
1264
- (void)_disableComplexTextInputIfNecessary
1265
{
1266
    if (!_data->_pluginComplexTextInputIdentifier)
1267
        return;
1268
1269
    if (_data->_pluginComplexTextInputState != PluginComplexTextInputEnabled)
1270
        return;
1271
1272
    // Check if the text input window has been dismissed.
1273
    if (![[WKTextInputWindowController sharedTextInputWindowController] hasMarkedText])
1274
        [self _setPluginComplexTextInputState:PluginComplexTextInputDisabled];
1275
}
1276
1260
- (BOOL)_handlePluginComplexTextInputKeyDown:(NSEvent *)event
1277
- (BOOL)_handlePluginComplexTextInputKeyDown:(NSEvent *)event
1261
{
1278
{
1262
    ASSERT(_data->_pluginComplexTextInputIdentifier);
1279
    ASSERT(_data->_pluginComplexTextInputIdentifier);
Lines 1282-1287 - (BOOL)_tryHandlePluginComplexTextInput Source/WebKit2/UIProcess/API/mac/WKView.mm_sec4
1282
    if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled)
1299
    if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled)
1283
        return NO;
1300
        return NO;
1284
1301
1302
    // Check if the text input window has been dismissed and let the plug-in process know.
1303
    // This is only valid with the updated Cocoa text input spec.
1304
    [self _disableComplexTextInputIfNecessary];
1305
1285
    // Try feeding the keyboard event directly to the plug-in.
1306
    // Try feeding the keyboard event directly to the plug-in.
1286
    return [self _handlePluginComplexTextInputKeyDown:event];
1307
    return [self _handlePluginComplexTextInputKeyDown:event];
1287
}
1308
}
Lines 2119-2126 - (void)_setUserInterfaceItemState:(NSSt Source/WebKit2/UIProcess/API/mac/WKView.mm_sec5
2119
2140
2120
- (BOOL)_tryPostProcessPluginComplexTextInputKeyDown:(NSEvent *)event
2141
- (BOOL)_tryPostProcessPluginComplexTextInputKeyDown:(NSEvent *)event
2121
{
2142
{
2122
    // FIXME: Implement.
2143
    if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled)
2123
    return NO;
2144
        return NO;
2145
2146
    // In the legacy text input model, the event has already been sent to the input method.
2147
    if (_data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy)
2148
        return NO;
2149
2150
    return [self _handlePluginComplexTextInputKeyDown:event];
2124
}
2151
}
2125
2152
2126
- (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled
2153
- (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled
Lines 2390-2396 - (void)_pluginFocusOrWindowFocusChanged Source/WebKit2/UIProcess/API/mac/WKView.mm_sec6
2390
    [NSApp updateWindows];
2417
    [NSApp updateWindows];
2391
}
2418
}
2392
2419
2393
- (void)_setPluginComplexTextInputState:(WebKit::PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier
2420
- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier
2394
{
2421
{
2395
    if (pluginComplexTextInputIdentifier != _data->_pluginComplexTextInputIdentifier) {
2422
    if (pluginComplexTextInputIdentifier != _data->_pluginComplexTextInputIdentifier) {
2396
        // We're asked to update the state for a plug-in that doesn't have focus.
2423
        // We're asked to update the state for a plug-in that doesn't have focus.
- Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm +2 lines
Lines 1010-1015 void NetscapePlugin::setComplexTextInput Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm_sec1
1010
    if (m_isComplexTextInputEnabled == complexTextInputEnabled)
1010
    if (m_isComplexTextInputEnabled == complexTextInputEnabled)
1011
        return;
1011
        return;
1012
1012
1013
    m_isComplexTextInputEnabled = complexTextInputEnabled;
1014
1013
    PluginComplexTextInputState complexTextInputState = PluginComplexTextInputDisabled;
1015
    PluginComplexTextInputState complexTextInputState = PluginComplexTextInputDisabled;
1014
    if (m_isComplexTextInputEnabled)
1016
    if (m_isComplexTextInputEnabled)
1015
        complexTextInputState = m_pluginWantsLegacyCocoaTextInput ? PluginComplexTextInputEnabledLegacy : PluginComplexTextInputEnabled;
1017
        complexTextInputState = m_pluginWantsLegacyCocoaTextInput ? PluginComplexTextInputEnabledLegacy : PluginComplexTextInputEnabled;

Return to Bug 67001