[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

tkent at chromium.org tkent at chromium.org
Fri Jan 21 14:37:31 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit d8814ccbf4d1376bb9c9e70e776bb7e9e9f1aaee
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 23 12:56:55 2010 +0000

    Refactor HTMLInputElement: Move a part of HTMLInputElement::defaultEventHandler()
    to InputTypes.
    https://bugs.webkit.org/show_bug.cgi?id=51093
    
    Reviewed by Dimitri Glazkov.
    
    Move BeforeTextInserted and Wheel event handling, event forwarding to
    renderers, and the isindex form submission quirk code to InputTypes.
    Also, change the return types of InputType event handlers from 'bool'
    to 'void'. We use Event::defaultHandled() to decide whether event
    handling should be stopped.
    
    No new tests because this is just a refactoring.
    
    * html/BaseButtonInputType.cpp: bool->void changes
    (WebCore::BaseButtonInputType::handleKeydownEvent):
    (WebCore::BaseButtonInputType::handleKeypressEvent):
    (WebCore::BaseButtonInputType::handleKeyupEvent):
    * html/BaseButtonInputType.h: ditto.
    * html/BaseCheckableInputType.cpp: ditto.
    (WebCore::BaseCheckableInputType::handleKeydownEvent):
    (WebCore::BaseCheckableInputType::handleKeypressEvent):
    * html/BaseCheckableInputType.h: ditto.
    * html/BaseDateAndTimeInputType.cpp:
    (WebCore::BaseDateAndTimeInputType::handleKeydownEvent): ditto.
    (WebCore::BaseDateAndTimeInputType::handleWheelEvent): Just calls handleWheelEventForSpinButton().
    * html/BaseDateAndTimeInputType.h: bool->void change and handleWhellEvent() addition.
    * html/CheckboxInputType.cpp: bool->void change
    (WebCore::CheckboxInputType::handleKeyupEvent):
    * html/CheckboxInputType.h: ditto.
    * html/FileInputType.cpp: ditto.
    (WebCore::FileInputType::handleDOMActivateEvent):
    * html/FileInputType.h: ditto.
    * html/HTMLInputElement.cpp:
    (WebCore::HTMLInputElement::defaultEventHandler):
     - Change return-value handling of InputType event handlers
     - Move out beforeTextInserted/wheel event handling and isindex form quirk.
    * html/HTMLInputElement.h:
    (WebCore::HTMLInputElement::handleBeforeTextInsertedEvent):
     Added so that InputType can call InputElement::handleBeforeTextInsertedEvent().
    * html/ImageInputType.cpp: bool->void change
    (WebCore::ImageInputType::handleDOMActivateEvent):
    * html/ImageInputType.h: ditto.
    * html/InputType.cpp: ditto.
    (WebCore::InputType::handleClickEvent):
    (WebCore::InputType::handleDOMActivateEvent):
    (WebCore::InputType::handleKeydownEvent):
    (WebCore::InputType::handleKeypressEvent):
    (WebCore::InputType::handleKeyupEvent):
    (WebCore::InputType::handleBeforeTextInsertedEvent):
    (WebCore::InputType::handleWheelEvent): Added default implementation.
    (WebCore::InputType::forwardEvent): ditto.
    (WebCore::InputType::formForSubmission): ditto.
    * html/InputType.h:
    * html/IsIndexInputType.cpp:
    (WebCore::IsIndexInputType::formForSubmission): Moved from HTMLInputElement.cpp.
    * html/IsIndexInputType.h:
    * html/NumberInputType.cpp:
    (WebCore::isNumberCharacter): Moved from HTMLInputElement.cpp.
    (WebCore::NumberInputType::handleKeydownEvent): bool->void change.
    (WebCore::NumberInputType::handleBeforeTextInsertedEvent): Moved from HTMInputElement.cpp.
    (WebCore::NumberInputType::handleWheelEvent): Added. Just calls handleWheelEventForSpinButton().
    * html/NumberInputType.h:
    * html/RadioInputType.cpp: bool->void changes.
    (WebCore::RadioInputType::handleClickEvent):
    (WebCore::RadioInputType::handleKeydownEvent):
    (WebCore::RadioInputType::handleKeyupEvent):
    * html/RadioInputType.h:
    * html/RangeInputType.cpp:
    (WebCore::RangeInputType::handleKeydownEvent): ditto.
    (WebCore::RangeInputType::forwardEvent): Moved from HTMLInputElement.cpp.
    * html/RangeInputType.h:
    * html/ResetInputType.cpp: bool->void change.
    (WebCore::ResetInputType::handleDOMActivateEvent):
    * html/ResetInputType.h: ditto.
    * html/SubmitInputType.cpp: ditto.
    (WebCore::SubmitInputType::handleDOMActivateEvent):
    * html/SubmitInputType.h: ditto.
    * html/TextFieldInputType.cpp:
    (WebCore::TextFieldInputType::handleKeydownEvent): bool->void change.
    (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): ditto.
    (WebCore::TextFieldInputType::handleWheelEventForSpinButton): Moved from HTMLInputElement.cpp.
    (WebCore::TextFieldInputType::forwardEvent): ditto.
    * html/TextFieldInputType.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74549 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3b5ce3b..f46b998 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,90 @@
+2010-12-23  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Refactor HTMLInputElement: Move a part of HTMLInputElement::defaultEventHandler()
+        to InputTypes.
+        https://bugs.webkit.org/show_bug.cgi?id=51093
+
+        Move BeforeTextInserted and Wheel event handling, event forwarding to
+        renderers, and the isindex form submission quirk code to InputTypes.
+        Also, change the return types of InputType event handlers from 'bool'
+        to 'void'. We use Event::defaultHandled() to decide whether event
+        handling should be stopped.
+
+        No new tests because this is just a refactoring.
+
+        * html/BaseButtonInputType.cpp: bool->void changes
+        (WebCore::BaseButtonInputType::handleKeydownEvent):
+        (WebCore::BaseButtonInputType::handleKeypressEvent):
+        (WebCore::BaseButtonInputType::handleKeyupEvent):
+        * html/BaseButtonInputType.h: ditto.
+        * html/BaseCheckableInputType.cpp: ditto.
+        (WebCore::BaseCheckableInputType::handleKeydownEvent):
+        (WebCore::BaseCheckableInputType::handleKeypressEvent):
+        * html/BaseCheckableInputType.h: ditto.
+        * html/BaseDateAndTimeInputType.cpp:
+        (WebCore::BaseDateAndTimeInputType::handleKeydownEvent): ditto.
+        (WebCore::BaseDateAndTimeInputType::handleWheelEvent): Just calls handleWheelEventForSpinButton().
+        * html/BaseDateAndTimeInputType.h: bool->void change and handleWhellEvent() addition.
+        * html/CheckboxInputType.cpp: bool->void change
+        (WebCore::CheckboxInputType::handleKeyupEvent):
+        * html/CheckboxInputType.h: ditto.
+        * html/FileInputType.cpp: ditto.
+        (WebCore::FileInputType::handleDOMActivateEvent):
+        * html/FileInputType.h: ditto.
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::defaultEventHandler):
+         - Change return-value handling of InputType event handlers
+         - Move out beforeTextInserted/wheel event handling and isindex form quirk.
+        * html/HTMLInputElement.h:
+        (WebCore::HTMLInputElement::handleBeforeTextInsertedEvent):
+         Added so that InputType can call InputElement::handleBeforeTextInsertedEvent().
+        * html/ImageInputType.cpp: bool->void change
+        (WebCore::ImageInputType::handleDOMActivateEvent):
+        * html/ImageInputType.h: ditto.
+        * html/InputType.cpp: ditto.
+        (WebCore::InputType::handleClickEvent):
+        (WebCore::InputType::handleDOMActivateEvent):
+        (WebCore::InputType::handleKeydownEvent):
+        (WebCore::InputType::handleKeypressEvent):
+        (WebCore::InputType::handleKeyupEvent):
+        (WebCore::InputType::handleBeforeTextInsertedEvent):
+        (WebCore::InputType::handleWheelEvent): Added default implementation.
+        (WebCore::InputType::forwardEvent): ditto.
+        (WebCore::InputType::formForSubmission): ditto.
+        * html/InputType.h:
+        * html/IsIndexInputType.cpp:
+        (WebCore::IsIndexInputType::formForSubmission): Moved from HTMLInputElement.cpp.
+        * html/IsIndexInputType.h:
+        * html/NumberInputType.cpp:
+        (WebCore::isNumberCharacter): Moved from HTMLInputElement.cpp.
+        (WebCore::NumberInputType::handleKeydownEvent): bool->void change.
+        (WebCore::NumberInputType::handleBeforeTextInsertedEvent): Moved from HTMInputElement.cpp.
+        (WebCore::NumberInputType::handleWheelEvent): Added. Just calls handleWheelEventForSpinButton().
+        * html/NumberInputType.h:
+        * html/RadioInputType.cpp: bool->void changes.
+        (WebCore::RadioInputType::handleClickEvent):
+        (WebCore::RadioInputType::handleKeydownEvent):
+        (WebCore::RadioInputType::handleKeyupEvent):
+        * html/RadioInputType.h:
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::handleKeydownEvent): ditto.
+        (WebCore::RangeInputType::forwardEvent): Moved from HTMLInputElement.cpp.
+        * html/RangeInputType.h:
+        * html/ResetInputType.cpp: bool->void change.
+        (WebCore::ResetInputType::handleDOMActivateEvent):
+        * html/ResetInputType.h: ditto.
+        * html/SubmitInputType.cpp: ditto.
+        (WebCore::SubmitInputType::handleDOMActivateEvent):
+        * html/SubmitInputType.h: ditto.
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::handleKeydownEvent): bool->void change.
+        (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): ditto.
+        (WebCore::TextFieldInputType::handleWheelEventForSpinButton): Moved from HTMLInputElement.cpp.
+        (WebCore::TextFieldInputType::forwardEvent): ditto.
+        * html/TextFieldInputType.h:
+
 2010-12-23  Alexander Pavlov  <apavlov at chromium.org>
 
         Reviewed by Joseph Pecoraro.
diff --git a/WebCore/html/BaseButtonInputType.cpp b/WebCore/html/BaseButtonInputType.cpp
index 0ba1d89..c8ffd37 100644
--- a/WebCore/html/BaseButtonInputType.cpp
+++ b/WebCore/html/BaseButtonInputType.cpp
@@ -43,7 +43,7 @@ bool BaseButtonInputType::appendFormData(FormDataList&, bool) const
     return false;
 }
 
-bool BaseButtonInputType::handleKeydownEvent(KeyboardEvent* event)
+void BaseButtonInputType::handleKeydownEvent(KeyboardEvent* event)
 {
     const String& key = event->keyIdentifier();
     if (key == "U+0020") {
@@ -51,33 +51,29 @@ bool BaseButtonInputType::handleKeydownEvent(KeyboardEvent* event)
         // No setDefaultHandled(), because IE dispatches a keypress in this case
         // and the caller will only dispatch a keypress if we don't call setDefaultHandled().
     }
-    return false;
 }
 
-bool BaseButtonInputType::handleKeypressEvent(KeyboardEvent* event)
+void BaseButtonInputType::handleKeypressEvent(KeyboardEvent* event)
 {
     int charCode = event->charCode();
     if (charCode == '\r') {
         element()->dispatchSimulatedClick(event);
         event->setDefaultHandled();
-        return true;
+        return;
     }
     if (charCode == ' ') {
         // Prevent scrolling down the page.
         event->setDefaultHandled();
-        return true;
     }
-    return false;
 }
 
-bool BaseButtonInputType::handleKeyupEvent(KeyboardEvent* event)
+void BaseButtonInputType::handleKeyupEvent(KeyboardEvent* event)
 {
     const String& key = event->keyIdentifier();
     if (key != "U+0020")
-        return false;
+        return;
     // Simulate mouse click for spacebar for button types.
     dispatchSimulatedClickIfActive(event);
-    return true;
 }
 
 RenderObject* BaseButtonInputType::createRenderer(RenderArena* arena, RenderStyle*) const
diff --git a/WebCore/html/BaseButtonInputType.h b/WebCore/html/BaseButtonInputType.h
index 59e28bf..9c3a564 100644
--- a/WebCore/html/BaseButtonInputType.h
+++ b/WebCore/html/BaseButtonInputType.h
@@ -42,9 +42,9 @@ protected:
 
 private:
     virtual bool appendFormData(FormDataList&, bool) const;
-    virtual bool handleKeydownEvent(KeyboardEvent*);
-    virtual bool handleKeypressEvent(KeyboardEvent*);
-    virtual bool handleKeyupEvent(KeyboardEvent*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
+    virtual void handleKeypressEvent(KeyboardEvent*);
+    virtual void handleKeyupEvent(KeyboardEvent*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const;
 };
 
diff --git a/WebCore/html/BaseCheckableInputType.cpp b/WebCore/html/BaseCheckableInputType.cpp
index 940acf4..e089945 100644
--- a/WebCore/html/BaseCheckableInputType.cpp
+++ b/WebCore/html/BaseCheckableInputType.cpp
@@ -58,7 +58,7 @@ bool BaseCheckableInputType::appendFormData(FormDataList& encoding, bool) const
     return true;
 }
 
-bool BaseCheckableInputType::handleKeydownEvent(KeyboardEvent* event)
+void BaseCheckableInputType::handleKeydownEvent(KeyboardEvent* event)
 {
     const String& key = event->keyIdentifier();
     if (key == "U+0020") {
@@ -66,17 +66,14 @@ bool BaseCheckableInputType::handleKeydownEvent(KeyboardEvent* event)
         // No setDefaultHandled(), because IE dispatches a keypress in this case
         // and the caller will only dispatch a keypress if we don't call setDefaultHandled().
     }
-    return false;
 }
 
-bool BaseCheckableInputType::handleKeypressEvent(KeyboardEvent* event)
+void BaseCheckableInputType::handleKeypressEvent(KeyboardEvent* event)
 {
     if (event->charCode() == ' ') {
         // Prevent scrolling down the page.
         event->setDefaultHandled();
-        return true;
     }
-    return false;
 }
 
 } // namespace WebCore
diff --git a/WebCore/html/BaseCheckableInputType.h b/WebCore/html/BaseCheckableInputType.h
index 8cb95cf..a9bbc76 100644
--- a/WebCore/html/BaseCheckableInputType.h
+++ b/WebCore/html/BaseCheckableInputType.h
@@ -39,13 +39,13 @@ namespace WebCore {
 class BaseCheckableInputType : public InputType {
 protected:
     BaseCheckableInputType(HTMLInputElement* element) : InputType(element) { }
-    virtual bool handleKeydownEvent(KeyboardEvent*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
 
 private:
     virtual bool saveFormControlState(String&) const;
     virtual void restoreFormControlState(const String&) const;
     virtual bool appendFormData(FormDataList&, bool) const;
-    virtual bool handleKeypressEvent(KeyboardEvent*);
+    virtual void handleKeypressEvent(KeyboardEvent*);
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/BaseDateAndTimeInputType.cpp b/WebCore/html/BaseDateAndTimeInputType.cpp
index 70243e5..6ae1afa 100644
--- a/WebCore/html/BaseDateAndTimeInputType.cpp
+++ b/WebCore/html/BaseDateAndTimeInputType.cpp
@@ -34,6 +34,7 @@
 #include "DateComponents.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
+#include "KeyboardEvent.h"
 #include <limits>
 #include <wtf/CurrentTime.h>
 #include <wtf/DateMath.h>
@@ -119,9 +120,16 @@ double BaseDateAndTimeInputType::stepBase() const
     return parseToDouble(element()->fastGetAttribute(minAttr), defaultStepBase());
 }
 
-bool BaseDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* event)
+void BaseDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* event)
 {
-    return handleKeydownEventForSpinButton(event) || TextFieldInputType::handleKeydownEvent(event);
+    handleKeydownEventForSpinButton(event);
+    if (!event->defaultHandled())
+        TextFieldInputType::handleKeydownEvent(event);
+}
+
+void BaseDateAndTimeInputType::handleWheelEvent(WheelEvent* event)
+{
+    handleWheelEventForSpinButton(event);
 }
 
 double BaseDateAndTimeInputType::parseToDouble(const String& src, double defaultValue) const
diff --git a/WebCore/html/BaseDateAndTimeInputType.h b/WebCore/html/BaseDateAndTimeInputType.h
index ad7302a..2daa77c 100644
--- a/WebCore/html/BaseDateAndTimeInputType.h
+++ b/WebCore/html/BaseDateAndTimeInputType.h
@@ -58,7 +58,8 @@ private:
     virtual double defaultValueForStepUp() const;
     virtual bool stepMismatch(const String&, double) const;
     virtual double stepBase() const;
-    virtual bool handleKeydownEvent(KeyboardEvent*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
+    virtual void handleWheelEvent(WheelEvent*);
     virtual String serialize(double) const;
 };
 
diff --git a/WebCore/html/CheckboxInputType.cpp b/WebCore/html/CheckboxInputType.cpp
index cd171c1..8f987c8 100644
--- a/WebCore/html/CheckboxInputType.cpp
+++ b/WebCore/html/CheckboxInputType.cpp
@@ -58,13 +58,12 @@ String CheckboxInputType::valueMissingText() const
     return validationMessageValueMissingForCheckboxText();
 }
 
-bool CheckboxInputType::handleKeyupEvent(KeyboardEvent* event)
+void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event)
 {
     const String& key = event->keyIdentifier();
     if (key != "U+0020")
-        return false;
+        return;
     dispatchSimulatedClickIfActive(event);
-    return true;
 }
 
 } // namespace WebCore
diff --git a/WebCore/html/CheckboxInputType.h b/WebCore/html/CheckboxInputType.h
index e66ab15..a58a0a3 100644
--- a/WebCore/html/CheckboxInputType.h
+++ b/WebCore/html/CheckboxInputType.h
@@ -44,7 +44,7 @@ private:
     virtual const AtomicString& formControlType() const;
     virtual bool valueMissing(const String&) const;
     virtual String valueMissingText() const;
-    virtual bool handleKeyupEvent(KeyboardEvent*);
+    virtual void handleKeyupEvent(KeyboardEvent*);
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/FileInputType.cpp b/WebCore/html/FileInputType.cpp
index b5fc2fb..0e0e357 100644
--- a/WebCore/html/FileInputType.cpp
+++ b/WebCore/html/FileInputType.cpp
@@ -83,13 +83,12 @@ String FileInputType::valueMissingText() const
     return element()->multiple() ? validationMessageValueMissingForMultipleFileText() : validationMessageValueMissingForFileText();
 }
 
-bool FileInputType::handleDOMActivateEvent(Event* event)
+void FileInputType::handleDOMActivateEvent(Event* event)
 {
     if (element()->disabled() || !element()->renderer())
-        return false;
+        return;
     toRenderFileUploadControl(element()->renderer())->click();
     event->setDefaultHandled();
-    return true;
 }
 
 RenderObject* FileInputType::createRenderer(RenderArena* arena, RenderStyle*) const
diff --git a/WebCore/html/FileInputType.h b/WebCore/html/FileInputType.h
index df95ffc..a8dad43 100644
--- a/WebCore/html/FileInputType.h
+++ b/WebCore/html/FileInputType.h
@@ -45,7 +45,7 @@ private:
     virtual bool appendFormData(FormDataList&, bool) const;
     virtual bool valueMissing(const String&) const;
     virtual String valueMissingText() const;
-    virtual bool handleDOMActivateEvent(Event*);
+    virtual void handleDOMActivateEvent(Event*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const;
 };
 
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index 76f8665..58c06a9 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -80,12 +80,6 @@ using namespace HTMLNames;
 
 const int maxSavedResults = 256;
 
-static bool isNumberCharacter(UChar ch)
-{
-    return ch == '+' || ch == '-' || ch == '.' || ch == 'e' || ch == 'E'
-        || (ch >= '0' && ch <= '9');
-}
-
 HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
     : HTMLTextFormControlElement(tagName, document, form)
     , m_maxResults(-1)
@@ -1294,14 +1288,17 @@ void HTMLInputElement::postDispatchEventHandler(Event *evt, void* data)
 
 void HTMLInputElement::defaultEventHandler(Event* evt)
 {
-    // FIXME: It would be better to refactor this for the different types of input element.
-    // Having them all in one giant function makes this hard to read, and almost all the handling is type-specific.
-
-    if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent && m_inputType->handleClickEvent(static_cast<MouseEvent*>(evt)))
-        return;
+    if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent) {
+        m_inputType->handleClickEvent(static_cast<MouseEvent*>(evt));
+        if (evt->defaultHandled())
+            return;
+    }
 
-    if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent && m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt)))
-        return;
+    if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) {
+        m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt));
+        if (evt->defaultHandled())
+            return;
+    }
 
     // Call the base event handler before any of our own event handling for almost all events in text fields.
     // Makes editing keyboard handling take precedence over the keydown and keypress handling in this function.
@@ -1316,16 +1313,25 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
     // actually submitting the form. For reset inputs, the form is reset. These events are sent when the user clicks
     // on the element, or presses enter while it is the active element. JavaScript code wishing to activate the element
     // must dispatch a DOMActivate event - a click event will not do the job.
-    if (evt->type() == eventNames().DOMActivateEvent && m_inputType->handleDOMActivateEvent(evt))
-        return;
+    if (evt->type() == eventNames().DOMActivateEvent) {
+        m_inputType->handleDOMActivateEvent(evt);
+        if (evt->defaultHandled())
+            return;
+    }
 
     // Use key press event here since sending simulated mouse events
     // on key down blocks the proper sending of the key press event.
-    if (evt->isKeyboardEvent() && evt->type() == eventNames().keypressEvent && m_inputType->handleKeypressEvent(static_cast<KeyboardEvent*>(evt)))
-        return;
+    if (evt->isKeyboardEvent() && evt->type() == eventNames().keypressEvent) {
+        m_inputType->handleKeypressEvent(static_cast<KeyboardEvent*>(evt));
+        if (evt->defaultHandled())
+            return;
+    }
 
-    if (evt->isKeyboardEvent() && evt->type() == eventNames().keyupEvent && m_inputType->handleKeyupEvent(static_cast<KeyboardEvent*>(evt)))
-        return;
+    if (evt->isKeyboardEvent() && evt->type() == eventNames().keyupEvent) {
+        m_inputType->handleKeyupEvent(static_cast<KeyboardEvent*>(evt));
+        if (evt->defaultHandled())
+            return;
+    }
 
     if (m_inputType->shouldSubmitImplicitly(evt)) {
         if (isSearchField()) {
@@ -1342,11 +1348,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
                 toRenderTextControl(r)->setChangedSinceLastChangeEvent(false);
         }
 
-        RefPtr<HTMLFormElement> formForSubmission = form();
-        // If there is no form and the element is an <isindex>, then create a temporary form just to be used for submission.
-        if (!formForSubmission && deprecatedInputType() == ISINDEX)
-            formForSubmission = createTemporaryFormForIsIndex();
-
+        RefPtr<HTMLFormElement> formForSubmission = m_inputType->formForSubmission();
         // Form may never have been present, or may have been destroyed by code responding to the change event.
         if (formForSubmission)
             formForSubmission->submitImplicitly(evt, canTriggerImplicitSubmission());
@@ -1356,72 +1358,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();
+        m_inputType->handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(evt));
+
+    if (evt->isWheelEvent()) {
+        m_inputType->handleWheelEvent(static_cast<WheelEvent*>(evt));
+        if (evt->defaultHandled())
             return;
-        }
     }
-    if (isTextField() && renderer() && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent() || evt->type() == eventNames().blurEvent || evt->type() == eventNames().focusEvent))
-        toRenderTextControlSingleLine(renderer())->forwardEvent(evt);
 
-    if (deprecatedInputType() == RANGE && renderer() && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent()))
-        toRenderSlider(renderer())->forwardEvent(evt);
+    m_inputType->forwardEvent(evt);
 
     if (!callBaseClassEarly && !evt->defaultHandled())
         HTMLFormControlElementWithState::defaultEventHandler(evt);
 }
 
-void HTMLInputElement::handleBeforeTextInsertedEvent(Event* event)
-{
-    if (deprecatedInputType() == NUMBER) {
-        BeforeTextInsertedEvent* textEvent = static_cast<BeforeTextInsertedEvent*>(event);
-        unsigned length = textEvent->text().length();
-        bool hasInvalidChar = false;
-        for (unsigned i = 0; i < length; ++i) {
-            if (!isNumberCharacter(textEvent->text()[i])) {
-                hasInvalidChar = true;
-                break;
-            }
-        }
-        if (hasInvalidChar) {
-            Vector<UChar> stripped;
-            stripped.reserveCapacity(length);
-            for (unsigned i = 0; i < length; ++i) {
-                UChar ch = textEvent->text()[i];
-                if (!isNumberCharacter(ch))
-                    continue;
-                stripped.append(ch);
-            }
-            textEvent->setText(String::adopt(stripped));
-        }
-    }
-    InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event);
-}
-
-PassRefPtr<HTMLFormElement> HTMLInputElement::createTemporaryFormForIsIndex()
-{
-    RefPtr<HTMLFormElement> form = HTMLFormElement::create(document());
-    form->registerFormElement(this);
-    form->setMethod("GET");
-    if (!document()->baseURL().isEmpty()) {
-        // We treat the href property of the <base> element as the form action, as per section 7.5 
-        // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>.
-        form->setAction(document()->baseURL().string());
-    }
-    return form.release();
-}
-
 bool HTMLInputElement::isURLAttribute(Attribute *attr) const
 {
     return (attr->name() == srcAttr || attr->name() == formactionAttr);
diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h
index 0f0e97e..b901edf 100644
--- a/WebCore/html/HTMLInputElement.h
+++ b/WebCore/html/HTMLInputElement.h
@@ -210,6 +210,8 @@ public:
         return document()->checkedRadioButtons();
     }
 
+    void handleBeforeTextInsertedEvent(Event* event);
+
 protected:
     HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
 
@@ -338,8 +340,6 @@ private:
 
     void updateCheckedRadioButtons();
     
-    void handleBeforeTextInsertedEvent(Event*);
-    PassRefPtr<HTMLFormElement> createTemporaryFormForIsIndex();
     // Helper for stepUp()/stepDown().  Adds step value * count to the current value.
     void applyStep(double count, ExceptionCode&);
 
@@ -371,6 +371,11 @@ private:
     OwnPtr<InputType> m_inputType;
 };
 
+inline void HTMLInputElement::handleBeforeTextInsertedEvent(Event* event)
+{
+    InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event);
+}
+
 } //namespace
 
 #endif
diff --git a/WebCore/html/ImageInputType.cpp b/WebCore/html/ImageInputType.cpp
index 7a76174..1ff3f49 100644
--- a/WebCore/html/ImageInputType.cpp
+++ b/WebCore/html/ImageInputType.cpp
@@ -62,11 +62,11 @@ bool ImageInputType::supportsValidation() const
     return false;
 }
 
-bool ImageInputType::handleDOMActivateEvent(Event* event)
+void ImageInputType::handleDOMActivateEvent(Event* event)
 {
     RefPtr<HTMLInputElement> element = this->element();
     if (element->disabled() || !element->form())
-        return false;
+        return;
     element->setActivatedSubmit(true);
     if (event->underlyingEvent() && event->underlyingEvent()->isMouseEvent()) {
         MouseEvent* mouseEvent = static_cast<MouseEvent*>(event->underlyingEvent());
@@ -76,7 +76,6 @@ bool ImageInputType::handleDOMActivateEvent(Event* event)
     element->form()->prepareSubmit(event); // Event handlers can run.
     element->setActivatedSubmit(false);
     event->setDefaultHandled();
-    return true;
 }
 
 RenderObject* ImageInputType::createRenderer(RenderArena* arena, RenderStyle*) const
diff --git a/WebCore/html/ImageInputType.h b/WebCore/html/ImageInputType.h
index 61abf9d..7e53622 100644
--- a/WebCore/html/ImageInputType.h
+++ b/WebCore/html/ImageInputType.h
@@ -47,7 +47,7 @@ private:
     virtual bool appendFormData(FormDataList&, bool) const;
     virtual bool supportsValidation() const;
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const;
-    virtual bool handleDOMActivateEvent(Event*);
+    virtual void handleDOMActivateEvent(Event*);
 
     // This is valid only during HTMLFormElement::prepareSubmit().
     IntPoint m_clickLocation;
diff --git a/WebCore/html/InputType.cpp b/WebCore/html/InputType.cpp
index 8a7a979..8bbc9b1 100644
--- a/WebCore/html/InputType.cpp
+++ b/WebCore/html/InputType.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "InputType.h"
 
+#include "BeforeTextInsertedEvent.h"
 #include "ButtonInputType.h"
 #include "CheckboxInputType.h"
 #include "ColorInputType.h"
@@ -291,29 +292,37 @@ String InputType::valueMissingText() const
     return validationMessageValueMissingText();
 }
 
-bool InputType::handleClickEvent(MouseEvent*)
+void InputType::handleClickEvent(MouseEvent*)
 {
-    return false;
 }
 
-bool InputType::handleDOMActivateEvent(Event*)
+void InputType::handleDOMActivateEvent(Event*)
 {
-    return false;
 }
 
-bool InputType::handleKeydownEvent(KeyboardEvent*)
+void InputType::handleKeydownEvent(KeyboardEvent*)
 {
-    return false;
 }
 
-bool InputType::handleKeypressEvent(KeyboardEvent*)
+void InputType::handleKeypressEvent(KeyboardEvent*)
 {
-    return false;
 }
 
-bool InputType::handleKeyupEvent(KeyboardEvent*)
+void InputType::handleKeyupEvent(KeyboardEvent*)
+{
+}
+
+void InputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event)
+{
+    element()->handleBeforeTextInsertedEvent(event);
+}
+
+void InputType::handleWheelEvent(WheelEvent*)
+{
+}
+
+void InputType::forwardEvent(Event*)
 {
-    return false;
 }
 
 bool InputType::shouldSubmitImplicitly(Event* event)
@@ -321,6 +330,11 @@ bool InputType::shouldSubmitImplicitly(Event* event)
     return event->isKeyboardEvent() && event->type() == eventNames().keypressEvent && static_cast<KeyboardEvent*>(event)->charCode() == '\r';
 }
 
+PassRefPtr<HTMLFormElement> InputType::formForSubmission() const
+{
+    return element()->form();
+}
+
 RenderObject* InputType::createRenderer(RenderArena*, RenderStyle* style) const
 {
     return RenderObject::createObject(element(), style);
diff --git a/WebCore/html/InputType.h b/WebCore/html/InputType.h
index f275ae8..767c675 100644
--- a/WebCore/html/InputType.h
+++ b/WebCore/html/InputType.h
@@ -37,15 +37,18 @@
 
 namespace WebCore {
 
+class BeforeTextInsertedEvent;
 class DateComponents;
 class Event;
 class FormDataList;
+class HTMLFormElement;
 class HTMLInputElement;
 class KeyboardEvent;
 class MouseEvent;
 class RenderArena;
 class RenderObject;
 class RenderStyle;
+class WheelEvent;
 
 // An InputType object represents the type-specific part of an HTMLInputElement.
 // Do not expose instances of InputType and classes derived from it to classes
@@ -105,17 +108,18 @@ public:
     virtual String valueMissingText() const;
 
     // Event handlers
-    // If the return value is true, do no further default event handling in the
-    // default event handler. If an event handler calls Event::setDefaultHandled(),
-    // its return value must be true.
-
-    virtual bool handleClickEvent(MouseEvent*);
-    virtual bool handleDOMActivateEvent(Event*);
-    virtual bool handleKeydownEvent(KeyboardEvent*);
-    virtual bool handleKeypressEvent(KeyboardEvent*);
-    virtual bool handleKeyupEvent(KeyboardEvent*);
-    // A helper for event handlers.
+
+    virtual void handleClickEvent(MouseEvent*);
+    virtual void handleDOMActivateEvent(Event*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
+    virtual void handleKeypressEvent(KeyboardEvent*);
+    virtual void handleKeyupEvent(KeyboardEvent*);
+    virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*);
+    virtual void handleWheelEvent(WheelEvent*);
+    virtual void forwardEvent(Event*);
+    // Helpers for event handlers.
     virtual bool shouldSubmitImplicitly(Event*);
+    virtual PassRefPtr<HTMLFormElement> formForSubmission() const;
 
     // Miscellaneous functions
 
diff --git a/WebCore/html/IsIndexInputType.cpp b/WebCore/html/IsIndexInputType.cpp
index c3cff41..31ee358 100644
--- a/WebCore/html/IsIndexInputType.cpp
+++ b/WebCore/html/IsIndexInputType.cpp
@@ -31,6 +31,8 @@
 #include "config.h"
 #include "IsIndexInputType.h"
 
+#include "Document.h"
+#include "HTMLInputElement.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -50,4 +52,22 @@ bool IsIndexInputType::supportsRequired() const
     return false;
 }
 
+PassRefPtr<HTMLFormElement> IsIndexInputType::formForSubmission() const
+{
+    RefPtr<HTMLFormElement> form = InputType::formForSubmission();
+    if (form)
+        return form.release();
+    // If there is no form, then create a temporary form just to be used for submission.
+    Document* document = element()->document();
+    form = HTMLFormElement::create(document);
+    form->registerFormElement(element());
+    form->setMethod("GET");
+    if (!document->baseURL().isEmpty()) {
+        // We treat the href property of the <base> element as the form action, as per section 7.5
+        // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>.
+        form->setAction(document->baseURL().string());
+    }
+    return form.release();
+}
+
 } // namespace WebCore
diff --git a/WebCore/html/IsIndexInputType.h b/WebCore/html/IsIndexInputType.h
index 2d4e193..f5e14af 100644
--- a/WebCore/html/IsIndexInputType.h
+++ b/WebCore/html/IsIndexInputType.h
@@ -44,6 +44,7 @@ private:
     IsIndexInputType(HTMLInputElement* element) : TextFieldInputType(element) { };
     virtual const AtomicString& formControlType() const;
     virtual bool supportsRequired() const;
+    virtual PassRefPtr<HTMLFormElement> formForSubmission() const;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/NumberInputType.cpp b/WebCore/html/NumberInputType.cpp
index e290e50..5e908ff 100644
--- a/WebCore/html/NumberInputType.cpp
+++ b/WebCore/html/NumberInputType.cpp
@@ -31,10 +31,13 @@
 #include "config.h"
 #include "NumberInputType.h"
 
+#include "BeforeTextInsertedEvent.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
+#include "KeyboardEvent.h"
 #include <limits>
+#include <wtf/ASCIICType.h>
 #include <wtf/MathExtras.h>
 #include <wtf/PassOwnPtr.h>
 
@@ -49,6 +52,11 @@ static const double numberDefaultMaximum = FLT_MAX;
 static const double numberDefaultStep = 1.0;
 static const double numberStepScaleFactor = 1.0;
 
+static bool isNumberCharacter(UChar ch)
+{
+    return ch == '+' || ch == '-' || ch == '.' || ch == 'e' || ch == 'E' || isASCIIDigit(ch);
+}
+
 PassOwnPtr<InputType> NumberInputType::create(HTMLInputElement* element)
 {
     return adoptPtr(new NumberInputType(element));
@@ -155,9 +163,40 @@ double NumberInputType::stepScaleFactor() const
     return numberStepScaleFactor;
 }
 
-bool NumberInputType::handleKeydownEvent(KeyboardEvent* event)
+void NumberInputType::handleKeydownEvent(KeyboardEvent* event)
+{
+    handleKeydownEventForSpinButton(event);
+    if (!event->defaultHandled())
+        TextFieldInputType::handleKeydownEvent(event);
+}
+
+void NumberInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event)
+{
+    unsigned length = event->text().length();
+    bool hasInvalidChar = false;
+    for (unsigned i = 0; i < length; ++i) {
+        if (!isNumberCharacter(event->text()[i])) {
+            hasInvalidChar = true;
+            break;
+        }
+    }
+    if (hasInvalidChar) {
+        Vector<UChar> stripped;
+        stripped.reserveCapacity(length);
+        for (unsigned i = 0; i < length; ++i) {
+            UChar ch = event->text()[i];
+            if (!isNumberCharacter(ch))
+                continue;
+            stripped.append(ch);
+        }
+        event->setText(String::adopt(stripped));
+    }
+    TextFieldInputType::handleBeforeTextInsertedEvent(event);
+}
+
+void NumberInputType::handleWheelEvent(WheelEvent* event)
 {
-    return handleKeydownEventForSpinButton(event) || TextFieldInputType::handleKeydownEventForSpinButton(event);
+    handleWheelEventForSpinButton(event);
 }
 
 double NumberInputType::parseToDouble(const String& src, double defaultValue) const
diff --git a/WebCore/html/NumberInputType.h b/WebCore/html/NumberInputType.h
index dc6e020..ee1a0e5 100644
--- a/WebCore/html/NumberInputType.h
+++ b/WebCore/html/NumberInputType.h
@@ -55,7 +55,9 @@ private:
     virtual double stepBaseWithDecimalPlaces(unsigned*) const;
     virtual double defaultStep() const;
     virtual double stepScaleFactor() const;
-    virtual bool handleKeydownEvent(KeyboardEvent*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
+    virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*);
+    virtual void handleWheelEvent(WheelEvent*);
     virtual double parseToDouble(const String&, double) const;
     virtual double parseToDoubleWithDecimalPlaces(const String&, double, unsigned*) const;
     virtual String serialize(double) const;
diff --git a/WebCore/html/RadioInputType.cpp b/WebCore/html/RadioInputType.cpp
index 4c459be..c5dfd78 100644
--- a/WebCore/html/RadioInputType.cpp
+++ b/WebCore/html/RadioInputType.cpp
@@ -56,19 +56,19 @@ String RadioInputType::valueMissingText() const
     return validationMessageValueMissingForRadioText();
 }
 
-bool RadioInputType::handleClickEvent(MouseEvent* event)
+void RadioInputType::handleClickEvent(MouseEvent* event)
 {
     event->setDefaultHandled();
-    return true;
 }
 
-bool RadioInputType::handleKeydownEvent(KeyboardEvent* event)
+void RadioInputType::handleKeydownEvent(KeyboardEvent* event)
 {
-    if (BaseCheckableInputType::handleKeydownEvent(event))
-        return true;
+    BaseCheckableInputType::handleKeydownEvent(event);
+    if (event->defaultHandled())
+        return;
     const String& key = event->keyIdentifier();
     if (key != "Up" && key != "Down" && key != "Left" && key != "Right")
-        return false;
+        return;
 
     // Left and up mean "previous radio button".
     // Right and down mean "next radio button".
@@ -77,7 +77,7 @@ bool RadioInputType::handleKeydownEvent(KeyboardEvent* event)
     // However, when using Spatial Navigation, we need to be able to navigate without changing the selection.
     Document* document = element()->document();
     if (isSpatialNavigationEnabled(document->frame()))
-        return false;
+        return;
     bool forward = (key == "Down" || key == "Right");
 
     // We can only stay within the form's children if the form hasn't been demoted to a leaf because
@@ -98,23 +98,21 @@ bool RadioInputType::handleKeydownEvent(KeyboardEvent* event)
             document->setFocusedNode(inputElement);
             inputElement->dispatchSimulatedClick(event, false, false);
             event->setDefaultHandled();
-            return true;
+            return;
         }
     }
-    return false;
 }
 
-bool RadioInputType::handleKeyupEvent(KeyboardEvent* event)
+void RadioInputType::handleKeyupEvent(KeyboardEvent* event)
 {
     const String& key = event->keyIdentifier();
     if (key != "U+0020")
-        return false;
+        return;
     // If an unselected radio is tabbed into (because the entire group has nothing
     // checked, or because of some explicit .focus() call), then allow space to check it.
     if (element()->checked())
-        return false;
+        return;
     dispatchSimulatedClickIfActive(event);
-    return true;
 }
 
 } // namespace WebCore
diff --git a/WebCore/html/RadioInputType.h b/WebCore/html/RadioInputType.h
index 62becf6..86dbc47 100644
--- a/WebCore/html/RadioInputType.h
+++ b/WebCore/html/RadioInputType.h
@@ -44,9 +44,9 @@ private:
     virtual const AtomicString& formControlType() const;
     virtual bool valueMissing(const String&) const;
     virtual String valueMissingText() const;
-    virtual bool handleClickEvent(MouseEvent*);
-    virtual bool handleKeydownEvent(KeyboardEvent*);
-    virtual bool handleKeyupEvent(KeyboardEvent*);
+    virtual void handleClickEvent(MouseEvent*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
+    virtual void handleKeyupEvent(KeyboardEvent*);
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/RangeInputType.cpp b/WebCore/html/RangeInputType.cpp
index 50520cd..6ded508 100644
--- a/WebCore/html/RangeInputType.cpp
+++ b/WebCore/html/RangeInputType.cpp
@@ -133,11 +133,11 @@ double RangeInputType::stepScaleFactor() const
     return rangeStepScaleFactor;
 }
 
-bool RangeInputType::handleKeydownEvent(KeyboardEvent* event)
+void RangeInputType::handleKeydownEvent(KeyboardEvent* event)
 {
     const String& key = event->keyIdentifier();
     if (key != "Up" && key != "Right" && key != "Down" && key != "Left")
-        return false;
+        return;
 
     ExceptionCode ec;
     if (equalIgnoringCase(element()->fastGetAttribute(stepAttr), "any")) {
@@ -171,7 +171,12 @@ bool RangeInputType::handleKeydownEvent(KeyboardEvent* event)
         element()->stepUpFromRenderer(stepMagnification);
     }
     event->setDefaultHandled();
-    return true;
+}
+
+void RangeInputType::forwardEvent(Event* event)
+{
+    if (element()->renderer() && (event->isMouseEvent() || event->isDragEvent() || event->isWheelEvent()))
+        toRenderSlider(element()->renderer())->forwardEvent(event);
 }
 
 RenderObject* RangeInputType::createRenderer(RenderArena* arena, RenderStyle*) const
diff --git a/WebCore/html/RangeInputType.h b/WebCore/html/RangeInputType.h
index 14280e8..440abb6 100644
--- a/WebCore/html/RangeInputType.h
+++ b/WebCore/html/RangeInputType.h
@@ -54,7 +54,8 @@ private:
     virtual double stepBase() const;
     virtual double defaultStep() const;
     virtual double stepScaleFactor() const;
-    virtual bool handleKeydownEvent(KeyboardEvent*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
+    virtual void forwardEvent(Event*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const;
     virtual double parseToDouble(const String&, double) const;
     virtual String serialize(double) const;
diff --git a/WebCore/html/ResetInputType.cpp b/WebCore/html/ResetInputType.cpp
index b911dee..27bf8ea 100644
--- a/WebCore/html/ResetInputType.cpp
+++ b/WebCore/html/ResetInputType.cpp
@@ -52,13 +52,12 @@ bool ResetInputType::supportsValidation() const
     return false;
 }
 
-bool ResetInputType::handleDOMActivateEvent(Event* event)
+void ResetInputType::handleDOMActivateEvent(Event* event)
 {
     if (element()->disabled() || !element()->form())
-        return false;
+        return;
     element()->form()->reset();
     event->setDefaultHandled();
-    return true;
 }
 
 } // namespace WebCore
diff --git a/WebCore/html/ResetInputType.h b/WebCore/html/ResetInputType.h
index 153afac..651ae50 100644
--- a/WebCore/html/ResetInputType.h
+++ b/WebCore/html/ResetInputType.h
@@ -43,7 +43,7 @@ private:
     ResetInputType(HTMLInputElement* element) : BaseButtonInputType(element) { }
     virtual const AtomicString& formControlType() const;
     virtual bool supportsValidation() const;
-    virtual bool handleDOMActivateEvent(Event*);
+    virtual void handleDOMActivateEvent(Event*);
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/SubmitInputType.cpp b/WebCore/html/SubmitInputType.cpp
index bad51cf..d7b8234 100644
--- a/WebCore/html/SubmitInputType.cpp
+++ b/WebCore/html/SubmitInputType.cpp
@@ -61,16 +61,15 @@ bool SubmitInputType::supportsRequired() const
     return false;
 }
 
-bool SubmitInputType::handleDOMActivateEvent(Event* event)
+void SubmitInputType::handleDOMActivateEvent(Event* event)
 {
     RefPtr<HTMLInputElement> element = this->element();
     if (element->disabled() || !element->form())
-        return false;
+        return;
     element->setActivatedSubmit(true);
     element->form()->prepareSubmit(event); // Event handlers can run.
     element->setActivatedSubmit(false);
     event->setDefaultHandled();
-    return true;
 }
 
 } // namespace WebCore
diff --git a/WebCore/html/SubmitInputType.h b/WebCore/html/SubmitInputType.h
index 48642dc..7ec1120 100644
--- a/WebCore/html/SubmitInputType.h
+++ b/WebCore/html/SubmitInputType.h
@@ -44,7 +44,7 @@ private:
     virtual const AtomicString& formControlType() const;
     virtual bool appendFormData(FormDataList&, bool) const;
     virtual bool supportsRequired() const;
-    virtual bool handleDOMActivateEvent(Event*);
+    virtual void handleDOMActivateEvent(Event*);
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/TextFieldInputType.cpp b/WebCore/html/TextFieldInputType.cpp
index 8b74359..a249420 100644
--- a/WebCore/html/TextFieldInputType.cpp
+++ b/WebCore/html/TextFieldInputType.cpp
@@ -36,6 +36,7 @@
 #include "KeyboardEvent.h"
 #include "RenderTextControlSingleLine.h"
 #include "TextEvent.h"
+#include "WheelEvent.h"
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -50,18 +51,17 @@ bool TextFieldInputType::valueMissing(const String& value) const
     return value.isEmpty();
 }
 
-bool TextFieldInputType::handleKeydownEvent(KeyboardEvent* event)
+void TextFieldInputType::handleKeydownEvent(KeyboardEvent* event)
 {
     if (!element()->focused())
-        return false;
+        return;
     Frame* frame = element()->document()->frame();
     if (!frame || !frame->editor()->doTextFieldCommandFromEvent(element(), event))
-        return false;
+        return;
     event->setDefaultHandled();
-    return true;
 }
 
-bool TextFieldInputType::handleKeydownEventForSpinButton(KeyboardEvent* event)
+void TextFieldInputType::handleKeydownEventForSpinButton(KeyboardEvent* event)
 {
     const String& key = event->keyIdentifier();
     int step = 0;
@@ -70,10 +70,28 @@ bool TextFieldInputType::handleKeydownEventForSpinButton(KeyboardEvent* event)
     else if (key == "Down")
         step = -1;
     else
-        return false;
+        return;
     element()->stepUpFromRenderer(step);
     event->setDefaultHandled();
-    return true;
+}
+
+void TextFieldInputType::handleWheelEventForSpinButton(WheelEvent* event)
+{
+    int step = 0;
+    if (event->wheelDeltaY() > 0)
+        step = 1;
+    else if (event->wheelDeltaY() < 0)
+        step = -1;
+    else
+        return;
+    element()->stepUpFromRenderer(step);
+    event->setDefaultHandled();
+}
+
+void TextFieldInputType::forwardEvent(Event* event)
+{
+    if (element()->renderer() && (event->isMouseEvent() || event->isDragEvent() || event->isWheelEvent() || event->type() == eventNames().blurEvent || event->type() == eventNames().focusEvent))
+        toRenderTextControlSingleLine(element()->renderer())->forwardEvent(event);
 }
 
 bool TextFieldInputType::shouldSubmitImplicitly(Event* event)
diff --git a/WebCore/html/TextFieldInputType.h b/WebCore/html/TextFieldInputType.h
index 07f06e9..8333b27 100644
--- a/WebCore/html/TextFieldInputType.h
+++ b/WebCore/html/TextFieldInputType.h
@@ -42,8 +42,10 @@ protected:
     TextFieldInputType(HTMLInputElement* element) : InputType(element) { }
     virtual bool isTextField() const;
     virtual bool valueMissing(const String&) const;
-    virtual bool handleKeydownEvent(KeyboardEvent*);
-    bool handleKeydownEventForSpinButton(KeyboardEvent*);
+    virtual void handleKeydownEvent(KeyboardEvent*);
+    void handleKeydownEventForSpinButton(KeyboardEvent*);
+    void handleWheelEventForSpinButton(WheelEvent*);
+    virtual void forwardEvent(Event*);
     virtual bool shouldSubmitImplicitly(Event*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const;
 };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list