From ca1412fd05c5f55ee9276f27756e7f53fe2911a1 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 7 Jul 2016 19:36:53 +0900 Subject: [PATCH] Bug 1260651 part.54 Rename nsHTMLEditorEventListeners to mozilla::HTMLEditorEventListener (and their file names) r=mccr8 MozReview-Commit-ID: DFW3E2WfXzJ --- ...stener.cpp => HTMLEditorEventListener.cpp} | 22 +++++++++---------- ...ntListener.h => HTMLEditorEventListener.h} | 16 ++++++++------ editor/libeditor/moz.build | 2 +- editor/libeditor/nsEditorEventListener.cpp | 2 +- editor/libeditor/nsHTMLEditor.cpp | 10 ++++----- editor/libeditor/nsHTMLEditor.h | 3 ++- 6 files changed, 27 insertions(+), 28 deletions(-) rename editor/libeditor/{nsHTMLEditorEventListener.cpp => HTMLEditorEventListener.cpp} (93%) rename editor/libeditor/{nsHTMLEditorEventListener.h => HTMLEditorEventListener.h} (74%) diff --git a/editor/libeditor/nsHTMLEditorEventListener.cpp b/editor/libeditor/HTMLEditorEventListener.cpp similarity index 93% rename from editor/libeditor/nsHTMLEditorEventListener.cpp rename to editor/libeditor/HTMLEditorEventListener.cpp index c4ece7dc0eb9d..d224aaae1376b 100644 --- a/editor/libeditor/nsHTMLEditorEventListener.cpp +++ b/editor/libeditor/HTMLEditorEventListener.cpp @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsHTMLEditorEventListener.h" +#include "HTMLEditorEventListener.h" #include "HTMLEditUtils.h" #include "mozilla/dom/Event.h" @@ -27,17 +27,13 @@ #include "nsQueryObject.h" #include "nsRange.h" -using namespace mozilla; -using namespace mozilla::dom; +namespace mozilla { -/* - * nsHTMLEditorEventListener implementation - * - */ +using namespace dom; #ifdef DEBUG nsresult -nsHTMLEditorEventListener::Connect(nsEditor* aEditor) +HTMLEditorEventListener::Connect(nsEditor* aEditor) { nsCOMPtr htmlEditor = do_QueryObject(aEditor); nsCOMPtr htmlInlineTableEditor = @@ -49,14 +45,14 @@ nsHTMLEditorEventListener::Connect(nsEditor* aEditor) #endif nsHTMLEditor* -nsHTMLEditorEventListener::GetHTMLEditor() +HTMLEditorEventListener::GetHTMLEditor() { // mEditor must be nsHTMLEditor or its subclass. return static_cast(mEditor); } nsresult -nsHTMLEditorEventListener::MouseUp(nsIDOMMouseEvent* aMouseEvent) +HTMLEditorEventListener::MouseUp(nsIDOMMouseEvent* aMouseEvent) { nsHTMLEditor* htmlEditor = GetHTMLEditor(); @@ -75,7 +71,7 @@ nsHTMLEditorEventListener::MouseUp(nsIDOMMouseEvent* aMouseEvent) } nsresult -nsHTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent) +HTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent) { nsHTMLEditor* htmlEditor = GetHTMLEditor(); // Contenteditable should disregard mousedowns outside it. @@ -205,7 +201,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent) } nsresult -nsHTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent) +HTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent) { nsCOMPtr target; nsresult rv = aMouseEvent->AsEvent()->GetTarget(getter_AddRefs(target)); @@ -217,3 +213,5 @@ nsHTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent) return nsEditorEventListener::MouseClick(aMouseEvent); } + +} // namespace mozilla diff --git a/editor/libeditor/nsHTMLEditorEventListener.h b/editor/libeditor/HTMLEditorEventListener.h similarity index 74% rename from editor/libeditor/nsHTMLEditorEventListener.h rename to editor/libeditor/HTMLEditorEventListener.h index 9b660878f3f84..7ece6ae011fe6 100644 --- a/editor/libeditor/nsHTMLEditorEventListener.h +++ b/editor/libeditor/HTMLEditorEventListener.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsHTMLEditorEventListener_h__ -#define nsHTMLEditorEventListener_h__ +#ifndef HTMLEditorEventListener_h +#define HTMLEditorEventListener_h #include "nsEditorEventListener.h" #include "nscore.h" @@ -12,15 +12,16 @@ class nsEditor; class nsHTMLEditor; -class nsHTMLEditorEventListener : public nsEditorEventListener +namespace mozilla { + +class HTMLEditorEventListener final : public nsEditorEventListener { public: - nsHTMLEditorEventListener() : - nsEditorEventListener() + HTMLEditorEventListener() { } - virtual ~nsHTMLEditorEventListener() + virtual ~HTMLEditorEventListener() { } @@ -37,5 +38,6 @@ class nsHTMLEditorEventListener : public nsEditorEventListener inline nsHTMLEditor* GetHTMLEditor(); }; -#endif // nsHTMLEditorEventListener_h__ +} // namespace mozilla +#endif // #ifndef HTMLEditorEventListener_h diff --git a/editor/libeditor/moz.build b/editor/libeditor/moz.build index d04beab959391..009ef67c55415 100644 --- a/editor/libeditor/moz.build +++ b/editor/libeditor/moz.build @@ -38,6 +38,7 @@ UNIFIED_SOURCES += [ 'EditorController.cpp', 'EditorUtils.cpp', 'EditTransactionBase.cpp', + 'HTMLEditorEventListener.cpp', 'HTMLEditRules.cpp', 'HTMLEditUtils.cpp', 'HTMLURIRefObject.cpp', @@ -51,7 +52,6 @@ UNIFIED_SOURCES += [ 'nsHTMLAnonymousUtils.cpp', 'nsHTMLDataTransfer.cpp', 'nsHTMLEditor.cpp', - 'nsHTMLEditorEventListener.cpp', 'nsHTMLEditorStyle.cpp', 'nsHTMLInlineTableEditor.cpp', 'nsHTMLObjectResizer.cpp', diff --git a/editor/libeditor/nsEditorEventListener.cpp b/editor/libeditor/nsEditorEventListener.cpp index 7bd5dc5f4c8ba..f30fb89be0104 100644 --- a/editor/libeditor/nsEditorEventListener.cpp +++ b/editor/libeditor/nsEditorEventListener.cpp @@ -770,7 +770,7 @@ nsEditorEventListener::NotifyIMEOfMouseButtonEvent( nsresult nsEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent) { - // FYI: This may be called by nsHTMLEditorEventListener::MouseDown() even + // FYI: This may be called by HTMLEditorEventListener::MouseDown() even // when the event is not acceptable for committing composition. mEditor->ForceCompositionEnd(); return NS_OK; diff --git a/editor/libeditor/nsHTMLEditor.cpp b/editor/libeditor/nsHTMLEditor.cpp index 41d5dc3c6c555..7a4e189fdfb33 100644 --- a/editor/libeditor/nsHTMLEditor.cpp +++ b/editor/libeditor/nsHTMLEditor.cpp @@ -13,17 +13,15 @@ #include "nsUnicharUtils.h" +#include "HTMLEditorEventListener.h" #include "HTMLEditRules.h" #include "HTMLEditUtils.h" #include "HTMLURIRefObject.h" #include "SetDocumentTitleTransaction.h" #include "StyleSheetTransactions.h" #include "TextEditUtils.h" - -#include "nsHTMLEditorEventListener.h" #include "TypeInState.h" - #include "nsIDOMText.h" #include "nsIDOMMozNamedAttrMap.h" #include "nsIDOMNodeList.h" @@ -442,7 +440,7 @@ nsHTMLEditor::CreateEventListeners() { // Don't create the handler twice if (!mEventListener) { - mEventListener = new nsHTMLEditorEventListener(); + mEventListener = new HTMLEditorEventListener(); } } @@ -455,8 +453,8 @@ nsHTMLEditor::InstallEventListeners() // NOTE: nsHTMLEditor doesn't need to initialize mEventTarget here because // the target must be document node and it must be referenced as weak pointer. - nsHTMLEditorEventListener* listener = - reinterpret_cast(mEventListener.get()); + HTMLEditorEventListener* listener = + reinterpret_cast(mEventListener.get()); return listener->Connect(this); } diff --git a/editor/libeditor/nsHTMLEditor.h b/editor/libeditor/nsHTMLEditor.h index 172547134bd94..fdfc18f8c6ae7 100644 --- a/editor/libeditor/nsHTMLEditor.h +++ b/editor/libeditor/nsHTMLEditor.h @@ -53,6 +53,7 @@ class nsIDOMRange; class nsRange; namespace mozilla { +class HTMLEditorEventListener; class HTMLEditRules; class TextEditRules; class TypeInState; @@ -974,10 +975,10 @@ class nsHTMLEditor final : public nsPlaintextEditor, public: // friends + friend class mozilla::HTMLEditorEventListener; friend class mozilla::HTMLEditRules; friend class mozilla::TextEditRules; friend class mozilla::WSRunObject; - friend class nsHTMLEditorEventListener; private: // Helpers