Skip to content

Commit d074a31

Browse files
Bug 1260651 part.33 Rename nsEditorController to mozilla::EditorController (and their files too) r=mccr8
MozReview-Commit-ID: 5xedcGTDlq1 --HG-- rename : editor/libeditor/nsEditorController.cpp => editor/libeditor/EditorController.cpp rename : editor/libeditor/nsEditorController.h => editor/libeditor/EditorController.h
1 parent 5fb3db7 commit d074a31

File tree

4 files changed

+57
-41
lines changed

4 files changed

+57
-41
lines changed

editor/libeditor/nsEditorController.cpp renamed to editor/libeditor/EditorController.cpp

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55

6-
#include "nsEditorController.h"
6+
#include "mozilla/EditorController.h"
77

88
#include "mozilla/mozalloc.h"
99
#include "nsDebug.h"
@@ -13,35 +13,40 @@
1313

1414
class nsIControllerCommand;
1515

16+
namespace mozilla {
1617

17-
18-
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
19-
{ \
20-
_cmdClass* theCmd = new _cmdClass(); \
21-
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
22-
inCommandTable->RegisterCommand(_cmdName, \
23-
static_cast<nsIControllerCommand *>(theCmd)); \
18+
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
19+
{ \
20+
_cmdClass* theCmd = new _cmdClass(); \
21+
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
22+
aCommandTable->RegisterCommand( \
23+
_cmdName, \
24+
static_cast<nsIControllerCommand *>(theCmd)); \
2425
}
2526

26-
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
27-
{ \
28-
_cmdClass* theCmd = new _cmdClass(); \
29-
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
30-
inCommandTable->RegisterCommand(_cmdName, \
31-
static_cast<nsIControllerCommand *>(theCmd));
32-
33-
#define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName) \
34-
inCommandTable->RegisterCommand(_cmdName, \
35-
static_cast<nsIControllerCommand *>(theCmd));
36-
37-
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
38-
inCommandTable->RegisterCommand(_cmdName, \
39-
static_cast<nsIControllerCommand *>(theCmd)); \
27+
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
28+
{ \
29+
_cmdClass* theCmd = new _cmdClass(); \
30+
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
31+
aCommandTable->RegisterCommand( \
32+
_cmdName, \
33+
static_cast<nsIControllerCommand *>(theCmd));
34+
35+
#define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName) \
36+
aCommandTable->RegisterCommand( \
37+
_cmdName, \
38+
static_cast<nsIControllerCommand *>(theCmd));
39+
40+
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
41+
aCommandTable->RegisterCommand( \
42+
_cmdName, \
43+
static_cast<nsIControllerCommand *>(theCmd)); \
4044
}
4145

42-
4346
// static
44-
nsresult nsEditorController::RegisterEditingCommands(nsIControllerCommandTable *inCommandTable)
47+
nsresult
48+
EditorController::RegisterEditingCommands(
49+
nsIControllerCommandTable* aCommandTable)
4550
{
4651
// now register all our commands
4752
// These are commands that will be used in text widgets, and in composer
@@ -78,9 +83,10 @@ nsresult nsEditorController::RegisterEditingCommands(nsIControllerCommandTable *
7883
return NS_OK;
7984
}
8085

81-
8286
// static
83-
nsresult nsEditorController::RegisterEditorCommands(nsIControllerCommandTable *inCommandTable)
87+
nsresult
88+
EditorController::RegisterEditorCommands(
89+
nsIControllerCommandTable* aCommandTable)
8490
{
8591
// These are commands that will be used in text widgets only.
8692

@@ -134,3 +140,4 @@ nsresult nsEditorController::RegisterEditorCommands(nsIControllerCommandTable *i
134140
return NS_OK;
135141
}
136142

143+
} // namespace mozilla

editor/libeditor/nsEditorController.h renamed to editor/libeditor/EditorController.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,35 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55

6-
#ifndef nsEditorController_h__
7-
#define nsEditorController_h__
6+
#ifndef mozilla_EditorController_h
7+
#define mozilla_EditorController_h
88

99
#include "nscore.h"
1010

1111
#define NS_EDITORCONTROLLER_CID \
12-
{ 0x26fb965c, 0x9de6, 0x11d3, { 0xbc, 0xcc, 0x0, 0x60, 0xb0, 0xfc, 0x76, 0xbd } }
12+
{ 0x26fb965c, 0x9de6, 0x11d3, \
13+
{ 0xbc, 0xcc, 0x0, 0x60, 0xb0, 0xfc, 0x76, 0xbd } }
1314

1415
#define NS_EDITINGCONTROLLER_CID \
15-
{ 0x2c5a5cdd, 0xe742, 0x4dfe, { 0x86, 0xb8, 0x06, 0x93, 0x09, 0xbf, 0x6c, 0x91 } }
16+
{ 0x2c5a5cdd, 0xe742, 0x4dfe, \
17+
{ 0x86, 0xb8, 0x06, 0x93, 0x09, 0xbf, 0x6c, 0x91 } }
1618

1719
class nsIControllerCommandTable;
1820

21+
namespace mozilla {
1922

2023
// the editor controller is used for both text widgets, and basic text editing
2124
// commands in composer. The refCon that gets passed to its commands is an nsIEditor.
2225

23-
class nsEditorController
26+
class EditorController final
2427
{
2528
public:
26-
static nsresult RegisterEditorCommands(nsIControllerCommandTable* inCommandTable);
27-
static nsresult RegisterEditingCommands(nsIControllerCommandTable* inCommandTable);
29+
static nsresult RegisterEditorCommands(
30+
nsIControllerCommandTable* aCommandTable);
31+
static nsresult RegisterEditingCommands(
32+
nsIControllerCommandTable* aCommandTable);
2833
};
2934

30-
#endif /* nsEditorController_h__ */
35+
} // namespace mozilla
3136

37+
#endif // #ifndef mozilla_EditorController_h

editor/libeditor/moz.build

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
1313

1414
BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
1515

16+
EXPORTS.mozilla += [
17+
'EditorController.h',
18+
]
19+
1620
UNIFIED_SOURCES += [
1721
'ChangeAttributeTransaction.cpp',
1822
'ChangeStyleTransaction.cpp',
@@ -22,6 +26,7 @@ UNIFIED_SOURCES += [
2226
'DeleteRangeTransaction.cpp',
2327
'DeleteTextTransaction.cpp',
2428
'EditAggregateTransaction.cpp',
29+
'EditorController.cpp',
2530
'EditorUtils.cpp',
2631
'EditTransactionBase.cpp',
2732
'HTMLEditUtils.cpp',
@@ -30,7 +35,6 @@ UNIFIED_SOURCES += [
3035
'JoinNodeTransaction.cpp',
3136
'nsEditor.cpp',
3237
'nsEditorCommands.cpp',
33-
'nsEditorController.cpp',
3438
'nsEditorEventListener.cpp',
3539
'nsHTMLAbsPosition.cpp',
3640
'nsHTMLAnonymousUtils.cpp',

layout/build/nsLayoutModule.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ using mozilla::dom::AudioChannelAgent;
138138
#include "nsEditorCID.h"
139139
#include "nsEditor.h"
140140
#include "nsPlaintextEditor.h"
141-
#include "nsEditorController.h" //CID
141+
#include "mozilla/EditorController.h" //CID
142142

143143
#include "nsHTMLEditor.h"
144144
#include "nsTextServicesDocument.h"
@@ -911,8 +911,7 @@ CreateWindowControllerWithSingletonCommandTable(nsISupports *aOuter,
911911
// Constructor of a controller which is set up to use, internally, a
912912
// singleton command-table pre-filled with editor commands.
913913
static nsresult
914-
nsEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
915-
void **aResult)
914+
EditorControllerConstructor(nsISupports* aOuter, REFNSIID aIID, void** aResult)
916915
{
917916
nsresult rv;
918917
nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
@@ -968,7 +967,7 @@ nsEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
968967
do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
969968
if (NS_FAILED(rv)) return rv;
970969

971-
rv = nsEditorController::RegisterEditorCommands(commandTable);
970+
rv = EditorController::RegisterEditorCommands(commandTable);
972971
if (NS_FAILED(rv)) return rv;
973972

974973
// we don't know here whether we're being created as an instance,
@@ -987,7 +986,7 @@ nsEditingCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
987986
do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
988987
if (NS_FAILED(rv)) return rv;
989988

990-
rv = nsEditorController::RegisterEditingCommands(commandTable);
989+
rv = EditorController::RegisterEditingCommands(commandTable);
991990
if (NS_FAILED(rv)) return rv;
992991

993992
// we don't know here whether we're being created as an instance,
@@ -1088,7 +1087,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
10881087
#endif
10891088
{ &kNS_AUDIOCHANNELAGENT_CID, true, nullptr, AudioChannelAgentConstructor },
10901089
{ &kNS_HTMLEDITOR_CID, false, nullptr, nsHTMLEditorConstructor },
1091-
{ &kNS_EDITORCONTROLLER_CID, false, nullptr, nsEditorControllerConstructor },
1090+
{ &kNS_EDITORCONTROLLER_CID, false, nullptr, EditorControllerConstructor },
10921091
{ &kNS_EDITINGCONTROLLER_CID, false, nullptr, nsEditingControllerConstructor },
10931092
{ &kNS_EDITORCOMMANDTABLE_CID, false, nullptr, nsEditorCommandTableConstructor },
10941093
{ &kNS_EDITINGCOMMANDTABLE_CID, false, nullptr, nsEditingCommandTableConstructor },

0 commit comments

Comments
 (0)