summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/chromium/PopupMenuChromium.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/chromium/PopupMenuChromium.cpp')
-rw-r--r--WebCore/platform/chromium/PopupMenuChromium.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp
index 51ed6ce..20e0901 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.cpp
+++ b/WebCore/platform/chromium/PopupMenuChromium.cpp
@@ -601,6 +601,22 @@ 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)
@@ -641,7 +657,8 @@ bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event)
break;
default:
if (!event.ctrlKey() && !event.altKey() && !event.metaKey()
- && isPrintableChar(event.windowsVirtualKeyCode()))
+ && isPrintableChar(event.windowsVirtualKeyCode())
+ && isCharacterTypeEvent(event))
typeAheadFind(event);
break;
}
@@ -690,21 +707,6 @@ 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)
{
@@ -714,8 +716,7 @@ 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.
- if (isCharacterTypeEvent(event))
- m_lastCharTime = now;
+ m_lastCharTime = now;
UChar c = event.windowsVirtualKeyCode();