diff options
author | Ben Murdoch <benm@google.com> | 2010-08-11 14:44:44 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-08-12 19:15:41 +0100 |
commit | dd8bb3de4f353a81954234999f1fea748aee2ea9 (patch) | |
tree | 729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /WebCore/html/HTMLInputElement.cpp | |
parent | f3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff) | |
download | external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2 |
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'WebCore/html/HTMLInputElement.cpp')
-rw-r--r-- | WebCore/html/HTMLInputElement.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index f4528c2..f0245ec 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -67,9 +67,13 @@ #include "StepRange.h" #include "StringHash.h" #include "TextEvent.h" +<<<<<<< HEAD #ifdef ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS #include "WebViewCore.h" #endif +======= +#include "WheelEvent.h" +>>>>>>> webkit.org at r65072 #include <wtf/HashMap.h> #include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> @@ -2040,7 +2044,7 @@ bool HTMLInputElement::storesValueSeparateFromAttribute() const return false; } -struct EventHandlingState { +struct EventHandlingState : FastAllocBase { RefPtr<HTMLInputElement> m_currRadio; bool m_indeterminate; bool m_checked; @@ -2419,6 +2423,20 @@ void HTMLInputElement::defaultEventHandler(Event* evt) if (evt->isBeforeTextInsertedEvent()) handleBeforeTextInsertedEvent(evt); + if (hasSpinButton() && evt->isWheelEvent()) { + WheelEvent* wheel = static_cast<WheelEvent*>(evt); + int step = 0; + if (wheel->wheelDeltaY() > 0) { + step = 1; + } else if (wheel->wheelDeltaY() < 0) { + step = -1; + } + if (step) { + stepUpFromRenderer(step); + evt->setDefaultHandled(); + return; + } + } if (isTextField() && renderer() && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent() || evt->type() == eventNames().blurEvent || evt->type() == eventNames().focusEvent)) toRenderTextControlSingleLine(renderer())->forwardEvent(evt); @@ -2814,10 +2832,16 @@ HTMLOptionElement* HTMLInputElement::selectedOption() const void HTMLInputElement::stepUpFromRenderer(int n) { - // The difference from stepUp()/stepDown() is: - // If the current value is invalid, the value will be - // - the minimum value if n > 0 - // - the maximum value if n < 0 + // The differences from stepUp()/stepDown(): + // If the current value is not a number, the value will be + // - The value should be the minimum value if n > 0 + // - The value should be the maximum value if n < 0 + // If the current value is smaller than the minimum value: + // - The value should be the minimum value if n > 0 + // - Nothing should happen if n < 0 + // If the current value is larger than the maximum value: + // - The value should be the maximum value if n < 0 + // - Nothing should happen if n > 0 ASSERT(hasSpinButton()); if (!hasSpinButton()) @@ -2829,7 +2853,7 @@ void HTMLInputElement::stepUpFromRenderer(int n) const double nan = numeric_limits<double>::quiet_NaN(); String currentStringValue = value(); double current = parseToDouble(currentStringValue, nan); - if (!isfinite(current)) + if (!isfinite(current) || (n > 0 && current < minimum()) || (n < 0 && current > maximum())) setValue(serialize(n > 0 ? minimum() : maximum())); else { ExceptionCode ec; |