* Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean}
(topLevelType, nativeEvent)
| 3273 | * @return {boolean} |
| 3274 | */ |
| 3275 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { |
| 3276 | switch (topLevelType) { |
| 3277 | case 'topKeyUp': |
| 3278 | // Command keys insert or clear IME input. |
| 3279 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; |
| 3280 | case 'topKeyDown': |
| 3281 | // Expect IME keyCode on each keydown. If we get any other |
| 3282 | // code we must have exited earlier. |
| 3283 | return nativeEvent.keyCode !== START_KEYCODE; |
| 3284 | case 'topKeyPress': |
| 3285 | case 'topMouseDown': |
| 3286 | case 'topBlur': |
| 3287 | // Events are not possible without cancelling IME. |
| 3288 | return true; |
| 3289 | default: |
| 3290 | return false; |
| 3291 | } |
| 3292 | } |
| 3293 | |
| 3294 | /** |
| 3295 | * Google Input Tools provides composition data via a CustomEvent, |
no outgoing calls
no test coverage detected