https://bugs.webkit.org/show_bug.cgi?id=76984
Reviewed by Dimitri Glazkov.
No new tests. Just a refactoring.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::handleFocusEvent):
Move the code to PasswordInputType::handleFocusEvent().
(WebCore::HTMLInputElement::handleBlurEvent):
Move the code to TextFieldInputType::handleBlurEvent() and
PasswordInputType::handleBlurEvent().
* html/InputType.cpp:
(WebCore::InputType::handleFocusEvent):
* html/InputType.h:
(InputType): Add handleFocusEvent().
* html/PasswordInputType.cpp:
(WebCore::PasswordInputType::handleFocusEvent):
Move the code for type=password from HTMLInputElement::handleFocusEvent().
(WebCore::PasswordInputType::handleBlurEvent):
Move the code for tyep=password from HTMLInputElement::handleBlurEvent().
* html/PasswordInputType.h:
(PasswordInputType): Add handleFocusEvent() and handleBlurEvent().
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::handleBlurEvent):
Move the code for text field types from HTMLInputElement::handleBlurEvent().
* html/TextFieldInputType.h:
(TextFieldInputType): Add handleBlurEvent().
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105937
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-25 Kent Tamura <tkent@chromium.org>
+
+ Move focus/blur handling code of HTMLInputElement to InputType
+ https://bugs.webkit.org/show_bug.cgi?id=76984
+
+ Reviewed by Dimitri Glazkov.
+
+ No new tests. Just a refactoring.
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::handleFocusEvent):
+ Move the code to PasswordInputType::handleFocusEvent().
+ (WebCore::HTMLInputElement::handleBlurEvent):
+ Move the code to TextFieldInputType::handleBlurEvent() and
+ PasswordInputType::handleBlurEvent().
+ * html/InputType.cpp:
+ (WebCore::InputType::handleFocusEvent):
+ * html/InputType.h:
+ (InputType): Add handleFocusEvent().
+ * html/PasswordInputType.cpp:
+ (WebCore::PasswordInputType::handleFocusEvent):
+ Move the code for type=password from HTMLInputElement::handleFocusEvent().
+ (WebCore::PasswordInputType::handleBlurEvent):
+ Move the code for tyep=password from HTMLInputElement::handleBlurEvent().
+ * html/PasswordInputType.h:
+ (PasswordInputType): Add handleFocusEvent() and handleBlurEvent().
+ * html/TextFieldInputType.cpp:
+ (WebCore::TextFieldInputType::handleBlurEvent):
+ Move the code for text field types from HTMLInputElement::handleBlurEvent().
+ * html/TextFieldInputType.h:
+ (TextFieldInputType): Add handleBlurEvent().
+
2012-01-25 Adam Barth <abarth@webkit.org>
Node.cpp shouldn't duplicate QualifiedName parsing logic
void HTMLInputElement::handleFocusEvent()
{
- if (!isTextField())
- return;
- if (isPasswordField() && document()->frame())
- document()->setUseSecureKeyboardEntryWhenActive(true);
+ m_inputType->handleFocusEvent();
}
void HTMLInputElement::handleBlurEvent()
{
m_inputType->handleBlurEvent();
- if (!isTextField())
- return;
- Frame* frame = document()->frame();
- if (!frame)
- return;
- if (isPasswordField())
- document()->setUseSecureKeyboardEntryWhenActive(false);
- frame->editor()->textFieldDidEndEditing(this);
}
void HTMLInputElement::setType(const String& type)
return false;
}
+void InputType::handleFocusEvent()
+{
+}
+
void InputType::handleBlurEvent()
{
}
virtual PassRefPtr<HTMLFormElement> formForSubmission() const;
virtual bool isKeyboardFocusable() const;
virtual bool shouldUseInputMethod() const;
+ virtual void handleFocusEvent();
virtual void handleBlurEvent();
virtual void accessKeyAction(bool sendMouseEvents);
virtual bool canBeSuccessfulSubmitButton();
#include "config.h"
#include "PasswordInputType.h"
+#include "HTMLInputElement.h"
#include <wtf/Assertions.h>
#include <wtf/PassOwnPtr.h>
return true;
}
+void PasswordInputType::handleFocusEvent()
+{
+ BaseTextInputType::handleFocusEvent();
+ if (element()->document()->frame())
+ element()->document()->setUseSecureKeyboardEntryWhenActive(true);
+}
+
+void PasswordInputType::handleBlurEvent()
+{
+ if (element()->document()->frame())
+ element()->document()->setUseSecureKeyboardEntryWhenActive(false);
+ BaseTextInputType::handleBlurEvent();
+}
+
} // namespace WebCore
virtual bool shouldRespectListAttribute() OVERRIDE;
virtual bool shouldRespectSpeechAttribute() OVERRIDE;
virtual bool isPasswordField() const OVERRIDE;
+ virtual void handleFocusEvent() OVERRIDE;
+ virtual void handleBlurEvent() OVERRIDE;
};
} // namespace WebCore
}
}
+void TextFieldInputType::handleBlurEvent()
+{
+ InputType::handleBlurEvent();
+ if (Frame* frame = element()->document()->frame())
+ frame->editor()->textFieldDidEndEditing(element());
+}
+
bool TextFieldInputType::shouldSubmitImplicitly(Event* event)
{
return (event->type() == eventNames().textInputEvent && event->hasInterface(eventNames().interfaceForTextEvent) && static_cast<TextEvent*>(event)->data() == "\n") || InputType::shouldSubmitImplicitly(event);
virtual void destroyShadowSubtree() OVERRIDE;
virtual void disabledAttributeChanged() OVERRIDE;
virtual void readonlyAttributeChanged() OVERRIDE;
+ virtual void handleBlurEvent() OVERRIDE;
private:
virtual bool isTextField() const OVERRIDE;