mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1489790 - Part 9: Remove the XPCOM component registration for @mozilla.org/editor/htmleditorcontroller;1; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5364
This commit is contained in:
parent
65f44ebf27
commit
f3142db64e
@ -243,3 +243,25 @@ nsBaseCommandController::CreateEditingController()
|
||||
|
||||
return controller.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIController>
|
||||
nsBaseCommandController::CreateHTMLEditorController()
|
||||
{
|
||||
nsCOMPtr<nsIController> controller = new nsBaseCommandController();
|
||||
|
||||
nsCOMPtr<nsIControllerCommandTable> composerCommandTable =
|
||||
nsControllerCommandTable::CreateHTMLEditorCommandTable();
|
||||
|
||||
// this guy is a singleton, so make it immutable
|
||||
composerCommandTable->MakeImmutable();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
rv = controllerContext->Init(composerCommandTable);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
return controller.forget();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
static already_AddRefed<nsIController> CreateWindowController();
|
||||
static already_AddRefed<nsIController> CreateEditorController();
|
||||
static already_AddRefed<nsIController> CreateEditingController();
|
||||
static already_AddRefed<nsIController> CreateHTMLEditorController();
|
||||
|
||||
protected:
|
||||
virtual ~nsBaseCommandController();
|
||||
|
@ -81,33 +81,16 @@ nsHTMLEditorDocStateControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
return controller->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
// Tere we make an instance of the controller that holds composer commands.
|
||||
// We set it up with a singleton command table.
|
||||
static nsresult
|
||||
nsHTMLEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsCOMPtr<nsIController> controller;
|
||||
nsresult rv = CreateControllerWithSingletonCommandTable(
|
||||
nsControllerCommandTable::CreateHTMLEditorCommandTable(),
|
||||
getter_AddRefs(controller));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return controller->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_HTMLEDITORCONTROLLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_EDITORDOCSTATECONTROLLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_EDITORSPELLCHECK_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kComposerCIDs[] = {
|
||||
{ &kNS_HTMLEDITORCONTROLLER_CID, false, nullptr, nsHTMLEditorControllerConstructor },
|
||||
{ &kNS_EDITORDOCSTATECONTROLLER_CID, false, nullptr, nsHTMLEditorDocStateControllerConstructor },
|
||||
{ &kNS_EDITORSPELLCHECK_CID, false, nullptr, EditorSpellCheckConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kComposerContracts[] = {
|
||||
{ "@mozilla.org/editor/htmleditorcontroller;1", &kNS_HTMLEDITORCONTROLLER_CID },
|
||||
{ "@mozilla.org/editor/editordocstatecontroller;1", &kNS_EDITORDOCSTATECONTROLLER_CID },
|
||||
{ "@mozilla.org/editor/editorspellchecker;1", &kNS_EDITORSPELLCHECK_CID },
|
||||
{ nullptr }
|
||||
|
@ -427,7 +427,7 @@ nsEditingSession::SetupEditorOnWindow(mozIDOMWindowProxy* aWindow)
|
||||
// setup the HTML editor command controller
|
||||
if (needHTMLController) {
|
||||
// The third controller takes an nsIEditor as the context
|
||||
rv = SetupEditorCommandController("@mozilla.org/editor/htmleditorcontroller;1",
|
||||
rv = SetupEditorCommandController(nsBaseCommandController::CreateHTMLEditorController,
|
||||
aWindow,
|
||||
static_cast<nsIEditor*>(htmlEditor),
|
||||
&mHTMLCommandControllerId);
|
||||
@ -1407,7 +1407,7 @@ nsEditingSession::ReattachToWindow(mozIDOMWindowProxy* aWindow)
|
||||
}
|
||||
|
||||
// The third controller takes an nsIEditor as the context
|
||||
rv = SetupEditorCommandController("@mozilla.org/editor/htmleditorcontroller;1",
|
||||
rv = SetupEditorCommandController(nsBaseCommandController::CreateHTMLEditorController,
|
||||
aWindow,
|
||||
static_cast<nsIEditor*>(htmlEditor.get()),
|
||||
&mHTMLCommandControllerId);
|
||||
|
@ -19,10 +19,6 @@ class nsIControllerCommandTable;
|
||||
#define NS_EDITORDOCSTATECONTROLLER_CID \
|
||||
{ 0x50e95301, 0x17a8, 0x11d4, { 0x9f, 0x7e, 0xdd, 0x53, 0x0d, 0x5f, 0x05, 0x7c } }
|
||||
|
||||
// The HTMLEditor controller is used only for HTML editors and takes nsIEditor as refCon
|
||||
#define NS_HTMLEDITORCONTROLLER_CID \
|
||||
{ 0x62db0002, 0xdbb6, 0x43f4, { 0x8f, 0xb7, 0x9d, 0x25, 0x38, 0xbc, 0x57, 0x47 } }
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class HTMLEditorController final
|
||||
|
Loading…
Reference in New Issue
Block a user