Bug 1340483 - Part 2. Expose chrome-only previewValue attribute. r=baku,heycam
MozReview-Commit-ID: BCu0vXVm6wj
This commit is contained in:
@@ -2722,6 +2722,37 @@ nsTextEditorState::UpdatePlaceholderText(bool aNotify)
|
||||
mPlaceholderDiv->GetFirstChild()->SetText(placeholderValue, aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
nsTextEditorState::SetPreviewText(const nsAString& aValue, bool aNotify)
|
||||
{
|
||||
MOZ_ASSERT(mPreviewDiv, "This function should not be called if "
|
||||
"mPreviewDiv isn't set");
|
||||
|
||||
// If we don't have a preview div, there's nothing to do.
|
||||
if (!mPreviewDiv)
|
||||
return;
|
||||
|
||||
nsAutoString previewValue(aValue);
|
||||
|
||||
nsContentUtils::RemoveNewlines(previewValue);
|
||||
MOZ_ASSERT(mPreviewDiv->GetFirstChild(), "preview div has no child");
|
||||
mPreviewDiv->GetFirstChild()->SetText(previewValue, aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
nsTextEditorState::GetPreviewText(nsAString& aValue)
|
||||
{
|
||||
// If we don't have a preview div, there's nothing to do.
|
||||
if (!mPreviewDiv)
|
||||
return;
|
||||
|
||||
MOZ_ASSERT(mPreviewDiv->GetFirstChild(), "preview div has no child");
|
||||
const nsTextFragment *text = mPreviewDiv->GetFirstChild()->GetText();
|
||||
|
||||
aValue.Truncate();
|
||||
text->AppendTo(aValue);
|
||||
}
|
||||
|
||||
void
|
||||
nsTextEditorState::UpdatePlaceholderVisibility(bool aNotify)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user