Bug 357969 container xul element which doesn't have a xbl def under a deck frame has no accessible objectpatch by nian.liu at sun.com r=surkov.alexander sr=neil

This commit is contained in:
ginn.chen@sun.com 2007-05-15 02:46:06 -07:00
parent 40e2acb8c6
commit 7ba9ae2d81
10 changed files with 63 additions and 83 deletions

View File

@ -45,7 +45,7 @@
object. For that XBL binding of element should implement the interface.
*/
[scriptable, uuid(18797ea7-44cc-469e-8923-bd5d1c144461)]
[scriptable, uuid(7250d0f0-732d-4981-b73e-dd5d71b16183)]
interface nsIAccessibleProvider : nsISupports
{
/**
@ -87,21 +87,18 @@ interface nsIAccessibleProvider : nsISupports
/** A combination of a tabs object and a tabpanels object */
const long XULTabBox = 0x00001022;
/** The display area for a dialog or tabbrowser interface */
const long XULTabPanels = 0x00001023;
/** The collection of tab objects, useable in the TabBox and independant of
as well */
const long XULTabs = 0x00001024;
const long XULTabs = 0x00001023;
const long XULText = 0x00001025;
const long XULTextBox = 0x00001026;
const long XULTree = 0x00001027;
const long XULTreeColumns = 0x00001028;
const long XULTreeColumnitem = 0x00001029;
const long XULToolbar = 0x00001030;
const long XULToolbarSeparator = 0x00001031;
const long XULTooltip = 0x00001032;
const long XULText = 0x00001024;
const long XULTextBox = 0x00001025;
const long XULTree = 0x00001026;
const long XULTreeColumns = 0x00001027;
const long XULTreeColumnitem = 0x00001028;
const long XULToolbar = 0x00001029;
const long XULToolbarSeparator = 0x00001030;
const long XULTooltip = 0x00001031;
/**

View File

@ -71,10 +71,13 @@ ACCESSIBILITY_ATOM(headerContentLanguage, "content-language")
// Alphabetical list of frame types
ACCESSIBILITY_ATOM(areaFrame, "AreaFrame")
ACCESSIBILITY_ATOM(blockFrame, "BlockFrame")
ACCESSIBILITY_ATOM(boxFrame, "BoxFrame")
ACCESSIBILITY_ATOM(brFrame, "BRFrame")
ACCESSIBILITY_ATOM(deckFrame, "DeckFrame")
ACCESSIBILITY_ATOM(inlineBlockFrame, "InlineBlockFrame")
ACCESSIBILITY_ATOM(inlineFrame, "InlineFrame")
ACCESSIBILITY_ATOM(objectFrame, "ObjectFrame")
ACCESSIBILITY_ATOM(scrollFrame, "ScrollFrame")
ACCESSIBILITY_ATOM(textFrame, "TextFrame")
ACCESSIBILITY_ATOM(tableCellFrame, "TableCellFrame")
ACCESSIBILITY_ATOM(tableOuterFrame, "TableOuterFrame")

View File

@ -1268,6 +1268,10 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
}
}
if (!newAcc) {
GetAccessibleForDeckChildren(aNode, getter_AddRefs(newAcc));
}
// If no accessible, see if we need to create a generic accessible because
// of some property that makes this object interesting
// We don't do this for <body>, <html>, <window>, <dialog> etc. which
@ -1372,12 +1376,12 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
*aAccessible = nsnull;
nsCOMPtr<nsIAccessibleProvider> node(do_QueryInterface(aNode));
if (!node)
nsCOMPtr<nsIAccessibleProvider> accessibleProvider(do_QueryInterface(aNode));
if (!accessibleProvider)
return NS_OK;
PRInt32 type;
nsresult rv = node->GetAccessibleType(&type);
nsresult rv = accessibleProvider->GetAccessibleType(&type);
NS_ENSURE_SUCCESS(rv, rv);
if (type == nsIAccessibleProvider::OuterDoc)
@ -1485,9 +1489,6 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
case nsIAccessibleProvider::XULTabBox:
*aAccessible = new nsXULTabBoxAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULTabPanels:
*aAccessible = new nsXULTabPanelsAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULTabs:
*aAccessible = new nsXULTabsAccessible(aNode, weakShell);
break;
@ -1674,3 +1675,31 @@ NS_GetAccessibilityService(nsIAccessibilityService** aResult)
return nsAccessibilityService::GetAccessibilityService(aResult);
}
nsresult
nsAccessibilityService::GetAccessibleForDeckChildren(nsIDOMNode *aNode, nsIAccessible** aAccessible)
{
nsCOMPtr<nsIWeakReference> weakShell;
GetShellFromNode(aNode, getter_AddRefs(weakShell));
NS_ENSURE_TRUE(weakShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(weakShell));
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame* frame = nsnull;
nsIFrame* parentFrame = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
if (content) {
frame = shell->GetPrimaryFrameFor(content);
}
if (frame && (frame->GetType() == nsAccessibilityAtoms::boxFrame ||
frame->GetType() == nsAccessibilityAtoms::scrollFrame)) {
parentFrame = frame->GetParent();
if (parentFrame && parentFrame->GetType() == nsAccessibilityAtoms::deckFrame) {
*aAccessible = new nsEnumRoleAccessible(aNode, weakShell, nsIAccessibleRole::ROLE_PROPERTYPAGE);
NS_ADDREF(*aAccessible);
}
}
return NS_OK;
}

View File

@ -83,6 +83,11 @@ private:
*/
nsresult GetAccessibleByType(nsIDOMNode *aNode, nsIAccessible **aAccessible);
PRBool HasListener(nsIContent *aContent, nsAString& aEventType);
/**
* Return accessible object if parent is a deck frame
*/
nsresult GetAccessibleForDeckChildren(nsIDOMNode *aNode, nsIAccessible **aAccessible);
};
#endif /* __nsIAccessibilityService_h__ */

View File

@ -183,43 +183,6 @@ NS_IMETHODIMP nsXULTabBoxAccessible::GetChildCount(PRInt32 *_retval)
}
#endif
/**
* XUL TabPanels
* XXX jgaunt -- this has to report the info for the selected child, reachable through
* the DOMNode. The TabPanels object has as its children the different
* vbox/hbox/whatevers that provide what you look at when you click on
* a tab.
* Here is how this will work: when asked about an object the tabPanels object will find
* out the selected child and create the tabPanel object using the child. That should wrap
* any XUL/HTML content in the child, since it is a simple nsAccessible basically.
* or maybe we just do that on creation. Not use the DOMnode we are given, but cache the selected
* DOMnode and then run from there.
*/
/** Constructor */
nsXULTabPanelsAccessible::nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessibleWrap(aNode, aShell)
{
}
/** We are a Property Page */
NS_IMETHODIMP nsXULTabPanelsAccessible::GetRole(PRUint32 *aRole)
{
*aRole = nsIAccessibleRole::ROLE_PROPERTYPAGE;
return NS_OK;
}
/**
* The name for the panel is the name from the tab associated with
* the panel. XXX not sure if the "panels" object should have the
* same name.
*/
NS_IMETHODIMP nsXULTabPanelsAccessible::GetName(nsAString& aName)
{
aName.Truncate();
return NS_OK;
}
/**
* XUL Tabs - the s really stands for strip. this is a collection of tab objects
*/

View File

@ -72,25 +72,6 @@ public:
//NS_IMETHOD GetChildCount(PRInt32 *_retval); // aaronl remove this?
};
/**
* Represents the content area associated with the tabs object (when
* used together)
*/
class nsXULTabPanelsAccessible : public nsAccessibleWrap
{
public:
nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetName(nsAString& _retval);
protected:
nsresult GetAccPluginChild(nsIAccessible **_retval);
// data members
nsCOMPtr<nsIDOMNode> mGParentDOMNode;
nsCOMPtr<nsIDOMNode> mParentDOMNode;
};
/** merely a container of tab obejcts */
class nsXULTabsAccessible : public nsXULSelectableAccessible
{

View File

@ -1361,6 +1361,7 @@ GK_ATOM(bulletFrame, "BulletFrame")
GK_ATOM(columnSetFrame, "ColumnSetFrame")
GK_ATOM(comboboxControlFrame, "ComboboxControlFrame")
GK_ATOM(comboboxDisplayFrame, "ComboboxDisplayFrame")
GK_ATOM(deckFrame, "DeckFrame")
GK_ATOM(directionalFrame, "DirectionalFrame")
GK_ATOM(fieldSetFrame, "FieldSetFrame")
GK_ATOM(frameSetFrame, "FrameSetFrame")

View File

@ -80,6 +80,12 @@ nsDeckFrame::nsDeckFrame(nsIPresShell* aPresShell,
SetLayoutManager(layout);
}
nsIAtom*
nsDeckFrame::GetType() const
{
return nsGkAtoms::deckFrame;
}
NS_IMETHODIMP
nsDeckFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,

View File

@ -74,6 +74,8 @@ public:
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
virtual nsIAtom* GetType() const;
virtual PRBool ChildrenMustHaveWidgets() const { return PR_TRUE; }
#ifdef NS_DEBUG

View File

@ -533,14 +533,7 @@
<binding id="tabpanels"
extends="chrome://global/content/bindings/tabbox.xml#tab-base">
<implementation implements="nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
<![CDATA[
return Components.interfaces.nsIAccessibleProvider.XULTabPanels;
]]>
</getter>
</property>
<implementation>
<field name="_selectedPanel">null</field>