WebCore/ChangeLog

 12009-06-01 Xiaomei Ji <xji@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Not auto-testable since it involves sending a keyboard event to
 6 the popup, which is not possible (eventSender sends the key
 7 events through webview, we want to go through the webwidget).
 8
 9 This patch is one part of the fix for issue "keyboard selection in
 10 Hebrew select element does not work in Windows". The other part of the
 11 fix is in chromium's webkit/glue layer.
 12 https://bugs.webkit.org/show_bug.cgi?id=25899
 13
 14 * manual-tests/keyboard_select_non_english.html: Added.
 15 * platform/chromium/PopupMenuChromium.cpp:
 16 (WebCore::isCharacterTypeEvent): Added. Check whether the event is a
 17 character type event. "Char" in Windows or "KeyDown" in Mac is character
 18 type event.
 19 (WebCore::PopupListBox::typeAheadFind): Since m_lastCharTime is used to
 20 indicate whether user types multiple characters continuely as a search
 21 prefix or not, it should be only assigned when the event is character
 22 type event.
 23
1242009-06-01 Nikolas Zimmermann <zimmermann@kde.org>
225
326 Reviewed by Eric Seidel.
44338

WebCore/manual-tests/keyboard_select_non_english.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8">
 5<title>
 6Test select non English element
 7</title>
 8</head>
 9<body>
 10See bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=25899">25899</a>.
 11<p>
 12Choose the correct input method. Open the select element then type the first
 13letter of one of the elements. The search prefix should be the first non English
 14letter, not the value of the physical keyboard plus the native non English
 15letter. For example, set the input method as Hebrew, hit keyboard 'c', the
 16translated Hebrew character is 'ב'. The search prefix should be 'ב', not "cב".
 17And the right element should be selected.
 18<p>
 19
 20Hebrew Select:
 21<select style="direction:rtl">
 22 <option>אאא</option>
 23 <option>בבב</option>
 24 <option>גגג</option>
 25 <option>דדדד מילה ערוכה מאוד, כדי שיהיה אפשר לראות יישור</option>
 26</select>
 27
 28Russian Select:
 29<select>
 30 <option>фисв</option>
 31 <option>уап</option>
 32 <option>ршол</option>
 33 <option>дьт</option>
 34</select>
 35</body>
 36</html>
0

WebCore/platform/chromium/PopupMenuChromium.cpp

@@static String stripLeadingWhiteSpace(con
686686 return string.substring(i, length - i);
687687}
688688
 689bool isCharacterTypeEvent(const PlatformKeyboardEvent& event) {
 690 // Check whether the event is a character-typed event or not.
 691 // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event
 692 // is considered as character type event. In Mac OS, KeyDown (not
 693 // KeyUp) is considered as character type event.
 694#if PLATFORM(WIN_OS)
 695 if (event.type() == PlatformKeyboardEvent::Char)
 696 return true;
 697#else
 698 if (event.type() == PlatformKeyboardEvent::KeyDown)
 699 return true;
 700#endif
 701 return false;
 702}
 703
689704// From HTMLSelectElement.cpp, with modifications
690705void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event)
691706{
692707 TimeStamp now = static_cast<TimeStamp>(currentTime() * 1000.0f);
693708 TimeStamp delta = now - m_lastCharTime;
694709
695  m_lastCharTime = now;
 710 // Reset the time when user types in a character. The time gap between
 711 // last character and the current character is used to indicate whether
 712 // user typed in a string or just a character as the search prefix.
 713 if (isCharacterTypeEvent(event))
 714 m_lastCharTime = now;
696715
697716 UChar c = event.windowsVirtualKeyCode();
698717
43971