Title: [105937] trunk/Source/WebCore
- Revision
- 105937
- Author
- [email protected]
- Date
- 2012-01-25 15:56:30 -0800 (Wed, 25 Jan 2012)
Log Message
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().
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (105936 => 105937)
--- trunk/Source/WebCore/ChangeLog 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/ChangeLog 2012-01-25 23:56:30 UTC (rev 105937)
@@ -1,3 +1,35 @@
+2012-01-25 Kent Tamura <[email protected]>
+
+ 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 <[email protected]>
Node.cpp shouldn't duplicate QualifiedName parsing logic
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (105936 => 105937)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-01-25 23:56:30 UTC (rev 105937)
@@ -472,23 +472,12 @@
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)
Modified: trunk/Source/WebCore/html/InputType.cpp (105936 => 105937)
--- trunk/Source/WebCore/html/InputType.cpp 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/html/InputType.cpp 2012-01-25 23:56:30 UTC (rev 105937)
@@ -436,6 +436,10 @@
return false;
}
+void InputType::handleFocusEvent()
+{
+}
+
void InputType::handleBlurEvent()
{
}
Modified: trunk/Source/WebCore/html/InputType.h (105936 => 105937)
--- trunk/Source/WebCore/html/InputType.h 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/html/InputType.h 2012-01-25 23:56:30 UTC (rev 105937)
@@ -183,6 +183,7 @@
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();
Modified: trunk/Source/WebCore/html/PasswordInputType.cpp (105936 => 105937)
--- trunk/Source/WebCore/html/PasswordInputType.cpp 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/html/PasswordInputType.cpp 2012-01-25 23:56:30 UTC (rev 105937)
@@ -32,6 +32,7 @@
#include "config.h"
#include "PasswordInputType.h"
+#include "HTMLInputElement.h"
#include <wtf/Assertions.h>
#include <wtf/PassOwnPtr.h>
@@ -86,4 +87,18 @@
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
Modified: trunk/Source/WebCore/html/PasswordInputType.h (105936 => 105937)
--- trunk/Source/WebCore/html/PasswordInputType.h 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/html/PasswordInputType.h 2012-01-25 23:56:30 UTC (rev 105937)
@@ -49,6 +49,8 @@
virtual bool shouldRespectListAttribute() OVERRIDE;
virtual bool shouldRespectSpeechAttribute() OVERRIDE;
virtual bool isPasswordField() const OVERRIDE;
+ virtual void handleFocusEvent() OVERRIDE;
+ virtual void handleBlurEvent() OVERRIDE;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (105936 => 105937)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2012-01-25 23:56:30 UTC (rev 105937)
@@ -161,6 +161,13 @@
}
}
+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);
Modified: trunk/Source/WebCore/html/TextFieldInputType.h (105936 => 105937)
--- trunk/Source/WebCore/html/TextFieldInputType.h 2012-01-25 23:52:52 UTC (rev 105936)
+++ trunk/Source/WebCore/html/TextFieldInputType.h 2012-01-25 23:56:30 UTC (rev 105937)
@@ -63,6 +63,7 @@
virtual void destroyShadowSubtree() OVERRIDE;
virtual void disabledAttributeChanged() OVERRIDE;
virtual void readonlyAttributeChanged() OVERRIDE;
+ virtual void handleBlurEvent() OVERRIDE;
private:
virtual bool isTextField() const OVERRIDE;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes