mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1489790 - Part 7: Remove the XPCOM component registration for @mozilla.org/editor/editingcontroller;1; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5362
This commit is contained in:
parent
935e51caab
commit
c9bfa076d5
@ -201,3 +201,24 @@ nsBaseCommandController::CreateWindowController()
|
||||
|
||||
return controller.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIController>
|
||||
nsBaseCommandController::CreateEditingController()
|
||||
{
|
||||
nsCOMPtr<nsIController> controller = new nsBaseCommandController();
|
||||
|
||||
nsCOMPtr<nsIControllerCommandTable> editingCommandTable =
|
||||
nsControllerCommandTable::CreateEditingCommandTable();
|
||||
|
||||
// this guy is a singleton, so make it immutable
|
||||
editingCommandTable->MakeImmutable();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
|
||||
if (NS_FAILED(rv)) return nullptr;
|
||||
|
||||
rv = controllerContext->Init(editingCommandTable);
|
||||
if (NS_FAILED(rv)) return nullptr;
|
||||
|
||||
return controller.forget();
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
static already_AddRefed<nsIController> CreateWindowController();
|
||||
static already_AddRefed<nsIController> CreateEditingController();
|
||||
|
||||
protected:
|
||||
virtual ~nsBaseCommandController();
|
||||
|
@ -114,6 +114,7 @@
|
||||
#include "nsIController.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsBaseCommandController.h"
|
||||
|
||||
// input type=date
|
||||
#include "js/Date.h"
|
||||
@ -5814,10 +5815,9 @@ HTMLInputElement::GetControllers(ErrorResult& aRv)
|
||||
|
||||
mControllers->AppendController(controller);
|
||||
|
||||
controller = do_CreateInstance("@mozilla.org/editor/editingcontroller;1",
|
||||
&rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
controller = nsBaseCommandController::CreateEditingController();
|
||||
if (!controller) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsTextEditorState.h"
|
||||
#include "nsIController.h"
|
||||
#include "nsBaseCommandController.h"
|
||||
|
||||
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
|
||||
|
||||
@ -638,9 +639,9 @@ HTMLTextAreaElement::GetControllers(ErrorResult& aError)
|
||||
|
||||
mControllers->AppendController(controller);
|
||||
|
||||
controller = do_CreateInstance("@mozilla.org/editor/editingcontroller;1", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aError.Throw(rv);
|
||||
controller = nsBaseCommandController::CreateEditingController();
|
||||
if (!controller) {
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsStringFwd.h" // for nsString
|
||||
#include "mozilla/dom/Selection.h" // for AutoHideSelectionChanges, etc
|
||||
#include "nsFrameSelection.h" // for nsFrameSelection
|
||||
#include "nsBaseCommandController.h" // for nsBaseCommandController
|
||||
|
||||
class nsISupports;
|
||||
class nsIURI;
|
||||
@ -156,7 +157,7 @@ nsEditingSession::MakeWindowEditable(mozIDOMWindowProxy* aWindow,
|
||||
// Setup commands common to plaintext and html editors,
|
||||
// including the document creation observers
|
||||
// the first is an editing controller
|
||||
rv = SetupEditorCommandController("@mozilla.org/editor/editingcontroller;1",
|
||||
rv = SetupEditorCommandController(nsBaseCommandController::CreateEditingController,
|
||||
aWindow,
|
||||
static_cast<nsIEditingSession*>(this),
|
||||
&mBaseCommandControllerId);
|
||||
@ -1372,7 +1373,7 @@ nsEditingSession::ReattachToWindow(mozIDOMWindowProxy* aWindow)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Setup the command controllers again.
|
||||
rv = SetupEditorCommandController("@mozilla.org/editor/editingcontroller;1",
|
||||
rv = SetupEditorCommandController(nsBaseCommandController::CreateEditingController,
|
||||
aWindow,
|
||||
static_cast<nsIEditingSession*>(this),
|
||||
&mBaseCommandControllerId);
|
||||
|
@ -12,10 +12,6 @@
|
||||
{ 0x26fb965c, 0x9de6, 0x11d3, \
|
||||
{ 0xbc, 0xcc, 0x0, 0x60, 0xb0, 0xfc, 0x76, 0xbd } }
|
||||
|
||||
#define NS_EDITINGCONTROLLER_CID \
|
||||
{ 0x2c5a5cdd, 0xe742, 0x4dfe, \
|
||||
{ 0x86, 0xb8, 0x06, 0x93, 0x09, 0xbf, 0x6c, 0x91 } }
|
||||
|
||||
class nsIControllerCommandTable;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -491,7 +491,6 @@ NS_DEFINE_NAMED_CID(NOTIFICATIONTELEMETRYSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(PUSHNOTIFIER_CID);
|
||||
NS_DEFINE_NAMED_CID(WORKERDEBUGGERMANAGER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_EDITORCONTROLLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_EDITINGCONTROLLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_WEBSOCKETEVENT_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID);
|
||||
@ -563,30 +562,6 @@ EditorControllerConstructor(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
||||
return controller->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
// Constructor of a controller which is set up to use, internally, a
|
||||
// singleton command-table pre-filled with editing commands.
|
||||
static nsresult
|
||||
nsEditingControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsCOMPtr<nsIController> controller = new nsBaseCommandController();
|
||||
|
||||
nsCOMPtr<nsIControllerCommandTable> editingCommandTable =
|
||||
nsControllerCommandTable::CreateEditingCommandTable();
|
||||
|
||||
// this guy is a singleton, so make it immutable
|
||||
editingCommandTable->MakeImmutable();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = controllerContext->Init(editingCommandTable);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return controller->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
||||
XPCONNECT_CIDENTRIES
|
||||
#ifdef DEBUG
|
||||
@ -636,7 +611,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
||||
{ &kPUSHNOTIFIER_CID, false, nullptr, PushNotifierConstructor },
|
||||
{ &kWORKERDEBUGGERMANAGER_CID, true, nullptr, WorkerDebuggerManagerConstructor },
|
||||
{ &kNS_EDITORCONTROLLER_CID, false, nullptr, EditorControllerConstructor },
|
||||
{ &kNS_EDITINGCONTROLLER_CID, false, nullptr, nsEditingControllerConstructor },
|
||||
{ &kNS_GEOLOCATION_CID, false, nullptr, GeolocationConstructor },
|
||||
{ &kNS_WEBSOCKETEVENT_SERVICE_CID, false, nullptr, WebSocketEventServiceConstructor },
|
||||
{ &kNS_FOCUSMANAGER_CID, false, nullptr, CreateFocusManager },
|
||||
@ -724,7 +698,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
||||
{ PUSHNOTIFIER_CONTRACTID, &kPUSHNOTIFIER_CID },
|
||||
{ WORKERDEBUGGERMANAGER_CONTRACTID, &kWORKERDEBUGGERMANAGER_CID },
|
||||
{ "@mozilla.org/editor/editorcontroller;1", &kNS_EDITORCONTROLLER_CID },
|
||||
{ "@mozilla.org/editor/editingcontroller;1", &kNS_EDITINGCONTROLLER_CID },
|
||||
{ "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID },
|
||||
{ "@mozilla.org/websocketevent/service;1", &kNS_WEBSOCKETEVENT_SERVICE_CID },
|
||||
{ "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID },
|
||||
|
Loading…
Reference in New Issue
Block a user