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

#include <ax_platform_node_mac.h>

Inheritance diagram for ui::AXPlatformNodeMac:
ui::AXPlatformNodeBase ui::AXPlatformNode

Public Member Functions

 AXPlatformNodeMac ()
 
gfx::NativeViewAccessible GetNativeViewAccessible () override
 
void NotifyAccessibilityEvent (ax::mojom::Event event_type) override
 
void AnnounceText (const std::u16string &text) override
 
void Destroy () override
 
bool IsPlatformCheckable () const override
 
- Public Member Functions inherited from ui::AXPlatformNodeBase
 AXPlatformNodeBase ()
 
 ~AXPlatformNodeBase () override
 
virtual void Init (AXPlatformNodeDelegate *delegate)
 
const AXNodeDataGetData () const
 
gfx::NativeViewAccessible GetFocus ()
 
gfx::NativeViewAccessible GetParent () const
 
int GetChildCount () const
 
gfx::NativeViewAccessible ChildAtIndex (int index) const
 
std::string GetName () const
 
std::u16string GetNameAsString16 () const
 
virtual std::optional< intGetIndexInParent ()
 
std::stack< gfx::NativeViewAccessibleGetAncestors ()
 
std::optional< intCompareTo (AXPlatformNodeBase &other)
 
void Destroy () override
 
gfx::NativeViewAccessible GetNativeViewAccessible () override
 
void NotifyAccessibilityEvent (ax::mojom::Event event_type) override
 
AXPlatformNodeDelegateGetDelegate () const override
 
bool IsDescendantOf (AXPlatformNode *ancestor) const override
 
AXPlatformNodeBaseGetPreviousSibling () const
 
AXPlatformNodeBaseGetNextSibling () const
 
AXPlatformNodeBaseGetFirstChild () const
 
AXPlatformNodeBaseGetLastChild () const
 
bool IsDescendant (AXPlatformNodeBase *descendant)
 
AXPlatformNodeChildIterator AXPlatformNodeChildrenBegin () const
 
AXPlatformNodeChildIterator AXPlatformNodeChildrenEnd () const
 
bool HasBoolAttribute (ax::mojom::BoolAttribute attr) const
 
bool GetBoolAttribute (ax::mojom::BoolAttribute attr) const
 
bool GetBoolAttribute (ax::mojom::BoolAttribute attr, bool *value) const
 
bool HasFloatAttribute (ax::mojom::FloatAttribute attr) const
 
float GetFloatAttribute (ax::mojom::FloatAttribute attr) const
 
bool GetFloatAttribute (ax::mojom::FloatAttribute attr, float *value) const
 
bool HasIntAttribute (ax::mojom::IntAttribute attribute) const
 
int GetIntAttribute (ax::mojom::IntAttribute attribute) const
 
bool GetIntAttribute (ax::mojom::IntAttribute attribute, int *value) const
 
bool HasStringAttribute (ax::mojom::StringAttribute attribute) const
 
const std::string & GetStringAttribute (ax::mojom::StringAttribute attribute) const
 
bool GetStringAttribute (ax::mojom::StringAttribute attribute, std::string *value) const
 
bool GetString16Attribute (ax::mojom::StringAttribute attribute, std::u16string *value) const
 
std::u16string GetString16Attribute (ax::mojom::StringAttribute attribute) const
 
bool HasInheritedStringAttribute (ax::mojom::StringAttribute attribute) const
 
const std::string & GetInheritedStringAttribute (ax::mojom::StringAttribute attribute) const
 
std::u16string GetInheritedString16Attribute (ax::mojom::StringAttribute attribute) const
 
bool GetInheritedStringAttribute (ax::mojom::StringAttribute attribute, std::string *value) const
 
bool GetInheritedString16Attribute (ax::mojom::StringAttribute attribute, std::u16string *value) const
 
bool HasIntListAttribute (ax::mojom::IntListAttribute attribute) const
 
const std::vector< int32_t > & GetIntListAttribute (ax::mojom::IntListAttribute attribute) const
 
bool GetIntListAttribute (ax::mojom::IntListAttribute attribute, std::vector< int32_t > *value) const
 
AXPlatformNodeBaseGetSelectionContainer () const
 
AXPlatformNodeBaseGetTable () const
 
AXPlatformNodeBaseGetTableCaption () const
 
AXPlatformNodeBaseGetTableCell (int index) const
 
AXPlatformNodeBaseGetTableCell (int row, int column) const
 
std::optional< intGetTableCellIndex () const
 
std::optional< intGetTableColumn () const
 
std::optional< intGetTableColumnCount () const
 
std::optional< intGetTableAriaColumnCount () const
 
std::optional< intGetTableColumnSpan () const
 
std::optional< intGetTableRow () const
 
std::optional< intGetTableRowCount () const
 
std::optional< intGetTableAriaRowCount () const
 
std::optional< intGetTableRowSpan () const
 
std::optional< float > GetFontSizeInPoints () const
 
bool HasCaret (const AXTree::Selection *unignored_selection=nullptr)
 
bool IsChildOfLeaf () const
 
bool IsLeaf () const
 
bool IsInvisibleOrIgnored () const
 
bool IsScrollable () const
 
bool IsHorizontallyScrollable () const
 
bool IsVerticallyScrollable () const
 
bool IsTextField () const
 
bool IsPlainTextField () const
 
bool IsRichTextField () const
 
bool IsText () const
 
virtual bool IsPlatformCheckable () const
 
bool HasFocus ()
 
std::u16string GetHypertext () const
 
std::u16string GetInnerText () const
 
virtual std::u16string GetValue () const
 
bool ScrollToNode (ScrollType scroll_type)
 
AXPlatformNodeBaseNearestLeafToPoint (gfx::Point point) const
 
int NearestTextIndexToPoint (gfx::Point point)
 
ui::TextAttributeList ComputeTextAttributes () const
 
int GetSelectionCount () const
 
AXPlatformNodeBaseGetSelectedItem (int selected_index) const
 
int GetSelectedItems (int max_items, std::vector< AXPlatformNodeBase * > *out_selected_items=nullptr) const
 
- Public Member Functions inherited from ui::AXPlatformNode
virtual void Destroy ()
 
virtual gfx::NativeViewAccessible GetNativeViewAccessible ()=0
 
virtual void NotifyAccessibilityEvent (ax::mojom::Event event_type)=0
 
virtual AXPlatformNodeDelegateGetDelegate () const =0
 
virtual bool IsDescendantOf (AXPlatformNode *ancestor) const =0
 
void SetIsPrimaryWebContentsForWindow (bool is_primary)
 
bool IsPrimaryWebContentsForWindow () const
 
int32_t GetUniqueId () const
 
std::string ToString ()
 
std::string SubtreeToString ()
 
virtual ~AXPlatformNode ()
 

Protected Member Functions

void AddAttributeToList (const char *name, const char *value, PlatformAttributeList *attributes) override
 
- Protected Member Functions inherited from ui::AXPlatformNodeBase
bool IsDocument () const
 
bool IsSelectionItemSupported () const
 
std::u16string GetRangeValueText () const
 
std::u16string GetRoleDescription () const
 
std::u16string GetRoleDescriptionFromImageAnnotationStatusOrFromAttribute () const
 
virtual void Dispose ()
 
bool SetHypertextSelection (int start_offset, int end_offset)
 
void ComputeAttributes (PlatformAttributeList *attributes)
 
void AddAttributeToList (const ax::mojom::StringAttribute attribute, const char *name, PlatformAttributeList *attributes)
 
void AddAttributeToList (const ax::mojom::BoolAttribute attribute, const char *name, PlatformAttributeList *attributes)
 
void AddAttributeToList (const ax::mojom::IntAttribute attribute, const char *name, PlatformAttributeList *attributes)
 
virtual void AddAttributeToList (const char *name, const std::string &value, PlatformAttributeList *attributes)
 
virtual void AddAttributeToList (const char *name, const char *value, PlatformAttributeList *attributes)
 
virtual void SanitizeTextAttributeValue (const std::string &input, std::string *output) const
 
void UpdateComputedHypertext () const
 
int GetSelectionAnchor (const AXTree::Selection *selection)
 
int GetSelectionFocus (const AXTree::Selection *selection)
 
void GetSelectionOffsets (int *selection_start, int *selection_end)
 
void GetSelectionOffsets (const AXTree::Selection *selection, int *selection_start, int *selection_end)
 
void GetSelectionOffsetsFromTree (const AXTree::Selection *selection, int *selection_start, int *selection_end)
 
AXPlatformNodeBaseGetHyperlinkFromHypertextOffset (int offset)
 
int32_t GetHyperlinkIndexFromChild (AXPlatformNodeBase *child)
 
int32_t GetHypertextOffsetFromHyperlinkIndex (int32_t hyperlink_index)
 
int32_t GetHypertextOffsetFromChild (AXPlatformNodeBase *child)
 
int32_t GetHypertextOffsetFromDescendant (AXPlatformNodeBase *descendant)
 
int GetHypertextOffsetFromEndpoint (AXPlatformNodeBase *endpoint_object, int endpoint_offset)
 
bool IsSameHypertextCharacter (const AXHypertext &old_hypertext, size_t old_char_index, size_t new_char_index)
 
std::optional< intGetPosInSet () const
 
std::optional< intGetSetSize () const
 
std::string GetInvalidValue () const
 
int GetMaxSelectableItems () const
 
- Protected Member Functions inherited from ui::AXPlatformNode
 AXPlatformNode ()
 

Additional Inherited Members

- Public Types inherited from ui::AXPlatformNodeBase
enum  ScrollType {
  TopLeft , BottomRight , TopEdge , BottomEdge ,
  LeftEdge , RightEdge , Anywhere
}
 
using AXPlatformNodeChildIterator = ui::AXNode::ChildIteratorBase< AXPlatformNodeBase, &AXPlatformNodeBase::GetNextSibling, &AXPlatformNodeBase::GetPreviousSibling, &AXPlatformNodeBase::GetFirstChild, &AXPlatformNodeBase::GetLastChild >
 
- Public Types inherited from ui::AXPlatformNode
typedef AXPlatformNodeNativeWindowHandlerCallback(gfx::NativeWindow)
 
- Static Public Member Functions inherited from ui::AXPlatformNodeBase
static AXPlatformNodeGetFromUniqueId (int32_t unique_id)
 
static size_t GetInstanceCountForTesting ()
 
static void SetOnNotifyEventCallbackForTesting (ax::mojom::Event event_type, std::function< void()> callback)
 
- Static Public Member Functions inherited from ui::AXPlatformNode
static AXPlatformNodeCreate (AXPlatformNodeDelegate *delegate)
 
static AXPlatformNodeFromNativeViewAccessible (gfx::NativeViewAccessible accessible)
 
static AXPlatformNodeFromNativeWindow (gfx::NativeWindow native_window)
 
static void RegisterNativeWindowHandler (std::function< NativeWindowHandlerCallback > handler)
 
static void AddAXModeObserver (AXModeObserver *observer)
 
static void RemoveAXModeObserver (AXModeObserver *observer)
 
static AXMode GetAccessibilityMode ()
 
static void NotifyAddAXModeFlags (AXMode mode_flags)
 
static gfx::NativeViewAccessible GetPopupFocusOverride ()
 
static void SetPopupFocusOverride (gfx::NativeViewAccessible focus_override)
 
- Public Attributes inherited from ui::AXPlatformNodeBase
AXPlatformNodeDelegatedelegate_ = nullptr
 
- Static Public Attributes inherited from ui::AXPlatformNodeBase
static const char16_t kEmbeddedCharacter = L'\xfffc'
 
- Protected Types inherited from ui::AXPlatformNodeBase
using PlatformAttributeList = std::vector< std::u16string >
 
- Static Protected Member Functions inherited from ui::AXPlatformNodeBase
static AXPlatformNodeBaseFromNativeViewAccessible (gfx::NativeViewAccessible accessible)
 
static void SanitizeStringAttribute (const std::string &input, std::string *output)
 
- Protected Attributes inherited from ui::AXPlatformNodeBase
AXHypertext hypertext_
 

Detailed Description

Definition at line 21 of file ax_platform_node_mac.h.

Constructor & Destructor Documentation

◆ AXPlatformNodeMac()

ui::AXPlatformNodeMac::AXPlatformNodeMac ( )

Definition at line 1065 of file ax_platform_node_mac.mm.

1065{}

Member Function Documentation

◆ AddAttributeToList()

void ui::AXPlatformNodeMac::AddAttributeToList ( const char *  name,
const char *  value,
PlatformAttributeList attributes 
)
overrideprotectedvirtual

Reimplemented from ui::AXPlatformNodeBase.

Definition at line 1147 of file ax_platform_node_mac.mm.

1149 {
1151}
#define BASE_UNREACHABLE()
Definition: logging.h:69

◆ AnnounceText()

void ui::AXPlatformNodeMac::AnnounceText ( const std::u16string &  text)
override

Definition at line 1129 of file ax_platform_node_mac.mm.

1129 {
1130 PostAnnouncementNotification(@(base::UTF16ToUTF8(text).data()), [native_node_ AXWindowInternal],
1131 false);
1132}
std::u16string text
std::string UTF16ToUTF8(std::u16string src)
Definition: string_utils.cc:71
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ Destroy()

void ui::AXPlatformNodeMac::Destroy ( )
overridevirtual

Reimplemented from ui::AXPlatformNodeBase.

Definition at line 1069 of file ax_platform_node_mac.mm.

1069 {
1070 if (native_node_)
1071 [native_node_ detach];
1073}

◆ GetNativeViewAccessible()

gfx::NativeViewAccessible ui::AXPlatformNodeMac::GetNativeViewAccessible ( )
overridevirtual

Reimplemented from ui::AXPlatformNodeBase.

Definition at line 1086 of file ax_platform_node_mac.mm.

1086 {
1087 if (!native_node_)
1088 native_node_.reset([[AXPlatformNodeCocoa alloc] initWithNode:this]);
1089 return native_node_.get();
1090}
void reset(NST object=nil)

◆ IsPlatformCheckable()

bool ui::AXPlatformNodeMac::IsPlatformCheckable ( ) const
overridevirtual

Reimplemented from ui::AXPlatformNodeBase.

Definition at line 1076 of file ax_platform_node_mac.mm.

1076 {
1077 if (GetData().role == ax::mojom::Role::kTab) {
1078 // On Mac, tabs are exposed as radio buttons, and are treated as checkable.
1079 // Also, the internal State::kSelected is be mapped to checked via AXValue.
1080 return true;
1081 }
1082
1084}
virtual bool IsPlatformCheckable() const
const AXNodeData & GetData() const

◆ NotifyAccessibilityEvent()

void ui::AXPlatformNodeMac::NotifyAccessibilityEvent ( ax::mojom::Event  event_type)
overridevirtual

Reimplemented from ui::AXPlatformNodeBase.

Definition at line 1092 of file ax_platform_node_mac.mm.

1092 {
1095 // Handle special cases.
1096
1097 // Alerts and live regions go through the announcement API instead of the
1098 // regular NSAccessibility notification system.
1101 if (auto announcement = [native_node_ announcementForEvent:event_type]) {
1102 [native_node_ scheduleLiveRegionAnnouncement:std::move(announcement)];
1103 }
1104 return;
1105 }
1107 ax::mojom::Role role = GetData().role;
1108 if (ui::IsMenuItem(role)) {
1109 // On Mac, map menu item selection to a focus event.
1110 NotifyMacEvent(native_node_, ax::mojom::Event::kFocus);
1111 return;
1112 } else if (ui::IsListItem(role)) {
1113 if (AXPlatformNodeBase* container = GetSelectionContainer()) {
1114 const ui::AXNodeData& data = container->GetData();
1115 if (data.role == ax::mojom::Role::kListBox &&
1118 NotifyMacEvent(native_node_, ax::mojom::Event::kFocus);
1119 return;
1120 }
1121 }
1122 }
1123 }
1124 // Otherwise, use mappings between ax::mojom::Event and NSAccessibility
1125 // notifications from the EventMap above.
1126 NotifyMacEvent(native_node_, event_type);
1127}
ax::mojom::Event event_type
AXPlatformNodeBase * GetSelectionContainer() const
void NotifyAccessibilityEvent(ax::mojom::Event event_type) override
AXPlatformNodeDelegate * GetDelegate() const override
gfx::NativeViewAccessible GetFocus()
gfx::NativeViewAccessible GetNativeViewAccessible() override
bool IsMenuItem(ax::mojom::Role role)
bool IsListItem(const ax::mojom::Role role)
ax::mojom::Role role
Definition: ax_node_data.h:277

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