Skip to content
  • keishi@webkit.org's avatar
    Better type ahead for DateTimeSymbolicFieldElement · 2f11fdeb
    keishi@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=103031
    
    Reviewed by Kent Tamura.
    
    Source/WebCore:
    
    This cuts out the type ahead code that will be used by HTMLSelectElement
    and DateTimeSymbolicFieldElement into a TypeAhead class. This will
    improve DateTimeSymbolicFieldElement type ahead which was first
    character match only, by adding cycling, prefix match and index number
    match.
    
    Added tests to month-multiple-fields-keyboard-events.html.
    
    * GNUmakefile.list.am: Added TypeAhead.{h,cpp}
    * Target.pri: Ditto.
    * WebCore.gypi: Ditto.
    * WebCore.vcproj/WebCore.vcproj: Ditto.
    * WebCore.xcodeproj/project.pbxproj: Ditto.
    * CMakeLists.txt: Ditto.
    * html/HTMLSelectElement.cpp:
    (WebCore):
    (WebCore::HTMLSelectElement::HTMLSelectElement):
    (WebCore::HTMLSelectElement::indexOfSelectedOption): Returns index of current selection.
    (WebCore::HTMLSelectElement::optionCount): Returns total number of options.
    (WebCore::HTMLSelectElement::optionAtIndex): Returns option at index.
    (WebCore::HTMLSelectElement::typeAheadFind): Use TypeAhead.
    * html/HTMLSelectElement.h:
    (HTMLSelectElement):
    * html/TypeAhead.cpp: Added.
    (WebCore):
    (WebCore::TypeAhead::TypeAhead):
    (WebCore::stripLeadingWhiteSpace): Moved from HTMLSelectElement.cpp.
    (WebCore::TypeAhead::handleEvent): Returns index for match.
    * html/TypeAhead.h: Added.
    (WebCore):
    (TypeAheadDataSource): Provide the data about the options that TypeAhead should match against.
    (TypeAhead):
    * html/shadow/DateTimeSymbolicFieldElement.cpp:
    (WebCore::DateTimeSymbolicFieldElement::DateTimeSymbolicFieldElement):
    (WebCore::DateTimeSymbolicFieldElement::handleKeyboardEvent):
    (WebCore::DateTimeSymbolicFieldElement::indexOfSelectedOption):
    (WebCore):
    (WebCore::DateTimeSymbolicFieldElement::optionCount):
    (WebCore::DateTimeSymbolicFieldElement::optionAtIndex):
    * html/shadow/DateTimeSymbolicFieldElement.h:
    (DateTimeSymbolicFieldElement):
    
    LayoutTests:
    
    * fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events-expected.txt:
    * fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html: Added tests for typeahead.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2f11fdeb