Changeset 19336 in webkit
- Timestamp:
- Feb 1, 2007 12:36:53 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r19331 r19336 1 2007-02-01 Darin Adler <darin@apple.com> 2 3 Reviewed by Maciej. 4 5 - test for <rdar://problem/4887428> REGRESSION: Implement slight delay for firing incremental onSearch event 6 7 * fast/forms/search-event-delay-expected.txt: Added. 8 * fast/forms/search-event-delay.html: Added. 9 1 10 2007-01-31 Darin Adler <darin@apple.com> 2 11 -
trunk/WebCore/ChangeLog
r19335 r19336 1 2007-02-01 Darin Adler <darin@apple.com> 2 3 Reviewed by Maciej. 4 5 - fix <rdar://problem/4887428> REGRESSION: Implement slight delay for firing incremental onSearch event 6 7 * rendering/RenderTextControl.h: 8 * rendering/RenderTextControl.cpp: 9 (WebCore::RenderTextControl::RenderTextControl): Set up timer. 10 (WebCore::RenderTextControl::subtreeHasChanged): Start timer here instead of immediately sending event. 11 (WebCore::RenderTextControl::searchEventTimerFired): Added. Sends search event. 12 (WebCore::RenderTextControl::stopSearchEventTimer): Added. 13 (WebCore::RenderTextControl::startSearchEventTimer): Added. Sends search event right away if there is 14 no text. If there is some text, sets the timer using the same delay rule as NSSearchField. If you keep 15 typing, then the timer keeps getting reset 0.2 seconds into the future until you pause. 16 17 * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::onSearch): Tell the renderer to 18 stop the timer, since we're sending a search event. This helps when a caller other than 19 the timer decides to send an explicit search event. 20 1 21 2007-02-01 Maciej Stachowiak <mjs@apple.com> 2 22 -
trunk/WebCore/html/HTMLInputElement.cpp
r19313 r19336 1538 1538 { 1539 1539 ASSERT(isSearchField()); 1540 if (renderer()) 1541 static_cast<RenderTextControl*>(renderer())->stopSearchEventTimer(); 1540 1542 dispatchHTMLEvent(searchEvent, true, false); 1541 1543 } -
trunk/WebCore/rendering/RenderTextControl.cpp
r19313 r19336 59 59 , m_searchPopup(0) 60 60 , m_searchPopupIsVisible(false) 61 , m_searchEventTimer(this, &RenderTextControl::searchEventTimerFired) 61 62 { 62 63 } … … 480 481 // If the incremental attribute is set, then dispatch the search event 481 482 if (!input->getAttribute(incrementalAttr).isNull()) 482 input->onSearch();483 startSearchEventTimer(); 483 484 484 485 if (!wasDirty) { … … 997 998 } 998 999 1000 void RenderTextControl::searchEventTimerFired(Timer<RenderTextControl>*) 1001 { 1002 static_cast<HTMLInputElement*>(node())->onSearch(); 1003 } 1004 1005 void RenderTextControl::stopSearchEventTimer() 1006 { 1007 m_searchEventTimer.stop(); 1008 } 1009 1010 void RenderTextControl::startSearchEventTimer() 1011 { 1012 unsigned length = text().length(); 1013 1014 // If there's no text, fire the event right away. 1015 if (!length) { 1016 m_searchEventTimer.stop(); 1017 static_cast<HTMLInputElement*>(node())->onSearch(); 1018 return; 1019 } 1020 1021 // After typing the first key, we wait 0.5 seconds. 1022 // After the second key, 0.4 seconds, then 0.3, then 0.2 from then on. 1023 m_searchEventTimer.startOneShot(max(0.2, 0.6 - 0.1 * length)); 1024 } 1025 999 1026 } // namespace WebCore -
trunk/WebCore/rendering/RenderTextControl.h
r19313 r19336 24 24 #include "PopupMenuClient.h" 25 25 #include "RenderBlock.h" 26 #include "Timer.h" 26 27 27 28 namespace WebCore { … … 89 90 void hidePopup(); 90 91 92 void stopSearchEventTimer(); 93 91 94 private: 92 95 // PopupMenuClient methods … … 117 120 void updateCancelButtonVisibility(RenderStyle*); 118 121 const AtomicString& autosaveName() const; 122 void startSearchEventTimer(); 123 void searchEventTimerFired(Timer<RenderTextControl>*); 119 124 120 125 RefPtr<HTMLTextFieldInnerElement> m_innerBlock; … … 130 135 bool m_searchPopupIsVisible; 131 136 mutable Vector<String> m_recentSearches; 137 138 Timer<RenderTextControl> m_searchEventTimer; 132 139 }; 133 140
Note: See TracChangeset
for help on using the changeset viewer.