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
This commit is contained in:
Cameron McCormack 2018-01-11 12:38:01 +08:00
parent ce7231c196
commit 3ef428b913
4 changed files with 16 additions and 20 deletions

View File

@ -72,6 +72,7 @@ namespace InspectorUtils {
boolean hasPseudoClassLock(Element element, DOMString pseudoClass);
void clearPseudoClassLocks(Element element);
[Throws] void parseStyleSheet(CSSStyleSheet sheet, DOMString input);
void scrollElementIntoView(Element element);
};
dictionary PropertyNamesOptions {

View File

@ -259,6 +259,12 @@ public:
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);

View File

@ -1120,24 +1120,20 @@ InspectorUtils::ParseStyleSheet(GlobalObject& aGlobalObject,
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

View File

@ -20,13 +20,6 @@ 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++