summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorpaul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 21:26:08 +0000
committerpaul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 21:26:08 +0000
commit0a9fe25653daa90f09eb7ff5b8309ccc70c20537 (patch)
tree72664aab159d7863db5b54343e646bc87fb67dd1 /webkit/glue
parent2537ef4f42cf26537cd7ac413f6d0ddaff9d5520 (diff)
downloadchromium_src-0a9fe25653daa90f09eb7ff5b8309ccc70c20537.zip
chromium_src-0a9fe25653daa90f09eb7ff5b8309ccc70c20537.tar.gz
chromium_src-0a9fe25653daa90f09eb7ff5b8309ccc70c20537.tar.bz2
Properly dismiss cocoa popup menus.
The virtual key code for mac popup menus was not set properly so HTML select menus, when dismissed by hitting escape or clicking outside of the popup menu area, were not shut down cleanly. WebInputEventFactory requires the charactersIgnoringModifiers field of the NSEvent to be set to VK_ESCAPE (0x1b) for the dimiss to work. The key event type also needs to be a key down (NSKeyDown) since PopupListBox::handleKeyEvent ignores the key up. Review URL: http://codereview.chromium.org/115618 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/webmenurunner_mac.mm5
1 files changed, 3 insertions, 2 deletions
diff --git a/webkit/glue/webmenurunner_mac.mm b/webkit/glue/webmenurunner_mac.mm
index c6b2b243..8997f05 100644
--- a/webkit/glue/webmenurunner_mac.mm
+++ b/webkit/glue/webmenurunner_mac.mm
@@ -122,14 +122,15 @@ NSEvent* EventWithMenuAction(BOOL item_chosen, int window_num,
NSPoint key_pos;
key_pos.x = 0;
key_pos.y = 0;
- event = [NSEvent keyEventWithType:NSKeyUp
+ NSString* escape_str = [NSString stringWithFormat:@"%c", 0x1B];
+ event = [NSEvent keyEventWithType:NSKeyDown
location:key_pos
modifierFlags:0
timestamp:event_time
windowNumber:window_num
context:nil
characters:@""
- charactersIgnoringModifiers:@""
+ charactersIgnoringModifiers:escape_str
isARepeat:NO
keyCode:0x1B];
}