* Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean}
(topLevelType, nativeEvent)
| 2568 | * @return {boolean} |
| 2569 | */ |
| 2570 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { |
| 2571 | switch (topLevelType) { |
| 2572 | case 'topKeyUp': |
| 2573 | // Command keys insert or clear IME input. |
| 2574 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; |
| 2575 | case 'topKeyDown': |
| 2576 | // Expect IME keyCode on each keydown. If we get any other |
| 2577 | // code we must have exited earlier. |
| 2578 | return nativeEvent.keyCode !== START_KEYCODE; |
| 2579 | case 'topKeyPress': |
| 2580 | case 'topMouseDown': |
| 2581 | case 'topBlur': |
| 2582 | // Events are not possible without cancelling IME. |
| 2583 | return true; |
| 2584 | default: |
| 2585 | return false; |
| 2586 | } |
| 2587 | } |
| 2588 | |
| 2589 | /** |
| 2590 | * Google Input Tools provides composition data via a CustomEvent, |
no outgoing calls
no test coverage detected