diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/platform/chromium/PopupMenuChromium.cpp | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/platform/chromium/PopupMenuChromium.cpp')
-rw-r--r-- | WebCore/platform/chromium/PopupMenuChromium.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index 5abd364..cab7ced 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -32,6 +32,7 @@ #include "PopupMenuChromium.h" #include "CharacterNames.h" +#include "Chrome.h" #include "ChromeClientChromium.h" #include "Font.h" #include "FontSelector.h" @@ -610,17 +611,10 @@ bool PopupListBox::isInterestedInEventForKey(int keyCode) static bool isCharacterTypeEvent(const PlatformKeyboardEvent& event) { // Check whether the event is a character-typed event or not. - // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event - // is considered as character type event. In Mac OS, KeyDown (not - // KeyUp) is considered as character type event. -#if PLATFORM(WIN_OS) - if (event.type() == PlatformKeyboardEvent::Char) - return true; -#else - if (event.type() == PlatformKeyboardEvent::KeyDown) - return true; -#endif - return false; + // We use RawKeyDown/Char/KeyUp event scheme on all platforms, + // so PlatformKeyboardEvent::Char (not RawKeyDown) type event + // is considered as character type event. + return event.type() == PlatformKeyboardEvent::Char; } bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) @@ -744,13 +738,18 @@ void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) } } + // Compute a case-folded copy of the prefix string before beginning the search for + // a matching element. This code uses foldCase to work around the fact that + // String::startWith does not fold non-ASCII characters. This code can be changed + // to use startWith once that is fixed. + String prefixWithCaseFolded(prefix.foldCase()); int itemCount = numItems(); int index = (max(0, m_selectedIndex) + searchStartOffset) % itemCount; for (int i = 0; i < itemCount; i++, index = (index + 1) % itemCount) { if (!isSelectableItem(index)) continue; - if (stripLeadingWhiteSpace(m_items[index]->label).startsWith(prefix, false)) { + if (stripLeadingWhiteSpace(m_items[index]->label).foldCase().startsWith(prefixWithCaseFolded)) { selectIndex(index); return; } @@ -912,6 +911,10 @@ int PopupListBox::pointToRowIndex(const IntPoint& point) void PopupListBox::acceptIndex(int index) { + // Clear m_acceptedIndexOnAbandon once user accepts the selected index. + if (m_acceptedIndexOnAbandon >= 0) + m_acceptedIndexOnAbandon = -1; + if (index >= numItems()) return; @@ -1134,7 +1137,7 @@ void PopupListBox::layout() // Calculate scroll bar width. int windowHeight = 0; -#if PLATFORM(DARWIN) +#if OS(DARWIN) // Set the popup's window to contain all available items on Mac only, which // uses native controls that manage their own scrolling. This allows hit // testing to work when selecting items in popups that have more menu entries @@ -1146,7 +1149,7 @@ void PopupListBox::layout() for (int i = 0; i < m_visibleRows; ++i) { int rowHeight = getRowHeight(i); -#if !PLATFORM(DARWIN) +#if !OS(DARWIN) // Only clip the window height for non-Mac platforms. if (windowHeight + rowHeight > kMaxHeight) { m_visibleRows = i; @@ -1224,7 +1227,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) { if (!p.popup) p.popup = PopupContainer::create(client(), dropDownSettings); -#if PLATFORM(DARWIN) +#if OS(DARWIN) p.popup->showExternal(r, v, index); #else p.popup->show(r, v, index); @@ -1234,7 +1237,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) void PopupMenu::hide() { if (p.popup) - p.popup->hidePopup(); + p.popup->hide(); } void PopupMenu::updateFromElement() |