Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Side by Side Diff: content/browser/accessibility/browser_accessibility_com_win.cc

Issue 2946673003: Aria-details takes an ID reference, not an ID reference list (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/accessibility/browser_accessibility_com_win.h" 5 #include "content/browser/accessibility/browser_accessibility_com_win.h"
6 6
7 #include <UIAutomationClient.h> 7 #include <UIAutomationClient.h>
8 #include <UIAutomationCoreApi.h> 8 #include <UIAutomationCoreApi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 3783 matching lines...) Expand 10 before | Expand all | Expand 10 after
3794 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, 3794 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR,
3795 IA2_RELATION_CONTROLLED_BY, 3795 IA2_RELATION_CONTROLLED_BY,
3796 ui::AX_ATTR_CONTROLS_IDS); 3796 ui::AX_ATTR_CONTROLS_IDS);
3797 AddBidirectionalRelations(IA2_RELATION_DESCRIBED_BY, 3797 AddBidirectionalRelations(IA2_RELATION_DESCRIBED_BY,
3798 IA2_RELATION_DESCRIPTION_FOR, 3798 IA2_RELATION_DESCRIPTION_FOR,
3799 ui::AX_ATTR_DESCRIBEDBY_IDS); 3799 ui::AX_ATTR_DESCRIBEDBY_IDS);
3800 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM, 3800 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM,
3801 ui::AX_ATTR_FLOWTO_IDS); 3801 ui::AX_ATTR_FLOWTO_IDS);
3802 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR, 3802 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR,
3803 ui::AX_ATTR_LABELLEDBY_IDS); 3803 ui::AX_ATTR_LABELLEDBY_IDS);
3804 AddBidirectionalRelations(IA2_RELATION_DETAILS, IA2_RELATION_DETAILS_FOR, 3804
3805 ui::AX_ATTR_DETAILS_IDS); 3805 int32_t details_id;
3806 if (GetIntAttribute(ui::AX_ATTR_DETAILS_ID, &details_id)) {
3807 std::vector<int32_t> details_ids;
3808 details_ids.push_back(details_id);
3809 AddBidirectionalRelations(IA2_RELATION_DETAILS, IA2_RELATION_DETAILS_FOR,
3810 details_ids);
3811 }
3806 3812
3807 int member_of_id; 3813 int member_of_id;
3808 if (owner()->GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id)) 3814 if (owner()->GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id))
3809 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id); 3815 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id);
3810 3816
3811 int error_message_id; 3817 int error_message_id;
3812 if (owner()->GetIntAttribute(ui::AX_ATTR_ERRORMESSAGE_ID, &error_message_id)) 3818 if (owner()->GetIntAttribute(ui::AX_ATTR_ERRORMESSAGE_ID, &error_message_id))
3813 AddRelation(IA2_RELATION_ERROR_MESSAGE, error_message_id); 3819 AddRelation(IA2_RELATION_ERROR_MESSAGE, error_message_id);
3814 3820
3815 UpdateRequiredAttributes(); 3821 UpdateRequiredAttributes();
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 4812
4807 void BrowserAccessibilityComWin::AddBidirectionalRelations( 4813 void BrowserAccessibilityComWin::AddBidirectionalRelations(
4808 const base::string16& relation_type, 4814 const base::string16& relation_type,
4809 const base::string16& reverse_relation_type, 4815 const base::string16& reverse_relation_type,
4810 ui::AXIntListAttribute attribute) { 4816 ui::AXIntListAttribute attribute) {
4811 if (!owner()->HasIntListAttribute(attribute)) 4817 if (!owner()->HasIntListAttribute(attribute))
4812 return; 4818 return;
4813 4819
4814 const std::vector<int32_t>& target_ids = 4820 const std::vector<int32_t>& target_ids =
4815 owner()->GetIntListAttribute(attribute); 4821 owner()->GetIntListAttribute(attribute);
4822 AddBidirectionalRelations(relation_type, reverse_relation_type, target_ids);
4823 }
4824
4825 void BrowserAccessibilityComWin::AddBidirectionalRelations(
4826 const base::string16& relation_type,
4827 const base::string16& reverse_relation_type,
4828 const std::vector<int32_t>& target_ids) {
4816 // Reflexive relations don't need to be exposed through IA2. 4829 // Reflexive relations don't need to be exposed through IA2.
4817 std::vector<int32_t> filtered_target_ids; 4830 std::vector<int32_t> filtered_target_ids;
4818 int32_t current_id = owner()->GetId(); 4831 int32_t current_id = owner()->GetId();
4819 std::copy_if(target_ids.begin(), target_ids.end(), 4832 std::copy_if(target_ids.begin(), target_ids.end(),
4820 std::back_inserter(filtered_target_ids), 4833 std::back_inserter(filtered_target_ids),
4821 [current_id](int32_t id) { return id != current_id; }); 4834 [current_id](int32_t id) { return id != current_id; });
4822 if (filtered_target_ids.empty()) 4835 if (filtered_target_ids.empty())
4823 return; 4836 return;
4824 4837
4825 CComObject<BrowserAccessibilityRelation>* relation; 4838 CComObject<BrowserAccessibilityRelation>* relation;
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
5570 5583
5571 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( 5584 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin(
5572 BrowserAccessibility* obj) { 5585 BrowserAccessibility* obj) {
5573 if (!obj || !obj->IsNative()) 5586 if (!obj || !obj->IsNative())
5574 return nullptr; 5587 return nullptr;
5575 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); 5588 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM();
5576 return result; 5589 return result;
5577 } 5590 }
5578 5591
5579 } // namespace content 5592 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_com_win.h ('k') | content/renderer/accessibility/blink_ax_tree_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698