5#ifndef UI_ACCESSIBILITY_AX_NODE_H_
6#define UI_ACCESSIBILITY_AX_NODE_H_
41 static constexpr AXID kInvalidAXID = -1;
74 template <
typename NodeType,
75 NodeType* (NodeType::*NextSibling)() const,
76 NodeType* (NodeType::*PreviousSibling)() const,
77 NodeType* (NodeType::*FirstChild)() const,
78 NodeType* (NodeType::*LastChild)() const>
88 NodeType*
get()
const;
90 NodeType* operator->()
const;
104 size_t index_in_parent,
105 size_t unignored_index_in_parent = 0);
113 const std::vector<AXNode*>&
children()
const {
return children_; }
120 size_t GetUnignoredChildCount()
const;
121 AXNode* GetUnignoredChildAtIndex(
size_t index)
const;
122 AXNode* GetUnignoredParent()
const;
126 OwnerTree::Selection GetUnignoredSelection()
const;
127 size_t GetUnignoredIndexInParent()
const;
128 size_t GetIndexInParent()
const;
129 AXNode* GetFirstUnignoredChild()
const;
130 AXNode* GetLastUnignoredChild()
const;
131 AXNode* GetDeepestFirstUnignoredChild()
const;
132 AXNode* GetDeepestLastUnignoredChild()
const;
133 AXNode* GetNextUnignoredSibling()
const;
134 AXNode* GetPreviousUnignoredSibling()
const;
135 AXNode* GetNextUnignoredInTreeOrder()
const;
136 AXNode* GetPreviousUnignoredInTreeOrder()
const;
149 AXNode* GetFirstChild()
const;
150 AXNode* GetLastChild()
const;
151 AXNode* GetPreviousSibling()
const;
152 AXNode* GetNextSibling()
const;
161 bool IsLineBreak()
const;
174 void SetLocation(int32_t offset_container_id,
179 void SetIndexInParent(
size_t index_in_parent);
182 void UpdateUnignoredCachedValues();
186 void SwapChildren(std::vector<AXNode*>* children);
196 bool IsDescendantOf(
const AXNode* ancestor)
const;
198 bool IsDescendantOfCrossingTreeBoundary(
const AXNode* ancestor)
const;
199 AXNode* GetParentCrossingTreeBoundary()
const;
203 std::vector<int> GetOrComputeLineStartOffsets();
209 return data().HasBoolAttribute(attribute);
212 return data().GetBoolAttribute(attribute);
215 return data().GetBoolAttribute(attribute,
value);
219 return data().HasFloatAttribute(attribute);
222 return data().GetFloatAttribute(attribute);
225 float*
value)
const {
226 return data().GetFloatAttribute(attribute,
value);
230 return data().HasIntAttribute(attribute);
233 return data().GetIntAttribute(attribute);
236 return data().GetIntAttribute(attribute,
value);
240 return data().HasStringAttribute(attribute);
244 return data().GetStringAttribute(attribute);
247 std::string*
value)
const {
248 return data().GetStringAttribute(attribute,
value);
252 std::u16string*
value)
const {
253 return data().GetString16Attribute(attribute,
value);
257 return data().GetString16Attribute(attribute);
261 return data().HasIntListAttribute(attribute);
265 return data().GetIntListAttribute(attribute);
268 std::vector<int32_t>*
value)
const {
269 return data().GetIntListAttribute(attribute,
value);
273 return data().HasStringListAttribute(attribute);
277 return data().GetStringListAttribute(attribute);
280 std::vector<std::string>*
value)
const {
281 return data().GetStringListAttribute(attribute,
value);
285 return data().GetHtmlAttribute(attribute,
value);
288 return data().GetHtmlAttribute(attribute,
value);
292 std::optional<int> GetHierarchicalLevel()
const;
295 bool IsOrderedSetItem()
const;
296 bool IsOrderedSet()
const;
297 std::optional<int> GetPosInSet();
298 std::optional<int> GetSetSize();
303 bool SetRoleMatchesItemRole(
const AXNode* ordered_set)
const;
307 bool IsIgnoredContainerForOrderedSet()
const;
309 const std::string& GetInheritedStringAttribute(
311 std::u16string GetInheritedString16Attribute(
319 std::string GetInnerText()
const;
329 std::string GetLanguage()
const;
349 bool IsTable()
const;
350 std::optional<int> GetTableColCount()
const;
351 std::optional<int> GetTableRowCount()
const;
352 std::optional<int> GetTableAriaColCount()
const;
353 std::optional<int> GetTableAriaRowCount()
const;
354 std::optional<int> GetTableCellCount()
const;
355 std::optional<bool> GetTableHasColumnOrRowHeaderNode()
const;
356 AXNode* GetTableCaption()
const;
357 AXNode* GetTableCellFromIndex(
int index)
const;
358 AXNode* GetTableCellFromCoords(
int row_index,
int col_index)
const;
360 std::vector<AXNode::AXID> GetTableColHeaderNodeIds()
const;
362 std::vector<AXNode::AXID> GetTableColHeaderNodeIds(
int col_index)
const;
364 std::vector<AXNode::AXID> GetTableRowHeaderNodeIds(
int row_index)
const;
365 std::vector<AXNode::AXID> GetTableUniqueCellIds()
const;
369 const std::vector<AXNode*>* GetExtraMacNodes()
const;
373 std::optional<int> GetTableRowRowIndex()
const;
375 std::vector<AXNode::AXID> GetTableRowNodeIds()
const;
380 std::optional<int> GetTableColColIndex()
const;
384 bool IsTableCellOrHeader()
const;
385 std::optional<int> GetTableCellIndex()
const;
386 std::optional<int> GetTableCellColIndex()
const;
387 std::optional<int> GetTableCellRowIndex()
const;
388 std::optional<int> GetTableCellColSpan()
const;
389 std::optional<int> GetTableCellRowSpan()
const;
390 std::optional<int> GetTableCellAriaColIndex()
const;
391 std::optional<int> GetTableCellAriaRowIndex()
const;
392 std::vector<AXNode::AXID> GetTableCellColHeaderNodeIds()
const;
393 std::vector<AXNode::AXID> GetTableCellRowHeaderNodeIds()
const;
394 void GetTableCellColHeaders(std::vector<AXNode*>* col_headers)
const;
395 void GetTableCellRowHeaders(std::vector<AXNode*>* row_headers)
const;
398 bool IsCellOrHeaderOfARIATable()
const;
399 bool IsCellOrHeaderOfARIAGrid()
const;
403 bool IsEmbeddedGroup()
const;
406 bool IsIgnored()
const;
411 bool IsChildOfLeaf()
const;
429 bool IsInListMarker()
const;
433 bool IsCollapsedMenuListPopUpButton()
const;
438 AXNode* GetCollapsedMenuListPopUpButtonAncestor()
const;
441 AXNode* GetTextFieldAncestor()
const;
444 AXNode* GetOrderedSet()
const;
450 AXNode* GetLowestPlatformAncestor()
const;
455 void ComputeLineStartOffsets(std::vector<int>* line_offsets,
456 int* start_offset)
const;
458 void IdVectorToNodeVector(
const std::vector<int32_t>& ids,
459 std::vector<AXNode*>* nodes)
const;
461 int UpdateUnignoredCachedValuesRecursive(
int startIndex);
462 AXNode* ComputeLastUnignoredChildRecursive()
const;
463 AXNode* ComputeFirstUnignoredChildRecursive()
const;
465 OwnerTree*
const tree_;
466 size_t index_in_parent_;
467 size_t unignored_index_in_parent_;
468 size_t unignored_child_count_ = 0;
470 std::vector<AXNode*> children_;
476template <
typename NodeType,
477 NodeType* (NodeType::*NextSibling)() const,
478 NodeType* (NodeType::*PreviousSibling)() const,
479 NodeType* (NodeType::*FirstChild)() const,
480 NodeType* (NodeType::*LastChild)() const>
481AXNode::ChildIteratorBase<NodeType,
487 : parent_(parent), child_(child) {}
489template <
typename NodeType,
490 NodeType* (NodeType::*NextSibling)() const,
491 NodeType* (NodeType::*PreviousSibling)() const,
492 NodeType* (NodeType::*FirstChild)() const,
493 NodeType* (NodeType::*LastChild)() const>
500 : parent_(it.parent_), child_(it.child_) {}
502template <
typename NodeType,
503 NodeType* (NodeType::*NextSibling)() const,
504 NodeType* (NodeType::*PreviousSibling)() const,
505 NodeType* (NodeType::*FirstChild)() const,
506 NodeType* (NodeType::*LastChild)() const>
513 return parent_ == rhs.
parent_ && child_ == rhs.child_;
516template <
typename NodeType,
517 NodeType* (NodeType::*NextSibling)() const,
518 NodeType* (NodeType::*PreviousSibling)() const,
519 NodeType* (NodeType::*FirstChild)() const,
520 NodeType* (NodeType::*LastChild)() const>
527 return parent_ != rhs.
parent_ || child_ != rhs.child_;
530template <
typename NodeType,
531 NodeType* (NodeType::*NextSibling)() const,
532 NodeType* (NodeType::*PreviousSibling)() const,
533 NodeType* (NodeType::*FirstChild)() const,
534 NodeType* (NodeType::*LastChild)() const>
544 LastChild>::operator++() {
548 if (child_ && parent_) {
549 if (child_ == (parent_->*LastChild)())
552 child_ = (child_->*NextSibling)();
558template <
typename NodeType,
559 NodeType* (NodeType::*NextSibling)() const,
560 NodeType* (NodeType::*PreviousSibling)() const,
561 NodeType* (NodeType::*FirstChild)() const,
562 NodeType* (NodeType::*LastChild)() const>
572 LastChild>::operator--() {
577 child_ = (parent_->*LastChild)();
581 else if (child_ != (parent_->*FirstChild)())
582 child_ = (child_->*PreviousSibling)();
588template <
typename NodeType,
589 NodeType* (NodeType::*NextSibling)() const,
590 NodeType* (NodeType::*PreviousSibling)() const,
591 NodeType* (NodeType::*FirstChild)() const,
592 NodeType* (NodeType::*LastChild)() const>
602template <
typename NodeType,
603 NodeType* (NodeType::*NextSibling)() const,
604 NodeType* (NodeType::*PreviousSibling)() const,
605 NodeType* (NodeType::*FirstChild)() const,
606 NodeType* (NodeType::*LastChild)() const>
611 LastChild>::operator*()
const {
616template <
typename NodeType,
617 NodeType* (NodeType::*NextSibling)() const,
618 NodeType* (NodeType::*PreviousSibling)() const,
619 NodeType* (NodeType::*FirstChild)() const,
620 NodeType* (NodeType::*LastChild)() const>
625 LastChild>::operator->()
const {
virtual AXTableInfo * GetTableInfo(const AXNode *table_node) const =0
virtual bool GetTreeUpdateInProgressState() const =0
virtual std::optional< int > GetSetSize(const AXNode &node)=0
virtual AXNode * GetFromId(int32_t id) const =0
virtual bool HasPaginationSupport() const =0
virtual AXTreeID GetAXTreeID() const =0
virtual std::optional< int > GetPosInSet(const AXNode &node)=0
virtual Selection GetUnignoredSelection() const =0
bool GetString16Attribute(ax::mojom::StringAttribute attribute, std::u16string *value) const
bool HasFloatAttribute(ax::mojom::FloatAttribute attribute) const
bool HasStringAttribute(ax::mojom::StringAttribute attribute) const
std::u16string GetString16Attribute(ax::mojom::StringAttribute attribute) const
bool GetBoolAttribute(ax::mojom::BoolAttribute attribute) const
bool HasIntAttribute(ax::mojom::IntAttribute attribute) const
AXNode * GetLastUnignoredChild() const
bool GetBoolAttribute(ax::mojom::BoolAttribute attribute, bool *value) const
const std::string & GetStringAttribute(ax::mojom::StringAttribute attribute) const
AXNode * GetFirstUnignoredChild() const
const std::vector< int32_t > & GetIntListAttribute(ax::mojom::IntListAttribute attribute) const
bool GetIntListAttribute(ax::mojom::IntListAttribute attribute, std::vector< int32_t > *value) const
bool HasStringListAttribute(ax::mojom::StringListAttribute attribute) const
bool GetHtmlAttribute(const char *attribute, std::string *value) const
bool GetHtmlAttribute(const char *attribute, std::u16string *value) const
const std::vector< AXNode * > & children() const
bool GetStringListAttribute(ax::mojom::StringListAttribute attribute, std::vector< std::string > *value) const
bool GetFloatAttribute(ax::mojom::FloatAttribute attribute, float *value) const
AXNode * GetPreviousUnignoredSibling() const
const std::vector< std::string > & GetStringListAttribute(ax::mojom::StringListAttribute attribute) const
bool GetStringAttribute(ax::mojom::StringAttribute attribute, std::string *value) const
bool GetIntAttribute(ax::mojom::IntAttribute attribute, int *value) const
bool HasBoolAttribute(ax::mojom::BoolAttribute attribute) const
bool HasIntListAttribute(ax::mojom::IntListAttribute attribute) const
int GetIntAttribute(ax::mojom::IntAttribute attribute) const
float GetFloatAttribute(ax::mojom::FloatAttribute attribute) const
AXNode * GetNextUnignoredSibling() const
size_t index_in_parent() const
const AXNodeData & data() const
constexpr Color operator*(T value, const Color &c)
const myers::Point & get(const myers::Segment &)
bool IsTableColumn(ax::mojom::Role role)
bool operator==(const AXEventIntent &a, const AXEventIntent &b)
bool IsTableRow(ax::mojom::Role role)
std::ostream & operator<<(std::ostream &os, AXEventGenerator::Event event)
bool operator!=(const AXEventIntent &a, const AXEventIntent &b)
bool IsText(ax::mojom::Role role)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
ax::mojom::TextAffinity focus_affinity
ax::mojom::TextAffinity anchor_affinity
std::shared_ptr< const fml::Mapping > data
#define BASE_DCHECK(condition)