#include "ui/accessibility/ax_event_generator.h"
#include "base/containers/contains.h"
#include "base/no_destructor.h"
#include "base/not_fatal_until.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_event.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_role_properties.h"
namespace ui {
namespace {
bool HasEvent(const std::set<AXEventGenerator::EventParams>& node_events,
AXEventGenerator::Event event) { … }
void RemoveEvent(std::set<AXEventGenerator::EventParams>* node_events,
AXEventGenerator::Event event) { … }
void RemoveEventsDueToIgnoredChanged(
std::set<AXEventGenerator::EventParams>* node_events) { … }
void AddIgnoredChangedState(
const AXEventGenerator::IgnoredChangedState& state,
AXEventGenerator::IgnoredChangedStatesBitset* ignored_changed_states) { … }
bool HasIgnoredChangedState(
const AXEventGenerator::IgnoredChangedStatesBitset& ignored_changed_states,
const AXEventGenerator::IgnoredChangedState& state) { … }
}
AXEventGenerator::EventParams::EventParams(const Event event) : … { … }
AXEventGenerator::EventParams::EventParams(
const Event event,
const ax::mojom::EventFrom event_from,
const ax::mojom::Action event_from_action,
const std::vector<AXEventIntent>& event_intents)
: … { … }
AXEventGenerator::EventParams::EventParams(const EventParams& other) = default;
AXEventGenerator::EventParams::~EventParams() = default;
AXEventGenerator::EventParams& AXEventGenerator::EventParams::operator=(
const EventParams& other) = default;
bool AXEventGenerator::EventParams::operator==(const EventParams& rhs) const { … }
bool AXEventGenerator::EventParams::operator<(const EventParams& rhs) const { … }
AXEventGenerator::TargetedEvent::TargetedEvent(AXNodeID node_id,
const EventParams& event_params)
: … { … }
AXEventGenerator::TargetedEvent::~TargetedEvent() = default;
AXEventGenerator::Iterator::Iterator(
std::map<AXNodeID, std::set<EventParams>>::const_iterator map_start_iter,
std::map<AXNodeID, std::set<EventParams>>::const_iterator map_end_iter)
: … { … }
AXEventGenerator::Iterator::Iterator(const AXEventGenerator::Iterator& other) =
default;
AXEventGenerator::Iterator::~Iterator() = default;
AXEventGenerator::Iterator& AXEventGenerator::Iterator::operator=(
const Iterator& other) = default;
AXEventGenerator::Iterator& AXEventGenerator::Iterator::operator++() { … }
AXEventGenerator::Iterator AXEventGenerator::Iterator::operator++(int) { … }
AXEventGenerator::TargetedEvent AXEventGenerator::Iterator::operator*() const { … }
bool operator==(const AXEventGenerator::Iterator& lhs,
const AXEventGenerator::Iterator& rhs) { … }
bool operator!=(const AXEventGenerator::Iterator& lhs,
const AXEventGenerator::Iterator& rhs) { … }
void swap(AXEventGenerator::Iterator& lhs, AXEventGenerator::Iterator& rhs) { … }
AXEventGenerator::AXEventGenerator() = default;
AXEventGenerator::AXEventGenerator(AXTree* tree) : … { … }
AXEventGenerator::~AXEventGenerator() = default;
void AXEventGenerator::SetTree(AXTree* new_tree) { … }
void AXEventGenerator::ReleaseTree() { … }
bool AXEventGenerator::empty() const { … }
size_t AXEventGenerator::size() const { … }
AXEventGenerator::Iterator AXEventGenerator::begin() const { … }
AXEventGenerator::Iterator AXEventGenerator::end() const { … }
void AXEventGenerator::ClearEvents() { … }
void AXEventGenerator::AddEvent(AXNode* node, AXEventGenerator::Event event) { … }
void AXEventGenerator::RegisterEventOnNode(Event event_type, AXNodeID node_id) { … }
void AXEventGenerator::UnregisterEventOnNode(Event event_type,
AXNodeID node_id) { … }
void AXEventGenerator::OnIgnoredWillChange(
AXTree* tree,
AXNode* node,
bool is_ignored_new_value,
bool is_changing_unignored_parents_children) { … }
void AXEventGenerator::OnNodeDataChanged(AXTree* tree,
const AXNodeData& old_node_data,
const AXNodeData& new_node_data) { … }
void AXEventGenerator::OnRoleChanged(AXTree* tree,
AXNode* node,
ax::mojom::Role old_role,
ax::mojom::Role new_role) { … }
void AXEventGenerator::OnIgnoredChanged(AXTree* tree,
AXNode* node,
bool is_ignored_new_value) { … }
void AXEventGenerator::OnStateChanged(AXTree* tree,
AXNode* node,
ax::mojom::State state,
bool new_value) { … }
void AXEventGenerator::OnStringAttributeChanged(AXTree* tree,
AXNode* node,
ax::mojom::StringAttribute attr,
const std::string& old_value,
const std::string& new_value) { … }
void AXEventGenerator::OnIntAttributeChanged(AXTree* tree,
AXNode* node,
ax::mojom::IntAttribute attr,
int32_t old_value,
int32_t new_value) { … }
void AXEventGenerator::OnFloatAttributeChanged(AXTree* tree,
AXNode* node,
ax::mojom::FloatAttribute attr,
float old_value,
float new_value) { … }
void AXEventGenerator::OnBoolAttributeChanged(AXTree* tree,
AXNode* node,
ax::mojom::BoolAttribute attr,
bool new_value) { … }
void AXEventGenerator::OnIntListAttributeChanged(
AXTree* tree,
AXNode* node,
ax::mojom::IntListAttribute attr,
const std::vector<int32_t>& old_value,
const std::vector<int32_t>& new_value) { … }
void AXEventGenerator::OnTreeDataChanged(AXTree* tree,
const AXTreeData& old_tree_data,
const AXTreeData& new_tree_data) { … }
void AXEventGenerator::OnSubtreeWillBeDeleted(AXTree* tree, AXNode* node) { … }
void AXEventGenerator::OnNodeWillBeReparented(AXTree* tree, AXNode* node) { … }
void AXEventGenerator::OnSubtreeWillBeReparented(AXTree* tree, AXNode* node) { … }
void AXEventGenerator::OnNodeDeleted(AXTree* tree, AXNodeID node_id) { … }
void AXEventGenerator::OnNodeReparented(AXTree* tree, AXNode* node) { … }
void AXEventGenerator::OnNodeCreated(AXTree* tree, AXNode* node) { … }
void AXEventGenerator::OnAtomicUpdateFinished(
AXTree* tree,
bool root_changed,
const std::vector<Change>& changes) { … }
void AXEventGenerator::AddEventsForTesting(
const AXNode& node,
const std::set<EventParams>& events) { … }
bool AXEventGenerator::IsRemovalRelevantInLiveRegion(AXNode* node) { … }
void AXEventGenerator::FireLiveRegionEvents(AXNode* node, bool is_removal) { … }
void AXEventGenerator::FireActiveDescendantEvents() { … }
bool CanContributeToValueOfTextfield(AXNode* target_node) { … }
void AXEventGenerator::FireValueInTextFieldChangedEventIfNecessary(
AXTree* tree,
AXNode* target_node) { … }
void AXEventGenerator::FireRelationSourceEvents(AXTree* tree,
AXNode* target_node) { … }
void AXEventGenerator::TrimEventsDueToAncestorIgnoredChanged(
AXNode* node,
std::map<AXNode*, IgnoredChangedStatesBitset>&
ancestor_ignored_changed_map) { … }
void AXEventGenerator::PostprocessEvents() { … }
void AXEventGenerator::GetRestrictionStates(ax::mojom::Restriction restriction,
bool* is_enabled,
bool* is_readonly) { … }
std::vector<int32_t> AXEventGenerator::ComputeIntListDifference(
const std::vector<int32_t>& lhs,
const std::vector<int32_t>& rhs) { … }
std::ostream& operator<<(std::ostream& os, AXEventGenerator::Event event) { … }
const char* ToString(AXEventGenerator::Event event) { … }
bool MaybeParseGeneratedEvent(const char* attribute,
AXEventGenerator::Event* result) { … }
AXEventGenerator::Event ParseGeneratedEvent(const char* attribute) { … }
}