зеркало из https://github.com/mozilla/gecko-dev.git
db32271cec
`TextEditRules::DocumentIsEmpty()` is a wrapper of `TextEditor::IsEmpty()` so that we can get rid of it simply. `HTMLEditRules::DocumentIsEmpty()` needs to change. It's oddly checks only `EditorBase::mPaddingBRElementForEmptyEditor` is `nullptr` or not. However, the editor may be completely empty. And the result may be different from `TextEditor::IsEmpty()` which is not overridden by `HTMLEditor`. For partially solving this issue, this patch makes `HTMLEditor` overrides `IsEmpty()` and optimizes `TextEditor::IsEmpty()`. With this change, the caller of `HTMLEditRules::DocumentIsEmpty()` may behave differently in the only caller, `HTMLEditor::SelectEntireDocument()`. And unfortunately, its root called from `SelectAllCommand::DoCommand()`. However, it does just collapse `Selection` into the root element (`<body>` or `Document.documentElement`) if it returns `true`. Therefore, this change must be safe since anyway `SelectionRefPtr()->SelectAllChildren()` with the root element is exactly same as `SelectionRefPtr()->Collapse()` with the empty root element if it's truly empty. Differential Revision: https://phabricator.services.mozilla.com/D45784 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
composer | ||
libeditor | ||
reftests | ||
spellchecker | ||
txmgr | ||
AsyncSpellCheckTestHelper.jsm | ||
moz.build | ||
nsIDocumentStateListener.idl | ||
nsIEditActionListener.idl | ||
nsIEditor.idl | ||
nsIEditorMailSupport.idl | ||
nsIEditorObserver.idl | ||
nsIEditorSpellCheck.idl | ||
nsIEditorStyleSheets.idl | ||
nsIHTMLAbsPosEditor.idl | ||
nsIHTMLEditor.idl | ||
nsIHTMLInlineTableEditor.idl | ||
nsIHTMLObjectResizer.idl | ||
nsIPlaintextEditor.idl | ||
nsITableEditor.idl |