diff --git a/accessible/src/base/AccTypes.h b/accessible/src/base/AccTypes.h index 44b7c7fa0a5..757cb5e8432 100644 --- a/accessible/src/base/AccTypes.h +++ b/accessible/src/base/AccTypes.h @@ -48,6 +48,7 @@ enum AccType { * Other accessible types. */ eApplicationType, + eHTMLOptGroupType, eImageMapType, eMenuPopupType, eProgressType, diff --git a/accessible/src/generic/Accessible.h b/accessible/src/generic/Accessible.h index 914bb7a63d4..b8188471724 100644 --- a/accessible/src/generic/Accessible.h +++ b/accessible/src/generic/Accessible.h @@ -488,6 +488,8 @@ public: bool IsHTMLListItem() const { return mType == eHTMLLiType; } HTMLLIAccessible* AsHTMLListItem(); + bool IsHTMLOptGroup() const { return mType == eHTMLOptGroupType; } + bool IsHTMLTable() const { return mType == eHTMLTableType; } bool IsHTMLTableRow() const { return mType == eHTMLTableRowType; } diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index 5f126946bb6..0021411f37f 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -1748,25 +1748,6 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode, if (child) { updateFlags |= UpdateTreeInternal(child, aIsInsert, reorderEvent); - - // XXX: since select change insertion point of option contained by optgroup - // then we need to have special processing for them (bug 690417). - if (!aIsInsert && aChildNode->IsHTML(nsGkAtoms::optgroup) && - aContainer->GetContent() && - aContainer->GetContent()->IsHTML(nsGkAtoms::select)) { - for (nsIContent* optContent = aChildNode->GetFirstChild(); optContent; - optContent = optContent->GetNextSibling()) { - if (optContent->IsHTML(nsGkAtoms::option)) { - Accessible* option = GetAccessible(optContent); - if (option) { - NS_ASSERTION(option->Parent() == aContainer, - "Not expected hierarchy on HTML select!"); - if (option->Parent() == aContainer) - updateFlags |= UpdateTreeInternal(option, aIsInsert, reorderEvent); - } - } - } - } } else { TreeWalker walker(aContainer, aChildNode, true); diff --git a/accessible/src/html/HTMLSelectAccessible.cpp b/accessible/src/html/HTMLSelectAccessible.cpp index 1813079d6bf..5e95eebd536 100644 --- a/accessible/src/html/HTMLSelectAccessible.cpp +++ b/accessible/src/html/HTMLSelectAccessible.cpp @@ -125,16 +125,7 @@ HTMLSelectListAccessible::CacheChildren() // as well as the accessibles for them. Avoid whitespace text nodes. We want // to count all the s and as it is - // for an . See eStyleContentType_Attr and - // CreateAttributeContent() in nsCSSFrameConstructor -} - - //////////////////////////////////////////////////////////////////////////////// // HTMLComboboxAccessible //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/html/HTMLSelectAccessible.h b/accessible/src/html/HTMLSelectAccessible.h index 46cc4205db5..6b6e18ed16a 100644 --- a/accessible/src/html/HTMLSelectAccessible.h +++ b/accessible/src/html/HTMLSelectAccessible.h @@ -57,13 +57,6 @@ protected: // Accessible virtual void CacheChildren(); - - // HTMLSelectListAccessible - - /** - * Recursive helper for CacheChildren(). - */ - void CacheOptSiblings(nsIContent* aParentContent); }; /* @@ -107,8 +100,12 @@ private: */ Accessible* GetSelect() const { - if (mParent && mParent->IsListControl()) { - Accessible* combobox = mParent->Parent(); + Accessible* parent = mParent; + if (parent && parent->IsHTMLOptGroup()) + parent = parent->Parent(); + + if (parent && parent->IsListControl()) { + Accessible* combobox = parent->Parent(); return combobox && combobox->IsCombobox() ? combobox : mParent.get(); } @@ -120,8 +117,12 @@ private: */ Accessible* GetCombobox() const { - if (mParent && mParent->IsListControl()) { - Accessible* combobox = mParent->Parent(); + Accessible* parent = mParent; + if (parent && parent->IsHTMLOptGroup()) + parent = parent->Parent(); + + if (parent && parent->IsListControl()) { + Accessible* combobox = parent->Parent(); return combobox && combobox->IsCombobox() ? combobox : nullptr; } @@ -136,7 +137,9 @@ class HTMLSelectOptGroupAccessible : public HTMLSelectOptionAccessible { public: - HTMLSelectOptGroupAccessible(nsIContent* aContent, DocAccessible* aDoc); + HTMLSelectOptGroupAccessible(nsIContent* aContent, DocAccessible* aDoc) : + HTMLSelectOptionAccessible(aContent, aDoc) + { mType = eHTMLOptGroupType; } virtual ~HTMLSelectOptGroupAccessible() {} // nsIAccessible @@ -149,10 +152,6 @@ public: // ActionAccessible virtual uint8_t ActionCount(); - -protected: - // Accessible - virtual void CacheChildren(); }; /** ------------------------------------------------------ */ diff --git a/accessible/tests/mochitest/focus/test_takeFocus.html b/accessible/tests/mochitest/focus/test_takeFocus.html index d6b522ba022..232d38a36a8 100644 --- a/accessible/tests/mochitest/focus/test_takeFocus.html +++ b/accessible/tests/mochitest/focus/test_takeFocus.html @@ -57,6 +57,9 @@ gQueue.push(new takeFocusInvoker("plugin")); gQueue.push(new takeFocusInvoker(document)); gQueue.push(new takeFocusInvoker("lb_item2")); + gQueue.push(new takeFocusInvoker(document)); + gQueue.push(new takeFocusInvoker("lb_item3.2")); + gQueue.push(new takeFocusInvoker("lb_item3.1")); gQueue.invoke(); // Will call SimpleTest.finish(); } @@ -114,6 +117,10 @@ diff --git a/accessible/tests/mochitest/tree/test_select.html b/accessible/tests/mochitest/tree/test_select.html index 6d2395d485b..45a1b48e65d 100644 --- a/accessible/tests/mochitest/tree/test_select.html +++ b/accessible/tests/mochitest/tree/test_select.html @@ -20,21 +20,27 @@ role: ROLE_LISTBOX, children: [ { - role: ROLE_HEADING - }, - { - role: ROLE_OPTION, + role: ROLE_GROUPING, children: [ { - role: ROLE_TEXT_LEAF - } - ] - }, - { - role: ROLE_OPTION, - children: [ + role: ROLE_STATICTEXT, + children: [ ] + }, { - role: ROLE_TEXT_LEAF + role: ROLE_OPTION, + children: [ + { + role: ROLE_TEXT_LEAF + } + ] + }, + { + role: ROLE_OPTION, + children: [ + { + role: ROLE_TEXT_LEAF + } + ] } ] }, @@ -57,24 +63,30 @@ role: ROLE_COMBOBOX_LIST, children: [ { - role: ROLE_HEADING - }, - { - role: ROLE_COMBOBOX_OPTION, + role: ROLE_GROUPING, children: [ { - role: ROLE_TEXT_LEAF - } - ] - }, - { - role: ROLE_COMBOBOX_OPTION, - children: [ + role: ROLE_STATICTEXT, + children: [ ] + }, { - role: ROLE_TEXT_LEAF - } + role: ROLE_COMBOBOX_OPTION, + children: [ + { + role: ROLE_TEXT_LEAF + } + ] + }, + { + role: ROLE_COMBOBOX_OPTION, + children: [ + { + role: ROLE_TEXT_LEAF + } + ] + }, ] - }, +}, { role: ROLE_COMBOBOX_OPTION, children: [