Commit 14deaa4b authored by dmazzoni's avatar dmazzoni Committed by Commit Bot

Aria-details takes an ID reference, not an ID reference list

BUG=644766

Review-Url: https://codereview.chromium.org/2946673003
Cr-Commit-Position: refs/heads/master@{#480877}
parent 035f4552
...@@ -3801,8 +3801,14 @@ void BrowserAccessibilityComWin::UpdateStep1ComputeWinAttributes() { ...@@ -3801,8 +3801,14 @@ void BrowserAccessibilityComWin::UpdateStep1ComputeWinAttributes() {
ui::AX_ATTR_FLOWTO_IDS); ui::AX_ATTR_FLOWTO_IDS);
AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR, AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR,
ui::AX_ATTR_LABELLEDBY_IDS); ui::AX_ATTR_LABELLEDBY_IDS);
AddBidirectionalRelations(IA2_RELATION_DETAILS, IA2_RELATION_DETAILS_FOR,
ui::AX_ATTR_DETAILS_IDS); int32_t details_id;
if (GetIntAttribute(ui::AX_ATTR_DETAILS_ID, &details_id)) {
std::vector<int32_t> details_ids;
details_ids.push_back(details_id);
AddBidirectionalRelations(IA2_RELATION_DETAILS, IA2_RELATION_DETAILS_FOR,
details_ids);
}
int member_of_id; int member_of_id;
if (owner()->GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id)) if (owner()->GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id))
...@@ -4813,6 +4819,13 @@ void BrowserAccessibilityComWin::AddBidirectionalRelations( ...@@ -4813,6 +4819,13 @@ void BrowserAccessibilityComWin::AddBidirectionalRelations(
const std::vector<int32_t>& target_ids = const std::vector<int32_t>& target_ids =
owner()->GetIntListAttribute(attribute); owner()->GetIntListAttribute(attribute);
AddBidirectionalRelations(relation_type, reverse_relation_type, target_ids);
}
void BrowserAccessibilityComWin::AddBidirectionalRelations(
const base::string16& relation_type,
const base::string16& reverse_relation_type,
const std::vector<int32_t>& target_ids) {
// Reflexive relations don't need to be exposed through IA2. // Reflexive relations don't need to be exposed through IA2.
std::vector<int32_t> filtered_target_ids; std::vector<int32_t> filtered_target_ids;
int32_t current_id = owner()->GetId(); int32_t current_id = owner()->GetId();
......
...@@ -909,6 +909,9 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79")) ...@@ -909,6 +909,9 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79"))
void AddBidirectionalRelations(const base::string16& relation_type, void AddBidirectionalRelations(const base::string16& relation_type,
const base::string16& reverse_relation_type, const base::string16& reverse_relation_type,
ui::AXIntListAttribute attribute); ui::AXIntListAttribute attribute);
void AddBidirectionalRelations(const base::string16& relation_type,
const base::string16& reverse_relation_type,
const std::vector<int32_t>& target_ids);
// Clears all the forward relations from this object to any other object and // Clears all the forward relations from this object to any other object and
// the associated reverse relations on the other objects, but leaves any // the associated reverse relations on the other objects, but leaves any
// reverse relations on this object alone. // reverse relations on this object alone.
......
...@@ -103,6 +103,9 @@ class AXContentNodeDataSparseAttributeAdapter ...@@ -103,6 +103,9 @@ class AXContentNodeDataSparseAttributeAdapter
case WebAXObjectAttribute::kAriaActiveDescendant: case WebAXObjectAttribute::kAriaActiveDescendant:
dst_->AddIntAttribute(ui::AX_ATTR_ACTIVEDESCENDANT_ID, value.AxID()); dst_->AddIntAttribute(ui::AX_ATTR_ACTIVEDESCENDANT_ID, value.AxID());
break; break;
case WebAXObjectAttribute::kAriaDetails:
dst_->AddIntAttribute(ui::AX_ATTR_DETAILS_ID, value.AxID());
break;
case WebAXObjectAttribute::kAriaErrorMessage: case WebAXObjectAttribute::kAriaErrorMessage:
dst_->AddIntAttribute(ui::AX_ATTR_ERRORMESSAGE_ID, value.AxID()); dst_->AddIntAttribute(ui::AX_ATTR_ERRORMESSAGE_ID, value.AxID());
break; break;
...@@ -119,10 +122,6 @@ class AXContentNodeDataSparseAttributeAdapter ...@@ -119,10 +122,6 @@ class AXContentNodeDataSparseAttributeAdapter
AddIntListAttributeFromWebObjects(ui::AX_ATTR_CONTROLS_IDS, value, AddIntListAttributeFromWebObjects(ui::AX_ATTR_CONTROLS_IDS, value,
dst_); dst_);
break; break;
case WebAXObjectVectorAttribute::kAriaDetails:
AddIntListAttributeFromWebObjects(ui::AX_ATTR_DETAILS_IDS, value,
dst_);
break;
case WebAXObjectVectorAttribute::kAriaFlowTo: case WebAXObjectVectorAttribute::kAriaFlowTo:
AddIntListAttributeFromWebObjects(ui::AX_ATTR_FLOWTO_IDS, value, dst_); AddIntListAttributeFromWebObjects(ui::AX_ATTR_FLOWTO_IDS, value, dst_);
break; break;
......
rootWebArea rootWebArea
++genericContainer ++genericContainer
++++textField detailsIds=paragraph ++++textField detailsId=paragraph
++paragraph ++paragraph
++++staticText name='Details' ++++staticText name='Details'
++++++inlineTextBox name='Details' ++++++inlineTextBox name='Details'
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
This text field has an error! This text field has an error!
Details 1 Details
Details 2
Select All Select All
{ {
"nodeId": "<string>", "nodeId": "<string>",
...@@ -129,16 +128,11 @@ Select All ...@@ -129,16 +128,11 @@ Select All
{ {
"name": "details", "name": "details",
"value": { "value": {
"type": "idrefList", "type": "idref",
"value": "",
"relatedNodes": [ "relatedNodes": [
{ {
"idref": "d1", "idref": "d",
"nodeResult": "div#d1" "nodeResult": "div#d"
},
{
"idref": "d2",
"nodeResult": "div#d2"
} }
] ]
} }
......
...@@ -18,9 +18,8 @@ function test() ...@@ -18,9 +18,8 @@ function test()
<input data-dump aria-errormessage="err"> <input data-dump aria-errormessage="err">
<h3 id="err">This text field has an error!</h3> <h3 id="err">This text field has an error!</h3>
<img data-dump aria-details="d1 d2" aria-label="Label"> <img data-dump aria-details="d" aria-label="Label">
<div id="d1">Details 1</div> <div id="d">Details</div>
<div id="d2">Details 2</div>
<button data-dump aria-keyshortcuts="Ctrl+A">Select All</button> <button data-dump aria-keyshortcuts="Ctrl+A">Select All</button>
......
...@@ -200,7 +200,7 @@ static AXSparseAttributeSetterMap& GetSparseAttributeSetterMap() { ...@@ -200,7 +200,7 @@ static AXSparseAttributeSetterMap& GetSparseAttributeSetterMap() {
new ObjectVectorAttributeSetter(AXObjectVectorAttribute::kAriaFlowTo)); new ObjectVectorAttributeSetter(AXObjectVectorAttribute::kAriaFlowTo));
ax_sparse_attribute_setter_map.Set( ax_sparse_attribute_setter_map.Set(
aria_detailsAttr, aria_detailsAttr,
new ObjectVectorAttributeSetter(AXObjectVectorAttribute::kAriaDetails)); new ObjectAttributeSetter(AXObjectAttribute::kAriaDetails));
ax_sparse_attribute_setter_map.Set( ax_sparse_attribute_setter_map.Set(
aria_errormessageAttr, aria_errormessageAttr,
new ObjectAttributeSetter(AXObjectAttribute::kAriaErrorMessage)); new ObjectAttributeSetter(AXObjectAttribute::kAriaErrorMessage));
......
...@@ -246,8 +246,8 @@ STATIC_ASSERT_ENUM(WebAXObjectAttribute::kAriaErrorMessage, ...@@ -246,8 +246,8 @@ STATIC_ASSERT_ENUM(WebAXObjectAttribute::kAriaErrorMessage,
AXObjectAttribute::kAriaErrorMessage); AXObjectAttribute::kAriaErrorMessage);
STATIC_ASSERT_ENUM(WebAXObjectVectorAttribute::kAriaControls, STATIC_ASSERT_ENUM(WebAXObjectVectorAttribute::kAriaControls,
AXObjectVectorAttribute::kAriaControls); AXObjectVectorAttribute::kAriaControls);
STATIC_ASSERT_ENUM(WebAXObjectVectorAttribute::kAriaDetails, STATIC_ASSERT_ENUM(WebAXObjectAttribute::kAriaDetails,
AXObjectVectorAttribute::kAriaDetails); AXObjectAttribute::kAriaDetails);
STATIC_ASSERT_ENUM(WebAXObjectVectorAttribute::kAriaFlowTo, STATIC_ASSERT_ENUM(WebAXObjectVectorAttribute::kAriaFlowTo,
AXObjectVectorAttribute::kAriaFlowTo); AXObjectVectorAttribute::kAriaFlowTo);
#undef STATIC_ASSERT_ENUM #undef STATIC_ASSERT_ENUM
......
...@@ -246,12 +246,12 @@ enum class AXStringAttribute { ...@@ -246,12 +246,12 @@ enum class AXStringAttribute {
enum class AXObjectAttribute { enum class AXObjectAttribute {
kAriaActiveDescendant, kAriaActiveDescendant,
kAriaDetails,
kAriaErrorMessage, kAriaErrorMessage,
}; };
enum class AXObjectVectorAttribute { enum class AXObjectVectorAttribute {
kAriaControls, kAriaControls,
kAriaDetails,
kAriaFlowTo, kAriaFlowTo,
}; };
......
...@@ -355,6 +355,11 @@ class SparseAttributeAXPropertyAdapter ...@@ -355,6 +355,11 @@ class SparseAttributeAXPropertyAdapter
CreateProperty(AXRelationshipAttributesEnum::Activedescendant, CreateProperty(AXRelationshipAttributesEnum::Activedescendant,
CreateRelatedNodeListValue(object))); CreateRelatedNodeListValue(object)));
break; break;
case AXObjectAttribute::kAriaDetails:
properties_.addItem(
CreateProperty(AXRelationshipAttributesEnum::Details,
CreateRelatedNodeListValue(object)));
break;
case AXObjectAttribute::kAriaErrorMessage: case AXObjectAttribute::kAriaErrorMessage:
properties_.addItem( properties_.addItem(
CreateProperty(AXRelationshipAttributesEnum::Errormessage, CreateProperty(AXRelationshipAttributesEnum::Errormessage,
...@@ -371,11 +376,6 @@ class SparseAttributeAXPropertyAdapter ...@@ -371,11 +376,6 @@ class SparseAttributeAXPropertyAdapter
AXRelationshipAttributesEnum::Controls, objects, aria_controlsAttr, AXRelationshipAttributesEnum::Controls, objects, aria_controlsAttr,
*ax_object_)); *ax_object_));
break; break;
case AXObjectVectorAttribute::kAriaDetails:
properties_.addItem(CreateRelatedNodeListProperty(
AXRelationshipAttributesEnum::Details, objects, aria_controlsAttr,
*ax_object_));
break;
case AXObjectVectorAttribute::kAriaFlowTo: case AXObjectVectorAttribute::kAriaFlowTo:
properties_.addItem(CreateRelatedNodeListProperty( properties_.addItem(CreateRelatedNodeListProperty(
AXRelationshipAttributesEnum::Flowto, objects, aria_flowtoAttr, AXRelationshipAttributesEnum::Flowto, objects, aria_flowtoAttr,
......
...@@ -379,6 +379,7 @@ enum class WebAXStringAttribute { ...@@ -379,6 +379,7 @@ enum class WebAXStringAttribute {
// sparse attribute the default value must be the null WebAXObject. // sparse attribute the default value must be the null WebAXObject.
enum class WebAXObjectAttribute { enum class WebAXObjectAttribute {
kAriaActiveDescendant, kAriaActiveDescendant,
kAriaDetails,
kAriaErrorMessage, kAriaErrorMessage,
}; };
...@@ -388,7 +389,6 @@ enum class WebAXObjectAttribute { ...@@ -388,7 +389,6 @@ enum class WebAXObjectAttribute {
// empty vector. // empty vector.
enum class WebAXObjectVectorAttribute { enum class WebAXObjectVectorAttribute {
kAriaControls, kAriaControls,
kAriaDetails,
kAriaFlowTo, kAriaFlowTo,
}; };
......
...@@ -404,6 +404,7 @@ ...@@ -404,6 +404,7 @@
// Relationships between this element and other elements. // Relationships between this element and other elements.
activedescendant_id, activedescendant_id,
details_id,
errormessage_id, errormessage_id,
in_page_link_target_id, in_page_link_target_id,
member_of_id, member_of_id,
...@@ -486,7 +487,6 @@ ...@@ -486,7 +487,6 @@
// Relationships between this element and other elements. // Relationships between this element and other elements.
controls_ids, controls_ids,
describedby_ids, describedby_ids,
details_ids,
flowto_ids, flowto_ids,
labelledby_ids, labelledby_ids,
radio_group_ids, radio_group_ids,
......
...@@ -92,6 +92,7 @@ typename std::vector<std::pair<FirstType, SecondType>>::const_iterator ...@@ -92,6 +92,7 @@ typename std::vector<std::pair<FirstType, SecondType>>::const_iterator
bool IsNodeIdIntAttribute(AXIntAttribute attr) { bool IsNodeIdIntAttribute(AXIntAttribute attr) {
switch (attr) { switch (attr) {
case AX_ATTR_ACTIVEDESCENDANT_ID: case AX_ATTR_ACTIVEDESCENDANT_ID:
case AX_ATTR_DETAILS_ID:
case AX_ATTR_ERRORMESSAGE_ID: case AX_ATTR_ERRORMESSAGE_ID:
case AX_ATTR_IN_PAGE_LINK_TARGET_ID: case AX_ATTR_IN_PAGE_LINK_TARGET_ID:
case AX_ATTR_MEMBER_OF_ID: case AX_ATTR_MEMBER_OF_ID:
...@@ -157,7 +158,6 @@ bool IsNodeIdIntListAttribute(AXIntListAttribute attr) { ...@@ -157,7 +158,6 @@ bool IsNodeIdIntListAttribute(AXIntListAttribute attr) {
case AX_ATTR_CELL_IDS: case AX_ATTR_CELL_IDS:
case AX_ATTR_CONTROLS_IDS: case AX_ATTR_CONTROLS_IDS:
case AX_ATTR_DESCRIBEDBY_IDS: case AX_ATTR_DESCRIBEDBY_IDS:
case AX_ATTR_DETAILS_IDS:
case AX_ATTR_FLOWTO_IDS: case AX_ATTR_FLOWTO_IDS:
case AX_ATTR_INDIRECT_CHILD_IDS: case AX_ATTR_INDIRECT_CHILD_IDS:
case AX_ATTR_LABELLEDBY_IDS: case AX_ATTR_LABELLEDBY_IDS:
...@@ -624,6 +624,9 @@ std::string AXNodeData::ToString() const { ...@@ -624,6 +624,9 @@ std::string AXNodeData::ToString() const {
case AX_ATTR_ACTIVEDESCENDANT_ID: case AX_ATTR_ACTIVEDESCENDANT_ID:
result += " activedescendant=" + value; result += " activedescendant=" + value;
break; break;
case AX_ATTR_DETAILS_ID:
result += " details=" + value;
break;
case AX_ATTR_ERRORMESSAGE_ID: case AX_ATTR_ERRORMESSAGE_ID:
result += " errormessage=" + value; result += " errormessage=" + value;
break; break;
...@@ -892,9 +895,6 @@ std::string AXNodeData::ToString() const { ...@@ -892,9 +895,6 @@ std::string AXNodeData::ToString() const {
case AX_ATTR_DESCRIBEDBY_IDS: case AX_ATTR_DESCRIBEDBY_IDS:
result += " describedby_ids=" + IntVectorToString(values); result += " describedby_ids=" + IntVectorToString(values);
break; break;
case AX_ATTR_DETAILS_IDS:
result += " details_ids=" + IntVectorToString(values);
break;
case AX_ATTR_FLOWTO_IDS: case AX_ATTR_FLOWTO_IDS:
result += " flowto_ids=" + IntVectorToString(values); result += " flowto_ids=" + IntVectorToString(values);
break; break;
......
...@@ -749,7 +749,7 @@ TEST(AXTreeTest, IntListChangeCallbacks) { ...@@ -749,7 +749,7 @@ TEST(AXTreeTest, IntListChangeCallbacks) {
initial_state.nodes.resize(1); initial_state.nodes.resize(1);
initial_state.nodes[0].id = 1; initial_state.nodes[0].id = 1;
initial_state.nodes[0].AddIntListAttribute(AX_ATTR_CONTROLS_IDS, one); initial_state.nodes[0].AddIntListAttribute(AX_ATTR_CONTROLS_IDS, one);
initial_state.nodes[0].AddIntListAttribute(AX_ATTR_DETAILS_IDS, two); initial_state.nodes[0].AddIntListAttribute(AX_ATTR_RADIO_GROUP_IDS, two);
AXTree tree(initial_state); AXTree tree(initial_state);
FakeAXTreeDelegate fake_delegate; FakeAXTreeDelegate fake_delegate;
...@@ -761,14 +761,14 @@ TEST(AXTreeTest, IntListChangeCallbacks) { ...@@ -761,14 +761,14 @@ TEST(AXTreeTest, IntListChangeCallbacks) {
update0.nodes.resize(1); update0.nodes.resize(1);
update0.nodes[0].id = 1; update0.nodes[0].id = 1;
update0.nodes[0].AddIntListAttribute(AX_ATTR_CONTROLS_IDS, two); update0.nodes[0].AddIntListAttribute(AX_ATTR_CONTROLS_IDS, two);
update0.nodes[0].AddIntListAttribute(AX_ATTR_DETAILS_IDS, three); update0.nodes[0].AddIntListAttribute(AX_ATTR_RADIO_GROUP_IDS, three);
EXPECT_TRUE(tree.Unserialize(update0)); EXPECT_TRUE(tree.Unserialize(update0));
const std::vector<std::string>& change_log = const std::vector<std::string>& change_log =
fake_delegate.attribute_change_log(); fake_delegate.attribute_change_log();
ASSERT_EQ(2U, change_log.size()); ASSERT_EQ(2U, change_log.size());
EXPECT_EQ("controlsIds changed from 1 to 2,2", change_log[0]); EXPECT_EQ("controlsIds changed from 1 to 2,2", change_log[0]);
EXPECT_EQ("detailsIds changed from 2,2 to 3", change_log[1]); EXPECT_EQ("radioGroupIds changed from 2,2 to 3", change_log[1]);
FakeAXTreeDelegate fake_delegate2; FakeAXTreeDelegate fake_delegate2;
tree.SetDelegate(&fake_delegate2); tree.SetDelegate(&fake_delegate2);
...@@ -778,7 +778,7 @@ TEST(AXTreeTest, IntListChangeCallbacks) { ...@@ -778,7 +778,7 @@ TEST(AXTreeTest, IntListChangeCallbacks) {
update1.root_id = 1; update1.root_id = 1;
update1.nodes.resize(1); update1.nodes.resize(1);
update1.nodes[0].id = 1; update1.nodes[0].id = 1;
update1.nodes[0].AddIntListAttribute(AX_ATTR_DETAILS_IDS, two); update1.nodes[0].AddIntListAttribute(AX_ATTR_RADIO_GROUP_IDS, two);
update1.nodes[0].AddIntListAttribute(AX_ATTR_FLOWTO_IDS, three); update1.nodes[0].AddIntListAttribute(AX_ATTR_FLOWTO_IDS, three);
EXPECT_TRUE(tree.Unserialize(update1)); EXPECT_TRUE(tree.Unserialize(update1));
...@@ -786,7 +786,7 @@ TEST(AXTreeTest, IntListChangeCallbacks) { ...@@ -786,7 +786,7 @@ TEST(AXTreeTest, IntListChangeCallbacks) {
fake_delegate2.attribute_change_log(); fake_delegate2.attribute_change_log();
ASSERT_EQ(3U, change_log2.size()); ASSERT_EQ(3U, change_log2.size());
EXPECT_EQ("controlsIds changed from 2,2 to ", change_log2[0]); EXPECT_EQ("controlsIds changed from 2,2 to ", change_log2[0]);
EXPECT_EQ("detailsIds changed from 3 to 2,2", change_log2[1]); EXPECT_EQ("radioGroupIds changed from 3 to 2,2", change_log2[1]);
EXPECT_EQ("flowtoIds changed from to 3", change_log2[2]); EXPECT_EQ("flowtoIds changed from to 3", change_log2[2]);
tree.SetDelegate(NULL); tree.SetDelegate(NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment