⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 136113 in webkit


Ignore:
Timestamp:
Nov 29, 2012, 2:16:34 AM (14 years ago)
Author:
apavlov@chromium.org
Message:

Unreviewed, rolling out r136111.
​http://trac.webkit.org/changeset/136111
​https://bugs.webkit.org/show_bug.cgi?id=103620

Broke compilation on Mac (unused private field m_matchMode)
(Requested by apavlov on #webkit).

Patch by Sheriff Bot <​webkit.review.bot@gmail.com> on 2012-11-29

Source/WebCore:

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • html/HTMLSelectElement.cpp:

(WebCore):
(WebCore::HTMLSelectElement::HTMLSelectElement):
(WebCore::stripLeadingWhiteSpace):
(WebCore::HTMLSelectElement::typeAheadFind):

  • html/HTMLSelectElement.h:

(HTMLSelectElement):

  • html/TypeAhead.cpp: Removed.
  • html/TypeAhead.h: Removed.
  • html/shadow/DateTimeSymbolicFieldElement.cpp:

(WebCore::DateTimeSymbolicFieldElement::DateTimeSymbolicFieldElement):
(WebCore::DateTimeSymbolicFieldElement::handleKeyboardEvent):

  • 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:
Location:
trunk
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r136112 r136113  
     12012-11-29  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r136111.
     4        http://trac.webkit.org/changeset/136111
     5        https://bugs.webkit.org/show_bug.cgi?id=103620
     6
     7        Broke compilation on Mac (unused private field m_matchMode)
     8        (Requested by apavlov on #webkit).
     9
     10        * fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events-expected.txt:
     11        * fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html:
     12
    1132012-11-29  Mike West  <mkwst@chromium.org>
    214
  • trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events-expected.txt

    r136111 r136113  
    1616FAIL input.value should be 0012-09. Was 0112-09.
    1717== Left/Right keys ==
    18 PASS input.value is "0005-06"
     18FAIL input.value should be 0005-06. Was 0005-09.
    1919PASS document.activeElement.id is "input"
    2020== Up/Down keys ==
    … …  
    5050PASS input.value is "0001-12"
    5151PASS input.value is "0002-12"
    52 == Typeahead cycle first character ==
    53 PASS input.value is "2012-01"
    54 PASS input.value is "2012-06"
    55 PASS input.value is "2012-07"
    56 PASS input.value is "2012-01"
    57 PASS input.value is "2012-01"
    58 == Typeahead prefix match ==
    59 PASS input.value is "2012-03"
    60 PASS input.value is "2012-03"
    61 PASS input.value is "2012-05"
    62 PASS input.value is "2012-05"
    63 == Typeahead index match ==
    64 PASS input.value is "2012-01"
    65 PASS input.value is "2012-12"
    66 PASS input.value is "2012-12"
    67 == Typeahead should search from current selection ==
    68 PASS input.value is "2012-06"
    6952== RTL Left/Right keys ==
    7053PASS input.value is "2012-10"
  • trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html

    r136111 r136113  
    172172shouldBeEqualToString('input.value', '0002-12');
    173173
    174 beginTest('Typeahead cycle first character', '2012-09');
    175 keyDown('j'); //          -> [Jan] 2012
    176 shouldBeEqualToString('input.value', '2012-01');
    177 keyDown('j'); //          -> [Jun] 2012
    178 shouldBeEqualToString('input.value', '2012-06');
    179 keyDown('j'); //          -> [Jul] 2012
    180 shouldBeEqualToString('input.value', '2012-07');
    181 keyDown('j'); //          -> [Jan] 2012
    182 shouldBeEqualToString('input.value', '2012-01');
    183 keyDown('x'); //          -> [Jan] 2012
    184 shouldBeEqualToString('input.value', '2012-01');
    185 
    186 beginTest('Typeahead prefix match', '2012-09');
    187 keyDown('m'); //          -> [Mar] 2012
    188 shouldBeEqualToString('input.value', '2012-03');
    189 keyDown('a'); //          -> [Mar] 2012
    190 shouldBeEqualToString('input.value', '2012-03');
    191 keyDown('y'); //          -> [May] 2012
    192 shouldBeEqualToString('input.value', '2012-05');
    193 keyDown('x'); //          -> [May] 2012
    194 shouldBeEqualToString('input.value', '2012-05');
    195 
    196 beginTest('Typeahead index match', '2012-09');
    197 keyDown('1'); //          -> [Jan] 2012
    198 shouldBeEqualToString('input.value', '2012-01');
    199 keyDown('2'); //          -> [Dec] 2012
    200 shouldBeEqualToString('input.value', '2012-12');
    201 keyDown('x'); //          -> [Dec] 2012
    202 shouldBeEqualToString('input.value', '2012-12');
    203 
    204 beginTest('Typeahead should search from current selection', '2012-01');
    205 keyDown('j'); //          -> [Jun] 2012
    206 shouldBeEqualToString('input.value', '2012-06');
    207 
    208174// The tests in the following block fail on platforms without the
    209175// lang-attribute-aware-form-control-UI feature.
  • trunk/Source/WebCore/CMakeLists.txt

    r136111 r136113  
    14681468    html/TimeInputType.cpp
    14691469    html/TimeRanges.cpp
    1470     html/TypeAhead.cpp
    14711470    html/URLInputType.cpp
    14721471    html/ValidationMessage.cpp
  • trunk/Source/WebCore/ChangeLog

    r136111 r136113  
     12012-11-29  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r136111.
     4        http://trac.webkit.org/changeset/136111
     5        https://bugs.webkit.org/show_bug.cgi?id=103620
     6
     7        Broke compilation on Mac (unused private field m_matchMode)
     8        (Requested by apavlov on #webkit).
     9
     10        * CMakeLists.txt:
     11        * GNUmakefile.list.am:
     12        * Target.pri:
     13        * WebCore.gypi:
     14        * WebCore.vcproj/WebCore.vcproj:
     15        * WebCore.xcodeproj/project.pbxproj:
     16        * html/HTMLSelectElement.cpp:
     17        (WebCore):
     18        (WebCore::HTMLSelectElement::HTMLSelectElement):
     19        (WebCore::stripLeadingWhiteSpace):
     20        (WebCore::HTMLSelectElement::typeAheadFind):
     21        * html/HTMLSelectElement.h:
     22        (HTMLSelectElement):
     23        * html/TypeAhead.cpp: Removed.
     24        * html/TypeAhead.h: Removed.
     25        * html/shadow/DateTimeSymbolicFieldElement.cpp:
     26        (WebCore::DateTimeSymbolicFieldElement::DateTimeSymbolicFieldElement):
     27        (WebCore::DateTimeSymbolicFieldElement::handleKeyboardEvent):
     28        * html/shadow/DateTimeSymbolicFieldElement.h:
     29        (DateTimeSymbolicFieldElement):
     30
    1312012-11-29  Keishi Hattori  <keishi@webkit.org>
    232
  • trunk/Source/WebCore/GNUmakefile.list.am

    r136111 r136113  
    36263626        Source/WebCore/html/track/WebVTTTokenizer.h \
    36273627        Source/WebCore/html/track/WebVTTTokenizer.cpp \
    3628         Source/WebCore/html/TypeAhead.cpp \
    3629         Source/WebCore/html/TypeAhead.h \
    36303628        Source/WebCore/html/URLInputType.cpp \
    36313629        Source/WebCore/html/URLInputType.h \
  • trunk/Source/WebCore/Target.pri

    r136111 r136113  
    691691    html/TextInputType.cpp \
    692692    html/TimeInputType.cpp \
    693     html/TypeAhead.cpp \
    694693    html/URLInputType.cpp \
    695694    html/ValidationMessage.cpp \
    … …  
    18461845    html/TextDocument.h \
    18471846    html/TimeRanges.h \
    1848     html/TypeAhead.h \
    18491847    html/ValidityState.h \
    18501848    html/parser/CSSPreloadScanner.h \
  • trunk/Source/WebCore/WebCore.gypi

    r136111 r136113  
    42664266            'html/WeekInputType.cpp',
    42674267            'html/WeekInputType.h',
    4268             'html/TypeAhead.cpp',
    4269             'html/TypeAhead.h',
    42704268            'html/canvas/CanvasContextAttributes.cpp',
    42714269            'html/canvas/CanvasContextAttributes.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r136111 r136113  
    6399063990                                >
    6399163991                        </File>
    63992                 <File
    63993                         RelativePath="..\html\TypeAhead.cpp"
    63994                         >
    63995                 </File>
    63996                 <File
    63997                         RelativePath="..\html\TypeAhead.h"
    63998                         >
    63999                 </File>
    6400063992                        <File
    6400163993                                RelativePath="..\html\URLInputType.cpp"
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r136111 r136113  
    58325832                C348612315FDE21E007A1CC9 /* InputTypeNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */; };
    58335833                C348612415FDE21E007A1CC9 /* InputTypeNames.h in Headers */ = {isa = PBXBuildFile; fileRef = C348612215FDE21E007A1CC9 /* InputTypeNames.h */; };
    5834                 C375D7FD16639519006184AB /* TypeAhead.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C375D7FB16639519006184AB /* TypeAhead.cpp */; };
    5835                 C375D7FE16639519006184AB /* TypeAhead.h in Headers */ = {isa = PBXBuildFile; fileRef = C375D7FC16639519006184AB /* TypeAhead.h */; };
    58365834                C37CDEBD149EF2030042090D /* ColorChooserClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C37CDEBC149EF2030042090D /* ColorChooserClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
    58375835                C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */; };
    … …  
    1324213240                C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputTypeNames.cpp; sourceTree = "<group>"; };
    1324313241                C348612215FDE21E007A1CC9 /* InputTypeNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputTypeNames.h; sourceTree = "<group>"; };
    13244                 C375D7FB16639519006184AB /* TypeAhead.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeAhead.cpp; sourceTree = "<group>"; };
    13245                 C375D7FC16639519006184AB /* TypeAhead.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeAhead.h; sourceTree = "<group>"; };
    1324613242                C37CDEBC149EF2030042090D /* ColorChooserClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooserClient.h; sourceTree = "<group>"; };
    1324713243                C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserver.cpp; sourceTree = "<group>"; };
    … …  
    1789717893                                E446139E0CD6331000FADA75 /* TimeRanges.h */,
    1789817894                                E446139F0CD6331000FADA75 /* TimeRanges.idl */,
    17899                                 C375D7FB16639519006184AB /* TypeAhead.cpp */,
    17900                                 C375D7FC16639519006184AB /* TypeAhead.h */,
    1790117895                                F55B3DA91251F12D003EF269 /* URLInputType.cpp */,
    1790217896                                F55B3DAA1251F12D003EF269 /* URLInputType.h */,
    … …  
    2584325837                                31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
    2584425838                                15B8B7C91652C5220036EF55 /* JSWebKitCSSMixFunctionValue.h in Headers */,
    25845                                 C375D7FE16639519006184AB /* TypeAhead.h in Headers */,
    2584625839                        );
    2584725840                        runOnlyForDeploymentPostprocessing = 0;
    … …  
    2894728940                                15B8B7C81652C5220036EF55 /* JSWebKitCSSMixFunctionValue.cpp in Sources */,
    2894828941                                86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */,
    28949                                 C375D7FD16639519006184AB /* TypeAhead.cpp in Sources */,
    2895028942                        );
    2895128943                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/html/HTMLSelectElement.cpp

    r136111 r136113  
    6565static const unsigned maxSelectItems = 10000;
    6666
     67static const DOMTimeStamp typeAheadTimeout = 1000;
     68
    6769HTMLSelectElement::HTMLSelectElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
    6870    : HTMLFormControlElementWithState(tagName, document, form)
    69     , m_typeAhead(this)
     71    , m_lastCharTime(0)
    7072    , m_size(0)
    7173    , m_lastOnChangeIndex(-1)
    7274    , m_activeSelectionAnchorIndex(-1)
    7375    , m_activeSelectionEndIndex(-1)
     76    , m_repeatingChar(0)
    7477    , m_isProcessingUserDrivenChange(false)
    7578    , m_multiple(false)
    … …  
    14721475}
    14731476
    1474 int HTMLSelectElement::indexOfSelectedOption() const
    1475 {
    1476     return optionToListIndex(selectedIndex());
    1477 }
    1478 
    1479 int HTMLSelectElement::optionCount() const
    1480 {
    1481     return listItems().size();
    1482 }
    1483 
    1484 String HTMLSelectElement::optionAtIndex(int index) const
    1485 {
    1486     const Vector<HTMLElement*>& items = listItems();
    1487    
    1488     HTMLElement* element = items[index];
    1489     if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->disabled())
    1490         return String();
    1491     return toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
     1477static String stripLeadingWhiteSpace(const String& string)
     1478{
     1479    int length = string.length();
     1480
     1481    int i;
     1482    for (i = 0; i < length; ++i) {
     1483        if (string[i] != noBreakSpace && (string[i] <= 0x7F ? !isASCIISpace(string[i]) : (direction(string[i]) != WhiteSpaceNeutral)))
     1484            break;
     1485    }
     1486
     1487    return string.substring(i, length - i);
    14921488}
    14931489
    14941490void HTMLSelectElement::typeAheadFind(KeyboardEvent* event)
    14951491{
    1496     int index = m_typeAhead.handleEvent(event, TypeAhead::MatchPrefix | TypeAhead::CycleFirstChar);
     1492    if (event->timeStamp() < m_lastCharTime)
     1493        return;
     1494
     1495    DOMTimeStamp delta = event->timeStamp() - m_lastCharTime;
     1496    m_lastCharTime = event->timeStamp();
     1497
     1498    UChar c = event->charCode();
     1499
     1500    String prefix;
     1501    int searchStartOffset = 1;
     1502    if (delta > typeAheadTimeout) {
     1503        prefix = String(&c, 1);
     1504        m_typedString = prefix;
     1505        m_repeatingChar = c;
     1506    } else {
     1507        m_typedString.append(c);
     1508
     1509        if (c == m_repeatingChar) {
     1510            // The user is likely trying to cycle through all the items starting
     1511            // with this character, so just search on the character.
     1512            prefix = String(&c, 1);
     1513        } else {
     1514            m_repeatingChar = 0;
     1515            prefix = m_typedString;
     1516            searchStartOffset = 0;
     1517        }
     1518    }
     1519
     1520    const Vector<HTMLElement*>& items = listItems();
     1521    int itemCount = items.size();
     1522    if (itemCount < 1)
     1523        return;
     1524
     1525    int selected = selectedIndex();
     1526    int index = optionToListIndex(selected >= 0 ? selected : 0) + searchStartOffset;
    14971527    if (index < 0)
    14981528        return;
    1499     selectOption(listToOptionIndex(index), DeselectOtherOptions | DispatchChangeEvent | UserDriven);
    1500     if (!usesMenuList())
    1501         listBoxOnChange();
     1529    index %= itemCount;
     1530
     1531    // Compute a case-folded copy of the prefix string before beginning the search for
     1532    // a matching element. This code uses foldCase to work around the fact that
     1533    // String::startWith does not fold non-ASCII characters. This code can be changed
     1534    // to use startWith once that is fixed.
     1535    String prefixWithCaseFolded(prefix.foldCase());
     1536    for (int i = 0; i < itemCount; ++i, index = (index + 1) % itemCount) {
     1537        HTMLElement* element = items[index];
     1538        if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->disabled())
     1539            continue;
     1540
     1541        // Fold the option string and check if its prefix is equal to the folded prefix.
     1542        String text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
     1543        if (stripLeadingWhiteSpace(text).foldCase().startsWith(prefixWithCaseFolded)) {
     1544            selectOption(listToOptionIndex(index), DeselectOtherOptions | DispatchChangeEvent | UserDriven);
     1545            if (!usesMenuList())
     1546                listBoxOnChange();
     1547
     1548            setOptionsChangedOnRenderer();
     1549            setNeedsStyleRecalc();
     1550            return;
     1551        }
     1552    }
    15021553}
    15031554
  • trunk/Source/WebCore/html/HTMLSelectElement.h

    r136111 r136113  
    3030#include "HTMLFormControlElementWithState.h"
    3131#include "HTMLOptionsCollection.h"
    32 #include "TypeAhead.h"
    3332#include <wtf/Vector.h>
    3433
    … …  
    3736class HTMLOptionElement;
    3837
    39 class HTMLSelectElement : public HTMLFormControlElementWithState, public TypeAheadDataSource {
     38class HTMLSelectElement : public HTMLFormControlElementWithState {
    4039public:
    4140    static PassRefPtr<HTMLSelectElement> create(const QualifiedName&, Document*, HTMLFormElement*);
    … …  
    105104    // For use in the implementation of HTMLOptionElement.
    106105    void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected);
    107 
     106   
    108107protected:
    109108    HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement*);
    … …  
    183182    virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
    184183
    185     // TypeAheadDataSource functions.
    186     virtual int indexOfSelectedOption() const OVERRIDE;
    187     virtual int optionCount() const OVERRIDE;
    188     virtual String optionAtIndex(int index) const OVERRIDE;
    189 
    190184    // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHRElement objects.
    191185    mutable Vector<HTMLElement*> m_listItems;
    192186    Vector<bool> m_lastOnChangeSelection;
    193187    Vector<bool> m_cachedStateForActiveSelection;
    194     TypeAhead m_typeAhead;
     188    DOMTimeStamp m_lastCharTime;
     189    String m_typedString;
    195190    int m_size;
    196191    int m_lastOnChangeIndex;
    197192    int m_activeSelectionAnchorIndex;
    198193    int m_activeSelectionEndIndex;
     194    UChar m_repeatingChar;
    199195    bool m_isProcessingUserDrivenChange;
    200196    bool m_multiple;
  • trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp

    r136111 r136113  
    5656    , m_visibleEmptyValue(makeVisibleEmptyValue(symbols))
    5757    , m_selectedIndex(-1)
    58     , m_typeAhead(this)
    5958{
    6059    ASSERT(!symbols.isEmpty());
    … …  
    8483
    8584    keyboardEvent->setDefaultHandled();
    86 
    87     int index = m_typeAhead.handleEvent(keyboardEvent, TypeAhead::MatchPrefix | TypeAhead::CycleFirstChar | TypeAhead::MatchIndex);
    88     if (index < 0)
    89         return;
    90     setValueAsInteger(index, DispatchEvent);
     85    for (unsigned index = 0; index < m_symbols.size(); ++index) {
     86        if (!m_symbols[index].isEmpty() && WTF::Unicode::toLower(m_symbols[index][0]) == charCode) {
     87            setValueAsInteger(index, DispatchEvent);
     88            return;
     89        }
     90    }
    9191}
    9292
    … …  
    151151}
    152152
    153 int DateTimeSymbolicFieldElement::indexOfSelectedOption() const
    154 {
    155     return m_selectedIndex;
    156 }
    157 
    158 int DateTimeSymbolicFieldElement::optionCount() const
    159 {
    160     return m_symbols.size();
    161 }
    162 
    163 String DateTimeSymbolicFieldElement::optionAtIndex(int index) const
    164 {
    165     return m_symbols[index];
    166 }
    167 
    168153} // namespace WebCore
    169154
  • trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h

    r136111 r136113  
    2929#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
    3030#include "DateTimeFieldElement.h"
    31 #include "TypeAhead.h"
    3231
    3332namespace WebCore {
    … …  
    3534// DateTimeSymbolicFieldElement represents non-numeric field of data time
    3635// format, such as: AM/PM, and month.
    37 class DateTimeSymbolicFieldElement : public DateTimeFieldElement, public TypeAheadDataSource {
     36class DateTimeSymbolicFieldElement : public DateTimeFieldElement {
    3837    WTF_MAKE_NONCOPYABLE(DateTimeSymbolicFieldElement);
    3938
    … …  
    6160    virtual String visibleValue() const OVERRIDE FINAL;
    6261
    63     // TypeAheadDataSource functions.
    64     virtual int indexOfSelectedOption() const OVERRIDE;
    65     virtual int optionCount() const OVERRIDE;
    66     virtual String optionAtIndex(int index) const OVERRIDE;
    67 
    6862    const Vector<String> m_symbols;
    6963
    … …  
    7266    const AtomicString m_visibleEmptyValue;
    7367    int m_selectedIndex;
    74     TypeAhead m_typeAhead;
    7568};
    7669
Note: See TracChangeset for help on using the changeset viewer.