bug277880 GOK Can't UI Grab to browser tabs

r  = pkwarren
sr = henry.jia
This commit is contained in:
louie.zhao%sun.com 2005-02-01 03:43:37 +00:00
Родитель b4a99b4032
Коммит 6d4321c037
3 изменённых файлов: 38 добавлений и 31 удалений

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

@ -86,38 +86,35 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULSelectableAccessible, nsAccessible, nsIAccessi
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;
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));
if (xulSelect) {
nsresult rv = NS_OK;
PRInt32 selIndex;
xulSelect->GetSelectedIndex(&selIndex);
if (selIndex == aIndex)
*aSelState = PR_TRUE;
if (eSelection_Add == aMethod && !(*aSelState))
rv = xulSelect->SetSelectedIndex(aIndex);
else if (eSelection_Remove == aMethod && (*aSelState)) {
rv = xulSelect->SetSelectedIndex(-1);
}
return rv;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
if (xulSelect || xulMultiSelect) {
item->GetSelected(aSelState);
if (eSelection_Add == aMethod && !(*aSelState)) {
if (xulMultiSelect)
return xulMultiSelect->AddItemToSelection(item);
else if (xulSelect)
return xulSelect->SetSelectedItem(item);
}
else if (eSelection_Remove == aMethod && (*aSelState)) {
if (xulMultiSelect)
return xulMultiSelect->RemoveItemFromSelection(item);
else if (xulSelect)
return xulSelect->SetSelectedIndex(-1);
}
}
return NS_ERROR_FAILURE;

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

@ -127,6 +127,15 @@ NS_IMETHODIMP nsXULTabAccessible::GetState(PRUint32 *_retval)
*_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;
}
@ -222,7 +231,7 @@ NS_IMETHODIMP nsXULTabPanelsAccessible::GetName(nsAString& _retval)
/** Constructor */
nsXULTabsAccessible::nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessibleWrap(aNode, aShell)
nsXULSelectableAccessible(aNode, aShell)
{
}

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

@ -41,6 +41,7 @@
// NOTE: alphabetically ordered
#include "nsBaseWidgetAccessible.h"
#include "nsXULSelectAccessible.h"
/** An individual tab */
class nsXULTabAccessible : public nsLeafAccessible
@ -90,7 +91,7 @@ protected:
};
/** merely a container of tab obejcts */
class nsXULTabsAccessible : public nsAccessibleWrap
class nsXULTabsAccessible : public nsXULSelectableAccessible
{
public:
nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);