diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 16:23:34 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-14 10:37:21 +0000 |
commit | 38a9a29f4f9436cace7f0e7abf9c586057df8a4e (patch) | |
tree | c4e8c458dc595bc0ddb435708fa2229edfd00bd4 /chromium/ui/accessibility/ax_event_generator.cc | |
parent | e684a3455bcc29a6e3e66a004e352dea4e1141e7 (diff) | |
download | qtwebengine-chromium-38a9a29f4f9436cace7f0e7abf9c586057df8a4e.tar.gz |
BASELINE: Update Chromium to 73.0.3683.37
Change-Id: I08c9af2948b645f671e5d933aca1f7a90ea372f2
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/ui/accessibility/ax_event_generator.cc')
-rw-r--r-- | chromium/ui/accessibility/ax_event_generator.cc | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/chromium/ui/accessibility/ax_event_generator.cc b/chromium/ui/accessibility/ax_event_generator.cc index d96824cbfe7..ffc7053460d 100644 --- a/chromium/ui/accessibility/ax_event_generator.cc +++ b/chromium/ui/accessibility/ax_event_generator.cc @@ -68,20 +68,20 @@ AXEventGenerator::AXEventGenerator() = default; AXEventGenerator::AXEventGenerator(AXTree* tree) : tree_(tree) { if (tree_) - tree_->SetDelegate(this); + tree_->AddObserver(this); } AXEventGenerator::~AXEventGenerator() { if (tree_) - tree_->SetDelegate(nullptr); + tree_->RemoveObserver(this); } void AXEventGenerator::SetTree(AXTree* new_tree) { if (tree_) - tree_->SetDelegate(nullptr); + tree_->RemoveObserver(this); tree_ = new_tree; if (tree_) - tree_->SetDelegate(this); + tree_->AddObserver(this); } void AXEventGenerator::ReleaseTree() { @@ -203,7 +203,9 @@ void AXEventGenerator::OnStringAttributeChanged(AXTree* tree, case ax::mojom::StringAttribute::kLiveStatus: // TODO(accessibility): tree in the midst of updates. Disallow access to // |node|. - if (node->data().role != ax::mojom::Role::kAlert) + if (node->data().GetStringAttribute( + ax::mojom::StringAttribute::kLiveStatus) != "off" && + node->data().role != ax::mojom::Role::kAlert) AddEvent(node, Event::LIVE_REGION_CREATED); break; default: @@ -290,15 +292,6 @@ void AXEventGenerator::OnIntListAttributeChanged( AddEvent(node, Event::OTHER_ATTRIBUTE_CHANGED); } -void AXEventGenerator::OnStringListAttributeChanged( - AXTree* tree, - AXNode* node, - ax::mojom::StringListAttribute attr, - const std::vector<std::string>& old_value, - const std::vector<std::string>& new_value) { - DCHECK_EQ(tree_, tree); -} - void AXEventGenerator::OnTreeDataChanged(AXTree* tree, const ui::AXTreeData& old_tree_data, const ui::AXTreeData& new_tree_data) { @@ -340,18 +333,6 @@ void AXEventGenerator::OnSubtreeWillBeReparented(AXTree* tree, AXNode* node) { DCHECK_EQ(tree_, tree); } -void AXEventGenerator::OnNodeCreated(AXTree* tree, AXNode* node) { - DCHECK_EQ(tree_, tree); -} - -void AXEventGenerator::OnNodeReparented(AXTree* tree, AXNode* node) { - DCHECK_EQ(tree_, tree); -} - -void AXEventGenerator::OnNodeChanged(AXTree* tree, AXNode* node) { - DCHECK_EQ(tree_, tree); -} - void AXEventGenerator::OnAtomicUpdateFinished( AXTree* tree, bool root_changed, @@ -371,7 +352,8 @@ void AXEventGenerator::OnAtomicUpdateFinished( ax::mojom::StringAttribute::kLiveStatus)) { if (change.node->data().role == ax::mojom::Role::kAlert) AddEvent(change.node, Event::ALERT); - else + else if (change.node->data().GetStringAttribute( + ax::mojom::StringAttribute::kLiveStatus) != "off") AddEvent(change.node, Event::LIVE_REGION_CREATED); } else if (change.node->data().HasStringAttribute( ax::mojom::StringAttribute::kContainerLiveStatus) && @@ -395,7 +377,9 @@ void AXEventGenerator::FireLiveRegionEvents(AXNode* node) { live_root = live_root->parent(); if (live_root && - !live_root->data().GetBoolAttribute(ax::mojom::BoolAttribute::kBusy)) { + !live_root->data().GetBoolAttribute(ax::mojom::BoolAttribute::kBusy) && + live_root->data().GetStringAttribute( + ax::mojom::StringAttribute::kLiveStatus) != "off") { // Fire LIVE_REGION_NODE_CHANGED on each node that changed. if (!node->data() .GetStringAttribute(ax::mojom::StringAttribute::kName) @@ -453,8 +437,16 @@ void AXEventGenerator::FireRelationSourceEvents(AXTree* tree, std::for_each(tree->int_reverse_relations().begin(), tree->int_reverse_relations().end(), callback); - std::for_each(tree->intlist_reverse_relations().begin(), - tree->intlist_reverse_relations().end(), callback); + std::for_each( + tree->intlist_reverse_relations().begin(), + tree->intlist_reverse_relations().end(), [&](auto& entry) { + // Explicitly exclude relationships for which an additional event on the + // source node would cause extra noise. For example, kRadioGroupIds + // forms relations among all radio buttons and serves little value for + // AT to get events on the previous radio button in the group. + if (entry.first != ax::mojom::IntListAttribute::kRadioGroupIds) + callback(entry); + }); } // Attempts to suppress load-related events that we presume no AT will be |