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

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

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Revert comment. Created 3 years, 7 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 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_tree.h" 5 #include "ui/accessibility/ax_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 AXTreeDelegate::AXTreeDelegate() { 121 AXTreeDelegate::AXTreeDelegate() {
122 } 122 }
123 123
124 AXTreeDelegate::~AXTreeDelegate() { 124 AXTreeDelegate::~AXTreeDelegate() {
125 } 125 }
126 126
127 AXTree::AXTree() 127 AXTree::AXTree()
128 : delegate_(NULL), root_(NULL) { 128 : delegate_(NULL), root_(NULL) {
129 AXNodeData root; 129 AXNodeData root;
130 root.id = -1; 130 root.id = -1;
131 root.ClearBitfields();
131 132
132 AXTreeUpdate initial_state; 133 AXTreeUpdate initial_state;
133 initial_state.root_id = -1; 134 initial_state.root_id = -1;
134 initial_state.nodes.push_back(root); 135 initial_state.nodes.push_back(root);
135 CHECK(Unserialize(initial_state)) << error(); 136 CHECK(Unserialize(initial_state)) << error();
136 } 137 }
137 138
138 AXTree::AXTree(const AXTreeUpdate& initial_state) 139 AXTree::AXTree(const AXTreeUpdate& initial_state)
139 : delegate_(NULL), root_(NULL) { 140 : delegate_(NULL), root_(NULL) {
140 CHECK(Unserialize(initial_state)) << error(); 141 CHECK(Unserialize(initial_state)) << error();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 354
354 const AXNodeData& old_data = node->data(); 355 const AXNodeData& old_data = node->data();
355 delegate_->OnNodeDataWillChange(this, old_data, new_data); 356 delegate_->OnNodeDataWillChange(this, old_data, new_data);
356 357
357 if (old_data.role != new_data.role) 358 if (old_data.role != new_data.role)
358 delegate_->OnRoleChanged(this, node, old_data.role, new_data.role); 359 delegate_->OnRoleChanged(this, node, old_data.role, new_data.role);
359 360
360 if (old_data.state != new_data.state) { 361 if (old_data.state != new_data.state) {
361 for (int i = AX_STATE_NONE + 1; i <= AX_STATE_LAST; ++i) { 362 for (int i = AX_STATE_NONE + 1; i <= AX_STATE_LAST; ++i) {
362 AXState state = static_cast<AXState>(i); 363 AXState state = static_cast<AXState>(i);
363 if (old_data.HasStateFlag(state) != new_data.HasStateFlag(state)) { 364 if (old_data.HasState(state) != new_data.HasState(state))
364 delegate_->OnStateChanged(this, node, state, 365 delegate_->OnStateChanged(this, node, state, new_data.HasState(state));
365 new_data.HasStateFlag(state));
366 }
367 } 366 }
368 } 367 }
369 368
370 auto string_callback = [this, node](AXStringAttribute attr, 369 auto string_callback = [this, node](AXStringAttribute attr,
371 const std::string& old_string, 370 const std::string& old_string,
372 const std::string& new_string) { 371 const std::string& new_string) {
373 delegate_->OnStringAttributeChanged(this, node, attr, old_string, 372 delegate_->OnStringAttributeChanged(this, node, attr, old_string,
374 new_string); 373 new_string);
375 }; 374 };
376 CallIfAttributeValuesChanged(old_data.string_attributes, 375 CallIfAttributeValuesChanged(old_data.string_attributes,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 update_state->pending_nodes.insert(child); 494 update_state->pending_nodes.insert(child);
496 update_state->new_nodes.insert(child); 495 update_state->new_nodes.insert(child);
497 } 496 }
498 new_children->push_back(child); 497 new_children->push_back(child);
499 } 498 }
500 499
501 return success; 500 return success;
502 } 501 }
503 502
504 } // namespace ui 503 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698