Skip to content

Commit 9e30876

Browse files
Bug 1260651 part.55 Rename nsEditorEventListeners to mozilla::EditorEventListener (and their file names) r=mccr8
MozReview-Commit-ID: HqUUCZkaFTT --HG-- rename : editor/libeditor/nsEditorEventListener.cpp => editor/libeditor/EditorEventListener.cpp rename : editor/libeditor/nsEditorEventListener.h => editor/libeditor/EditorEventListener.h
1 parent 729e312 commit 9e30876

File tree

8 files changed

+68
-70
lines changed

8 files changed

+68
-70
lines changed

editor/libeditor/nsEditorEventListener.cpp renamed to editor/libeditor/EditorEventListener.cpp

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

7-
#include "nsEditorEventListener.h"
7+
#include "EditorEventListener.h"
88

99
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
1010
#include "mozilla/EventListenerManager.h" // for EventListenerManager
@@ -64,8 +64,9 @@
6464

6565
class nsPresContext;
6666

67-
using namespace mozilla;
68-
using namespace mozilla::dom;
67+
namespace mozilla {
68+
69+
using namespace dom;
6970

7071
static void
7172
DoCommandCallback(Command aCommand, void* aData)
@@ -96,7 +97,7 @@ DoCommandCallback(Command aCommand, void* aData)
9697
}
9798
}
9899

99-
nsEditorEventListener::nsEditorEventListener()
100+
EditorEventListener::EditorEventListener()
100101
: mEditor(nullptr)
101102
, mCommitText(false)
102103
, mInTransaction(false)
@@ -109,7 +110,7 @@ nsEditorEventListener::nsEditorEventListener()
109110
{
110111
}
111112

112-
nsEditorEventListener::~nsEditorEventListener()
113+
EditorEventListener::~EditorEventListener()
113114
{
114115
if (mEditor) {
115116
NS_WARNING("We're not uninstalled");
@@ -118,7 +119,7 @@ nsEditorEventListener::~nsEditorEventListener()
118119
}
119120

120121
nsresult
121-
nsEditorEventListener::Connect(nsEditor* aEditor)
122+
EditorEventListener::Connect(nsEditor* aEditor)
122123
{
123124
NS_ENSURE_ARG(aEditor);
124125

@@ -141,7 +142,7 @@ nsEditorEventListener::Connect(nsEditor* aEditor)
141142
}
142143

143144
nsresult
144-
nsEditorEventListener::InstallToEditor()
145+
EditorEventListener::InstallToEditor()
145146
{
146147
NS_PRECONDITION(mEditor, "The caller must set mEditor");
147148

@@ -211,7 +212,7 @@ nsEditorEventListener::InstallToEditor()
211212
}
212213

213214
void
214-
nsEditorEventListener::Disconnect()
215+
EditorEventListener::Disconnect()
215216
{
216217
if (!mEditor) {
217218
return;
@@ -236,7 +237,7 @@ nsEditorEventListener::Disconnect()
236237
}
237238

238239
void
239-
nsEditorEventListener::UninstallFromEditor()
240+
EditorEventListener::UninstallFromEditor()
240241
{
241242
nsCOMPtr<EventTarget> piTarget = mEditor->GetDOMEventTarget();
242243
if (!piTarget) {
@@ -298,22 +299,22 @@ nsEditorEventListener::UninstallFromEditor()
298299
}
299300

300301
already_AddRefed<nsIPresShell>
301-
nsEditorEventListener::GetPresShell()
302+
EditorEventListener::GetPresShell()
302303
{
303304
NS_PRECONDITION(mEditor,
304305
"The caller must check whether this is connected to an editor");
305306
return mEditor->GetPresShell();
306307
}
307308

308309
nsPresContext*
309-
nsEditorEventListener::GetPresContext()
310+
EditorEventListener::GetPresContext()
310311
{
311312
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
312313
return presShell ? presShell->GetPresContext() : nullptr;
313314
}
314315

315316
nsIContent*
316-
nsEditorEventListener::GetFocusedRootContent()
317+
EditorEventListener::GetFocusedRootContent()
317318
{
318319
NS_ENSURE_TRUE(mEditor, nullptr);
319320

@@ -333,7 +334,7 @@ nsEditorEventListener::GetFocusedRootContent()
333334
}
334335

335336
bool
336-
nsEditorEventListener::EditorHasFocus()
337+
EditorEventListener::EditorHasFocus()
337338
{
338339
NS_PRECONDITION(mEditor,
339340
"The caller must check whether this is connected to an editor");
@@ -345,18 +346,10 @@ nsEditorEventListener::EditorHasFocus()
345346
return !!composedDoc;
346347
}
347348

348-
/**
349-
* nsISupports implementation
350-
*/
351-
352-
NS_IMPL_ISUPPORTS(nsEditorEventListener, nsIDOMEventListener)
353-
354-
/**
355-
* nsIDOMEventListener implementation
356-
*/
349+
NS_IMPL_ISUPPORTS(EditorEventListener, nsIDOMEventListener)
357350

358351
NS_IMETHODIMP
359-
nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
352+
EditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
360353
{
361354
NS_ENSURE_TRUE(mEditor, NS_ERROR_FAILURE);
362355

@@ -416,7 +409,7 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
416409
case eMouseDown: {
417410
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
418411
NS_ENSURE_TRUE(mouseEvent, NS_OK);
419-
// nsEditorEventListener may receive (1) all mousedown, mouseup and click
412+
// EditorEventListener may receive (1) all mousedown, mouseup and click
420413
// events, (2) only mousedown event or (3) only mouseup event.
421414
// mMouseDownOrUpConsumedByIME is used only for ignoring click event if
422415
// preceding mousedown and/or mouseup event is consumed by IME.
@@ -433,7 +426,7 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
433426
// See above comment in the eMouseDown case, first.
434427
// This code assumes that case #1 is occuring. However, if case #3 may
435428
// occurs after case #2 and the mousedown is consumed,
436-
// mMouseDownOrUpConsumedByIME is true even though nsEditorEventListener
429+
// mMouseDownOrUpConsumedByIME is true even though EditorEventListener
437430
// has not received the preceding mousedown event of this mouseup event.
438431
// So, mMouseDownOrUpConsumedByIME may be invalid here. However,
439432
// this is not a matter because mMouseDownOrUpConsumedByIME is referred
@@ -545,7 +538,7 @@ bool IsCtrlShiftPressed(nsIDOMKeyEvent* aEvent, bool& isRTL)
545538
// RenderWidgetHostViewWin::OnKeyEvent.
546539

547540
nsresult
548-
nsEditorEventListener::KeyUp(nsIDOMKeyEvent* aKeyEvent)
541+
EditorEventListener::KeyUp(nsIDOMKeyEvent* aKeyEvent)
549542
{
550543
NS_ENSURE_TRUE(aKeyEvent, NS_OK);
551544

@@ -567,7 +560,7 @@ nsEditorEventListener::KeyUp(nsIDOMKeyEvent* aKeyEvent)
567560
}
568561

569562
nsresult
570-
nsEditorEventListener::KeyDown(nsIDOMKeyEvent* aKeyEvent)
563+
EditorEventListener::KeyDown(nsIDOMKeyEvent* aKeyEvent)
571564
{
572565
NS_ENSURE_TRUE(aKeyEvent, NS_OK);
573566

@@ -592,7 +585,7 @@ nsEditorEventListener::KeyDown(nsIDOMKeyEvent* aKeyEvent)
592585
#endif
593586

594587
nsresult
595-
nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
588+
EditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
596589
{
597590
NS_ENSURE_TRUE(aKeyEvent, NS_OK);
598591

@@ -649,7 +642,7 @@ nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
649642
}
650643

651644
nsresult
652-
nsEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
645+
EditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
653646
{
654647
// nothing to do if editor isn't editable or clicked on out of the editor.
655648
if (mEditor->IsReadonly() || mEditor->IsDisabled() ||
@@ -687,7 +680,7 @@ nsEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
687680
}
688681

689682
nsresult
690-
nsEditorEventListener::HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent)
683+
EditorEventListener::HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent)
691684
{
692685
if (!Preferences::GetBool("middlemouse.paste", false)) {
693686
// Middle click paste isn't enabled.
@@ -747,8 +740,8 @@ nsEditorEventListener::HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent)
747740
}
748741

749742
bool
750-
nsEditorEventListener::NotifyIMEOfMouseButtonEvent(
751-
nsIDOMMouseEvent* aMouseEvent)
743+
EditorEventListener::NotifyIMEOfMouseButtonEvent(
744+
nsIDOMMouseEvent* aMouseEvent)
752745
{
753746
if (!EditorHasFocus()) {
754747
return false;
@@ -768,7 +761,7 @@ nsEditorEventListener::NotifyIMEOfMouseButtonEvent(
768761
}
769762

770763
nsresult
771-
nsEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
764+
EditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
772765
{
773766
// FYI: This may be called by HTMLEditorEventListener::MouseDown() even
774767
// when the event is not acceptable for committing composition.
@@ -777,7 +770,7 @@ nsEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
777770
}
778771

779772
nsresult
780-
nsEditorEventListener::HandleText(nsIDOMEvent* aTextEvent)
773+
EditorEventListener::HandleText(nsIDOMEvent* aTextEvent)
781774
{
782775
if (!mEditor->IsAcceptableInputEvent(aTextEvent)) {
783776
return NS_OK;
@@ -796,7 +789,7 @@ nsEditorEventListener::HandleText(nsIDOMEvent* aTextEvent)
796789
*/
797790

798791
nsresult
799-
nsEditorEventListener::DragEnter(nsIDOMDragEvent* aDragEvent)
792+
EditorEventListener::DragEnter(nsIDOMDragEvent* aDragEvent)
800793
{
801794
NS_ENSURE_TRUE(aDragEvent, NS_OK);
802795

@@ -819,7 +812,7 @@ nsEditorEventListener::DragEnter(nsIDOMDragEvent* aDragEvent)
819812
}
820813

821814
nsresult
822-
nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
815+
EditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
823816
{
824817
NS_ENSURE_TRUE(aDragEvent, NS_OK);
825818

@@ -864,7 +857,7 @@ nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
864857
}
865858

866859
void
867-
nsEditorEventListener::CleanupDragDropCaret()
860+
EditorEventListener::CleanupDragDropCaret()
868861
{
869862
if (!mCaret) {
870863
return;
@@ -882,7 +875,7 @@ nsEditorEventListener::CleanupDragDropCaret()
882875
}
883876

884877
nsresult
885-
nsEditorEventListener::DragExit(nsIDOMDragEvent* aDragEvent)
878+
EditorEventListener::DragExit(nsIDOMDragEvent* aDragEvent)
886879
{
887880
NS_ENSURE_TRUE(aDragEvent, NS_OK);
888881

@@ -892,7 +885,7 @@ nsEditorEventListener::DragExit(nsIDOMDragEvent* aDragEvent)
892885
}
893886

894887
nsresult
895-
nsEditorEventListener::Drop(nsIDOMDragEvent* aDragEvent)
888+
EditorEventListener::Drop(nsIDOMDragEvent* aDragEvent)
896889
{
897890
NS_ENSURE_TRUE(aDragEvent, NS_OK);
898891

@@ -928,7 +921,7 @@ nsEditorEventListener::Drop(nsIDOMDragEvent* aDragEvent)
928921
}
929922

930923
bool
931-
nsEditorEventListener::CanDrop(nsIDOMDragEvent* aEvent)
924+
EditorEventListener::CanDrop(nsIDOMDragEvent* aEvent)
932925
{
933926
// if the target doc is read-only, we can't drop
934927
if (mEditor->IsReadonly() || mEditor->IsDisabled()) {
@@ -1030,7 +1023,7 @@ nsEditorEventListener::CanDrop(nsIDOMDragEvent* aEvent)
10301023
}
10311024

10321025
nsresult
1033-
nsEditorEventListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
1026+
EditorEventListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
10341027
{
10351028
if (!mEditor->IsAcceptableInputEvent(aCompositionEvent)) {
10361029
return NS_OK;
@@ -1041,7 +1034,7 @@ nsEditorEventListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
10411034
}
10421035

10431036
void
1044-
nsEditorEventListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
1037+
EditorEventListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
10451038
{
10461039
if (!mEditor->IsAcceptableInputEvent(aCompositionEvent)) {
10471040
return;
@@ -1051,7 +1044,7 @@ nsEditorEventListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
10511044
}
10521045

10531046
nsresult
1054-
nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
1047+
EditorEventListener::Focus(nsIDOMEvent* aEvent)
10551048
{
10561049
NS_ENSURE_TRUE(aEvent, NS_OK);
10571050

@@ -1115,7 +1108,7 @@ nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
11151108
}
11161109

11171110
nsresult
1118-
nsEditorEventListener::Blur(nsIDOMEvent* aEvent)
1111+
EditorEventListener::Blur(nsIDOMEvent* aEvent)
11191112
{
11201113
NS_ENSURE_TRUE(aEvent, NS_OK);
11211114

@@ -1133,7 +1126,7 @@ nsEditorEventListener::Blur(nsIDOMEvent* aEvent)
11331126
}
11341127

11351128
void
1136-
nsEditorEventListener::SpellCheckIfNeeded()
1129+
EditorEventListener::SpellCheckIfNeeded()
11371130
{
11381131
// If the spell check skip flag is still enabled from creation time,
11391132
// disable it because focused editors are allowed to spell check.
@@ -1146,7 +1139,7 @@ nsEditorEventListener::SpellCheckIfNeeded()
11461139
}
11471140

11481141
bool
1149-
nsEditorEventListener::IsFileControlTextBox()
1142+
EditorEventListener::IsFileControlTextBox()
11501143
{
11511144
dom::Element* root = mEditor->GetRoot();
11521145
if (!root || !root->ChromeOnlyAccess()) {
@@ -1161,7 +1154,7 @@ nsEditorEventListener::IsFileControlTextBox()
11611154
}
11621155

11631156
bool
1164-
nsEditorEventListener::ShouldHandleNativeKeyBindings(nsIDOMKeyEvent* aKeyEvent)
1157+
EditorEventListener::ShouldHandleNativeKeyBindings(nsIDOMKeyEvent* aKeyEvent)
11651158
{
11661159
// Only return true if the target of the event is a desendant of the active
11671160
// editing host in order to match the similar decision made in
@@ -1197,3 +1190,5 @@ nsEditorEventListener::ShouldHandleNativeKeyBindings(nsIDOMKeyEvent* aKeyEvent)
11971190

11981191
return nsContentUtils::ContentIsDescendantOf(targetContent, editingHost);
11991192
}
1193+
1194+
} // namespace mozilla

editor/libeditor/nsEditorEventListener.h renamed to editor/libeditor/EditorEventListener.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
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 nsEditorEventListener_h__
7-
#define nsEditorEventListener_h__
6+
#ifndef EditorEventListener_h
7+
#define EditorEventListener_h
88

99
#include "nsCOMPtr.h"
1010
#include "nsError.h"
@@ -32,10 +32,12 @@ class nsPresContext;
3232
#define HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
3333
#endif
3434

35-
class nsEditorEventListener : public nsIDOMEventListener
35+
namespace mozilla {
36+
37+
class EditorEventListener : public nsIDOMEventListener
3638
{
3739
public:
38-
nsEditorEventListener();
40+
EditorEventListener();
3941

4042
virtual nsresult Connect(nsEditor* aEditor);
4143

@@ -47,7 +49,7 @@ class nsEditorEventListener : public nsIDOMEventListener
4749
void SpellCheckIfNeeded();
4850

4951
protected:
50-
virtual ~nsEditorEventListener();
52+
virtual ~EditorEventListener();
5153

5254
nsresult InstallToEditor();
5355
void UninstallFromEditor();
@@ -95,4 +97,6 @@ class nsEditorEventListener : public nsIDOMEventListener
9597
#endif
9698
};
9799

98-
#endif // nsEditorEventListener_h__
100+
} // namespace mozilla
101+
102+
#endif // #ifndef EditorEventListener_h

0 commit comments

Comments
 (0)