diff options
author | Ben Murdoch <benm@google.com> | 2010-08-13 05:20:16 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-13 05:20:16 -0700 |
commit | f4958a7d95cd5fbc1c74905e229b02c95cd5ee78 (patch) | |
tree | 14a0f1b07a19948c2ed93d0d8547caa7fe10aa0e /WebCore/html/HTMLInputElement.cpp | |
parent | d074a7997da8ce379434eb6e208b97cde8a0841c (diff) | |
parent | f964bc1fd59a545a80a0cc2529ad8830be514871 (diff) | |
download | external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.zip external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.gz external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.bz2 |
Merge changes I60a96064,I6929172f,Idefd9bec,I8cf448f2,I8791737a,I992c56b0,Ibb4b089d,I779a8ec0,Ife412e30,I2da1ae98,Ibcf41849
* changes:
Merge WebKit at r65072 : Update WebKit revision number.
Merge WebKit at r65072 : Update test_expectations.
Merge WebKit at r65072 : Complete cherry-pick of WebKit change 43848 to add EmptyDeviceMotionClient
Merge WebKit at r65072 : Implement DeviceMotionClientAndroid
Merge WebKit at r65072: JSC build fix in InspectorController.h
Merge WebKit at r65072: Fix V8 code generator.
Merge WebKit at r65072 : Build fix for JSC, update ambiguous usage of JSLock.
Merge WebKit at r65072: String class has moved to the WTF namespace.
Merge Webkit at r65072 : Fix conflicts.
Merge Webkit at r65072 : Fix Makefiles.
Merge WebKit at r65072 : Initial merge by git.
Diffstat (limited to 'WebCore/html/HTMLInputElement.cpp')
-rw-r--r-- | WebCore/html/HTMLInputElement.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index f4528c2..8c759cb 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -70,6 +70,7 @@ #ifdef ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS #include "WebViewCore.h" #endif +#include "WheelEvent.h" #include <wtf/HashMap.h> #include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> @@ -2040,7 +2041,7 @@ bool HTMLInputElement::storesValueSeparateFromAttribute() const return false; } -struct EventHandlingState { +struct EventHandlingState : FastAllocBase { RefPtr<HTMLInputElement> m_currRadio; bool m_indeterminate; bool m_checked; @@ -2419,6 +2420,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 +2829,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 +2850,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; |