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
authorginn.chen@sun.com
Tue, 15 May 2007 02:46:06 -0700
changeset 1477 36f4f56a7a10d9f64033a8d3198a588ea082adc7
parent 1476 1293a7d0ed279bc3dcf2d292f1154dcaba01bd9e
child 1478 864c627e1594407805f775e0a87389391e659321
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov.alexander, neil
bugs357969
milestone1.9a5pre
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
accessible/public/nsIAccessibleProvider.idl
accessible/src/base/nsAccessibilityAtomList.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessibilityService.h
accessible/src/xul/nsXULTabAccessible.cpp
accessible/src/xul/nsXULTabAccessible.h
content/base/src/nsGkAtomList.h
layout/xul/base/src/nsDeckFrame.cpp
layout/xul/base/src/nsDeckFrame.h
toolkit/content/widgets/tabbox.xml
--- a/accessible/public/nsIAccessibleProvider.idl
+++ b/accessible/public/nsIAccessibleProvider.idl
@@ -40,17 +40,17 @@
 
 #include "nsISupports.idl"
 
 /**
  * nsIAccessibleProvider interface is used to link element and accessible
    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
 {
   /**
    * Constants set of common use.
    */
 
   /** For elements that spawn a new document. For example now it is used by
     <xul:iframe>, <xul:browser> and <xul:editor>. */
@@ -82,31 +82,28 @@ interface nsIAccessibleProvider : nsISup
   const long XULRadioGroup = 0x00001020;
 
   /** The single tab in a dialog or tabbrowser/editor interface */
   const long XULTab = 0x00001021;
 
   /** 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;
 
 
   /**
    * Constants set is used by XForms elements.
    */
 
   /** Used for xforms elements that provide accessible object for itself as
    * well for anonymous content. This property are used for upload,
--- a/accessible/src/base/nsAccessibilityAtomList.h
+++ b/accessible/src/base/nsAccessibilityAtomList.h
@@ -66,20 +66,23 @@ ACCESSIBILITY_ATOM(submit, "submit")
 ACCESSIBILITY_ATOM(_true, "true")
 
   // Header info
 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")
 
   // Alphabetical list of tag names
 ACCESSIBILITY_ATOM(a, "a")
 ACCESSIBILITY_ATOM(abbr, "abbr")
 ACCESSIBILITY_ATOM(acronym, "acronym")
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1263,16 +1263,20 @@ NS_IMETHODIMP nsAccessibilityService::Ge
       }
     }
 
     if (tryFrame) {
       frame->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
     }
   }
 
+  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 
   // correspond to the doc accessible and will be created in any case
   if (!newAcc && content->Tag() != nsAccessibilityAtoms::body && content->GetParent() && 
       (content->IsFocusable() ||
        nsAccessibilityUtils::HasListener(content, NS_LITERAL_STRING("click")) ||
        content->HasAttr(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::describedby) ||
@@ -1367,22 +1371,22 @@ nsAccessibilityService::GetRelevantConte
 nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
                                                      nsIAccessible **aAccessible)
 {
   NS_ENSURE_ARG(aNode);
   NS_ENSURE_ARG_POINTER(aAccessible);
 
   *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)
     return CreateOuterDocAccessible(aNode, aAccessible);
 
   nsCOMPtr<nsIWeakReference> weakShell;
   GetShellFromNode(aNode, getter_AddRefs(weakShell));
 
@@ -1480,19 +1484,16 @@ nsresult nsAccessibilityService::GetAcce
       *aAccessible = new nsXULRadioGroupAccessible(aNode, weakShell);
       break;
     case nsIAccessibleProvider::XULTab:
       *aAccessible = new nsXULTabAccessible(aNode, weakShell);
       break;
     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;
     case nsIAccessibleProvider::XULText:
       *aAccessible = new nsXULTextAccessible(aNode, weakShell);
       break;
     case nsIAccessibleProvider::XULTextBox:
       *aAccessible = new nsXULTextFieldAccessible(aNode, weakShell);
@@ -1669,8 +1670,36 @@ nsAccessibilityService::GetAccessibility
 }
 
 nsresult
 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;
+}
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -78,11 +78,16 @@ private:
   nsresult InitAccessible(nsIAccessible *aAccessibleIn, nsIAccessible **aAccessibleOut);
 
   /**
    * Return accessible object for elements implementing nsIAccessibleProvider
    * interface.
    */
   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__ */
--- a/accessible/src/xul/nsXULTabAccessible.cpp
+++ b/accessible/src/xul/nsXULTabAccessible.cpp
@@ -179,53 +179,16 @@ nsXULTabBoxAccessible::GetState(PRUint32
 NS_IMETHODIMP nsXULTabBoxAccessible::GetChildCount(PRInt32 *_retval)
 {
   *_retval = 2;
   return NS_OK;
 }
 #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
   */
 
 /** Constructor */
 nsXULTabsAccessible::nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsXULSelectableAccessible(aNode, aShell)
 { 
 }
--- a/accessible/src/xul/nsXULTabAccessible.h
+++ b/accessible/src/xul/nsXULTabAccessible.h
@@ -67,35 +67,16 @@ class nsXULTabBoxAccessible : public nsA
 {
 public:
   nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
   NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
   //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
 {
 public:
   nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
   NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -1356,16 +1356,17 @@ GK_ATOM(areaFrame, "AreaFrame")
 GK_ATOM(bcTableCellFrame, "BCTableCellFrame") // table cell in border collapsing model
 GK_ATOM(blockFrame, "BlockFrame")
 GK_ATOM(boxFrame, "BoxFrame")
 GK_ATOM(brFrame, "BRFrame")
 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")
 GK_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")
 GK_ATOM(HTMLButtonControlFrame, "HTMLButtonControlFrame")
 GK_ATOM(HTMLCanvasFrame, "HTMLCanvasFrame")
 GK_ATOM(subDocumentFrame, "subDocumentFrame")
 GK_ATOM(imageBoxFrame, "ImageBoxFrame")
--- a/layout/xul/base/src/nsDeckFrame.cpp
+++ b/layout/xul/base/src/nsDeckFrame.cpp
@@ -75,16 +75,22 @@ nsDeckFrame::nsDeckFrame(nsIPresShell* a
 
   if (!layout) {
     NS_NewStackLayout(aPresShell, layout);
   }
 
   SetLayoutManager(layout);
 }
 
+nsIAtom*
+nsDeckFrame::GetType() const
+{
+  return nsGkAtoms::deckFrame;
+}
+
 NS_IMETHODIMP
 nsDeckFrame::AttributeChanged(PRInt32         aNameSpaceID,
                               nsIAtom*        aAttribute,
                               PRInt32         aModType)
 {
   nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
                                              aModType);
 
--- a/layout/xul/base/src/nsDeckFrame.h
+++ b/layout/xul/base/src/nsDeckFrame.h
@@ -69,16 +69,18 @@ public:
   NS_IMETHOD BuildDisplayListForChildren(nsDisplayListBuilder*   aBuilder,
                                          const nsRect&           aDirtyRect,
                                          const nsDisplayListSet& aLists);
                                          
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
 
+  virtual nsIAtom* GetType() const;
+
   virtual PRBool ChildrenMustHaveWidgets() const { return PR_TRUE; }
 
 #ifdef NS_DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const
   {
       return MakeFrameName(NS_LITERAL_STRING("Deck"), aResult);
   }
 #endif
--- a/toolkit/content/widgets/tabbox.xml
+++ b/toolkit/content/widgets/tabbox.xml
@@ -528,24 +528,17 @@
           <xul:toolbarbutton ondblclick="event.stopPropagation();" class="tabs-closebutton close-button" xbl:inherits="disabled=disableclose,oncommand=onclosetab"/>
         </xul:hbox>
       </xul:stack>
     </content>
   </binding>
 
   <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>
 
       <property name="selectedIndex">
         <getter>
         <![CDATA[
           var indexStr = this.getAttribute("selectedIndex");
           return indexStr ? parseInt(indexStr) : -1;