- Revision
- 123687
- Author
- yo...@chromium.org
- Date
- 2012-07-25 18:01:08 -0700 (Wed, 25 Jul 2012)
Log Message
[Forms] Move HTMLInputElement::updateInnerTextValue to InputType class
https://bugs.webkit.org/show_bug.cgi?id=92230
Reviewed by Kent Tamura.
This patch moves implementaion of HTMLInputElement::updateInnerTextValue()
into input type classes, removes updateInnerTextValue() from HTMLInputElement,
and updates call site of updateInnerTextValue().
No new tests. This patch doesn't change behavior.
* html/DateInputType.cpp:
(WebCore::DateInputType::handleBlurEvent): Updated call site of updateInnerTextValue().
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateType): Updated call site of updateInnerTextValue().
(WebCore::HTMLInputElement::parseAttribute): Updated call site of updateInnerTextValue().
(WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement): Updated call site of updateInnerTextValue().
(WebCore::HTMLInputElement::setSuggestedValue): Updated call site of updateInnerTextValue().
* html/HTMLInputElement.h:
(HTMLInputElement): Removed updateInnerTextValue().
* html/InputType.cpp:
(WebCore::InputType::updateInnerTextValue): Added default implementaion.
* html/InputType.h:
(InputType): Added declaration of updateInnerTextValue().
* html/NumberInputType.cpp:
(WebCore::NumberInputType::handleBlurEvent): Updated call site of updateInnerTextValue().
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::setValue): Updated call site of updateInnerTextValue().
(WebCore::TextFieldInputType::updateInnerTextValue): Moved implementaion from HTMLInputElement.
* html/TextFieldInputType.h:
(TextFieldInputType): Added declaration of updateInnerTextValue().
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (123686 => 123687)
--- trunk/Source/WebCore/ChangeLog 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/ChangeLog 2012-07-26 01:01:08 UTC (rev 123687)
@@ -1,3 +1,37 @@
+2012-07-25 Yoshifumi Inoue <yo...@chromium.org>
+
+ [Forms] Move HTMLInputElement::updateInnerTextValue to InputType class
+ https://bugs.webkit.org/show_bug.cgi?id=92230
+
+ Reviewed by Kent Tamura.
+
+ This patch moves implementaion of HTMLInputElement::updateInnerTextValue()
+ into input type classes, removes updateInnerTextValue() from HTMLInputElement,
+ and updates call site of updateInnerTextValue().
+
+ No new tests. This patch doesn't change behavior.
+
+ * html/DateInputType.cpp:
+ (WebCore::DateInputType::handleBlurEvent): Updated call site of updateInnerTextValue().
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::updateType): Updated call site of updateInnerTextValue().
+ (WebCore::HTMLInputElement::parseAttribute): Updated call site of updateInnerTextValue().
+ (WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement): Updated call site of updateInnerTextValue().
+ (WebCore::HTMLInputElement::setSuggestedValue): Updated call site of updateInnerTextValue().
+ * html/HTMLInputElement.h:
+ (HTMLInputElement): Removed updateInnerTextValue().
+ * html/InputType.cpp:
+ (WebCore::InputType::updateInnerTextValue): Added default implementaion.
+ * html/InputType.h:
+ (InputType): Added declaration of updateInnerTextValue().
+ * html/NumberInputType.cpp:
+ (WebCore::NumberInputType::handleBlurEvent): Updated call site of updateInnerTextValue().
+ * html/TextFieldInputType.cpp:
+ (WebCore::TextFieldInputType::setValue): Updated call site of updateInnerTextValue().
+ (WebCore::TextFieldInputType::updateInnerTextValue): Moved implementaion from HTMLInputElement.
+ * html/TextFieldInputType.h:
+ (TextFieldInputType): Added declaration of updateInnerTextValue().
+
2012-07-25 Dana Jansens <dan...@chromium.org>
[chromium] Move ephemeral data for a single frame in LayerRendererChromium into a structure with a scoped lifetime equal to the frame
Modified: trunk/Source/WebCore/html/DateInputType.cpp (123686 => 123687)
--- trunk/Source/WebCore/html/DateInputType.cpp 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/DateInputType.cpp 2012-07-26 01:01:08 UTC (rev 123687)
@@ -144,7 +144,7 @@
element()->setFormControlValueMatchesRenderer(false);
// We need to reset the renderer value explicitly because an unacceptable
// renderer value should be purged before style calculation.
- element()->updateInnerTextValue();
+ updateInnerTextValue();
}
bool DateInputType::supportsPlaceholder() const
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (123686 => 123687)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-07-26 01:01:08 UTC (rev 123687)
@@ -456,7 +456,7 @@
updateValueIfNeeded();
setFormControlValueMatchesRenderer(false);
- updateInnerTextValue();
+ m_inputType->updateInnerTextValue();
m_wasModifiedByUser = false;
@@ -489,22 +489,6 @@
notifyFormStateChanged();
}
-void HTMLInputElement::updateInnerTextValue()
-{
- if (!isTextField())
- return;
-
- if (!suggestedValue().isNull()) {
- setInnerTextValue(suggestedValue());
- updatePlaceholderVisibility(false);
- } else if (!formControlValueMatchesRenderer()) {
- // Update the renderer value if the formControlValueMatchesRenderer() flag is false.
- // It protects an unacceptable renderer value from being overwritten with the DOM value.
- setInnerTextValue(visibleValue());
- updatePlaceholderVisibility(false);
- }
-}
-
void HTMLInputElement::subtreeHasChanged()
{
ASSERT(isTextField());
@@ -727,7 +711,7 @@
#endif
else
HTMLTextFormControlElement::parseAttribute(attribute);
- updateInnerTextValue();
+ m_inputType->updateInnerTextValue();
}
void HTMLInputElement::finishParsingChildren()
@@ -902,7 +886,7 @@
HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source);
setFormControlValueMatchesRenderer(false);
- updateInnerTextValue();
+ m_inputType->updateInnerTextValue();
}
String HTMLInputElement::value() const
@@ -950,7 +934,7 @@
setFormControlValueMatchesRenderer(false);
m_suggestedValue = sanitizeValue(value);
setNeedsStyleRecalc();
- updateInnerTextValue();
+ m_inputType->updateInnerTextValue();
}
void HTMLInputElement::setEditingValue(const String& value)
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (123686 => 123687)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2012-07-26 01:01:08 UTC (rev 123687)
@@ -153,8 +153,6 @@
String localizeValue(const String&) const;
- void updateInnerTextValue();
-
// The value which is drawn by a renderer.
String visibleValue() const;
String convertFromVisibleValue(const String&) const;
Modified: trunk/Source/WebCore/html/InputType.cpp (123686 => 123687)
--- trunk/Source/WebCore/html/InputType.cpp 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/InputType.cpp 2012-07-26 01:01:08 UTC (rev 123687)
@@ -863,6 +863,10 @@
return String();
}
+void InputType::updateInnerTextValue()
+{
+}
+
void InputType::updatePlaceholderText()
{
}
Modified: trunk/Source/WebCore/html/InputType.h (123686 => 123687)
--- trunk/Source/WebCore/html/InputType.h 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/InputType.h 2012-07-26 01:01:08 UTC (rev 123687)
@@ -271,6 +271,7 @@
virtual bool supportsPlaceholder() const;
virtual bool usesFixedPlaceholder() const;
virtual String fixedPlaceholder();
+ virtual void updateInnerTextValue();
virtual void updatePlaceholderText();
virtual void multipleAttributeChanged();
virtual void disabledAttributeChanged();
Modified: trunk/Source/WebCore/html/NumberInputType.cpp (123686 => 123687)
--- trunk/Source/WebCore/html/NumberInputType.cpp 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/NumberInputType.cpp 2012-07-26 01:01:08 UTC (rev 123687)
@@ -224,7 +224,7 @@
// We need to reset the renderer value explicitly because an unacceptable
// renderer value should be purged before style calculation.
- element()->updateInnerTextValue();
+ updateInnerTextValue();
}
static bool isE(UChar ch)
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (123686 => 123687)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2012-07-26 01:01:08 UTC (rev 123687)
@@ -103,7 +103,7 @@
InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent);
if (valueChanged)
- input->updateInnerTextValue();
+ updateInnerTextValue();
unsigned max = visibleValue().length();
if (input->focused())
@@ -450,5 +450,17 @@
stepUpFromRenderer(1);
}
+void TextFieldInputType::updateInnerTextValue()
+{
+ if (!element()->suggestedValue().isNull()) {
+ element()->setInnerTextValue(element()->suggestedValue());
+ element()->updatePlaceholderVisibility(false);
+ } else if (!element()->formControlValueMatchesRenderer()) {
+ // Update the renderer value if the formControlValueMatchesRenderer() flag is false.
+ // It protects an unacceptable renderer value from being overwritten with the DOM value.
+ element()->setInnerTextValue(visibleValue());
+ element()->updatePlaceholderVisibility(false);
+ }
+}
} // namespace WebCore
Modified: trunk/Source/WebCore/html/TextFieldInputType.h (123686 => 123687)
--- trunk/Source/WebCore/html/TextFieldInputType.h 2012-07-26 00:57:51 UTC (rev 123686)
+++ trunk/Source/WebCore/html/TextFieldInputType.h 2012-07-26 01:01:08 UTC (rev 123687)
@@ -66,6 +66,7 @@
virtual void disabledAttributeChanged() OVERRIDE;
virtual void readonlyAttributeChanged() OVERRIDE;
virtual void handleBlurEvent() OVERRIDE;
+ virtual void updateInnerTextValue() OVERRIDE;
private:
virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE;