Bug 1260651 part.57 Move classes in nsHTMLObjectResizer.h into mozilla namespace and its file name should be HTMLEditorObjectResizerUtils.h r=mccr8 draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 07 Jul 2016 19:49:07 +0900
changeset 385889 4b047618bddf0c4ea4f859569e69f130c220eaaa
parent 385888 51addd3c3e4791ff30cabb2860df401f2cd51b09
child 385890 81b95b59e8ceb1019a57a7d682d94c79a06e4b6e
push id22587
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 06:59:31 +0000
reviewersmccr8
bugs1260651
milestone50.0a1
Bug 1260651 part.57 Move classes in nsHTMLObjectResizer.h into mozilla namespace and its file name should be HTMLEditorObjectResizerUtils.h r=mccr8 This patch renames: ResizerSelectionListener -> mozilla::ResizerSelectionListener ResizerMouseMotionListener -> mozilla::ResizerMouseMotionListener DocumentResizeEventListener -> mozilla::DocumentResizeEventListener And making the header file name HTMLEditorObjectResizerUtils.h because it doesn't define specific class related to its file name and should be clearer that it's related to HTMLEditor. MozReview-Commit-ID: GOJyEwtFdJV
editor/libeditor/HTMLAbsPositionEditor.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditorObjectResizer.cpp
editor/libeditor/HTMLEditorObjectResizerUtils.h
editor/libeditor/nsHTMLObjectResizer.h
--- a/editor/libeditor/HTMLAbsPositionEditor.cpp
+++ b/editor/libeditor/HTMLAbsPositionEditor.cpp
@@ -2,32 +2,32 @@
  * 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 "mozilla/HTMLEditor.h"
 
 #include <math.h>
 
 #include "EditorUtils.h"
+#include "HTMLEditorObjectResizerUtils.h"
 #include "HTMLEditRules.h"
 #include "HTMLEditUtils.h"
 #include "TextEditUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/mozalloc.h"
 #include "nsAString.h"
 #include "nsAlgorithm.h"
 #include "nsCOMPtr.h"
 #include "nsComputedDOMStyle.h"
 #include "nsDebug.h"
 #include "nsEditor.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
-#include "nsHTMLObjectResizer.h"
 #include "nsIContent.h"
 #include "nsROCSSPrimitiveValue.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMNode.h"
 #include "nsDOMCSSRGBColor.h"
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -51,20 +51,20 @@
 #include "nsPIDOMWindow.h"
 
 // netwerk
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 
 // Misc
 #include "EditorUtils.h"
+#include "HTMLEditorObjectResizerUtils.h"
 #include "TextEditorTest.h"
 #include "WSRunObject.h"
 #include "nsGkAtoms.h"
-#include "nsHTMLObjectResizer.h"
 #include "nsIWidget.h"
 
 #include "nsIFrame.h"
 #include "nsIParserService.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/DocumentFragment.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 "mozilla/HTMLEditor.h"
-#include "nsHTMLObjectResizer.h"
+#include "HTMLEditorObjectResizerUtils.h"
 
 #include "EditorUtils.h"
 #include "HTMLEditUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/mozalloc.h"
@@ -40,55 +40,51 @@
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsSubstringTuple.h"
 #include "nscore.h"
 #include <algorithm>
 
 class nsISelection;
 
+namespace mozilla {
+
+using namespace dom;
+
 /******************************************************************************
- * DocumentResizeEventListener
+ * mozilla::DocumentResizeEventListener
  ******************************************************************************/
 
 NS_IMPL_ISUPPORTS(DocumentResizeEventListener, nsIDOMEventListener)
 
 DocumentResizeEventListener::DocumentResizeEventListener(nsIHTMLEditor* aEditor)
 {
   mEditor = do_GetWeakReference(aEditor);
 }
 
-DocumentResizeEventListener::~DocumentResizeEventListener()
-{
-}
-
 NS_IMETHODIMP
 DocumentResizeEventListener::HandleEvent(nsIDOMEvent* aMouseEvent)
 {
   nsCOMPtr<nsIHTMLObjectResizer> objectResizer = do_QueryReferent(mEditor);
   if (objectResizer)
     return objectResizer->RefreshResizers();
   return NS_OK;
 }
 
 /******************************************************************************
- * ResizerSelectionListener
+ * mozilla::ResizerSelectionListener
  ******************************************************************************/
 
 NS_IMPL_ISUPPORTS(ResizerSelectionListener, nsISelectionListener)
 
 ResizerSelectionListener::ResizerSelectionListener(nsIHTMLEditor* aEditor)
 {
   mEditor = do_GetWeakReference(aEditor);
 }
 
-ResizerSelectionListener::~ResizerSelectionListener()
-{
-}
-
 NS_IMETHODIMP
 ResizerSelectionListener::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
                                                  nsISelection* aSelection,
                                                  int16_t aReason)
 {
   if ((aReason & (nsISelectionListener::MOUSEDOWN_REASON |
                   nsISelectionListener::KEYPRESS_REASON |
                   nsISelectionListener::SELECTALL_REASON)) && aSelection)
@@ -99,30 +95,26 @@ ResizerSelectionListener::NotifySelectio
     if (editor)
       editor->CheckSelectionStateForAnonymousButtons(aSelection);
   }
 
   return NS_OK;
 }
 
 /******************************************************************************
- * ResizerMouseMotionListener
+ * mozilla::ResizerMouseMotionListener
  ******************************************************************************/
 
 NS_IMPL_ISUPPORTS(ResizerMouseMotionListener, nsIDOMEventListener)
 
 ResizerMouseMotionListener::ResizerMouseMotionListener(nsIHTMLEditor* aEditor)
 {
   mEditor = do_GetWeakReference(aEditor);
 }
 
-ResizerMouseMotionListener::~ResizerMouseMotionListener()
-{
-}
-
 NS_IMETHODIMP
 ResizerMouseMotionListener::HandleEvent(nsIDOMEvent* aMouseEvent)
 {
   nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(aMouseEvent) );
   if (!mouseEvent) {
     //non-ui event passed in.  bad things.
     return NS_OK;
   }
@@ -133,20 +125,16 @@ ResizerMouseMotionListener::HandleEvent(
   {
     // check if we have to redisplay a resizing shadow
     objectResizer->MouseMove(aMouseEvent);
   }
 
   return NS_OK;
 }
 
-namespace mozilla {
-
-using namespace dom;
-
 /******************************************************************************
  * mozilla::HTMLEditor
  ******************************************************************************/
 
 already_AddRefed<Element>
 HTMLEditor::CreateResizer(int16_t aLocation,
                           nsIDOMNode* aParentNode)
 {
rename from editor/libeditor/nsHTMLObjectResizer.h
rename to editor/libeditor/HTMLEditorObjectResizerUtils.h
--- a/editor/libeditor/nsHTMLObjectResizer.h
+++ b/editor/libeditor/HTMLEditorObjectResizerUtils.h
@@ -1,89 +1,82 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 _nshtmlobjectresizer__h
-#define _nshtmlobjectresizer__h
+#ifndef HTMLEditorObjectResizerUtils_h
+#define HTMLEditorObjectResizerUtils_h
 
 #include "nsIDOMEventListener.h"
 #include "nsISelectionListener.h"
 #include "nsISupportsImpl.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsLiteralString.h"
 
 class nsIHTMLEditor;
 
+namespace mozilla {
+
 #define kTopLeft       NS_LITERAL_STRING("nw")
 #define kTop           NS_LITERAL_STRING("n")
 #define kTopRight      NS_LITERAL_STRING("ne")
 #define kLeft          NS_LITERAL_STRING("w")
 #define kRight         NS_LITERAL_STRING("e")
 #define kBottomLeft    NS_LITERAL_STRING("sw")
 #define kBottom        NS_LITERAL_STRING("s")
 #define kBottomRight   NS_LITERAL_STRING("se")
 
-// ==================================================================
-// ResizerSelectionListener
-// ==================================================================
+/******************************************************************************
+ * mozilla::ResizerSelectionListener
+ ******************************************************************************/
 
-class ResizerSelectionListener : public nsISelectionListener
+class ResizerSelectionListener final : public nsISelectionListener
 {
 public:
-
-  explicit ResizerSelectionListener(nsIHTMLEditor * aEditor);
+  explicit ResizerSelectionListener(nsIHTMLEditor* aEditor);
   void Reset();
 
-  /*interfaces for addref and release and queryinterface*/
   NS_DECL_ISUPPORTS
-
   NS_DECL_NSISELECTIONLISTENER
 
 protected:
-  virtual ~ResizerSelectionListener();
-
+  virtual ~ResizerSelectionListener() {}
   nsWeakPtr mEditor;
 };
 
-// ==================================================================
-// ResizerMouseMotionListener
-// ==================================================================
+/******************************************************************************
+ * mozilla::ResizerMouseMotionListener
+ ******************************************************************************/
 
-class ResizerMouseMotionListener : public nsIDOMEventListener
+class ResizerMouseMotionListener final : public nsIDOMEventListener
 {
 public:
-  explicit ResizerMouseMotionListener(nsIHTMLEditor * aEditor);
+  explicit ResizerMouseMotionListener(nsIHTMLEditor* aEditor);
 
-/*interfaces for addref and release and queryinterface*/
   NS_DECL_ISUPPORTS
-
   NS_DECL_NSIDOMEVENTLISTENER
 
- protected:
-  virtual ~ResizerMouseMotionListener();
-
+protected:
+  virtual ~ResizerMouseMotionListener() {}
   nsWeakPtr mEditor;
-
 };
 
-// ==================================================================
-// DocumentResizeEventListener
-// ==================================================================
+/******************************************************************************
+ * mozilla::DocumentResizeEventListener
+ ******************************************************************************/
 
-class DocumentResizeEventListener: public nsIDOMEventListener
+class DocumentResizeEventListener final : public nsIDOMEventListener
 {
 public:
-  explicit DocumentResizeEventListener(nsIHTMLEditor * aEditor);
+  explicit DocumentResizeEventListener(nsIHTMLEditor* aEditor);
 
-  /*interfaces for addref and release and queryinterface*/
   NS_DECL_ISUPPORTS
-
   NS_DECL_NSIDOMEVENTLISTENER
 
- protected:
-  virtual ~DocumentResizeEventListener();
+protected:
+  virtual ~DocumentResizeEventListener() {}
   nsWeakPtr mEditor;
-
 };
 
-#endif /* _nshtmlobjectresizer__h */
+} // namespace mozilla
+
+#endif // #ifndef HTMLEditorObjectResizerUtils_h