base::NativeEvent does not include full modifier-state |
|||
Issue descriptionui::Events created from platform input events include a base::NativeEvent containing the raw platform-native event data. Under Windows, this is the MSG for the input event, which does not include full detail of the modifiers active when the event was received. This means that code which expects to be able to re-create a ui::Event from a stored NativEvent runs the risk of re-creating it with incorrect modifiers set, if any other input MSGs have been processed in the meantime. We could capture all the "raw" modifier state when receiving the MSG, to include in the base::NativeEvent, and migrate call-sites which currently rely on directly querying the ui::GetModifiersFromKeyState() helper.
,
Nov 21 2017
I've already removed the KeyboardEvent equivalent of the builders you link to in comment #1. Besides the remaining builders we have PenEventProcess::GenerateMouseEvent() using GetModifiersFromKeyState(). We then have calls to ui::EventFromNative(), which internally calls on to that, in various places. Each of these call-sites is removed to some degree from the HWND message handler, making it harder to reason about whether the modifiers grabbed from the thread keyboard state are actually correct. We also expose the SystemEventStateLookup helpers so that anyone can query the thread keyboard state; I'd suggest hiding those, to avoid misuse.
,
Nov 21 2017
PenEventProcessor is called from the HWND handler so it is ok. Personally my approach would be to never have the native os_event hung off of the ui::Event. What is the primary reason it is still needed?
,
Nov 21 2017
Under Windows it gets used to populate fields in WebInputEvents that ui::Event populates differently, or loses entirely. For keyboard events, for example, ui::Event has a different notion of whether the event is a "system key", and we lose the "native_key_code", which it seems some Blink code may still rely on. Auditing for uses of those and migrating them is likely tedious, but certainly do-able, and I agree that we should convert to ui::Events and work with that, not keep dipping back in to the "original" event.
,
Aug 1
,
Aug 7
|
|||
►
Sign in to add a comment |
|||
Comment 1 by dtapu...@chromium.org
, Nov 21 2017