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

Side by Side Diff: ui/accessibility/ax_node_data.cc

Issue 1550483002: Switch to standard integer types in ui/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-ui-events
Patch Set: Created 4 years, 12 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
« no previous file with comments | « ui/accessibility/ax_node_data.h ('k') | ui/accessibility/ax_serializable_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/accessibility/ax_node_data.h" 5 #include "ui/accessibility/ax_node_data.h"
6 6
7 #include <stddef.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 #include <set> 10 #include <set>
9 11
10 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
14 16
15 using base::DoubleToString; 17 using base::DoubleToString;
16 using base::IntToString; 18 using base::IntToString;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 return false; 173 return false;
172 *value = base::UTF8ToUTF16(value_utf8); 174 *value = base::UTF8ToUTF16(value_utf8);
173 return true; 175 return true;
174 } 176 }
175 177
176 bool AXNodeData::HasIntListAttribute(AXIntListAttribute attribute) const { 178 bool AXNodeData::HasIntListAttribute(AXIntListAttribute attribute) const {
177 auto iter = FindInVectorOfPairs(attribute, intlist_attributes); 179 auto iter = FindInVectorOfPairs(attribute, intlist_attributes);
178 return iter != intlist_attributes.end(); 180 return iter != intlist_attributes.end();
179 } 181 }
180 182
181 const std::vector<int32>& AXNodeData::GetIntListAttribute( 183 const std::vector<int32_t>& AXNodeData::GetIntListAttribute(
182 AXIntListAttribute attribute) const { 184 AXIntListAttribute attribute) const {
183 CR_DEFINE_STATIC_LOCAL(std::vector<int32>, empty_vector, ()); 185 CR_DEFINE_STATIC_LOCAL(std::vector<int32_t>, empty_vector, ());
184 auto iter = FindInVectorOfPairs(attribute, intlist_attributes); 186 auto iter = FindInVectorOfPairs(attribute, intlist_attributes);
185 if (iter != intlist_attributes.end()) 187 if (iter != intlist_attributes.end())
186 return iter->second; 188 return iter->second;
187 return empty_vector; 189 return empty_vector;
188 } 190 }
189 191
190 bool AXNodeData::GetIntListAttribute( 192 bool AXNodeData::GetIntListAttribute(AXIntListAttribute attribute,
191 AXIntListAttribute attribute, std::vector<int32>* value) const { 193 std::vector<int32_t>* value) const {
192 auto iter = FindInVectorOfPairs(attribute, intlist_attributes); 194 auto iter = FindInVectorOfPairs(attribute, intlist_attributes);
193 if (iter != intlist_attributes.end()) { 195 if (iter != intlist_attributes.end()) {
194 *value = iter->second; 196 *value = iter->second;
195 return true; 197 return true;
196 } 198 }
197 199
198 return false; 200 return false;
199 } 201 }
200 202
201 bool AXNodeData::GetHtmlAttribute( 203 bool AXNodeData::GetHtmlAttribute(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void AXNodeData::AddFloatAttribute( 235 void AXNodeData::AddFloatAttribute(
234 AXFloatAttribute attribute, float value) { 236 AXFloatAttribute attribute, float value) {
235 float_attributes.push_back(std::make_pair(attribute, value)); 237 float_attributes.push_back(std::make_pair(attribute, value));
236 } 238 }
237 239
238 void AXNodeData::AddBoolAttribute( 240 void AXNodeData::AddBoolAttribute(
239 AXBoolAttribute attribute, bool value) { 241 AXBoolAttribute attribute, bool value) {
240 bool_attributes.push_back(std::make_pair(attribute, value)); 242 bool_attributes.push_back(std::make_pair(attribute, value));
241 } 243 }
242 244
243 void AXNodeData::AddIntListAttribute( 245 void AXNodeData::AddIntListAttribute(AXIntListAttribute attribute,
244 AXIntListAttribute attribute, const std::vector<int32>& value) { 246 const std::vector<int32_t>& value) {
245 intlist_attributes.push_back(std::make_pair(attribute, value)); 247 intlist_attributes.push_back(std::make_pair(attribute, value));
246 } 248 }
247 249
248 void AXNodeData::SetName(const std::string& name) { 250 void AXNodeData::SetName(const std::string& name) {
249 string_attributes.push_back(std::make_pair(AX_ATTR_NAME, name)); 251 string_attributes.push_back(std::make_pair(AX_ATTR_NAME, name));
250 } 252 }
251 253
252 void AXNodeData::SetValue(const std::string& value) { 254 void AXNodeData::SetValue(const std::string& value) {
253 string_attributes.push_back(std::make_pair(AX_ATTR_VALUE, value)); 255 string_attributes.push_back(std::make_pair(AX_ATTR_VALUE, value));
254 } 256 }
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 break; 584 break;
583 case AX_ATTR_CANVAS_HAS_FALLBACK: 585 case AX_ATTR_CANVAS_HAS_FALLBACK:
584 result += " has_fallback=" + value; 586 result += " has_fallback=" + value;
585 break; 587 break;
586 case AX_BOOL_ATTRIBUTE_NONE: 588 case AX_BOOL_ATTRIBUTE_NONE:
587 break; 589 break;
588 } 590 }
589 } 591 }
590 592
591 for (size_t i = 0; i < intlist_attributes.size(); ++i) { 593 for (size_t i = 0; i < intlist_attributes.size(); ++i) {
592 const std::vector<int32>& values = intlist_attributes[i].second; 594 const std::vector<int32_t>& values = intlist_attributes[i].second;
593 switch (intlist_attributes[i].first) { 595 switch (intlist_attributes[i].first) {
594 case AX_ATTR_INDIRECT_CHILD_IDS: 596 case AX_ATTR_INDIRECT_CHILD_IDS:
595 result += " indirect_child_ids=" + IntVectorToString(values); 597 result += " indirect_child_ids=" + IntVectorToString(values);
596 break; 598 break;
597 case AX_ATTR_CONTROLS_IDS: 599 case AX_ATTR_CONTROLS_IDS:
598 result += " controls_ids=" + IntVectorToString(values); 600 result += " controls_ids=" + IntVectorToString(values);
599 break; 601 break;
600 case AX_ATTR_DESCRIBEDBY_IDS: 602 case AX_ATTR_DESCRIBEDBY_IDS:
601 result += " describedby_ids=" + IntVectorToString(values); 603 result += " describedby_ids=" + IntVectorToString(values);
602 break; 604 break;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 bool AXNodeData::IsRoot() const { 640 bool AXNodeData::IsRoot() const {
639 return (role == AX_ROLE_ROOT_WEB_AREA || 641 return (role == AX_ROLE_ROOT_WEB_AREA ||
640 role == AX_ROLE_DESKTOP); 642 role == AX_ROLE_DESKTOP);
641 } 643 }
642 644
643 void AXNodeData::SetRoot() { 645 void AXNodeData::SetRoot() {
644 role = AX_ROLE_ROOT_WEB_AREA; 646 role = AX_ROLE_ROOT_WEB_AREA;
645 } 647 }
646 648
647 } // namespace ui 649 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_node_data.h ('k') | ui/accessibility/ax_serializable_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698