Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
ui::AXEventGenerator Class Reference

#include <ax_event_generator.h>

Inheritance diagram for ui::AXEventGenerator:
ui::AXTreeObserver

Classes

struct  EventParams
 
class  Iterator
 
struct  TargetedEvent
 

Public Types

enum class  Event : int32_t {
  ACCESS_KEY_CHANGED , ACTIVE_DESCENDANT_CHANGED , ALERT , ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED ,
  ATOMIC_CHANGED , AUTO_COMPLETE_CHANGED , BUSY_CHANGED , CHECKED_STATE_CHANGED ,
  CHILDREN_CHANGED , CLASS_NAME_CHANGED , COLLAPSED , CONTROLS_CHANGED ,
  DESCRIBED_BY_CHANGED , DESCRIPTION_CHANGED , DOCUMENT_SELECTION_CHANGED , DOCUMENT_TITLE_CHANGED ,
  DROPEFFECT_CHANGED , ENABLED_CHANGED , EXPANDED , FOCUS_CHANGED ,
  FLOW_FROM_CHANGED , FLOW_TO_CHANGED , GRABBED_CHANGED , HASPOPUP_CHANGED ,
  HIERARCHICAL_LEVEL_CHANGED , IGNORED_CHANGED , IMAGE_ANNOTATION_CHANGED , INVALID_STATUS_CHANGED ,
  KEY_SHORTCUTS_CHANGED , LABELED_BY_CHANGED , LANGUAGE_CHANGED , LAYOUT_INVALIDATED ,
  LIVE_REGION_CHANGED , LIVE_REGION_CREATED , LIVE_REGION_NODE_CHANGED , LIVE_RELEVANT_CHANGED ,
  LIVE_STATUS_CHANGED , LOAD_COMPLETE , LOAD_START , MENU_ITEM_SELECTED ,
  MULTILINE_STATE_CHANGED , MULTISELECTABLE_STATE_CHANGED , NAME_CHANGED , OBJECT_ATTRIBUTE_CHANGED ,
  OTHER_ATTRIBUTE_CHANGED , PLACEHOLDER_CHANGED , PORTAL_ACTIVATED , POSITION_IN_SET_CHANGED ,
  RELATED_NODE_CHANGED , READONLY_CHANGED , REQUIRED_STATE_CHANGED , ROLE_CHANGED ,
  ROW_COUNT_CHANGED , SCROLL_HORIZONTAL_POSITION_CHANGED , SCROLL_VERTICAL_POSITION_CHANGED , SELECTED_CHANGED ,
  SELECTED_CHILDREN_CHANGED , SET_SIZE_CHANGED , SORT_CHANGED , STATE_CHANGED ,
  SUBTREE_CREATED , TEXT_ATTRIBUTE_CHANGED , VALUE_CHANGED , VALUE_MAX_CHANGED ,
  VALUE_MIN_CHANGED , VALUE_STEP_CHANGED , WIN_IACCESSIBLE_STATE_CHANGED
}
 
enum class  IgnoredChangedState : uint8_t { kShow , kHide , kCount = 2 }
 
using IgnoredChangedStatesBitset = std::bitset< static_cast< size_t >(IgnoredChangedState::kCount)>
 
using const_iterator = Iterator
 
using iterator = Iterator
 
using value_type = TargetedEvent
 
- Public Types inherited from ui::AXTreeObserver
enum  ChangeType {
  NODE_CREATED , SUBTREE_CREATED , NODE_CHANGED , NODE_REPARENTED ,
  SUBTREE_REPARENTED
}
 

Public Member Functions

 AXEventGenerator ()
 
 AXEventGenerator (AXTree *tree)
 
 ~AXEventGenerator () override
 
void SetTree (AXTree *new_tree)
 
void ReleaseTree ()
 
Iterator begin () const
 
Iterator end () const
 
void ClearEvents ()
 
void AddEvent (ui::AXNode *node, Event event)
 
void set_always_fire_load_complete (bool val)
 
- Public Member Functions inherited from ui::AXTreeObserver
 AXTreeObserver ()
 
virtual ~AXTreeObserver ()
 
virtual void OnNodeDataWillChange (AXTree *tree, const AXNodeData &old_node_data, const AXNodeData &new_node_data)
 
virtual void OnNodeDataChanged (AXTree *tree, const AXNodeData &old_node_data, const AXNodeData &new_node_data)
 
virtual void OnRoleChanged (AXTree *tree, AXNode *node, ax::mojom::Role old_role, ax::mojom::Role new_role)
 
virtual void OnStateChanged (AXTree *tree, AXNode *node, ax::mojom::State state, bool new_value)
 
virtual void OnStringAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::StringAttribute attr, const std::string &old_value, const std::string &new_value)
 
virtual void OnIntAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::IntAttribute attr, int32_t old_value, int32_t new_value)
 
virtual void OnFloatAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::FloatAttribute attr, float old_value, float new_value)
 
virtual void OnBoolAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::BoolAttribute attr, bool new_value)
 
virtual void OnIntListAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::IntListAttribute attr, const std::vector< int32_t > &old_value, const std::vector< int32_t > &new_value)
 
virtual void OnStringListAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::StringListAttribute attr, const std::vector< std::string > &old_value, const std::vector< std::string > &new_value)
 
virtual void OnTreeDataChanged (AXTree *tree, const AXTreeData &old_data, const AXTreeData &new_data)
 
virtual void OnNodeWillBeDeleted (AXTree *tree, AXNode *node)
 
virtual void OnSubtreeWillBeDeleted (AXTree *tree, AXNode *node)
 
virtual void OnNodeWillBeReparented (AXTree *tree, AXNode *node)
 
virtual void OnSubtreeWillBeReparented (AXTree *tree, AXNode *node)
 
virtual void OnNodeCreated (AXTree *tree, AXNode *node)
 
virtual void OnNodeDeleted (AXTree *tree, int32_t node_id)
 
virtual void OnNodeReparented (AXTree *tree, AXNode *node)
 
virtual void OnNodeChanged (AXTree *tree, AXNode *node)
 
virtual void OnAtomicUpdateFinished (AXTree *tree, bool root_changed, const std::vector< Change > &changes)
 

Protected Member Functions

void OnNodeDataChanged (AXTree *tree, const AXNodeData &old_node_data, const AXNodeData &new_node_data) override
 
void OnRoleChanged (AXTree *tree, AXNode *node, ax::mojom::Role old_role, ax::mojom::Role new_role) override
 
void OnStateChanged (AXTree *tree, AXNode *node, ax::mojom::State state, bool new_value) override
 
void OnStringAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::StringAttribute attr, const std::string &old_value, const std::string &new_value) override
 
void OnIntAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::IntAttribute attr, int32_t old_value, int32_t new_value) override
 
void OnFloatAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::FloatAttribute attr, float old_value, float new_value) override
 
void OnBoolAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::BoolAttribute attr, bool new_value) override
 
void OnIntListAttributeChanged (AXTree *tree, AXNode *node, ax::mojom::IntListAttribute attr, const std::vector< int32_t > &old_value, const std::vector< int32_t > &new_value) override
 
void OnTreeDataChanged (AXTree *tree, const ui::AXTreeData &old_data, const ui::AXTreeData &new_data) override
 
void OnNodeWillBeDeleted (AXTree *tree, AXNode *node) override
 
void OnSubtreeWillBeDeleted (AXTree *tree, AXNode *node) override
 
void OnNodeWillBeReparented (AXTree *tree, AXNode *node) override
 
void OnSubtreeWillBeReparented (AXTree *tree, AXNode *node) override
 
void OnAtomicUpdateFinished (AXTree *tree, bool root_changed, const std::vector< Change > &changes) override
 

Detailed Description

Definition at line 25 of file ax_event_generator.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 157 of file ax_event_generator.h.

◆ IgnoredChangedStatesBitset

Definition at line 155 of file ax_event_generator.h.

◆ iterator

Definition at line 158 of file ax_event_generator.h.

◆ value_type

Definition at line 159 of file ax_event_generator.h.

Member Enumeration Documentation

◆ Event

enum class ui::AXEventGenerator::Event : int32_t
strong
Enumerator
ACCESS_KEY_CHANGED 
ACTIVE_DESCENDANT_CHANGED 
ALERT 
ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED 
ATOMIC_CHANGED 
AUTO_COMPLETE_CHANGED 
BUSY_CHANGED 
CHECKED_STATE_CHANGED 
CHILDREN_CHANGED 
CLASS_NAME_CHANGED 
COLLAPSED 
CONTROLS_CHANGED 
DESCRIBED_BY_CHANGED 
DESCRIPTION_CHANGED 
DOCUMENT_SELECTION_CHANGED 
DOCUMENT_TITLE_CHANGED 
DROPEFFECT_CHANGED 
ENABLED_CHANGED 
EXPANDED 
FOCUS_CHANGED 
FLOW_FROM_CHANGED 
FLOW_TO_CHANGED 
GRABBED_CHANGED 
HASPOPUP_CHANGED 
HIERARCHICAL_LEVEL_CHANGED 
IGNORED_CHANGED 
IMAGE_ANNOTATION_CHANGED 
INVALID_STATUS_CHANGED 
KEY_SHORTCUTS_CHANGED 
LABELED_BY_CHANGED 
LANGUAGE_CHANGED 
LAYOUT_INVALIDATED 
LIVE_REGION_CHANGED 
LIVE_REGION_CREATED 
LIVE_REGION_NODE_CHANGED 
LIVE_RELEVANT_CHANGED 
LIVE_STATUS_CHANGED 
LOAD_COMPLETE 
LOAD_START 
MENU_ITEM_SELECTED 
MULTILINE_STATE_CHANGED 
MULTISELECTABLE_STATE_CHANGED 
NAME_CHANGED 
OBJECT_ATTRIBUTE_CHANGED 
OTHER_ATTRIBUTE_CHANGED 
PLACEHOLDER_CHANGED 
PORTAL_ACTIVATED 
POSITION_IN_SET_CHANGED 
RELATED_NODE_CHANGED 
READONLY_CHANGED 
REQUIRED_STATE_CHANGED 
ROLE_CHANGED 
ROW_COUNT_CHANGED 
SCROLL_HORIZONTAL_POSITION_CHANGED 
SCROLL_VERTICAL_POSITION_CHANGED 
SELECTED_CHANGED 
SELECTED_CHILDREN_CHANGED 
SET_SIZE_CHANGED 
SORT_CHANGED 
STATE_CHANGED 
SUBTREE_CREATED 
TEXT_ATTRIBUTE_CHANGED 
VALUE_CHANGED 
VALUE_MAX_CHANGED 
VALUE_MIN_CHANGED 
VALUE_STEP_CHANGED 
WIN_IACCESSIBLE_STATE_CHANGED 

Definition at line 27 of file ax_event_generator.h.

27 : int32_t {
28 ACCESS_KEY_CHANGED,
29 ACTIVE_DESCENDANT_CHANGED,
30 ALERT,
31 // ATK treats alignment, indentation, and other format-related attributes as
32 // text attributes even when they are only applicable to the entire object.
33 // And it lacks an event for object attributes changing.
34 ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED,
35 ATOMIC_CHANGED,
36 AUTO_COMPLETE_CHANGED,
37 BUSY_CHANGED,
38 CHECKED_STATE_CHANGED,
39 CHILDREN_CHANGED,
40 CLASS_NAME_CHANGED,
41 COLLAPSED,
42 CONTROLS_CHANGED,
43 DESCRIBED_BY_CHANGED,
44 DESCRIPTION_CHANGED,
45 DOCUMENT_SELECTION_CHANGED,
46 DOCUMENT_TITLE_CHANGED,
47 DROPEFFECT_CHANGED,
48 ENABLED_CHANGED,
49 EXPANDED,
50 FOCUS_CHANGED,
51 FLOW_FROM_CHANGED,
52 FLOW_TO_CHANGED,
53 GRABBED_CHANGED,
54 HASPOPUP_CHANGED,
55 HIERARCHICAL_LEVEL_CHANGED,
56 IGNORED_CHANGED,
57 IMAGE_ANNOTATION_CHANGED,
58 INVALID_STATUS_CHANGED,
59 KEY_SHORTCUTS_CHANGED,
60 LABELED_BY_CHANGED,
61 LANGUAGE_CHANGED,
62 LAYOUT_INVALIDATED, // Fired when aria-busy goes false
63 LIVE_REGION_CHANGED, // Fired on the root of a live region.
64 LIVE_REGION_CREATED,
65 LIVE_REGION_NODE_CHANGED, // Fired on a node within a live region.
66 LIVE_RELEVANT_CHANGED,
67 LIVE_STATUS_CHANGED,
68 LOAD_COMPLETE,
69 LOAD_START,
70 MENU_ITEM_SELECTED,
71 MULTILINE_STATE_CHANGED,
72 MULTISELECTABLE_STATE_CHANGED,
73 NAME_CHANGED,
74 OBJECT_ATTRIBUTE_CHANGED,
75 OTHER_ATTRIBUTE_CHANGED,
76 PLACEHOLDER_CHANGED,
77 PORTAL_ACTIVATED,
78 POSITION_IN_SET_CHANGED,
79 RELATED_NODE_CHANGED,
80 READONLY_CHANGED,
81 REQUIRED_STATE_CHANGED,
82 ROLE_CHANGED,
83 ROW_COUNT_CHANGED,
84 SCROLL_HORIZONTAL_POSITION_CHANGED,
85 SCROLL_VERTICAL_POSITION_CHANGED,
86 SELECTED_CHANGED,
87 SELECTED_CHILDREN_CHANGED,
88 SET_SIZE_CHANGED,
89 SORT_CHANGED,
90 STATE_CHANGED,
92 TEXT_ATTRIBUTE_CHANGED,
93 VALUE_CHANGED,
94 VALUE_MAX_CHANGED,
95 VALUE_MIN_CHANGED,
96 VALUE_STEP_CHANGED,
97
98 // This event is for the exact set of attributes that affect
99 // the MSAA/IAccessible state on Windows. Not needed on other platforms,
100 // but very natural to compute here.
101 WIN_IACCESSIBLE_STATE_CHANGED,
102 };

◆ IgnoredChangedState

enum class ui::AXEventGenerator::IgnoredChangedState : uint8_t
strong
Enumerator
kShow 
kHide 
kCount 

Definition at line 106 of file ax_event_generator.h.

Constructor & Destructor Documentation

◆ AXEventGenerator() [1/2]

ui::AXEventGenerator::AXEventGenerator ( )
default

◆ AXEventGenerator() [2/2]

ui::AXEventGenerator::AXEventGenerator ( AXTree tree)
explicit

Definition at line 150 of file ax_event_generator.cc.

150 : tree_(tree) {
151 if (tree_)
152 tree_->AddObserver(this);
153}
void AddObserver(AXTreeObserver *observer)
Definition: ax_tree.cc:708

◆ ~AXEventGenerator()

ui::AXEventGenerator::~AXEventGenerator ( )
overridedefault

Member Function Documentation

◆ AddEvent()

void ui::AXEventGenerator::AddEvent ( ui::AXNode node,
Event  event 
)

Definition at line 174 of file ax_event_generator.cc.

174 {
175 BASE_DCHECK(node);
176
178 return;
179
180 std::set<EventParams>& node_events = tree_events_[node];
181 node_events.emplace(event, ax::mojom::EventFrom::kNone,
182 tree_->event_intents());
183}
const AXNodeData & data() const
Definition: ax_node.h:112
const std::vector< AXEventIntent > & event_intents() const
Definition: ax_tree.h:167
FlKeyEvent * event
ax::mojom::Role role
Definition: ax_node_data.h:277
#define BASE_DCHECK(condition)
Definition: logging.h:63

◆ begin()

Iterator ui::AXEventGenerator::begin ( ) const
inline

Definition at line 181 of file ax_event_generator.h.

181 {
182 return Iterator(tree_events_, tree_events_.begin());
183 }

◆ ClearEvents()

void ui::AXEventGenerator::ClearEvents ( )

Definition at line 170 of file ax_event_generator.cc.

170 {
171 tree_events_.clear();
172}

◆ end()

Iterator ui::AXEventGenerator::end ( ) const
inline

Definition at line 184 of file ax_event_generator.h.

184{ return Iterator(tree_events_, tree_events_.end()); }

◆ OnAtomicUpdateFinished()

void ui::AXEventGenerator::OnAtomicUpdateFinished ( AXTree tree,
bool  root_changed,
const std::vector< Change > &  changes 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 599 of file ax_event_generator.cc.

602 {
603 BASE_DCHECK(tree_ == tree);
604
605 if (root_changed && ShouldFireLoadEvents(tree->root())) {
606 if (tree->data().loaded)
607 AddEvent(tree->root(), Event::LOAD_COMPLETE);
608 else
609 AddEvent(tree->root(), Event::LOAD_START);
610 }
611
612 for (const auto& change : changes) {
613 if (change.type == SUBTREE_CREATED) {
614 AddEvent(change.node, Event::SUBTREE_CREATED);
615 } else if (change.type != NODE_CREATED) {
616 FireRelationSourceEvents(tree, change.node);
617 continue;
618 }
619
620 if (IsAlert(change.node->data().role))
621 AddEvent(change.node, Event::ALERT);
622 else if (IsActiveLiveRegion(change))
624 else if (IsContainedInLiveRegion(change))
625 FireLiveRegionEvents(change.node);
626 }
627
628 FireActiveDescendantEvents();
629
630 PostprocessEvents();
631}
void AddEvent(ui::AXNode *node, Event event)
bool IsAlert(const ax::mojom::Role role)

◆ OnBoolAttributeChanged()

void ui::AXEventGenerator::OnBoolAttributeChanged ( AXTree tree,
AXNode node,
ax::mojom::BoolAttribute  attr,
bool  new_value 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 469 of file ax_event_generator.cc.

472 {
473 BASE_DCHECK(tree_ == tree);
474
475 switch (attr) {
479 // Fire an 'invalidated' event when aria-busy becomes false
480 if (!new_value)
482 break;
485 break;
488 break;
492 AXNode* container = node;
493 while (container &&
494 !IsContainerWithSelectableChildren(container->data().role))
495 container = container->parent();
496 if (container)
498 break;
499 }
500 default:
502 break;
503 }
504}
bool IsContainerWithSelectableChildren(const ax::mojom::Role role)

◆ OnFloatAttributeChanged()

void ui::AXEventGenerator::OnFloatAttributeChanged ( AXTree tree,
AXNode node,
ax::mojom::FloatAttribute  attr,
float  old_value,
float  new_value 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 431 of file ax_event_generator.cc.

435 {
436 BASE_DCHECK(tree_ == tree);
437
438 switch (attr) {
441 break;
444 break;
447 break;
450 break;
454 break;
456 // Indentation is exposed as an object attribute because it cannot apply
457 // to a substring. However, for some platforms (e.g. ATK), alignment is a
458 // text attribute. Therefore fire both events to ensure platforms get the
459 // expected notifications.
462 break;
463 default:
465 break;
466 }
467}

◆ OnIntAttributeChanged()

void ui::AXEventGenerator::OnIntAttributeChanged ( AXTree tree,
AXNode node,
ax::mojom::IntAttribute  attr,
int32_t  old_value,
int32_t  new_value 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 332 of file ax_event_generator.cc.

336 {
337 BASE_DCHECK(tree_ == tree);
338
339 switch (attr) {
341 // Don't fire on invisible containers, as it confuses some screen readers,
342 // such as NVDA.
343 if (!node->data().HasState(ax::mojom::State::kInvisible)) {
345 active_descendant_changed_.push_back(node);
346 }
347 break;
351 break;
354 break;
358 break;
361 break;
364 break;
367 break;
369 bool was_enabled;
370 bool was_readonly;
371 GetRestrictionStates(static_cast<ax::mojom::Restriction>(old_value),
372 &was_enabled, &was_readonly);
373 bool is_enabled;
374 bool is_readonly;
375 GetRestrictionStates(static_cast<ax::mojom::Restriction>(new_value),
377
378 if (was_enabled != is_enabled) {
381 }
382 if (was_readonly != is_readonly) {
385 }
386 break;
387 }
390 break;
393 break;
395 // Ignore sort direction changes on roles other than table headers and
396 // grid headers.
397 if (IsTableHeader(node->data().role))
399 break;
401 // The image annotation is reported as part of the accessible name.
403 break;
406 break;
416 break;
418 // Alignment is exposed as an object attribute because it cannot apply to
419 // a substring. However, for some platforms (e.g. ATK), alignment is a
420 // text attribute. Therefore fire both events to ensure platforms get the
421 // expected notifications.
424 break;
425 default:
427 break;
428 }
429}
static bool is_readonly(const InterfaceBlock &block)
bool IsTableHeader(ax::mojom::Role role)
static Target * is_enabled(Benchmark *bench, const Config &config)
Definition: nanobench.cpp:714

◆ OnIntListAttributeChanged()

void ui::AXEventGenerator::OnIntListAttributeChanged ( AXTree tree,
AXNode node,
ax::mojom::IntListAttribute  attr,
const std::vector< int32_t > &  old_value,
const std::vector< int32_t > &  new_value 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 506 of file ax_event_generator.cc.

511 {
512 BASE_DCHECK(tree_ == tree);
513
514 switch (attr) {
517 break;
520 break;
523
524 // Fire FLOW_FROM_CHANGED for all nodes added or removed
525 for (int32_t id : ComputeIntListDifference(old_value, new_value)) {
526 if (auto* target_node = tree->GetFromId(id))
528 }
529 break;
530 }
533 break;
537 // On a native text field, the spelling- and grammar-error markers are
538 // associated with children not exposed on any platform. Therefore, we
539 // adjust the node we fire that event on here.
540 if (AXNode* text_field = node->GetTextFieldAncestor())
542 else
544 break;
545 default:
547 break;
548 }
549}

◆ OnNodeDataChanged()

void ui::AXEventGenerator::OnNodeDataChanged ( AXTree tree,
const AXNodeData old_node_data,
const AXNodeData new_node_data 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 185 of file ax_event_generator.cc.

187 {
188 BASE_DCHECK(tree_ == tree);
189 // Fire CHILDREN_CHANGED events when the list of children updates.
190 // Internally we store inline text box nodes as children of a static text
191 // node or a line break node, which enables us to determine character bounds
192 // and line layout. We don't expose those to platform APIs, though, so
193 // suppress CHILDREN_CHANGED events on static text nodes.
194 if (new_node_data.child_ids != old_node_data.child_ids &&
195 !ui::IsText(new_node_data.role)) {
196 AXNode* node = tree_->GetFromId(new_node_data.id);
197 tree_events_[node].emplace(Event::CHILDREN_CHANGED,
199 tree_->event_intents());
200 }
201}
AXNode * GetFromId(int32_t id) const override
Definition: ax_tree.cc:728
bool IsText(ax::mojom::Role role)

◆ OnNodeWillBeDeleted()

void ui::AXEventGenerator::OnNodeWillBeDeleted ( AXTree tree,
AXNode node 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 581 of file ax_event_generator.cc.

581 {
582 BASE_DCHECK(tree_ == tree);
583 tree_events_.erase(node);
584}

◆ OnNodeWillBeReparented()

void ui::AXEventGenerator::OnNodeWillBeReparented ( AXTree tree,
AXNode node 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 590 of file ax_event_generator.cc.

590 {
591 BASE_DCHECK(tree_ == tree);
592 tree_events_.erase(node);
593}

◆ OnRoleChanged()

void ui::AXEventGenerator::OnRoleChanged ( AXTree tree,
AXNode node,
ax::mojom::Role  old_role,
ax::mojom::Role  new_role 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 203 of file ax_event_generator.cc.

206 {
207 BASE_DCHECK(tree_ == tree);
209}

◆ OnStateChanged()

void ui::AXEventGenerator::OnStateChanged ( AXTree tree,
AXNode node,
ax::mojom::State  state,
bool  new_value 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 211 of file ax_event_generator.cc.

214 {
215 BASE_DCHECK(tree_ == tree);
216
220 }
221
222 switch (state) {
224 AddEvent(node, new_value ? Event::EXPANDED : Event::COLLAPSED);
225
226 if (node->data().role == ax::mojom::Role::kRow ||
227 node->data().role == ax::mojom::Role::kTreeItem) {
228 AXNode* container = node;
229 while (container && !IsRowContainer(container->data().role))
230 container = container->parent();
231 if (container)
233 }
234 break;
236 AXNode* unignored_parent = node->GetUnignoredParent();
237 if (unignored_parent)
238 AddEvent(unignored_parent, Event::CHILDREN_CHANGED);
240 if (!new_value)
242 break;
243 }
246 break;
249 break;
252 break;
253 default:
254 break;
255 }
256}
AtkStateType state
bool IsRowContainer(const ax::mojom::Role role)

◆ OnStringAttributeChanged()

void ui::AXEventGenerator::OnStringAttributeChanged ( AXTree tree,
AXNode node,
ax::mojom::StringAttribute  attr,
const std::string &  old_value,
const std::string &  new_value 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 258 of file ax_event_generator.cc.

262 {
263 BASE_DCHECK(tree_ == tree);
264
265 switch (attr) {
268 break;
271 break;
274 break;
277 break;
280 break;
283 break;
286 break;
289 break;
292
293 // Fire a LIVE_REGION_CREATED if the previous value was off, and the new
294 // value is not-off.
295 if (!IsAlert(node->data().role)) {
296 bool old_state = !old_value.empty() && old_value != "off";
297 bool new_state = !new_value.empty() && new_value != "off";
298 if (!old_state && new_state)
300 }
301 break;
303 // If the name of the root node changes, we expect OnTreeDataChanged to
304 // add a DOCUMENT_TITLE_CHANGED event instead.
305 if (node != tree->root())
307
308 if (node->data().HasStringAttribute(
310 FireLiveRegionEvents(node);
311 }
312 break;
315 break;
318 break;
320 // The image annotation is reported as part of the accessible name.
322 break;
325 break;
326 default:
328 break;
329 }
330}

◆ OnSubtreeWillBeDeleted()

void ui::AXEventGenerator::OnSubtreeWillBeDeleted ( AXTree tree,
AXNode node 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 586 of file ax_event_generator.cc.

586 {
587 BASE_DCHECK(tree_ == tree);
588}

◆ OnSubtreeWillBeReparented()

void ui::AXEventGenerator::OnSubtreeWillBeReparented ( AXTree tree,
AXNode node 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 595 of file ax_event_generator.cc.

595 {
596 BASE_DCHECK(tree_ == tree);
597}

◆ OnTreeDataChanged()

void ui::AXEventGenerator::OnTreeDataChanged ( AXTree tree,
const ui::AXTreeData old_data,
const ui::AXTreeData new_data 
)
overrideprotectedvirtual

Reimplemented from ui::AXTreeObserver.

Definition at line 551 of file ax_event_generator.cc.

553 {
554 BASE_DCHECK(tree_ == tree);
555
556 if (new_tree_data.loaded && !old_tree_data.loaded &&
557 ShouldFireLoadEvents(tree->root())) {
558 AddEvent(tree->root(), Event::LOAD_COMPLETE);
559 }
560
561 if (new_tree_data.sel_is_backward != old_tree_data.sel_is_backward ||
562 new_tree_data.sel_anchor_object_id !=
563 old_tree_data.sel_anchor_object_id ||
564 new_tree_data.sel_anchor_offset != old_tree_data.sel_anchor_offset ||
565 new_tree_data.sel_anchor_affinity != old_tree_data.sel_anchor_affinity ||
566 new_tree_data.sel_focus_object_id != old_tree_data.sel_focus_object_id ||
567 new_tree_data.sel_focus_offset != old_tree_data.sel_focus_offset ||
568 new_tree_data.sel_focus_affinity != old_tree_data.sel_focus_affinity) {
570 }
571 if (new_tree_data.title != old_tree_data.title)
573 if (new_tree_data.focus_id != old_tree_data.focus_id) {
574 AXNode* focus_node = tree->GetFromId(new_tree_data.focus_id);
575 if (focus_node) {
576 AddEvent(focus_node, Event::FOCUS_CHANGED);
577 }
578 }
579}

◆ ReleaseTree()

void ui::AXEventGenerator::ReleaseTree ( )

Definition at line 165 of file ax_event_generator.cc.

165 {
166 tree_->RemoveObserver(this);
167 tree_ = nullptr;
168}
void RemoveObserver(AXTreeObserver *observer)
Definition: ax_tree.cc:717

◆ set_always_fire_load_complete()

void ui::AXEventGenerator::set_always_fire_load_complete ( bool  val)
inline

Definition at line 198 of file ax_event_generator.h.

198 {
199 always_fire_load_complete_ = val;
200 }

◆ SetTree()

void ui::AXEventGenerator::SetTree ( AXTree new_tree)

Definition at line 157 of file ax_event_generator.cc.

157 {
158 if (tree_)
159 tree_->RemoveObserver(this);
160 tree_ = new_tree;
161 if (tree_)
162 tree_->AddObserver(this);
163}

The documentation for this class was generated from the following files: