Changeset 66001 in webkit
- Timestamp:
- Aug 25, 2010 2:45:06 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r66000 r66001 1 2010-08-25 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Shinichiro Hamaji 4 5 <input type=number>: Support auto-repeat by mouse press 6 https://bugs.webkit.org/show_bug.cgi?id=44476 7 8 Update existing tests. 9 10 * fast/forms/script-tests/input-spinbutton-capturing.js: 11 * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum: 12 * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.png: 13 * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt: 14 1 15 2010-08-25 Kent Tamura <tkent@chromium.org> 2 16 -
trunk/LayoutTests/fast/forms/script-tests/input-spinbutton-capturing.js
r65997 r66001 15 15 // clear and this click didn't work. 16 16 eventSender.mouseMoveTo(anotherInput.offsetLeft + anotherInput.offsetWidth - 10, anotherInput.offsetTop + anotherInput.offsetHeight / 4); 17 eventSender.mouseMoveTo(anotherInput.offsetLeft + anotherInput.offsetWidth - 10, anotherInput.offsetTop + anotherInput.offsetHeight / 4 - 1); 17 18 eventSender.mouseDown(); 18 19 eventSender.mouseUp(); -
trunk/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum
r61751 r66001 1 5c1b34460d03938fffe006161914f725 1 00e1de48e3e84449e88ede94e8e11b58 -
trunk/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt
r63403 r66001 17 17 RenderBlock {DIV} at (3,3) size 165x21 18 18 RenderText {#text} at (1,0) size 12x21 19 text run at (1,0) width 12: " 0"20 caret: position 0of child 0 {DIV} of child 5 {INPUT} of body19 text run at (1,0) width 12: "1" 20 caret: position 1 of child 0 {#text} of child 0 {DIV} of child 5 {INPUT} of body -
trunk/WebCore/ChangeLog
r65999 r66001 1 2010-08-25 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Shinichiro Hamaji 4 5 <input type=number>: Support auto-repeat by mouse press 6 https://bugs.webkit.org/show_bug.cgi?id=44476 7 8 Like arrow button of scrollbars, spinbuttons of <input 9 type=number> should continue to increase/decrease their values 10 while the mouse button is pressed. 11 12 No new tests because the new behavior strongly depends on a timer. 13 14 * rendering/TextControlInnerElements.cpp: 15 (WebCore::SpinButtonElement::SpinButtonElement): 16 Initializes the timer. 17 (WebCore::SpinButtonElement::defaultEventHandler): 18 Starts the timer by a mousedown event. 19 (WebCore::SpinButtonElement::startRepeatingTimer): 20 (WebCore::SpinButtonElement::stopRepeatingTimer): 21 (WebCore::SpinButtonElement::repeatingTimerFired): 22 * rendering/TextControlInnerElements.h: 23 1 24 2010-08-25 Gabor Loki <loki@webkit.org> 2 25 -
trunk/WebCore/rendering/TextControlInnerElements.cpp
r65997 r66001 40 40 #include "RenderLayer.h" 41 41 #include "RenderTextControlSingleLine.h" 42 #include "ScrollbarTheme.h" 42 43 #include "SpeechInput.h" 43 44 … … 259 260 , m_capturing(false) 260 261 , m_upDownState(Indeterminate) 262 , m_pressStartingState(Indeterminate) 263 , m_repeatingTimer(this, &SpinButtonElement::repeatingTimerFired) 261 264 { 262 265 } … … 282 285 } 283 286 284 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);285 287 HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); 286 288 if (input->disabled() || input->isReadOnlyFormControl()) { … … 290 292 } 291 293 294 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); 292 295 IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); 293 if ( event->type() == eventNames().clickEvent && mouseEvent->button() == LeftButton) {296 if (mouseEvent->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) { 294 297 if (box->borderBoxRect().contains(local)) { 295 298 RefPtr<Node> protector(input); 296 299 input->focus(); 297 300 input->select(); 298 if (local.y() < box->height() / 2) 299 input->stepUpFromRenderer(1); 300 else 301 input->stepUpFromRenderer(-1); 301 input->stepUpFromRenderer(m_upDownState == Up ? 1 : -1); 302 302 event->setDefaultHandled(); 303 } 304 } else if (event->type() == eventNames().mousemoveEvent) { 303 startRepeatingTimer(); 304 } 305 } else if (mouseEvent->type() == eventNames().mouseupEvent && mouseEvent->button() == LeftButton) 306 stopRepeatingTimer(); 307 else if (event->type() == eventNames().mousemoveEvent) { 305 308 if (box->borderBoxRect().contains(local)) { 306 309 if (!m_capturing) { … … 316 319 } else { 317 320 if (m_capturing) { 321 stopRepeatingTimer(); 318 322 if (Frame* frame = document()->frame()) { 319 323 frame->eventHandler()->setCapturingMouseEventsNode(0); … … 326 330 if (!event->defaultHandled()) 327 331 HTMLDivElement::defaultEventHandler(event); 332 } 333 334 void SpinButtonElement::startRepeatingTimer() 335 { 336 m_pressStartingState = m_upDownState; 337 ScrollbarTheme* theme = ScrollbarTheme::nativeTheme(); 338 m_repeatingTimer.start(theme->initialAutoscrollTimerDelay(), theme->autoscrollTimerDelay()); 339 } 340 341 void SpinButtonElement::stopRepeatingTimer() 342 { 343 m_repeatingTimer.stop(); 344 } 345 346 void SpinButtonElement::repeatingTimerFired(Timer<SpinButtonElement>*) 347 { 348 HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); 349 if (input->disabled() || input->isReadOnlyFormControl()) 350 return; 351 // On Mac OS, NSStepper updates the value for the button under the mouse 352 // cursor regardless of the button pressed at the beginning. So the 353 // following check is not needed for Mac OS. 354 #if !OS(MAC_OS_X) 355 if (m_upDownState != m_pressStartingState) 356 return; 357 #endif 358 input->stepUpFromRenderer(m_upDownState == Up ? 1 : -1); 328 359 } 329 360 -
trunk/WebCore/rendering/TextControlInnerElements.h
r65856 r66001 30 30 #include "HTMLDivElement.h" 31 31 #include "SpeechInputListener.h" 32 #include "Timer.h" 32 33 #include <wtf/Forward.h> 33 34 … … 108 109 virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isReadOnlyFormControl(); } 109 110 virtual void defaultEventHandler(Event*); 111 void startRepeatingTimer(); 112 void stopRepeatingTimer(); 113 void repeatingTimerFired(Timer<SpinButtonElement>*); 110 114 virtual void setHovered(bool = true); 111 115 112 116 bool m_capturing; 113 117 UpDownState m_upDownState; 118 UpDownState m_pressStartingState; 119 Timer<SpinButtonElement> m_repeatingTimer; 114 120 }; 115 121
Note: See TracChangeset
for help on using the changeset viewer.