Commit d2d10bf3 authored by Navid Zolghadr's avatar Navid Zolghadr Committed by Commit Bot

Fix the native event created from WebKeyboardEvent.

Apparently some MacOS platform code (e.g processing
shortcuts for menu items in NSMenu) uses this hidden
field eventRef in NSEvent which is initalized on first
access. Apparently they access it in a way that it
doesn't get initialized. So we need to initialize
it in our code.

Bug: 881827
Change-Id: I6192b9cb8da3e5bc3fe20630f338cfd873efe877
Reviewed-on: https://chromium-review.googlesource.com/c/1351597Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarLan Wei <lanwei@chromium.org>
Commit-Queue: Navid Zolghadr <nzolghadr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611718}
parent e71b3a7f
...@@ -84,6 +84,12 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent( ...@@ -84,6 +84,12 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(
charactersIgnoringModifiers:unmodified_text charactersIgnoringModifiers:unmodified_text
isARepeat:NO isARepeat:NO
keyCode:web_event.native_key_code] retain]; keyCode:web_event.native_key_code] retain];
// The eventRef is necessary for MacOS code (like NSMenu) to work later in the
// pipeline. As per documentation:
// https://developer.apple.com/documentation/appkit/nsevent/1525143-eventref
// "Other NSEvent objects create an EventRef when this property is first
// accessed, if possible".
[os_event eventRef];
} }
NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment