Bug 1349426 - Remove nsIHTMLObjectResizeListener. r?masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 27 Mar 2017 15:16:40 +0900
changeset 551645 43535e36513e4b2d0b9d54d925927a0cf590cc47
parent 551502 cc53710589fb500610495da5258b7b9221edf681
child 621593 0fd3d8aa1c135cbe2eed9835ae13b08f97824f5e
push id51109
push userm_kato@ga2.so-net.ne.jp
push dateMon, 27 Mar 2017 06:30:00 +0000
reviewersmasayuki
bugs1349426
milestone55.0a1
Bug 1349426 - Remove nsIHTMLObjectResizeListener. r?masayuki m-c, c-c, addons and bluegriffon don't use this interface, so we can remove it. MozReview-Commit-ID: I8sVLpDR2gx
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditor.h
editor/libeditor/HTMLEditorObjectResizer.cpp
editor/moz.build
editor/nsIHTMLObjectResizeListener.idl
editor/nsIHTMLObjectResizer.idl
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -210,17 +210,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBottomRightHandle)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mActivatedHandle)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResizingShadow)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResizingInfo)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResizedObject)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMouseMotionListenerP)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSelectionListenerP)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResizeEventListenerP)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mObjectResizeEventListeners)
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAbsolutelyPositionedObject)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGrabber)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPositioningShadow)
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInlineEditedCell)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAddColumnBeforeButton)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRemoveColumnButton)
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -24,17 +24,16 @@
 #include "nsIEditor.h"
 #include "nsIEditorMailSupport.h"
 #include "nsIEditorStyleSheets.h"
 #include "nsIEditorUtils.h"
 #include "nsIEditRules.h"
 #include "nsIHTMLAbsPosEditor.h"
 #include "nsIHTMLEditor.h"
 #include "nsIHTMLInlineTableEditor.h"
-#include "nsIHTMLObjectResizeListener.h"
 #include "nsIHTMLObjectResizer.h"
 #include "nsISelectionListener.h"
 #include "nsITableEditor.h"
 #include "nsPoint.h"
 #include "nsStubMutationObserver.h"
 #include "nsTArray.h"
 
 class nsDocumentFragment;
@@ -905,18 +904,16 @@ protected:
   nsCOMPtr<Element> mResizingInfo;
 
   nsCOMPtr<Element> mResizedObject;
 
   nsCOMPtr<nsIDOMEventListener>  mMouseMotionListenerP;
   nsCOMPtr<nsISelectionListener> mSelectionListenerP;
   nsCOMPtr<nsIDOMEventListener>  mResizeEventListenerP;
 
-  nsTArray<OwningNonNull<nsIHTMLObjectResizeListener>> mObjectResizeEventListeners;
-
   int32_t mOriginalX;
   int32_t mOriginalY;
 
   int32_t mResizedObjectX;
   int32_t mResizedObjectY;
   int32_t mResizedObjectWidth;
   int32_t mResizedObjectHeight;
 
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -26,17 +26,16 @@
 #include "nsIDOMElement.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMText.h"
 #include "nsIDocument.h"
 #include "nsIEditor.h"
-#include "nsIHTMLObjectResizeListener.h"
 #include "nsIHTMLObjectResizer.h"
 #include "nsIPresShell.h"
 #include "nsISupportsUtils.h"
 #include "nsPIDOMWindow.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsSubstringTuple.h"
@@ -486,21 +485,16 @@ HTMLEditor::HideShadowAndInfo()
     mResizingInfo->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
                            NS_LITERAL_STRING("hidden"), true);
   }
 }
 
 nsresult
 HTMLEditor::StartResizing(nsIDOMElement* aHandle)
 {
-  // First notify the listeners if any
-  for (auto& listener : mObjectResizeEventListeners) {
-    listener->OnStartResizing(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)));
-  }
-
   mIsResizing = true;
   mActivatedHandle = do_QueryInterface(aHandle);
   NS_ENSURE_STATE(mActivatedHandle || !aHandle);
   mActivatedHandle->SetAttr(kNameSpaceID_None, nsGkAtoms::_moz_activated,
                             NS_LITERAL_STRING("true"), true);
 
   // do we want to preserve ratio or not?
   bool preserveRatio = HTMLEditUtils::IsImage(mResizedObject) &&
@@ -965,22 +959,16 @@ HTMLEditor::SetFinalSize(int32_t aX,
       mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::width,
                                        EmptyString());
     }
     if (setHeight) {
       mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::height,
                                        EmptyString());
     }
   }
-  // finally notify the listeners if any
-  for (auto& listener : mObjectResizeEventListeners) {
-    listener->OnEndResizing(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)),
-                            mResizedObjectWidth, mResizedObjectHeight, width,
-                            height);
-  }
 
   // keep track of that size
   mResizedObjectWidth  = width;
   mResizedObjectHeight = height;
 
   RefreshResizers();
 }
 
@@ -1001,38 +989,9 @@ HTMLEditor::GetObjectResizingEnabled(boo
 
 NS_IMETHODIMP
 HTMLEditor::SetObjectResizingEnabled(bool aObjectResizingEnabled)
 {
   mIsObjectResizingEnabled = aObjectResizingEnabled;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-HTMLEditor::AddObjectResizeEventListener(nsIHTMLObjectResizeListener* aListener)
-{
-  NS_ENSURE_ARG_POINTER(aListener);
-  if (mObjectResizeEventListeners.Contains(aListener)) {
-    /* listener already registered */
-    NS_ASSERTION(false,
-                 "trying to register an already registered object resize event listener");
-    return NS_OK;
-  }
-  mObjectResizeEventListeners.AppendElement(*aListener);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-HTMLEditor::RemoveObjectResizeEventListener(
-              nsIHTMLObjectResizeListener* aListener)
-{
-  NS_ENSURE_ARG_POINTER(aListener);
-  if (!mObjectResizeEventListeners.Contains(aListener)) {
-    /* listener was not registered */
-    NS_ASSERTION(false,
-                 "trying to remove an object resize event listener that was not already registered");
-    return NS_OK;
-  }
-  mObjectResizeEventListeners.RemoveElement(aListener);
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/editor/moz.build
+++ b/editor/moz.build
@@ -20,17 +20,16 @@ XPIDL_SOURCES += [
     'nsIEditorMailSupport.idl',
     'nsIEditorObserver.idl',
     'nsIEditorSpellCheck.idl',
     'nsIEditorStyleSheets.idl',
     'nsIEditorUtils.idl',
     'nsIHTMLAbsPosEditor.idl',
     'nsIHTMLEditor.idl',
     'nsIHTMLInlineTableEditor.idl',
-    'nsIHTMLObjectResizeListener.idl',
     'nsIHTMLObjectResizer.idl',
     'nsIPlaintextEditor.idl',
     'nsITableEditor.idl',
     'nsIURIRefObject.idl',
     'nsPIEditorTransaction.idl',
 ]
 
 XPIDL_MODULE = 'editor'
deleted file mode 100644
--- a/editor/nsIHTMLObjectResizeListener.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- 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 "nsISupports.idl"
-#include "domstubs.idl"
-
-[scriptable, uuid(27b00295-349c-429f-ad0c-87b859e77130)]
-
-interface nsIHTMLObjectResizeListener : nsISupports
-{
-  /**
-   * Listener's callback called by the editor when the user
-   * starts resizing an element
-   * @param aElement [IN] the element
-   */
-  void onStartResizing(in nsIDOMElement aElement);
-
-  /**
-   * Listener's callback called by the editor when the user
-   * has finalized the resizing of an element
-   * @param aElement [IN] the element that was resized
-   * @param aOldWidth  [IN] the width of the element before resizing
-   * @param aOldHeight [IN] the height of the element before resizing
-   * @param aNewWidth  [IN] the width of the element after resizing
-   * @param aNewHeight [IN] the height of the element after resizing
-   */
-  void onEndResizing(in nsIDOMElement aElement,
-                     in long aOldWidth, in long aOldHeight,
-                     in long aNewWidth, in long aNewHeight);
-
-};
--- a/editor/nsIHTMLObjectResizer.idl
+++ b/editor/nsIHTMLObjectResizer.idl
@@ -1,18 +1,16 @@
 /* -*- 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 "nsISupports.idl"
 #include "domstubs.idl"
 
-interface nsIHTMLObjectResizeListener;
-
 [scriptable, uuid(8b396020-69d3-451f-80c1-1a96a7da25a9)]
 
 interface nsIHTMLObjectResizer : nsISupports
 {
 %{C++
   typedef short EResizerLocation;
 %}
   const short eTopLeft = 0;
@@ -69,25 +67,10 @@ interface nsIHTMLObjectResizer : nsISupp
   void mouseUp(in long aX, in long aY,
                in nsIDOMElement aTarget);
 
   /**
    * event callback when the mouse pointer is moved
    * @param aMouseEvent [IN] the event
    */
   void mouseMove(in nsIDOMEvent aMouseEvent);
-
-  /* Event Listeners */
-
-  /**
-   * Creates a resize listener that can be used to get notifications
-   * that the user started to resize an object or finalized such an operation
-   * @param aListener [IN] an instance of nsIHTMLObjectResizeListener
-   */
-  void addObjectResizeEventListener(in nsIHTMLObjectResizeListener aListener);
-
-  /**
-   * Deletes a resize listener
-   * @param aListener [IN] an instance of nsIHTMLObjectResizeListener
-   */
-  void removeObjectResizeEventListener(in nsIHTMLObjectResizeListener aListener);
 };