Comment 40 for bug 602877

Revision history for this message
In , Alexander Surkov (surkov-alexander) wrote :

(From update of attachment 448030)

>+ /* Now that selection is done, move the focus to the selection. */
>+ nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
>+ if (fm) {
>+ nsCOMPtr<nsIPresShell> shell = GetPresShell();
>+ NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
>+ nsCOMPtr<nsIDocument> doc = shell->GetDocument();
>+ NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);

It's preferable to add GetDocumentNode() method to nsAccessNode and use it here

>+ <script type="application/javascript">
>+ function testFocus(aID, aAcc, aSelectedBefore, aSelectedAfter)
>+ {

nit: you could merge aID and aAcc

>+ is(aAcc.selected, aSelectedBefore,
>+ "Wrong selected state before focus for ID " + aID + "!");
>+ document.getElementById(aID).focus();
>+ is(aAcc.selected, aSelectedAfter,
>+ "Wrong seleccted state after focus for ID " + aID + "!");
>+ }
>+
>+ function doTest()
>+ {
>+ //////////////////////////////////////////////////////////////////////////
>+ // normal hyperlink
>+ var link4 = getAccessible("link4", [nsIAccessibleHyperLink]);
>+ testFocus("link4", link4, false, true);
>+ heading1 = getAccessible("heading1", [nsIAccessibleText]);
>+ heading1.caretOffset = 3;
>+ testFocus("link4", link4, false, true);

I'm not sure what you test here, it looks like you ensure caretOffset removes the focus from link. Can you describe please what you want to check here?