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
Родитель 12aebaafa2
Коммит ec2abb5885
7 изменённых файлов: 20 добавлений и 29 удалений

Просмотреть файл

@ -252,31 +252,6 @@ nsAccessNode::IsPrimaryForNode() const
return true; 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 void
nsAccessNode::Language(nsAString& aLanguage) nsAccessNode::Language(nsAString& aLanguage)
{ {

Просмотреть файл

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

Просмотреть файл

@ -2240,7 +2240,7 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
NS_IMETHODIMP NS_IMETHODIMP
nsAccessible::ScrollTo(PRUint32 aHow) nsAccessible::ScrollTo(PRUint32 aHow)
{ {
nsAccessNode::ScrollTo(aHow); nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aHow);
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -726,6 +726,17 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn)
nsGkAtoms::_true, eCaseMatters); 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 // nsAccessibleDOMStringList
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -335,6 +335,12 @@ public:
*/ */
static bool IsColumnHidden(nsITreeColumn *aColumn); 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. * Return true if the given node is table header element.
*/ */

Просмотреть файл

@ -397,7 +397,7 @@ __try {
aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT : aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT :
nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT; nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT;
ScrollTo(scrollType); nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, scrollType);
return S_OK; return S_OK;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

Просмотреть файл

@ -1229,7 +1229,7 @@ __try {
if (IsDefunct()) if (IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
nsAccessNode::ScrollTo(aScrollType); nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aScrollType);
return S_OK; return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }