зеркало из https://github.com/mozilla/pjs.git
Bug 366340 List items should not have SHOWING state when they are scrolled off
patch by Nian.Liu r=surkov.alexander
This commit is contained in:
Родитель
cc5c18cac8
Коммит
3f261b3e05
|
@ -551,27 +551,14 @@ nsHTMLSelectOptionAccessible::GetAttributesInternal(nsIPersistentProperties *aAt
|
|||
|
||||
nsIFrame* nsHTMLSelectOptionAccessible::GetBoundsFrame()
|
||||
{
|
||||
nsCOMPtr<nsIContent> selectContent(do_QueryInterface(mDOMNode));
|
||||
|
||||
while (selectContent && selectContent->Tag() != nsAccessibilityAtoms::select) {
|
||||
selectContent = selectContent->GetParent();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> selectNode(do_QueryInterface(selectContent));
|
||||
if (selectNode) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsIAccessible> selAcc;
|
||||
accService->GetAccessibleFor(selectNode, getter_AddRefs(selAcc));
|
||||
if (selAcc) {
|
||||
PRUint32 state = State(selAcc);
|
||||
if (state & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
||||
if (!presShell) {
|
||||
return nsnull;
|
||||
}
|
||||
return presShell->GetPrimaryFrameFor(selectContent);
|
||||
}
|
||||
PRUint32 state;
|
||||
nsCOMPtr<nsIContent> content = GetSelectState(&state);
|
||||
if (state & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
||||
if (!presShell) {
|
||||
return nsnull;
|
||||
}
|
||||
return presShell->GetPrimaryFrameFor(content);
|
||||
}
|
||||
|
||||
return nsAccessible::GetBoundsFrame();
|
||||
|
@ -621,6 +608,13 @@ nsHTMLSelectOptionAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
*aState |= nsIAccessibleStates::STATE_SELECTABLE |
|
||||
nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
|
||||
// remove STATE_SHOWING if parent is STATE_COLLAPSED
|
||||
PRUint32 state;
|
||||
GetSelectState(&state);
|
||||
if (state & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
*aState |= nsIAccessibleStates::STATE_OFFSCREEN;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -787,6 +781,29 @@ void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibl
|
|||
privateMultiSelect->FireToolkitEvent(eventType, optionAccessible, nsnull);
|
||||
}
|
||||
|
||||
nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
while (content && content->Tag() != nsAccessibilityAtoms::select) {
|
||||
content = content->GetParent();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> selectNode(do_QueryInterface(content));
|
||||
if (selectNode) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
|
||||
if (accService) {
|
||||
nsCOMPtr<nsIAccessible> selAcc;
|
||||
accService->GetAccessibleFor(selectNode, getter_AddRefs(selAcc));
|
||||
if (selAcc) {
|
||||
PRUint32 dummy;
|
||||
selAcc->GetFinalState(aState, &dummy);
|
||||
return content;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/** ----- nsHTMLSelectOptGroupAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
|
|
|
@ -169,6 +169,15 @@ public:
|
|||
nsIFrame* GetBoundsFrame();
|
||||
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsIDOMNode **aFocusedOptionNode);
|
||||
static void SelectionChangedIfOption(nsIContent *aPossibleOption);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Get Select element's accessible state
|
||||
* @param aState, Select element state
|
||||
* @return Select element content, returns null if not avaliable
|
||||
*/
|
||||
nsIContent* GetSelectState(PRUint32* aState);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче