Open Bug 1181501 Opened 9 years ago Updated 5 months ago

eKeyPress event should be fired in XP level and dispatched with preceding eKeyDown event in same event loop

Categories

(Core :: DOM: UI Events & Focus Handling, enhancement, P3)

enhancement

Tracking

()

Tracking Status
e10s + ---

People

(Reporter: masayuki, Unassigned)

References

(Blocks 2 open bugs)

Details

Currently, NS_KEY_DOWN and NS_KEY_PRESS are dispatched from widget separately. However, this causes hacky handling of preventDefault() of keydown event. http://mxr.mozilla.org/mozilla-central/source/dom/ipc/TabChild.cpp?rev=e17e313a3066&mark=2544-2549#2539 I think that NS_KEY_DOWN_PRESS should be created and widget should dispatch it with enough information for dispatching both keydown event and keypress event. Then, we can make better consistency between platforms and reduce number of IPC. I think that we should fix this bug only with TextEventDispatcher here. Then, fixing bug 1137560 will fix this bug on all platforms automatically.
Version: 40 Branch → Trunk
Priority: -- → P3
Summary: [e10s] NS_KEY_PRESS event should be fired in XP level → [e10s] eKeyPress event should be fired in XP level
Component: Event Handling → User events and focus handling
Assignee: masayuki → nobody
Severity: normal → S3
Type: defect → enhancement
Summary: [e10s] eKeyPress event should be fired in XP level → eKeyPress event should be fired in XP level and dispatched with preceding eKeyDown event in same event loop

From widget point of view:

On WIndows, we can fix this simply because NativeKey peeks enqueued messages when it handles WM_KEYDOWN.

On Linux, modern IME works asynchronously (if IME handles key events synchronously, we can fix it simply). First, we receive GDK_KEY_PRESS and we send it to IME. Then, async IMEs returns "consumed" immediately without any text input. Then, we store the posted key event for the further processing. Then, same event will be sent by IME and we send same event to IME again. Then, IME sends composition events to let us know the inputting text. So, in the latter timing, we could fix this.

On macOS, like Linux, we receive a keyDown: call. Then, we notify its super class of the event to let IME know the event. Then, IME will call insertText: synchronously. So, we can fix this simply.

I'm not sure about Android. Makoto-san, do you know?

Flags: needinfo?(m_kato)

Note that we cannot remove the IPC for eKeyPress because eKeyPress will keep needed by widget to dispatch isolated text input especially on Windows.

As Android OS, it has ACTION_DOWN and ACTION_UP only. Android's widget dispatches eKeyPress after eKeyDown. If eKeyPress is dispatched automatically on content process, we can remove this emulation.

When using physical keyboard, https://searchfox.org/mozilla-central/rev/95935109bbbd4a39d612a917e59025f9c81f9d76/widget/android/GeckoEditableSupport.cpp#547
When using IME even if direct input, https://searchfox.org/mozilla-central/rev/95935109bbbd4a39d612a917e59025f9c81f9d76/widget/android/GeckoEditableSupport.cpp#960 (no composition only)

But, actually, we dispatch it on content process. So it may be another case.

Flags: needinfo?(m_kato)

Thank you. I'll suggest to make us give higher priority to this bug.

You need to log in before you can comment on or make changes to this bug.