chromium/ui/accessibility/ax_node_data.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/accessibility/ax_node_data.h"

#include <stddef.h>

#include <set>
#include <type_traits>
#include <utility>
#include <vector>

#include "base/no_destructor.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/accessibility/ax_enum_util.h"
#include "ui/accessibility/ax_enums.mojom-shared.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_role_properties.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/gfx/geometry/transform.h"

namespace ui {

namespace {

bool IsFlagSet(uint32_t bitfield, uint32_t flag) {}

bool IsFlagSet(uint64_t bitfield, uint32_t flag) {}

uint32_t ModifyFlag(uint32_t bitfield, uint32_t flag, bool set) {}

uint64_t ModifyFlag(uint64_t bitfield, uint32_t flag, bool set) {}

std::string StateBitfieldToString(uint32_t state_enum) {}

std::string ActionsBitfieldToString(uint64_t actions) {}

template <typename ItemType, typename ItemToStringFunction>
std::string VectorToString(const std::vector<ItemType>& items,
                           ItemToStringFunction itemToStringFunction) {}

std::string IntVectorToString(const std::vector<int32_t>& items) {}

// Helper function that finds a key in a vector of pairs by matching on the
// first value, and returns an iterator.
template <typename FirstType, typename SecondType>
typename std::vector<std::pair<FirstType, SecondType>>::const_iterator
FindInVectorOfPairs(
    FirstType first,
    const std::vector<std::pair<FirstType, SecondType>>& vector) {}

}  // namespace

// Return true if |attr| is a node ID that would need to be mapped when
// renumbering the ids in a combined tree.
bool IsNodeIdIntAttribute(ax::mojom::IntAttribute attr) {}

// Returns true if |attr| contains a vector of node ids that would need
// to be mapped when renumbering the ids in a combined tree.
bool IsNodeIdIntListAttribute(ax::mojom::IntListAttribute attr) {}

AXNodeData::AXNodeData() :{}

AXNodeData::~AXNodeData() = default;

AXNodeData::AXNodeData(const AXNodeData& other) {}

AXNodeData::AXNodeData(AXNodeData&& other) {}

AXNodeData& AXNodeData::operator=(const AXNodeData& other) {}

bool AXNodeData::HasBoolAttribute(ax::mojom::BoolAttribute attribute) const {}

bool AXNodeData::GetBoolAttribute(ax::mojom::BoolAttribute attribute) const {}

bool AXNodeData::GetBoolAttribute(ax::mojom::BoolAttribute attribute,
                                  bool* value) const {}

bool AXNodeData::HasFloatAttribute(ax::mojom::FloatAttribute attribute) const {}

float AXNodeData::GetFloatAttribute(ax::mojom::FloatAttribute attribute) const {}

bool AXNodeData::GetFloatAttribute(ax::mojom::FloatAttribute attribute,
                                   float* value) const {}

bool AXNodeData::HasIntAttribute(ax::mojom::IntAttribute attribute) const {}

int AXNodeData::GetIntAttribute(ax::mojom::IntAttribute attribute) const {}

bool AXNodeData::GetIntAttribute(ax::mojom::IntAttribute attribute,
                                 int* value) const {}

bool AXNodeData::HasStringAttribute(
    ax::mojom::StringAttribute attribute) const {}

const std::string& AXNodeData::GetStringAttribute(
    ax::mojom::StringAttribute attribute) const {}

bool AXNodeData::GetStringAttribute(ax::mojom::StringAttribute attribute,
                                    std::string* value) const {}

std::u16string AXNodeData::GetString16Attribute(
    ax::mojom::StringAttribute attribute) const {}

bool AXNodeData::GetString16Attribute(ax::mojom::StringAttribute attribute,
                                      std::u16string* value) const {}

bool AXNodeData::HasIntListAttribute(
    ax::mojom::IntListAttribute attribute) const {}

const std::vector<int32_t>& AXNodeData::GetIntListAttribute(
    ax::mojom::IntListAttribute attribute) const {}

bool AXNodeData::GetIntListAttribute(ax::mojom::IntListAttribute attribute,
                                     std::vector<int32_t>* value) const {}

bool AXNodeData::HasStringListAttribute(
    ax::mojom::StringListAttribute attribute) const {}

const std::vector<std::string>& AXNodeData::GetStringListAttribute(
    ax::mojom::StringListAttribute attribute) const {}

bool AXNodeData::GetStringListAttribute(
    ax::mojom::StringListAttribute attribute,
    std::vector<std::string>* value) const {}

bool AXNodeData::HasHtmlAttribute(const char* attribute) const {}

bool AXNodeData::GetHtmlAttribute(const char* attribute,
                                  std::string* value) const {}

std::u16string AXNodeData::GetHtmlAttribute(const char* attribute) const {}

bool AXNodeData::GetHtmlAttribute(const char* attribute,
                                  std::u16string* value) const {}

void AXNodeData::AddChildTreeId(const AXTreeID& tree_id) {}

bool AXNodeData::HasChildTreeID() const {}

std::optional<AXTreeID> AXNodeData::GetChildTreeID() const {}

void AXNodeData::AddBoolAttribute(ax::mojom::BoolAttribute attribute,
                                  bool value) {}

void AXNodeData::AddIntAttribute(ax::mojom::IntAttribute attribute, int value) {}

void AXNodeData::AddFloatAttribute(ax::mojom::FloatAttribute attribute,
                                   float value) {}

void AXNodeData::AddStringAttribute(ax::mojom::StringAttribute attribute,
                                    const std::string& value) {}

void AXNodeData::AddIntListAttribute(ax::mojom::IntListAttribute attribute,
                                     const std::vector<int32_t>& value) {}

void AXNodeData::AddStringListAttribute(
    ax::mojom::StringListAttribute attribute,
    const std::vector<std::string>& value) {}

void AXNodeData::RemoveBoolAttribute(ax::mojom::BoolAttribute attribute) {}

void AXNodeData::RemoveIntAttribute(ax::mojom::IntAttribute attribute) {}

void AXNodeData::RemoveFloatAttribute(ax::mojom::FloatAttribute attribute) {}

void AXNodeData::RemoveStringAttribute(ax::mojom::StringAttribute attribute) {}

void AXNodeData::RemoveIntListAttribute(ax::mojom::IntListAttribute attribute) {}

void AXNodeData::RemoveStringListAttribute(
    ax::mojom::StringListAttribute attribute) {}

AXTextAttributes AXNodeData::GetTextAttributes() const {}

int AXNodeData::GetDOMNodeId() const {}

void AXNodeData::SetName(const std::string& name) {}

void AXNodeData::SetName(const std::u16string& name) {}

void AXNodeData::SetNameChecked(const std::string& name) {}

void AXNodeData::SetNameChecked(const std::u16string& name) {}

void AXNodeData::SetNameExplicitlyEmpty() {}

void AXNodeData::SetDescription(const std::string& description) {}

void AXNodeData::SetDescription(const std::u16string& description) {}

void AXNodeData::SetDescriptionExplicitlyEmpty() {}

void AXNodeData::SetValue(const std::string& value) {}

void AXNodeData::SetValue(const std::u16string& value) {}

bool AXNodeData::HasState(ax::mojom::State state_enum) const {}

bool AXNodeData::HasAction(ax::mojom::Action action) const {}

bool AXNodeData::HasTextStyle(ax::mojom::TextStyle text_style_enum) const {}

void AXNodeData::AddState(ax::mojom::State state_enum) {}

void AXNodeData::RemoveState(ax::mojom::State state_enum) {}

void AXNodeData::AddAction(ax::mojom::Action action_enum) {}

void AXNodeData::RemoveAction(ax::mojom::Action action_enum) {}

void AXNodeData::AddTextStyle(ax::mojom::TextStyle text_style_enum) {}

ax::mojom::CheckedState AXNodeData::GetCheckedState() const {}

void AXNodeData::SetCheckedState(ax::mojom::CheckedState checked_state) {}

bool AXNodeData::HasCheckedState() const {}

ax::mojom::DefaultActionVerb AXNodeData::GetDefaultActionVerb() const {}

void AXNodeData::SetDefaultActionVerb(
    ax::mojom::DefaultActionVerb default_action_verb) {}

ax::mojom::HasPopup AXNodeData::GetHasPopup() const {}

void AXNodeData::SetHasPopup(ax::mojom::HasPopup has_popup) {}

ax::mojom::IsPopup AXNodeData::GetIsPopup() const {}

void AXNodeData::SetIsPopup(ax::mojom::IsPopup is_popup) {}

ax::mojom::InvalidState AXNodeData::GetInvalidState() const {}

void AXNodeData::SetInvalidState(ax::mojom::InvalidState invalid_state) {}

ax::mojom::NameFrom AXNodeData::GetNameFrom() const {}

void AXNodeData::SetNameFrom(ax::mojom::NameFrom name_from) {}

ax::mojom::DescriptionFrom AXNodeData::GetDescriptionFrom() const {}

void AXNodeData::SetDescriptionFrom(
    ax::mojom::DescriptionFrom description_from) {}

ax::mojom::TextPosition AXNodeData::GetTextPosition() const {}

void AXNodeData::SetTextPosition(ax::mojom::TextPosition text_position) {}

ax::mojom::ImageAnnotationStatus AXNodeData::GetImageAnnotationStatus() const {}

void AXNodeData::SetImageAnnotationStatus(
    ax::mojom::ImageAnnotationStatus status) {}

ax::mojom::Restriction AXNodeData::GetRestriction() const {}

void AXNodeData::SetRestriction(ax::mojom::Restriction restriction) {}

ax::mojom::ListStyle AXNodeData::GetListStyle() const {}

void AXNodeData::SetListStyle(ax::mojom::ListStyle list_style) {}

ax::mojom::TextAlign AXNodeData::GetTextAlign() const {}

void AXNodeData::SetTextAlign(ax::mojom::TextAlign text_align) {}

ax::mojom::WritingDirection AXNodeData::GetTextDirection() const {}

void AXNodeData::SetTextDirection(ax::mojom::WritingDirection text_direction) {}

bool AXNodeData::IsActivatable() const {}

bool AXNodeData::IsActiveLiveRegionRoot() const {}

bool AXNodeData::IsButtonPressed() const {}

bool AXNodeData::IsClickable() const {}

bool AXNodeData::IsContainedInActiveLiveRegion() const {}

bool AXNodeData::IsSelectable() const {}

bool AXNodeData::IsIgnored() const {}

bool AXNodeData::IsInvisible() const {}

bool AXNodeData::IsInvisibleOrIgnored() const {}

bool AXNodeData::IsInvocable() const {}

bool AXNodeData::IsMenuButton() const {}

bool AXNodeData::IsTextField() const {}

bool AXNodeData::IsPasswordField() const {}

bool AXNodeData::IsAtomicTextField() const {}

bool AXNodeData::IsNonAtomicTextField() const {}

bool AXNodeData::IsSpinnerTextField() const {}

bool AXNodeData::IsRangeValueSupported() const {}

bool AXNodeData::SupportsExpandCollapse() const {}

// TODO(accessibility) Consider reusing code from AXTreeFormatterBlink, where
// the |verbose| parameter alters the property filter. Would remove ~800 lines.
std::string AXNodeData::ToString(bool verbose) const {}

size_t AXNodeData::ByteSize() const {}

void AXNodeData::AccumulateSize(
    AXNodeData::AXNodeDataSize& node_data_size) const {}

size_t AXNodeData::AXNodeDataSize::ByteSize() const {}

}  // namespace ui