diff options
Diffstat (limited to 'dom/html/nsTextEditorState.cpp')
-rw-r--r-- | dom/html/nsTextEditorState.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp index 25be6016c..b25b14ece 100644 --- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -2214,6 +2213,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() { |