Bug 1360154 - nsIPlaintextEditor might have to have hasText property for UpdateOverlayTextVisibility

* DocumentIsBody should return bool, not nsresult
* Add fast path to check whether valus is emtpy

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-04-17 07:43:03 -04:00 committed by Roy Tam
commit a6f048fc42
7 changed files with 33 additions and 18 deletions

View file

@ -2214,6 +2214,23 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
return true;
}
bool
nsTextEditorState::HasNonEmptyValue()
{
if (mEditor && mBoundFrame && mEditorInitialized &&
!mIsCommittingComposition) {
bool empty;
nsresult rv = mEditor->GetDocumentIsEmpty(&empty);
if (NS_SUCCEEDED(rv)) {
return !empty;
}
}
nsAutoString value;
GetValue(value, true);
return !value.IsEmpty();
}
void
nsTextEditorState::InitializeKeyboardEventListeners()
{