diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 4e46b84b20925..b9b5ab2d9eeb1 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -32,6 +32,7 @@ #include "mozilla/RestyleManager.h" #include "mozilla/StaticPrefs.h" #include "mozilla/StorageAccess.h" +#include "mozilla/TextEditor.h" #include "mozilla/URLExtraData.h" #include @@ -44,9 +45,6 @@ #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsILoadContext.h" -#include "nsIEditor.h" -#include "nsIEditorStyleSheets.h" -#include "nsIPlaintextEditor.h" #include "nsITextControlFrame.h" #include "nsCommandManager.h" #include "nsCommandParams.h" @@ -4304,95 +4302,175 @@ bool Document::ExecCommand(const nsAString& commandID, bool doShowUI, } } - // special case for cut & copy - // cut & copy are allowed in non editable documents + // Next, consider context of command handling which is automatically resolved + // by order of controllers in `nsCommandManager::GetControllerForCommand()`. + // The order is: + // 1. HTMLEditor for the document, if there is. + // 2. TextEditor if there is an active element and it has TextEditor like + // or