diff --git a/mozilla/accessible/public/nsIAccessNode.idl b/mozilla/accessible/public/nsIAccessNode.idl index 1d24dba61cd..92093e6e805 100644 --- a/mozilla/accessible/public/nsIAccessNode.idl +++ b/mozilla/accessible/public/nsIAccessNode.idl @@ -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. diff --git a/mozilla/accessible/src/base/nsAccessNode.cpp b/mozilla/accessible/src/base/nsAccessNode.cpp index 2ceebd719d7..8c024d7ac5c 100755 --- a/mozilla/accessible/src/base/nsAccessNode.cpp +++ b/mozilla/accessible/src/base/nsAccessNode.cpp @@ -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 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) { diff --git a/mozilla/accessible/src/msaa/nsAccessNodeWrap.cpp b/mozilla/accessible/src/msaa/nsAccessNodeWrap.cpp index caca3136763..3dde4318fa4 100644 --- a/mozilla/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/mozilla/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -314,19 +314,9 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties( STDMETHODIMP nsAccessNodeWrap::scrollTo(/* [in] */ boolean aScrollTopLeft) { - nsCOMPtr 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; }