* Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean}
(topLevelType, nativeEvent)
| 2471 | * @return {boolean} |
| 2472 | */ |
| 2473 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { |
| 2474 | switch (topLevelType) { |
| 2475 | case 'topKeyUp': |
| 2476 | // Command keys insert or clear IME input. |
| 2477 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; |
| 2478 | case 'topKeyDown': |
| 2479 | // Expect IME keyCode on each keydown. If we get any other |
| 2480 | // code we must have exited earlier. |
| 2481 | return nativeEvent.keyCode !== START_KEYCODE; |
| 2482 | case 'topKeyPress': |
| 2483 | case 'topMouseDown': |
| 2484 | case 'topBlur': |
| 2485 | // Events are not possible without cancelling IME. |
| 2486 | return true; |
| 2487 | default: |
| 2488 | return false; |
| 2489 | } |
| 2490 | } |
| 2491 | |
| 2492 | /** |
| 2493 | * Google Input Tools provides composition data via a CustomEvent, |
no outgoing calls
no test coverage detected