Bug 741683 - move nsAccessNodeScrollTo to nsCoreUtils, r=surkov, m=hub

Bug 741683 - move nsAccessNodeScrollTo to nsCoreUtils, r=surkov, m=hub
This commit is contained in:
Mark Capella 2012-04-09 17:39:00 -07:00
parent ca9f2eb792
commit d474f387fc
7 changed files with 20 additions and 29 deletions

View File

@ -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)
{

View File

@ -152,7 +152,6 @@ public:
* Interface methods on nsIAccessible shared with ISimpleDOM.
*/
void Language(nsAString& aLocale);
void ScrollTo(PRUint32 aType);
protected:
nsPresContext* GetPresContext();

View File

@ -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;
}

View File

@ -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
////////////////////////////////////////////////////////////////////////////////

View File

@ -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.
*/

View File

@ -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())) { }

View File

@ -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())) { }