when document is focused but textarea is not then caretOffset on textarea returns the focus position of selection.
Created attachment 595669 [details] [diff] [review] patch new portions of ifs unfortunately
note, the patch enables tests disabled in bug 510128
(In reply to alexander :surkov from comment #2) > note, the patch enables tests disabled in bug 510128 and I think this bug is a fix for bug 510128
some details: Since elements like input or textarea has own selection controller then selection we get is different from documents one. Since selection is turned into caret position then we can get result different from -1 for these controls if document is focused (see eContainedByFocus check in nsHyperTextAccessible::GetCaretOffset).
Comment on attachment 595669 [details] [diff] [review] patch its kind of weird but I think this makes sense. We should look at ways to make the check if we're focusable faster.