Bug 1427419 - Part 26: Move inIDOMUtils.scrollElementIntoView to InspectorUtils. r=bz
authorCameron McCormack <cam@mcc.id.au>
Thu, 11 Jan 2018 12:38:01 +0800
changeset 453005 9fd3dcaae286fceb6fb2428cfe7ec5779cacf560
parent 453004 3196880bdf5d68ca71e3a1c601afd3df9e3acaf6
child 453006 4446129c5aba5834a8717e1d8e86e4b2c629897b
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1427419
milestone59.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 1427419 - Part 26: Move inIDOMUtils.scrollElementIntoView to InspectorUtils. r=bz This is unused in mozilla-central but still used in comm-central. MozReview-Commit-ID: HlJT7dthI41
dom/webidl/InspectorUtils.webidl
layout/inspector/InspectorUtils.h
layout/inspector/inDOMUtils.cpp
layout/inspector/inIDOMUtils.idl
--- a/dom/webidl/InspectorUtils.webidl
+++ b/dom/webidl/InspectorUtils.webidl
@@ -67,16 +67,17 @@ namespace InspectorUtils {
   sequence<DOMString> getCSSPseudoElementNames();
   void addPseudoClassLock(Element element,
                           DOMString pseudoClass,
                           optional boolean enabled = true);
   void removePseudoClassLock(Element element, DOMString pseudoClass);
   boolean hasPseudoClassLock(Element element, DOMString pseudoClass);
   void clearPseudoClassLocks(Element element);
   [Throws] void parseStyleSheet(CSSStyleSheet sheet, DOMString input);
+  void scrollElementIntoView(Element element);
 };
 
 dictionary PropertyNamesOptions {
   boolean includeAliases = false;
 };
 
 dictionary InspectorRGBATuple {
   /*
--- a/layout/inspector/InspectorUtils.h
+++ b/layout/inspector/InspectorUtils.h
@@ -254,16 +254,22 @@ public:
    * @param DOMString aInput
    *        The new source string for the style sheet.
    */
   static void ParseStyleSheet(GlobalObject& aGlobal,
                               StyleSheet& aSheet,
                               const nsAString& aInput,
                               ErrorResult& aRv);
 
+  /**
+   * Scroll an element completely into view, if possible.
+   * This is similar to ensureElementIsVisible but for all ancestors.
+   */
+  static void ScrollElementIntoView(GlobalObject& aGlobal, Element& aElement);
+
 private:
   static already_AddRefed<nsStyleContext>
     GetCleanStyleContextForElement(Element* aElement, nsAtom* aPseudo);
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -1115,29 +1115,25 @@ InspectorUtils::ParseStyleSheet(GlobalOb
       aRv.Throw(rv);
     }
     return;
   }
 
   aRv.Throw(NS_ERROR_INVALID_POINTER);
 }
 
-} // namespace dom
-} // namespace mozilla
-
-NS_IMETHODIMP
-inDOMUtils::ScrollElementIntoView(nsIDOMElement *aElement)
+void
+InspectorUtils::ScrollElementIntoView(GlobalObject& aGlobalObject,
+                                      Element& aElement)
 {
-  nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
-  NS_ENSURE_ARG_POINTER(content);
-
-  nsIPresShell* presShell = content->OwnerDoc()->GetShell();
+  nsIPresShell* presShell = aElement.OwnerDoc()->GetShell();
   if (!presShell) {
-    return NS_OK;
+    return;
   }
 
-  presShell->ScrollContentIntoView(content,
+  presShell->ScrollContentIntoView(&aElement,
                                    nsIPresShell::ScrollAxis(),
                                    nsIPresShell::ScrollAxis(),
                                    nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
+}
 
-  return NS_OK;
-}
+} // namespace dom
+} // namespace mozilla
--- a/layout/inspector/inIDOMUtils.idl
+++ b/layout/inspector/inIDOMUtils.idl
@@ -15,20 +15,13 @@ interface nsIDOMNode;
 interface nsIDOMNodeList;
 interface nsIDOMFontFaceList;
 interface nsIDOMRange;
 interface nsIDOMCSSStyleSheet;
 
 [scriptable, uuid(362e98c3-82c2-4ad8-8dcb-00e8e4eab497)]
 interface inIDOMUtils : nsISupports
 {
-  /**
-   * Scroll an element completely into view, if possible.
-   * This is similar to ensureElementIsVisible but for all ancestors.
-   *
-   * @param DOMElement aElement
-   */
-  void scrollElementIntoView(in nsIDOMElement aElement);
 };
 
 %{ C++
 #define IN_DOMUTILS_CONTRACTID "@mozilla.org/inspector/dom-utils;1"
 %}