Bug 371593. Expose nsIAccessNode::scrollTo(). Patch by Alexander Surkov. r=aaronlev

This commit is contained in:
aaronleventhal%moonset.net 2007-02-28 14:21:41 +00:00
Родитель b8f6f98e2b
Коммит 30fbfa5ecc
3 изменённых файлов: 28 добавлений и 14 удалений

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

@ -55,7 +55,7 @@ interface nsIAccessibleDocument;
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(46820F9B-3088-4046-AB0F-56FDACDC7A82)]
[scriptable, uuid(0bd7ccde-486d-483c-a6df-79869cb6647d)]
interface nsIAccessNode : nsISupports
{
/**
@ -115,6 +115,14 @@ interface nsIAccessNode : nsISupports
*/
readonly attribute DOMString innerHTML;
/**
* Makes an object visible on screen.
*
* @param topLeft - if false then it will scroll the shortest distance it
* needs to put the element on-screen.
*/
void scrollTo(in boolean aTopLeft);
/**
* The OS window handle for the window this node
* is being displayed in.

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

@ -352,6 +352,22 @@ nsAccessNode::GetInnerHTML(nsAString& aInnerHTML)
return domNSElement->GetInnerHTML(aInnerHTML);
}
NS_IMETHODIMP
nsAccessNode::ScrollTo(PRBool aTopLeft)
{
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> shell(GetPresShell());
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame *frame = GetFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
PRInt32 percent = aTopLeft ? NS_PRESSHELL_SCROLL_TOP :
NS_PRESSHELL_SCROLL_ANYWHERE;
return shell->ScrollFrameIntoView(frame, percent, percent);
}
nsresult
nsAccessNode::MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode)
{

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

@ -314,19 +314,9 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties(
STDMETHODIMP nsAccessNodeWrap::scrollTo(/* [in] */ boolean aScrollTopLeft)
{
nsCOMPtr<nsIPresShell> shell(GetPresShell());
if (!mDOMNode || !shell) {
return E_FAIL;
}
nsIFrame *frame = GetFrame();
if (frame) {
PRInt32 percent = NS_PRESSHELL_SCROLL_ANYWHERE;
if (aScrollTopLeft)
percent = 0;
return shell->ScrollFrameIntoView(frame, percent, percent);
}
nsresult rv = ScrollTo(aScrollTopLeft);
if (NS_SUCCEEDED(rv))
return S_OK;
return E_FAIL;
}