OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 | 2077 |
2078 // To emulate Windows, over-write |event.windowsKeyCode| to VK_PROCESSKEY | 2078 // To emulate Windows, over-write |event.windowsKeyCode| to VK_PROCESSKEY |
2079 // while an input method is composing or inserting a text. | 2079 // while an input method is composing or inserting a text. |
2080 // Gmail checks this code in its onkeydown handler to stop auto-completing | 2080 // Gmail checks this code in its onkeydown handler to stop auto-completing |
2081 // e-mail addresses while composing a CJK text. | 2081 // e-mail addresses while composing a CJK text. |
2082 // If the text to be inserted has only one character, then we don't need this | 2082 // If the text to be inserted has only one character, then we don't need this |
2083 // trick, because we'll send the text as a key press event instead. | 2083 // trick, because we'll send the text as a key press event instead. |
2084 if (hasMarkedText_ || oldHasMarkedText || textToBeInserted_.length() > 1) { | 2084 if (hasMarkedText_ || oldHasMarkedText || textToBeInserted_.length() > 1) { |
2085 NativeWebKeyboardEvent fakeEvent = event; | 2085 NativeWebKeyboardEvent fakeEvent = event; |
2086 fakeEvent.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY | 2086 fakeEvent.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY |
2087 fakeEvent.setKeyIdentifierFromWindowsKeyCode(); | |
2088 fakeEvent.skip_in_browser = true; | 2087 fakeEvent.skip_in_browser = true; |
2089 widgetHost->ForwardKeyboardEvent(fakeEvent); | 2088 widgetHost->ForwardKeyboardEvent(fakeEvent); |
2090 // If this key event was handled by the input method, but | 2089 // If this key event was handled by the input method, but |
2091 // -doCommandBySelector: (invoked by the call to -interpretKeyEvents: above) | 2090 // -doCommandBySelector: (invoked by the call to -interpretKeyEvents: above) |
2092 // enqueued edit commands, then in order to let webkit handle them | 2091 // enqueued edit commands, then in order to let webkit handle them |
2093 // correctly, we need to send the real key event and corresponding edit | 2092 // correctly, we need to send the real key event and corresponding edit |
2094 // commands after processing the input method result. | 2093 // commands after processing the input method result. |
2095 // We shouldn't do this if a new marked text was set by the input method, | 2094 // We shouldn't do this if a new marked text was set by the input method, |
2096 // otherwise the new marked text might be cancelled by webkit. | 2095 // otherwise the new marked text might be cancelled by webkit. |
2097 if (hasEditCommands_ && !hasMarkedText_) | 2096 if (hasEditCommands_ && !hasMarkedText_) |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3307 | 3306 |
3308 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3307 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3309 // regions that are not draggable. (See ControlRegionView in | 3308 // regions that are not draggable. (See ControlRegionView in |
3310 // native_app_window_cocoa.mm). This requires the render host view to be | 3309 // native_app_window_cocoa.mm). This requires the render host view to be |
3311 // draggable by default. | 3310 // draggable by default. |
3312 - (BOOL)mouseDownCanMoveWindow { | 3311 - (BOOL)mouseDownCanMoveWindow { |
3313 return YES; | 3312 return YES; |
3314 } | 3313 } |
3315 | 3314 |
3316 @end | 3315 @end |
OLD | NEW |