Bug 1485927 - Get rid of nsIHTMLObjectResizers.resizedObject r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 11 Sep 2018 05:02:30 +0000
changeset 491390 bd66e63ffd37f43803e35f7188e1cb79a93d1141
parent 491389 1133e8b0513781b8e4bde79e41678b0551fc00a2
child 491391 e3ba99143d2fc50c5963a573f145602543a0fd20
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1485927
milestone64.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 1485927 - Get rid of nsIHTMLObjectResizers.resizedObject r=m_kato nsIHTMLObjectResizers.resizedObject is used only for avoiding warning of nsIHTMLObjectResizers.refreshResizers() if resizers are not visible. Therefore, if we remove the unnecessary warnings, we can get rid of the attribute. Differential Revision: https://phabricator.services.mozilla.com/D5427
editor/libeditor/HTMLEditorObjectResizer.cpp
editor/nsIHTMLObjectResizer.idl
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -248,29 +248,29 @@ HTMLEditor::SetAllResizersPosition()
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLEditor::RefreshResizers()
 {
-  if (NS_WARN_IF(!mResizedObject)) {
-    return NS_OK;
-  }
   nsresult rv = RefreshResizersInternal();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 nsresult
 HTMLEditor::RefreshResizersInternal()
 {
+  // Don't warn even if resizers are not visible since script cannot check
+  // if they are visible and this is non-virtual method.  So, the cost of
+  // calling this can be ignored.
   if (!mResizedObject) {
     return NS_OK;
   }
 
   nsresult rv = GetPositionAndDimensions(*mResizedObject,
                                          mResizedObjectX,
                                          mResizedObjectY,
                                          mResizedObjectWidth,
@@ -297,17 +297,18 @@ HTMLEditor::RefreshResizersInternal()
   }
   return NS_OK;
 }
 
 nsresult
 HTMLEditor::ShowResizersInternal(Element& aResizedElement)
 {
   // When we have visible resizers, we cannot show new resizers.
-  // So, the caller should call HideResizersInternal() first.
+  // So, the caller should call HideResizersInternal() first if this
+  // returns error.
   if (NS_WARN_IF(mResizedObject)) {
     return NS_ERROR_UNEXPECTED;
   }
 
   nsCOMPtr<nsIContent> parentContent = aResizedElement.GetParent();
   if (NS_WARN_IF(!parentContent)) {
     return NS_ERROR_FAILURE;
   }
@@ -515,17 +516,20 @@ HTMLEditor::HideResizers()
     return rv;
   }
   return NS_OK;
 }
 
 nsresult
 HTMLEditor::HideResizersInternal()
 {
-  if (NS_WARN_IF(!mResizedObject)) {
+  // Don't warn even if resizers are visible since script cannot check
+  // if they are visible and this is non-virtual method.  So, the cost of
+  // calling this can be ignored.
+  if (!mResizedObject) {
     return NS_OK;
   }
 
   // get the presshell's document observer interface.
   nsCOMPtr<nsIPresShell> presShell = GetPresShell();
   NS_WARNING_ASSERTION(presShell, "There is no presShell");
   // We allow the pres shell to be null; when it is, we presume there
   // are no document observers to notify, but we still want to
@@ -1141,24 +1145,16 @@ HTMLEditor::SetFinalSize(int32_t aX,
   mResizedObjectWidth  = width;
   mResizedObjectHeight = height;
 
   DebugOnly<nsresult> rv = RefreshResizersInternal();
   NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed ot refresh resizers");
 }
 
 NS_IMETHODIMP
-HTMLEditor::GetResizedObject(Element** aResizedObject)
-{
-  RefPtr<Element> ret = mResizedObject;
-  ret.forget(aResizedObject);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 HTMLEditor::GetObjectResizingEnabled(bool* aIsObjectResizingEnabled)
 {
   *aIsObjectResizingEnabled = IsObjectResizerEnabled();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLEditor::SetObjectResizingEnabled(bool aObjectResizingEnabled)
--- a/editor/nsIHTMLObjectResizer.idl
+++ b/editor/nsIHTMLObjectResizer.idl
@@ -19,21 +19,16 @@ interface nsIHTMLObjectResizer : nsISupp
   const short eTopRight = 2;
   const short eLeft = 3;
   const short eRight = 4;
   const short eBottomLeft = 5;
   const short eBottom = 6;
   const short eBottomRight = 7;
 
   /**
-   * the element currently displaying resizers
-   */
-  readonly attribute Element resizedObject;
-
-  /**
    * a boolean indicating if object resizing is enabled in the editor
    */
   attribute boolean objectResizingEnabled;
 
   /**
    * Hide resizers if they are visible.  If this is called while there is no
    * visible resizers, this does not throw exception, just does nothing.
    */