Title: [98222] trunk
- Revision
- 98222
- Author
- [email protected]
- Date
- 2011-10-24 01:14:02 -0700 (Mon, 24 Oct 2011)
Log Message
[Forms] Setting defaultValue should hide an input placeholder.
https://bugs.webkit.org/show_bug.cgi?id=70586
Patch by Yosifumi Inoue <[email protected]> on 2011-10-24
Reviewed by Kent Tamura.
Source/WebCore:
Tests: fast/forms/placeholder-and-default-value-expected.html
fast/forms/placeholder-and-default-value.html
When input element has default value, we should not display
placeholder. Changing default value should tell rendering engine about
changing display of input element.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseMappedAttribute): Calls updatePlaceholderVisibility for valueAttr if it doesn't have dirty value.
LayoutTests:
This test checks "value" attribute (default value) changing in two
ways, one is using setDefault method and another is setAttribute
method.
* fast/forms/placeholder-and-default-value-expected.html: Added. Render text input element with "Default" value.
* fast/forms/placeholder-and-default-value.html: Added. Render text input element with placeholder attribute and a script to change default value of input element to "Default" from empty.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (98221 => 98222)
--- trunk/LayoutTests/ChangeLog 2011-10-24 07:53:30 UTC (rev 98221)
+++ trunk/LayoutTests/ChangeLog 2011-10-24 08:14:02 UTC (rev 98222)
@@ -1,3 +1,17 @@
+2011-10-24 Yosifumi Inoue <[email protected]>
+
+ [Forms] Setting defaultValue should hide an input placeholder.
+ https://bugs.webkit.org/show_bug.cgi?id=70586
+
+ Reviewed by Kent Tamura.
+
+ This test checks "value" attribute (default value) changing in two
+ ways, one is using setDefault method and another is setAttribute
+ method.
+
+ * fast/forms/placeholder-and-default-value-expected.html: Added. Render text input element with "Default" value.
+ * fast/forms/placeholder-and-default-value.html: Added. Render text input element with placeholder attribute and a script to change default value of input element to "Default" from empty.
+
2011-10-23 Adam Barth <[email protected]>
<img crossorigin> should fail to load when CORS check fails
Added: trunk/LayoutTests/fast/forms/placeholder-and-default-value-expected.html (0 => 98222)
--- trunk/LayoutTests/fast/forms/placeholder-and-default-value-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/placeholder-and-default-value-expected.html 2011-10-24 08:14:02 UTC (rev 98222)
@@ -0,0 +1,9 @@
+<p>This is a test for <a href="" 70586</a>.</p>
+<ol>
+<li>Use defaultValue method to change "value" attribute.
+<input id="c1" value="Default" /><br />
+</li>
+<li>Use setAttribute method to change "value" attribute.
+<input id="c2" value="Default" /><br />
+</li>
+</ol>
Added: trunk/LayoutTests/fast/forms/placeholder-and-default-value.html (0 => 98222)
--- trunk/LayoutTests/fast/forms/placeholder-and-default-value.html (rev 0)
+++ trunk/LayoutTests/fast/forms/placeholder-and-default-value.html 2011-10-24 08:14:02 UTC (rev 98222)
@@ -0,0 +1,13 @@
+<p>This is a test for <a href="" 70586</a>.</p>
+<ol>
+<li>Use defaultValue method to change "value" attribute.
+<input id="c1" placeholder="Placeholder" /><br />
+</li>
+<li>Use setAttribute method to change "value" attribute.
+<input id="c2" placeholder="Placeholder" /><br />
+</li>
+</ol>
+<script>
+document.getElementById("c1").defaultValue = "Default";
+document.getElementById("c2").setAttribute("value", "Default");
+</script>
Modified: trunk/Source/WebCore/ChangeLog (98221 => 98222)
--- trunk/Source/WebCore/ChangeLog 2011-10-24 07:53:30 UTC (rev 98221)
+++ trunk/Source/WebCore/ChangeLog 2011-10-24 08:14:02 UTC (rev 98222)
@@ -1,3 +1,20 @@
+2011-10-24 Yosifumi Inoue <[email protected]>
+
+ [Forms] Setting defaultValue should hide an input placeholder.
+ https://bugs.webkit.org/show_bug.cgi?id=70586
+
+ Reviewed by Kent Tamura.
+
+ Tests: fast/forms/placeholder-and-default-value-expected.html
+ fast/forms/placeholder-and-default-value.html
+
+ When input element has default value, we should not display
+ placeholder. Changing default value should tell rendering engine about
+ changing display of input element.
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::parseMappedAttribute): Calls updatePlaceholderVisibility for valueAttr if it doesn't have dirty value.
+
2011-10-23 Darin Adler <[email protected]>
Eliminate OptionElement (second and final part)
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (98221 => 98222)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-10-24 07:53:30 UTC (rev 98221)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-10-24 08:14:02 UTC (rev 98222)
@@ -747,8 +747,10 @@
updateType();
} else if (attr->name() == valueAttr) {
// We only need to setChanged if the form is looking at the default value right now.
- if (!hasDirtyValue())
+ if (!hasDirtyValue()) {
+ updatePlaceholderVisibility(false);
setNeedsStyleRecalc();
+ }
setFormControlValueMatchesRenderer(false);
setNeedsValidityCheck();
} else if (attr->name() == checkedAttr) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes