diff --git a/accessible/src/base/nsAccessNode.cpp b/accessible/src/base/nsAccessNode.cpp index 2282a3b2806..f60034af218 100644 --- a/accessible/src/base/nsAccessNode.cpp +++ b/accessible/src/base/nsAccessNode.cpp @@ -252,31 +252,6 @@ nsAccessNode::IsPrimaryForNode() const return true; } -//////////////////////////////////////////////////////////////////////////////// -void -nsAccessNode::ScrollTo(PRUint32 aScrollType) -{ - if (!mDoc) - return; - - nsIPresShell* shell = mDoc->PresShell(); - if (!shell) - return; - - nsIFrame *frame = GetFrame(); - if (!frame) - return; - - nsIContent* content = frame->GetContent(); - if (!content) - return; - - nsIPresShell::ScrollAxis vertical, horizontal; - nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal); - shell->ScrollContentIntoView(content, vertical, horizontal, - nsIPresShell::SCROLL_OVERFLOW_HIDDEN); -} - void nsAccessNode::Language(nsAString& aLanguage) { diff --git a/accessible/src/base/nsAccessNode.h b/accessible/src/base/nsAccessNode.h index 4a9e7608dc3..b2b17cfd425 100644 --- a/accessible/src/base/nsAccessNode.h +++ b/accessible/src/base/nsAccessNode.h @@ -152,7 +152,6 @@ public: * Interface methods on nsIAccessible shared with ISimpleDOM. */ void Language(nsAString& aLocale); - void ScrollTo(PRUint32 aType); protected: nsPresContext* GetPresContext(); diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index cab5f266f52..da5d321cc68 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -2240,7 +2240,7 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex) NS_IMETHODIMP nsAccessible::ScrollTo(PRUint32 aHow) { - nsAccessNode::ScrollTo(aHow); + nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aHow); return NS_OK; } diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index 902ca2426ae..0e5cd1e81f3 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -726,6 +726,17 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn) nsGkAtoms::_true, eCaseMatters); } +void +nsCoreUtils::ScrollTo(nsIPresShell* aPresShell, nsIContent* aContent, + PRUint32 aScrollType) +{ + nsIPresShell::ScrollAxis vertical, horizontal; + ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal); + aPresShell->ScrollContentIntoView(aContent, vertical, horizontal, + nsIPresShell::SCROLL_OVERFLOW_HIDDEN); +} + + //////////////////////////////////////////////////////////////////////////////// // nsAccessibleDOMStringList //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/base/nsCoreUtils.h b/accessible/src/base/nsCoreUtils.h index a595fc867e5..547b0d94134 100644 --- a/accessible/src/base/nsCoreUtils.h +++ b/accessible/src/base/nsCoreUtils.h @@ -335,6 +335,12 @@ public: */ static bool IsColumnHidden(nsITreeColumn *aColumn); + /** + * Scroll content into view. + */ + static void ScrollTo(nsIPresShell* aPresShell, nsIContent* aContent, + PRUint32 aScrollType); + /** * Return true if the given node is table header element. */ diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 94a886a6e3e..56b4fb6be3b 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -397,7 +397,7 @@ __try { aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT : nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT; - ScrollTo(scrollType); + nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, scrollType); return S_OK; } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } diff --git a/accessible/src/msaa/nsAccessibleWrap.cpp b/accessible/src/msaa/nsAccessibleWrap.cpp index dc00a185785..30c370f42b4 100644 --- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -1229,7 +1229,7 @@ __try { if (IsDefunct()) return CO_E_OBJNOTCONNECTED; - nsAccessNode::ScrollTo(aScrollType); + nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aScrollType); return S_OK; } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }