Bug 1391044 - Preserve newlines in textarea placeholders. r=bz

MozReview-Commit-ID: 7h1dXSd4Ci7

--HG--
extra : rebase_source : 9fe03a61f12b04dae0778d1aa0b3c95ee3fb3d8f
This commit is contained in:
Ian Moody 2017-12-02 00:11:39 +00:00
parent c5dd8401e2
commit 1fe91d8a29

View File

@ -494,7 +494,11 @@ nsTextControlFrame::CreatePlaceholderIfNeeded()
// Do we need a placeholder node?
nsAutoString placeholderTxt;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholderTxt);
nsContentUtils::RemoveNewlines(placeholderTxt);
if (IsTextArea()) { // <textarea>s preserve newlines...
nsContentUtils::PlatformToDOMLineBreaks(placeholderTxt);
} else { // ...<input>s don't
nsContentUtils::RemoveNewlines(placeholderTxt);
}
if (placeholderTxt.IsEmpty()) {
return;