Bug 27448 - [Chromium] On Mac, arrow keys should cause Select to pop up its menu
Summary: [Chromium] On Mac, arrow keys should cause Select to pop up its menu
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Minor
Assignee: David Levin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-20 09:53 PDT by Jens Alfke
Modified: 2009-07-21 12:19 PDT (History)
1 user (show)

See Also:


Attachments
patch for ARROW_KEYS_POP_MENU (1.56 KB, patch)
2009-07-20 10:10 PDT, Jens Alfke
levin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Alfke 2009-07-20 09:53:42 PDT
(Split off from bug 22784)

On Mac OS, when a pop-up menu control has focus, pressing an arrow key or the spacebar should pop up the menu. On other platforms, the arrow keys will just change the currently selected item without popping it up. WebCore's SelectElement.cpp configures what behavior to use by defining a constant ARROW_KEYS_POP_UP_MENU. 

This constant is currently set to true if PLATFORM(MAC) is enabled. Unfortunately, in the Mac build of Chromium this flag is always false, because other code in WebCore assumes that if it's on, AppKit is available (which is not true inside a Chromium renderer process.) So that means Mac Chromium gets the wrong key behavior for pop-ups.

I've fixed this by changing the definition of ARROW_KEYS_POP_UP_MENU from
    #if PLATFORM(MAC)
to
    #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN))
which is a bit of a hack, but the best we can do given that there isn't currently a 'Mac platform but not necessarily AppKit' flag. (See 22784 for the discussion that led to using this particular test.)
Comment 1 Jens Alfke 2009-07-20 10:10:36 PDT
Created attachment 33092 [details]
patch for ARROW_KEYS_POP_MENU

It's the feel-good, focused patch of the summer! The critics are raving:
"If you had a patch and a bug just for the define change for ARROW_KEYS_POP_MENU.  I'd r+ it right now."
--David Levin, from comment in 22784
Comment 2 David Levin 2009-07-21 11:17:25 PDT
Assign to levin for landing.
Comment 3 David Levin 2009-07-21 12:19:55 PDT
Committed as http://trac.webkit.org/changeset/46185