Following HTML should not should placeholder in text field: <input type="text" placeholder="placeholder" id="t"> <script> document.getElementById("t").defaultValue="default"; </script> Expect: Text input field displays "default". Result: Text input field displays both "default" and "placeholder"
This bug comes from Chromium bug http://crbug.com/93585
Created attachment 112149 [details] Patch 1
Created attachment 112150 [details] Patch
Add tkent@ to CC
Comment on attachment 112150 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=112150&action=review Thanks for tackling this. > Source/WebCore/html/HTMLInputElement.cpp:1303 > + updatePlaceholderVisibility(false); This is the wrong way to do it. You also want the placeholder to go away if the value attribute is set directly. For example, if your test said this: document.getElementById("c1").setAttribute("value", "Default"); We need to test both cases, and we need code that works in both cases. The way to do that is to put the code into parseMappedAttribute, in the case for valueAttr. In fact, it should go inside the !hasDirtyValue if statement, since it only needs to run if the default value hasn’t been overwritten.
Comment on attachment 112150 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=112150&action=review > Source/WebCore/ChangeLog:9 > + Tests: fast/forms/70586-expected.html > + fast/forms/70586.html 70586.html is meaningless. Please name it something representing a test case.
Created attachment 112154 [details] Patch
Comment on attachment 112154 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=112154&action=review > LayoutTests/ChangeLog:13 > + * fast/forms/70586-expected.html: Added. Render text input element with "Default" value. > + * fast/forms/70586.html: Added. Render text input element with placeholder attribute and a script to change default value of input element to "Default" from empty. Please rename the test. Number-only name is hard to imagine the content.
Created attachment 112156 [details] Patch
Comment on attachment 112156 [details] Patch Looks good. Thank you for fixing this.
Comment on attachment 112156 [details] Patch Clearing flags on attachment: 112156 Committed r98222: <http://trac.webkit.org/changeset/98222>
All reviewed patches have been landed. Closing bug.