Bug 254011. After focusing an element with a negative tabindex, tab relative to it's position in doc. r=bryner, sr=jst

This commit is contained in:
aaronleventhal%moonset.net 2004-08-03 12:52:42 +00:00
Родитель 403166f3a8
Коммит 37fd617b34
2 изменённых файлов: 4 добавлений и 15 удалений

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

@ -3167,7 +3167,9 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
}
if (aStart) {
TabIndexFrom(aStart, &mCurrentTabIndex);
if (aStart->HasAttr(kNameSpaceID_None, nsHTMLAtoms::tabindex)) {
aStart->IsFocusable(&mCurrentTabIndex);
}
} else if (!mCurrentFocus) { // Get tabindex ready
if (aForward) {
mCurrentTabIndex = docHasFocus && selectionFrame ? 0 : 1;
@ -3182,7 +3184,7 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
nsIFrame* nextFocusFrame;
if (aForward || !docHasFocus || selectionFrame)
GetNextTabbableContent(rootContent, startContent, curFocusFrame,
aForward, ignoreTabIndex,
aForward, ignoreTabIndex || mCurrentTabIndex < 0,
getter_AddRefs(nextFocus), &nextFocusFrame);
// Clear out mCurrentTabIndex. It has a garbage value because of GetNextTabbableContent()'s side effects
@ -3375,18 +3377,6 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
return NS_OK;
}
void
nsEventStateManager::TabIndexFrom(nsIContent *aFrom, PRInt32 *aOutIndex)
{
nsAutoString tabIndexStr;
aFrom->GetAttr(kNameSpaceID_None, nsHTMLAtoms::tabindex, tabIndexStr);
if (!tabIndexStr.IsEmpty()) {
PRInt32 ec, tabIndexVal = tabIndexStr.ToInteger(&ec);
if (NS_SUCCEEDED(ec))
*aOutIndex = tabIndexVal;
}
}
nsresult
nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
nsIContent* aStartContent,

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

@ -174,7 +174,6 @@ protected:
nsIFrame** aResultFrame);
nsIContent *GetNextTabbableMapArea(PRBool aForward, nsIContent *imageContent);
void TabIndexFrom(nsIContent *aFrom, PRInt32 *aOutIndex);
PRInt32 GetNextTabIndex(nsIContent* aParent, PRBool foward);
nsresult SendFocusBlur(nsPresContext* aPresContext, nsIContent *aContent, PRBool aEnsureWindowHasFocus);
PRBool CheckDisabled(nsIContent* aContent);