зеркало из https://github.com/mozilla/pjs.git
bug277880 GOK Can't UI Grab to browser tabs
r = pkwarren sr = henry.jia
This commit is contained in:
Родитель
b4a99b4032
Коммит
6d4321c037
|
@ -86,38 +86,35 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULSelectableAccessible, nsAccessible, nsIAccessi
|
||||||
|
|
||||||
NS_IMETHODIMP nsXULSelectableAccessible::ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState)
|
NS_IMETHODIMP nsXULSelectableAccessible::ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState)
|
||||||
{
|
{
|
||||||
|
nsCOMPtr<nsIAccessible> childAcc;
|
||||||
|
GetChildAt(aIndex, getter_AddRefs(childAcc));
|
||||||
|
nsCOMPtr<nsIAccessNode> accNode = do_QueryInterface(childAcc);
|
||||||
|
NS_ENSURE_TRUE(accNode, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMNode> childNode;
|
||||||
|
accNode->GetDOMNode(getter_AddRefs(childNode));
|
||||||
|
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(childNode));
|
||||||
|
NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
*aSelState = PR_FALSE;
|
*aSelState = PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
|
|
||||||
if (xulMultiSelect) {
|
|
||||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
|
||||||
xulMultiSelect->GetChildNodes(getter_AddRefs(nodeList));
|
|
||||||
if (nodeList) {
|
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
|
||||||
nodeList->Item(aIndex, getter_AddRefs(node));
|
|
||||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(node));
|
|
||||||
item->GetSelected(aSelState);
|
|
||||||
if (eSelection_Add == aMethod && !(*aSelState))
|
|
||||||
xulMultiSelect->AddItemToSelection(item);
|
|
||||||
else if (eSelection_Remove == aMethod && (*aSelState))
|
|
||||||
xulMultiSelect->RemoveItemFromSelection(item);
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMXULSelectControlElement> xulSelect(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIDOMXULSelectControlElement> xulSelect(do_QueryInterface(mDOMNode));
|
||||||
if (xulSelect) {
|
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
|
||||||
nsresult rv = NS_OK;
|
|
||||||
PRInt32 selIndex;
|
if (xulSelect || xulMultiSelect) {
|
||||||
xulSelect->GetSelectedIndex(&selIndex);
|
item->GetSelected(aSelState);
|
||||||
if (selIndex == aIndex)
|
if (eSelection_Add == aMethod && !(*aSelState)) {
|
||||||
*aSelState = PR_TRUE;
|
if (xulMultiSelect)
|
||||||
if (eSelection_Add == aMethod && !(*aSelState))
|
return xulMultiSelect->AddItemToSelection(item);
|
||||||
rv = xulSelect->SetSelectedIndex(aIndex);
|
else if (xulSelect)
|
||||||
else if (eSelection_Remove == aMethod && (*aSelState)) {
|
return xulSelect->SetSelectedItem(item);
|
||||||
rv = xulSelect->SetSelectedIndex(-1);
|
}
|
||||||
}
|
else if (eSelection_Remove == aMethod && (*aSelState)) {
|
||||||
return rv;
|
if (xulMultiSelect)
|
||||||
|
return xulMultiSelect->RemoveItemFromSelection(item);
|
||||||
|
else if (xulSelect)
|
||||||
|
return xulSelect->SetSelectedIndex(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -127,6 +127,15 @@ NS_IMETHODIMP nsXULTabAccessible::GetState(PRUint32 *_retval)
|
||||||
*_retval |= STATE_FOCUSABLE;
|
*_retval |= STATE_FOCUSABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check whether the tab is selected
|
||||||
|
*_retval |= STATE_SELECTABLE;
|
||||||
|
*_retval &= ~STATE_SELECTED;
|
||||||
|
nsCOMPtr<nsIDOMXULSelectControlItemElement> tab(do_QueryInterface(mDOMNode));
|
||||||
|
if (tab) {
|
||||||
|
PRBool selected = PR_FALSE;
|
||||||
|
if (NS_SUCCEEDED(tab->GetSelected(&selected)) && selected)
|
||||||
|
*_retval |= STATE_SELECTED;
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +231,7 @@ NS_IMETHODIMP nsXULTabPanelsAccessible::GetName(nsAString& _retval)
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
nsXULTabsAccessible::nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
nsXULTabsAccessible::nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||||
nsAccessibleWrap(aNode, aShell)
|
nsXULSelectableAccessible(aNode, aShell)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
// NOTE: alphabetically ordered
|
// NOTE: alphabetically ordered
|
||||||
#include "nsBaseWidgetAccessible.h"
|
#include "nsBaseWidgetAccessible.h"
|
||||||
|
#include "nsXULSelectAccessible.h"
|
||||||
|
|
||||||
/** An individual tab */
|
/** An individual tab */
|
||||||
class nsXULTabAccessible : public nsLeafAccessible
|
class nsXULTabAccessible : public nsLeafAccessible
|
||||||
|
@ -90,7 +91,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** merely a container of tab obejcts */
|
/** merely a container of tab obejcts */
|
||||||
class nsXULTabsAccessible : public nsAccessibleWrap
|
class nsXULTabsAccessible : public nsXULSelectableAccessible
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче