Bug 1088158 - Update the visibility state of placeholders for textareas correctly when they get their anonymous content; r=roc

This commit is contained in:
Ehsan Akhgari 2014-10-28 09:44:26 -04:00
parent 86b9567292
commit a7f04dfe6e
4 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,2 @@
<!DOCTYPE html>
<textarea placeholder="placeholder"></textarea>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<script>
onload = function() {
var t = document.createElement('textarea');
t.placeholder = "placeholder";
document.body.appendChild(t.cloneNode(true));
}
</script>

View File

@ -127,3 +127,4 @@ needs-focus == spellcheck-contenteditable-focused-reframe.html spellcheck-conten
== spellcheck-contenteditable-property-dynamic-override-inherit.html spellcheck-contenteditable-disabled-ref.html
needs-focus == 969773.html 969773-ref.html
== 997805.html 997805-ref.html
== 1088158.html 1088158-ref.html

View File

@ -351,6 +351,13 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
placeholderStyleContext))) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (!IsSingleLineTextControl()) {
// For textareas, UpdateValueDisplay doesn't initialize the visibility
// status of the placeholder because it returns early, so we have to
// do that manually here.
txtCtrl->UpdatePlaceholderVisibility(true);
}
}
rv = UpdateValueDisplay(false);