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

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

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Full patch including mechanical changes Created 4 years, 1 month 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 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> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 void AXNodeData::AddIntListAttribute(AXIntListAttribute attribute, 284 void AXNodeData::AddIntListAttribute(AXIntListAttribute attribute,
285 const std::vector<int32_t>& value) { 285 const std::vector<int32_t>& value) {
286 intlist_attributes.push_back(std::make_pair(attribute, value)); 286 intlist_attributes.push_back(std::make_pair(attribute, value));
287 } 287 }
288 288
289 void AXNodeData::SetName(const std::string& name) { 289 void AXNodeData::SetName(const std::string& name) {
290 string_attributes.push_back(std::make_pair(AX_ATTR_NAME, name)); 290 string_attributes.push_back(std::make_pair(AX_ATTR_NAME, name));
291 } 291 }
292 292
293 void AXNodeData::SetName(const base::string16& name) {
294 string_attributes.push_back(
295 std::make_pair(AX_ATTR_NAME, base::UTF16ToUTF8(name)));
296 }
297
293 void AXNodeData::SetValue(const std::string& value) { 298 void AXNodeData::SetValue(const std::string& value) {
294 string_attributes.push_back(std::make_pair(AX_ATTR_VALUE, value)); 299 string_attributes.push_back(std::make_pair(AX_ATTR_VALUE, value));
295 } 300 }
296 301
302 void AXNodeData::SetValue(const base::string16& value) {
303 string_attributes.push_back(
304 std::make_pair(AX_ATTR_VALUE, base::UTF16ToUTF8(value)));
305 }
306
307 // static
308 bool AXNodeData::IsFlagSet(uint32_t state, ui::AXState state_flag) {
309 return 0 != (state & (1 << state_flag));
310 }
311
312 void AXNodeData::AddStateFlag(ui::AXState state_flag) {
313 state |= (1 << state_flag);
314 }
315
316 bool AXNodeData::HasStateFlag(ui::AXState state_flag) const {
317 return IsFlagSet(state, state_flag);
318 }
319
297 std::string AXNodeData::ToString() const { 320 std::string AXNodeData::ToString() const {
298 std::string result; 321 std::string result;
299 322
300 result += "id=" + IntToString(id); 323 result += "id=" + IntToString(id);
301 result += " " + ui::ToString(role); 324 result += " " + ui::ToString(role);
302 325
303 if (state & (1 << AX_STATE_BUSY)) 326 if (state & (1 << AX_STATE_BUSY))
304 result += " BUSY"; 327 result += " BUSY";
305 if (state & (1 << AX_STATE_CHECKED)) 328 if (state & (1 << AX_STATE_CHECKED))
306 result += " CHECKED"; 329 result += " CHECKED";
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 } 769 }
747 } 770 }
748 771
749 if (!child_ids.empty()) 772 if (!child_ids.empty())
750 result += " child_ids=" + IntVectorToString(child_ids); 773 result += " child_ids=" + IntVectorToString(child_ids);
751 774
752 return result; 775 return result;
753 } 776 }
754 777
755 } // namespace ui 778 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698