Changeset 136113 in webkit
- Timestamp:
- Nov 29, 2012, 2:16:34 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 14 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events-expected.txt (modified) (2 diffs)
-
LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html (modified) (1 diff)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/GNUmakefile.list.am (modified) (1 diff)
-
Source/WebCore/Target.pri (modified) (2 diffs)
-
Source/WebCore/WebCore.gypi (modified) (1 diff)
-
Source/WebCore/WebCore.vcproj/WebCore.vcproj (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
Source/WebCore/html/HTMLSelectElement.cpp (modified) (2 diffs)
-
Source/WebCore/html/HTMLSelectElement.h (modified) (4 diffs)
-
Source/WebCore/html/TypeAhead.cpp (deleted)
-
Source/WebCore/html/TypeAhead.h (deleted)
-
Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp (modified) (3 diffs)
-
Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r136112 r136113 1 2012-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 1 13 2012-11-29 Mike West <mkwst@chromium.org> 2 14 -
trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events-expected.txt
r136111 r136113 16 16 FAIL input.value should be 0012-09. Was 0112-09. 17 17 == Left/Right keys == 18 PASS input.value is "0005-06" 18 FAIL input.value should be 0005-06. Was 0005-09. 19 19 PASS document.activeElement.id is "input" 20 20 == Up/Down keys == … … 50 50 PASS input.value is "0001-12" 51 51 PASS 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"69 52 == RTL Left/Right keys == 70 53 PASS input.value is "2012-10" -
trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html
r136111 r136113 172 172 shouldBeEqualToString('input.value', '0002-12'); 173 173 174 beginTest('Typeahead cycle first character', '2012-09');175 keyDown('j'); // -> [Jan] 2012176 shouldBeEqualToString('input.value', '2012-01');177 keyDown('j'); // -> [Jun] 2012178 shouldBeEqualToString('input.value', '2012-06');179 keyDown('j'); // -> [Jul] 2012180 shouldBeEqualToString('input.value', '2012-07');181 keyDown('j'); // -> [Jan] 2012182 shouldBeEqualToString('input.value', '2012-01');183 keyDown('x'); // -> [Jan] 2012184 shouldBeEqualToString('input.value', '2012-01');185 186 beginTest('Typeahead prefix match', '2012-09');187 keyDown('m'); // -> [Mar] 2012188 shouldBeEqualToString('input.value', '2012-03');189 keyDown('a'); // -> [Mar] 2012190 shouldBeEqualToString('input.value', '2012-03');191 keyDown('y'); // -> [May] 2012192 shouldBeEqualToString('input.value', '2012-05');193 keyDown('x'); // -> [May] 2012194 shouldBeEqualToString('input.value', '2012-05');195 196 beginTest('Typeahead index match', '2012-09');197 keyDown('1'); // -> [Jan] 2012198 shouldBeEqualToString('input.value', '2012-01');199 keyDown('2'); // -> [Dec] 2012200 shouldBeEqualToString('input.value', '2012-12');201 keyDown('x'); // -> [Dec] 2012202 shouldBeEqualToString('input.value', '2012-12');203 204 beginTest('Typeahead should search from current selection', '2012-01');205 keyDown('j'); // -> [Jun] 2012206 shouldBeEqualToString('input.value', '2012-06');207 208 174 // The tests in the following block fail on platforms without the 209 175 // lang-attribute-aware-form-control-UI feature. -
trunk/Source/WebCore/CMakeLists.txt
r136111 r136113 1468 1468 html/TimeInputType.cpp 1469 1469 html/TimeRanges.cpp 1470 html/TypeAhead.cpp1471 1470 html/URLInputType.cpp 1472 1471 html/ValidationMessage.cpp -
trunk/Source/WebCore/ChangeLog
r136111 r136113 1 2012-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 1 31 2012-11-29 Keishi Hattori <keishi@webkit.org> 2 32 -
trunk/Source/WebCore/GNUmakefile.list.am
r136111 r136113 3626 3626 Source/WebCore/html/track/WebVTTTokenizer.h \ 3627 3627 Source/WebCore/html/track/WebVTTTokenizer.cpp \ 3628 Source/WebCore/html/TypeAhead.cpp \3629 Source/WebCore/html/TypeAhead.h \3630 3628 Source/WebCore/html/URLInputType.cpp \ 3631 3629 Source/WebCore/html/URLInputType.h \ -
trunk/Source/WebCore/Target.pri
r136111 r136113 691 691 html/TextInputType.cpp \ 692 692 html/TimeInputType.cpp \ 693 html/TypeAhead.cpp \694 693 html/URLInputType.cpp \ 695 694 html/ValidationMessage.cpp \ … … 1846 1845 html/TextDocument.h \ 1847 1846 html/TimeRanges.h \ 1848 html/TypeAhead.h \1849 1847 html/ValidityState.h \ 1850 1848 html/parser/CSSPreloadScanner.h \ -
trunk/Source/WebCore/WebCore.gypi
r136111 r136113 4266 4266 'html/WeekInputType.cpp', 4267 4267 'html/WeekInputType.h', 4268 'html/TypeAhead.cpp',4269 'html/TypeAhead.h',4270 4268 'html/canvas/CanvasContextAttributes.cpp', 4271 4269 'html/canvas/CanvasContextAttributes.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r136111 r136113 63990 63990 > 63991 63991 </File> 63992 <File63993 RelativePath="..\html\TypeAhead.cpp"63994 >63995 </File>63996 <File63997 RelativePath="..\html\TypeAhead.h"63998 >63999 </File>64000 63992 <File 64001 63993 RelativePath="..\html\URLInputType.cpp" -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r136111 r136113 5832 5832 C348612315FDE21E007A1CC9 /* InputTypeNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */; }; 5833 5833 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 */; };5836 5834 C37CDEBD149EF2030042090D /* ColorChooserClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C37CDEBC149EF2030042090D /* ColorChooserClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5837 5835 C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */; }; … … 13242 13240 C348612115FDE21E007A1CC9 /* InputTypeNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputTypeNames.cpp; sourceTree = "<group>"; }; 13243 13241 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>"; };13246 13242 C37CDEBC149EF2030042090D /* ColorChooserClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooserClient.h; sourceTree = "<group>"; }; 13247 13243 C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserver.cpp; sourceTree = "<group>"; }; … … 17897 17893 E446139E0CD6331000FADA75 /* TimeRanges.h */, 17898 17894 E446139F0CD6331000FADA75 /* TimeRanges.idl */, 17899 C375D7FB16639519006184AB /* TypeAhead.cpp */,17900 C375D7FC16639519006184AB /* TypeAhead.h */,17901 17895 F55B3DA91251F12D003EF269 /* URLInputType.cpp */, 17902 17896 F55B3DAA1251F12D003EF269 /* URLInputType.h */, … … 25843 25837 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */, 25844 25838 15B8B7C91652C5220036EF55 /* JSWebKitCSSMixFunctionValue.h in Headers */, 25845 C375D7FE16639519006184AB /* TypeAhead.h in Headers */,25846 25839 ); 25847 25840 runOnlyForDeploymentPostprocessing = 0; … … 28947 28940 15B8B7C81652C5220036EF55 /* JSWebKitCSSMixFunctionValue.cpp in Sources */, 28948 28941 86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */, 28949 C375D7FD16639519006184AB /* TypeAhead.cpp in Sources */,28950 28942 ); 28951 28943 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/html/HTMLSelectElement.cpp
r136111 r136113 65 65 static const unsigned maxSelectItems = 10000; 66 66 67 static const DOMTimeStamp typeAheadTimeout = 1000; 68 67 69 HTMLSelectElement::HTMLSelectElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) 68 70 : HTMLFormControlElementWithState(tagName, document, form) 69 , m_ typeAhead(this)71 , m_lastCharTime(0) 70 72 , m_size(0) 71 73 , m_lastOnChangeIndex(-1) 72 74 , m_activeSelectionAnchorIndex(-1) 73 75 , m_activeSelectionEndIndex(-1) 76 , m_repeatingChar(0) 74 77 , m_isProcessingUserDrivenChange(false) 75 78 , m_multiple(false) … … 1472 1475 } 1473 1476 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(); 1477 static 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); 1492 1488 } 1493 1489 1494 1490 void HTMLSelectElement::typeAheadFind(KeyboardEvent* event) 1495 1491 { 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; 1497 1527 if (index < 0) 1498 1528 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 } 1502 1553 } 1503 1554 -
trunk/Source/WebCore/html/HTMLSelectElement.h
r136111 r136113 30 30 #include "HTMLFormControlElementWithState.h" 31 31 #include "HTMLOptionsCollection.h" 32 #include "TypeAhead.h"33 32 #include <wtf/Vector.h> 34 33 … … 37 36 class HTMLOptionElement; 38 37 39 class HTMLSelectElement : public HTMLFormControlElementWithState , public TypeAheadDataSource{38 class HTMLSelectElement : public HTMLFormControlElementWithState { 40 39 public: 41 40 static PassRefPtr<HTMLSelectElement> create(const QualifiedName&, Document*, HTMLFormElement*); … … 105 104 // For use in the implementation of HTMLOptionElement. 106 105 void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected); 107 106 108 107 protected: 109 108 HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement*); … … 183 182 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } 184 183 185 // TypeAheadDataSource functions.186 virtual int indexOfSelectedOption() const OVERRIDE;187 virtual int optionCount() const OVERRIDE;188 virtual String optionAtIndex(int index) const OVERRIDE;189 190 184 // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHRElement objects. 191 185 mutable Vector<HTMLElement*> m_listItems; 192 186 Vector<bool> m_lastOnChangeSelection; 193 187 Vector<bool> m_cachedStateForActiveSelection; 194 TypeAhead m_typeAhead; 188 DOMTimeStamp m_lastCharTime; 189 String m_typedString; 195 190 int m_size; 196 191 int m_lastOnChangeIndex; 197 192 int m_activeSelectionAnchorIndex; 198 193 int m_activeSelectionEndIndex; 194 UChar m_repeatingChar; 199 195 bool m_isProcessingUserDrivenChange; 200 196 bool m_multiple; -
trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp
r136111 r136113 56 56 , m_visibleEmptyValue(makeVisibleEmptyValue(symbols)) 57 57 , m_selectedIndex(-1) 58 , m_typeAhead(this)59 58 { 60 59 ASSERT(!symbols.isEmpty()); … … 84 83 85 84 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 } 91 91 } 92 92 … … 151 151 } 152 152 153 int DateTimeSymbolicFieldElement::indexOfSelectedOption() const154 {155 return m_selectedIndex;156 }157 158 int DateTimeSymbolicFieldElement::optionCount() const159 {160 return m_symbols.size();161 }162 163 String DateTimeSymbolicFieldElement::optionAtIndex(int index) const164 {165 return m_symbols[index];166 }167 168 153 } // namespace WebCore 169 154 -
trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h
r136111 r136113 29 29 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 30 30 #include "DateTimeFieldElement.h" 31 #include "TypeAhead.h"32 31 33 32 namespace WebCore { … … 35 34 // DateTimeSymbolicFieldElement represents non-numeric field of data time 36 35 // format, such as: AM/PM, and month. 37 class DateTimeSymbolicFieldElement : public DateTimeFieldElement , public TypeAheadDataSource{36 class DateTimeSymbolicFieldElement : public DateTimeFieldElement { 38 37 WTF_MAKE_NONCOPYABLE(DateTimeSymbolicFieldElement); 39 38 … … 61 60 virtual String visibleValue() const OVERRIDE FINAL; 62 61 63 // TypeAheadDataSource functions.64 virtual int indexOfSelectedOption() const OVERRIDE;65 virtual int optionCount() const OVERRIDE;66 virtual String optionAtIndex(int index) const OVERRIDE;67 68 62 const Vector<String> m_symbols; 69 63 … … 72 66 const AtomicString m_visibleEmptyValue; 73 67 int m_selectedIndex; 74 TypeAhead m_typeAhead;75 68 }; 76 69
Note:
See TracChangeset
for help on using the changeset viewer.