From 058ccc7ba0a4d59b9f6e92808332aa9895425fc7 Mon Sep 17 00:00:00 2001 From: Andrei Popescu Date: Wed, 19 Aug 2009 14:09:30 +0100 Subject: Revert "Merge WebKit r47420" This reverts commit d227fc870c7a697500a3c900c31baf05fb9a8524. --- WebCore/platform/chromium/PopupMenuChromium.cpp | 37 ++++++++++++------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'WebCore/platform/chromium/PopupMenuChromium.cpp') diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index 20e0901..51ed6ce 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -601,22 +601,6 @@ 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; -} - bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) { if (event.type() == PlatformKeyboardEvent::KeyUp) @@ -657,8 +641,7 @@ bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) break; default: if (!event.ctrlKey() && !event.altKey() && !event.metaKey() - && isPrintableChar(event.windowsVirtualKeyCode()) - && isCharacterTypeEvent(event)) + && isPrintableChar(event.windowsVirtualKeyCode())) typeAheadFind(event); break; } @@ -707,6 +690,21 @@ static String stripLeadingWhiteSpace(const String& string) return string.substring(i, length - i); } +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; +} + // From HTMLSelectElement.cpp, with modifications void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) { @@ -716,7 +714,8 @@ void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) // Reset the time when user types in a character. The time gap between // last character and the current character is used to indicate whether // user typed in a string or just a character as the search prefix. - m_lastCharTime = now; + if (isCharacterTypeEvent(event)) + m_lastCharTime = now; UChar c = event.windowsVirtualKeyCode(); -- cgit v1.1