First of all, TextInputHandler::HandleKeyDown() dispatches an eKeyDown event before sending IME. This is different behavior from Gecko on the other platforms and it means TextInputHandler does not know if the eKeyDown event will be handled by IME. Therefore, we need to make TextInputHandler dispatch an eKeyDown event dispatch when it needs to dispatch another event. Therefore, this patch makes TextInputHandler not dispatch an eKeyDown even from its HandleKeyDown() unless it's already has composition (because if it's already had composition, any eKeyDown event except modifier keys should be marked as "processed by IME" for compatibility with the other browsers). For dispatching eKeyDown event only once for a native keydown event, this patch implements TextInputHandlerBase::MaybeDispatchCurrentKeydownEvent() to check whether eKeyDown event has already been dispatched for the event and if it's not so, dispatches eKeyDown event. Note that on macOS, dead keys are implemented as IME. However, we need to treat dead keys as is. Therefore, if current keydown event is a dead keydown event, MaybeDispatchCurrentKeydownEvent() should NOT mark dispatching eKeyDown event and its following eKeyDown event as "processed by IME". MozReview-Commit-ID: 7epk8wdAznd
183 KiB
183 KiB