- Revision
- 101847
- Author
- [email protected]
- Date
- 2011-12-02 13:49:30 -0800 (Fri, 02 Dec 2011)
Log Message
[Lion][Windows] Both of placeholder and input text are shown in <input type=number>
https://bugs.webkit.org/show_bug.cgi?id=73615
Reviewed by Joseph Pecoraro.
Source/WebCore:
Placeholder visibility was checked by HTMLInputElement::value
emptiness. It should be innerTextValue emptiness because it is
possible that a number field has empty HTMLInputElement::value and
non-empty innerTextValue.
Tests: fast/forms/number/number-placeholder-with-unacceptable-value.html
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateInnerTextValue):
We should update placeholder visiblity when the innerTextValue is updated.
(WebCore::HTMLInputElement::subtreeHasChanged): ditto.
(WebCore::HTMLInputElement::setSuggestedValue):
We don't need to call updatePlaceholderVisibility() because updateInnerTextValue() calls it.
(WebCore::HTMLInputElement::setValueFromRenderer):
We don't need to call updatePlaceholderVisibility() because subtreeHasChanged() calls it.
* html/HTMLInputElement.h: Checks innerTextValue emptiness.
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::setValue):
We don't need to call updatePlaceholderVisibility() because updateInnerTextValue() calls it.
LayoutTests:
* fast/forms/number/number-placeholder-with-unacceptable-value-expected.html: Added.
* fast/forms/number/number-placeholder-with-unacceptable-value.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (101846 => 101847)
--- trunk/LayoutTests/ChangeLog 2011-12-02 21:49:17 UTC (rev 101846)
+++ trunk/LayoutTests/ChangeLog 2011-12-02 21:49:30 UTC (rev 101847)
@@ -1,3 +1,13 @@
+2011-12-02 Kent Tamura <[email protected]>
+
+ [Lion][Windows] Both of placeholder and input text are shown in <input type=number>
+ https://bugs.webkit.org/show_bug.cgi?id=73615
+
+ Reviewed by Joseph Pecoraro.
+
+ * fast/forms/number/number-placeholder-with-unacceptable-value-expected.html: Added.
+ * fast/forms/number/number-placeholder-with-unacceptable-value.html: Added.
+
2011-12-01 Alok Priyadarshi <[email protected]>
[chromium] CCLayerQuad does not return FloatQuad in correct order
Added: trunk/LayoutTests/fast/forms/number/number-placeholder-with-unacceptable-value-expected.html (0 => 101847)
--- trunk/LayoutTests/fast/forms/number/number-placeholder-with-unacceptable-value-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/number/number-placeholder-with-unacceptable-value-expected.html 2011-12-02 21:49:30 UTC (rev 101847)
@@ -0,0 +1,4 @@
+<input type="number" autofocus>
+<script>
+document.execCommand('inserttext', false, 'aaa');
+</script>
Added: trunk/LayoutTests/fast/forms/number/number-placeholder-with-unacceptable-value.html (0 => 101847)
--- trunk/LayoutTests/fast/forms/number/number-placeholder-with-unacceptable-value.html (rev 0)
+++ trunk/LayoutTests/fast/forms/number/number-placeholder-with-unacceptable-value.html 2011-12-02 21:49:30 UTC (rev 101847)
@@ -0,0 +1,4 @@
+<input type="number" placeholder="placeholder" autofocus>
+<script>
+document.execCommand('inserttext', false, 'aaa');
+</script>
Modified: trunk/Source/WebCore/ChangeLog (101846 => 101847)
--- trunk/Source/WebCore/ChangeLog 2011-12-02 21:49:17 UTC (rev 101846)
+++ trunk/Source/WebCore/ChangeLog 2011-12-02 21:49:30 UTC (rev 101847)
@@ -1,3 +1,30 @@
+2011-12-02 Kent Tamura <[email protected]>
+
+ [Lion][Windows] Both of placeholder and input text are shown in <input type=number>
+ https://bugs.webkit.org/show_bug.cgi?id=73615
+
+ Reviewed by Joseph Pecoraro.
+
+ Placeholder visibility was checked by HTMLInputElement::value
+ emptiness. It should be innerTextValue emptiness because it is
+ possible that a number field has empty HTMLInputElement::value and
+ non-empty innerTextValue.
+
+ Tests: fast/forms/number/number-placeholder-with-unacceptable-value.html
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::updateInnerTextValue):
+ We should update placeholder visiblity when the innerTextValue is updated.
+ (WebCore::HTMLInputElement::subtreeHasChanged): ditto.
+ (WebCore::HTMLInputElement::setSuggestedValue):
+ We don't need to call updatePlaceholderVisibility() because updateInnerTextValue() calls it.
+ (WebCore::HTMLInputElement::setValueFromRenderer):
+ We don't need to call updatePlaceholderVisibility() because subtreeHasChanged() calls it.
+ * html/HTMLInputElement.h: Checks innerTextValue emptiness.
+ * html/TextFieldInputType.cpp:
+ (WebCore::TextFieldInputType::setValue):
+ We don't need to call updatePlaceholderVisibility() because updateInnerTextValue() calls it.
+
2011-12-01 Alok Priyadarshi <[email protected]>
[chromium] CCLayerQuad does not return FloatQuad in correct order
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (101846 => 101847)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-12-02 21:49:17 UTC (rev 101846)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-12-02 21:49:30 UTC (rev 101847)
@@ -622,12 +622,14 @@
if (!isTextField())
return;
- if (!suggestedValue().isNull())
+ if (!suggestedValue().isNull()) {
setInnerTextValue(suggestedValue());
- else if (!formControlValueMatchesRenderer()) {
+ 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);
}
}
@@ -647,6 +649,7 @@
String value = innerTextValue();
if (isAcceptableValue(value))
setValueFromRenderer(sanitizeValue(convertFromVisibleValue(value)));
+ updatePlaceholderVisibility(false);
// Recalc for :invalid and hasUnacceptableValue() change.
setNeedsStyleRecalc();
@@ -1073,7 +1076,6 @@
return;
setFormControlValueMatchesRenderer(false);
m_suggestedValue = sanitizeValue(value);
- updatePlaceholderVisibility(false);
setNeedsStyleRecalc();
updateInnerTextValue();
}
@@ -1174,7 +1176,6 @@
dispatchInputEvent();
notifyFormStateChanged();
- updatePlaceholderVisibility(false);
setNeedsValidityCheck();
// Clear autofill flag (and yellow background) on user edit.
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (101846 => 101847)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2011-12-02 21:49:17 UTC (rev 101846)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2011-12-02 21:49:30 UTC (rev 101847)
@@ -311,7 +311,7 @@
virtual bool supportsPlaceholder() const;
virtual void updatePlaceholderText();
- virtual bool isEmptyValue() const { return value().isEmpty(); }
+ virtual bool isEmptyValue() const OVERRIDE { return innerTextValue().isEmpty(); }
virtual bool isEmptySuggestedValue() const { return suggestedValue().isEmpty(); }
virtual void handleFocusEvent();
virtual void handleBlurEvent();
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (101846 => 101847)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2011-12-02 21:49:17 UTC (rev 101846)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2011-12-02 21:49:30 UTC (rev 101847)
@@ -80,7 +80,6 @@
void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChanged, bool sendChangeEvent)
{
InputType::setValue(sanitizedValue, valueChanged, sendChangeEvent);
- element()->updatePlaceholderVisibility(false);
if (valueChanged)
element()->updateInnerTextValue();