diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:43:03 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:43:03 -0400 |
commit | eb1e5950cdbb235b117a3b1e21596072a86d579d (patch) | |
tree | f664dfac761bd71fdccf73d4d3d76abb87b2adef /editor/libeditor/HTMLEditor.cpp | |
parent | bea6ef77ad25e5fd1b2f30210f22ecdb1ebd2e0d (diff) | |
download | aura-central-eb1e5950cdbb235b117a3b1e21596072a86d579d.tar.gz |
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 mcp-graveyard/UXP%1375
Diffstat (limited to 'editor/libeditor/HTMLEditor.cpp')
-rw-r--r-- | editor/libeditor/HTMLEditor.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index 04a710cde..c2f0bdc6d 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -3530,15 +3530,11 @@ HTMLEditor::SelectEntireDocument(Selection* aSelection) // Protect the edit rules object from dying nsCOMPtr<nsIEditRules> rules(mRules); - // get editor root node - nsCOMPtr<nsIDOMElement> rootElement = do_QueryInterface(GetRoot()); - // is doc empty? - bool bDocIsEmpty; - nsresult rv = rules->DocumentIsEmpty(&bDocIsEmpty); - NS_ENSURE_SUCCESS(rv, rv); + if (rules->DocumentIsEmpty()) { + // get editor root node + Element* rootElement = GetRoot(); - if (bDocIsEmpty) { // if its empty dont select entire doc - that would select the bogus node return aSelection->Collapse(rootElement, 0); } |