Bug 1455674 part 5. Remove remaining IDL use of nsIDOMElement in editor. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 26 Apr 2018 23:35:18 -0400
changeset 469541 f283a9ca271bf70ae1373a3382b22e2bc75fc754
parent 469540 15071a2629d9add643a5122b74dbb58d9e490c20
child 469542 ae8e688883d564331a142a075b801046dda18312
push id9171
push userryanvm@gmail.com
push dateSat, 28 Apr 2018 10:35:57 +0000
treeherdermozilla-beta@89f3ba72015a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1455674
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455674 part 5. Remove remaining IDL use of nsIDOMElement in editor. r=masayuki
editor/libeditor/HTMLAbsPositionEditor.cpp
editor/libeditor/HTMLEditor.h
editor/libeditor/HTMLEditorObjectResizer.cpp
editor/nsIHTMLAbsPosEditor.idl
editor/nsIHTMLObjectResizer.idl
--- a/editor/libeditor/HTMLAbsPositionEditor.cpp
+++ b/editor/libeditor/HTMLAbsPositionEditor.cpp
@@ -569,26 +569,16 @@ HTMLEditor::SetTopAndLeft(Element& aElem
                           int32_t aX,
                           int32_t aY)
 {
   AutoPlaceholderBatch batchIt(this);
   mCSSEditUtils->SetCSSPropertyPixels(aElement, *nsGkAtoms::left, aX);
   mCSSEditUtils->SetCSSPropertyPixels(aElement, *nsGkAtoms::top, aY);
 }
 
-// self-explanatory
-NS_IMETHODIMP
-HTMLEditor::GetPositionedElement(nsIDOMElement** aReturn)
-{
-  nsCOMPtr<nsIDOMElement> ret =
-    static_cast<nsIDOMElement*>(GetAsDOMNode(GetPositionedElement()));
-  ret.forget(aReturn);
-  return NS_OK;
-}
-
 nsresult
 HTMLEditor::GetTemporaryStyleForFocusedPositionedElement(Element& aElement,
                                                          nsAString& aReturn)
 {
   // we are going to outline the positioned element and bring it to the
   // front to overlap any other element intersecting with it. But
   // first, let's see what's the background and foreground colors of the
   // positioned element.
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -1313,17 +1313,17 @@ protected:
   ManualNACPtr mBottomHandle;
   ManualNACPtr mBottomRightHandle;
 
   nsCOMPtr<Element> mActivatedHandle;
 
   ManualNACPtr mResizingShadow;
   ManualNACPtr mResizingInfo;
 
-  nsCOMPtr<Element> mResizedObject;
+  RefPtr<Element> mResizedObject;
 
   nsCOMPtr<nsIDOMEventListener>  mMouseMotionListenerP;
   nsCOMPtr<nsIDOMEventListener>  mResizeEventListenerP;
 
   int32_t mOriginalX;
   int32_t mOriginalY;
 
   int32_t mResizedObjectX;
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -236,26 +236,22 @@ HTMLEditor::RefreshResizers()
   NS_ENSURE_SUCCESS(rv, rv);
   rv = SetAllResizersPosition();
   NS_ENSURE_SUCCESS(rv, rv);
   return SetShadowPosition(mResizingShadow, mResizedObject,
                            mResizedObjectX, mResizedObjectY);
 }
 
 NS_IMETHODIMP
-HTMLEditor::ShowResizers(nsIDOMElement* aResizedElement)
+HTMLEditor::ShowResizers(Element* aResizedElement)
 {
   if (NS_WARN_IF(!aResizedElement)) {
    return NS_ERROR_NULL_POINTER;
   }
-  nsCOMPtr<Element> element = do_QueryInterface(aResizedElement);
-  if (NS_WARN_IF(!element)) {
-    return NS_ERROR_FAILURE;
-  }
-  return ShowResizers(*element);
+  return ShowResizers(*aResizedElement);
 }
 
 nsresult
 HTMLEditor::ShowResizers(Element& aResizedElement)
 {
   nsresult rv = ShowResizersInner(aResizedElement);
   if (NS_FAILED(rv)) {
     HideResizers();
@@ -929,19 +925,19 @@ HTMLEditor::SetFinalSize(int32_t aX,
   // keep track of that size
   mResizedObjectWidth  = width;
   mResizedObjectHeight = height;
 
   RefreshResizers();
 }
 
 NS_IMETHODIMP
-HTMLEditor::GetResizedObject(nsIDOMElement** aResizedObject)
+HTMLEditor::GetResizedObject(Element** aResizedObject)
 {
-  nsCOMPtr<nsIDOMElement> ret = static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject));
+  RefPtr<Element> ret = mResizedObject;
   ret.forget(aResizedObject);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLEditor::GetObjectResizingEnabled(bool* aIsObjectResizingEnabled)
 {
   *aIsObjectResizingEnabled = mIsObjectResizingEnabled;
--- a/editor/nsIHTMLAbsPosEditor.idl
+++ b/editor/nsIHTMLAbsPosEditor.idl
@@ -2,26 +2,19 @@
 /* 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, builtinclass, uuid(91375f52-20e6-4757-9835-eb04fabe5498)]
-
 interface nsIHTMLAbsPosEditor : nsISupports
 {
   /**
-   * this contains the absolutely positioned element currently edited
-   * or null
-   */
-  readonly attribute nsIDOMElement positionedElement;
-
-  /**
    * true if Absolute Positioning handling is enabled in the editor
    */
   attribute boolean absolutePositioningEnabled;
 
 
   /* Utility methods */
 
   /**
--- a/editor/nsIHTMLObjectResizer.idl
+++ b/editor/nsIHTMLObjectResizer.idl
@@ -1,18 +1,19 @@
 /* -*- 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"
 
+webidl Element;
+
 [scriptable, builtinclass, uuid(8b396020-69d3-451f-80c1-1a96a7da25a9)]
-
 interface nsIHTMLObjectResizer : nsISupports
 {
 %{C++
   typedef short EResizerLocation;
 %}
   const short eTopLeft = 0;
   const short eTop = 1;
   const short eTopRight = 2;
@@ -20,28 +21,28 @@ interface nsIHTMLObjectResizer : nsISupp
   const short eRight = 4;
   const short eBottomLeft = 5;
   const short eBottom = 6;
   const short eBottomRight = 7;
 
   /**
    * the element currently displaying resizers
    */
-  readonly attribute nsIDOMElement resizedObject;
+  readonly attribute Element resizedObject;
 
   /**
    * a boolean indicating if object resizing is enabled in the editor
    */
   attribute boolean objectResizingEnabled;
 
   /**
    * Shows active resizers around an element's frame
    * @param aResizedElement [IN] a DOM Element
    */
-  void showResizers(in nsIDOMElement aResizedElement);
+  void showResizers(in Element aResizedElement);
 
   /**
    * Hide resizers if they are visible
    */
   void hideResizers();
 
   /**
    * Refresh visible resizers