* Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean}
(topLevelType, nativeEvent)
| 2599 | * @return {boolean} |
| 2600 | */ |
| 2601 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { |
| 2602 | switch (topLevelType) { |
| 2603 | case 'topKeyUp': |
| 2604 | // Command keys insert or clear IME input. |
| 2605 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; |
| 2606 | case 'topKeyDown': |
| 2607 | // Expect IME keyCode on each keydown. If we get any other |
| 2608 | // code we must have exited earlier. |
| 2609 | return nativeEvent.keyCode !== START_KEYCODE; |
| 2610 | case 'topKeyPress': |
| 2611 | case 'topMouseDown': |
| 2612 | case 'topBlur': |
| 2613 | // Events are not possible without cancelling IME. |
| 2614 | return true; |
| 2615 | default: |
| 2616 | return false; |
| 2617 | } |
| 2618 | } |
| 2619 | |
| 2620 | /** |
| 2621 | * Google Input Tools provides composition data via a CustomEvent, |
no outgoing calls
no test coverage detected