Changeset 47150 in webkit


Ignore:
Timestamp:
Aug 12, 2009 2:49:20 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-08-12 Xiaomei Ji <xji@chromium.org>

Reviewed by Eric Seidel.

Fix [Chromium] drop down menu letter selection, skip selections
https://bugs.webkit.org/show_bug.cgi?id=28205

Not auto-testable since it is chromim platform specific code, and it involves sending a keyboard
event to the popup, which is not possible (eventSender sends the key
events through webview, we want to go through the webwidget).

  • manual-tests/keyboard_select_elements_with_same_beginning.html: Added.
  • platform/chromium/PopupMenuChromium.cpp: (WebCore::isCharacterTypeEvent): style change. (WebCore::PopupListBox::handleKeyEvent): typeAheadFind should be called only when the event is a character type event to avoid calling twice for English. (WebCore::PopupListBox::typeAheadFind): remove unnecessary checking of isCharacterTypeEvent() since the whole function is only called under that condition.
Location:
trunk/WebCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r47147 r47150  
     12009-08-12  Xiaomei Ji  <xji@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Fix [Chromium] drop down menu letter selection, skip selections
     6        https://bugs.webkit.org/show_bug.cgi?id=28205
     7
     8        Not auto-testable since it is chromim platform specific code, and it involves sending a keyboard
     9        event to the popup, which is not possible (eventSender sends the key
     10        events through webview, we want to go through the webwidget).
     11
     12        * manual-tests/keyboard_select_elements_with_same_beginning.html: Added.
     13        * platform/chromium/PopupMenuChromium.cpp:
     14        (WebCore::isCharacterTypeEvent): style change.
     15        (WebCore::PopupListBox::handleKeyEvent): typeAheadFind should be called only when the event is
     16        a character type event to avoid calling twice for English.
     17        (WebCore::PopupListBox::typeAheadFind): remove unnecessary checking of isCharacterTypeEvent() since the whole function is only called under that condition.
     18
    1192009-08-12  Maxime Simon  <simon.maxime@gmail.com>
    220
  • trunk/WebCore/platform/chromium/PopupMenuChromium.cpp

    r46184 r47150  
    600600        return false;
    601601    }
     602}
     603
     604static bool isCharacterTypeEvent(const PlatformKeyboardEvent& event)
     605{
     606    // Check whether the event is a character-typed event or not.
     607    // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event
     608    // is considered as character type event. In Mac OS, KeyDown (not
     609    // KeyUp) is considered as character type event.
     610#if PLATFORM(WIN_OS)
     611    if (event.type() == PlatformKeyboardEvent::Char)
     612        return true;
     613#else
     614    if (event.type() == PlatformKeyboardEvent::KeyDown)
     615        return true;
     616#endif
     617    return false;
    602618}
    603619
     
    642658    default:
    643659        if (!event.ctrlKey() && !event.altKey() && !event.metaKey()
    644             && isPrintableChar(event.windowsVirtualKeyCode()))
     660            && isPrintableChar(event.windowsVirtualKeyCode())
     661            && isCharacterTypeEvent(event))
    645662            typeAheadFind(event);
    646663        break;
     
    691708}
    692709
    693 static bool isCharacterTypeEvent(const PlatformKeyboardEvent& event) {
    694     // Check whether the event is a character-typed event or not.
    695     // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event
    696     // is considered as character type event. In Mac OS, KeyDown (not
    697     // KeyUp) is considered as character type event.
    698 #if PLATFORM(WIN_OS)
    699     if (event.type() == PlatformKeyboardEvent::Char)
    700         return true;
    701 #else
    702     if (event.type() == PlatformKeyboardEvent::KeyDown)
    703         return true;
    704 #endif
    705     return false;
    706 }
    707 
    708710// From HTMLSelectElement.cpp, with modifications
    709711void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event)
     
    715717    // last character and the current character is used to indicate whether
    716718    // user typed in a string or just a character as the search prefix.
    717     if (isCharacterTypeEvent(event))
    718         m_lastCharTime = now;
     719    m_lastCharTime = now;
    719720
    720721    UChar c = event.windowsVirtualKeyCode();
Note: See TracChangeset for help on using the changeset viewer.