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: 9jTqGDkbcFE
--- 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"
%}