Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flutter::FlutterPlatformNodeDelegateMac Class Reference

#include <FlutterPlatformNodeDelegateMac.h>

Inheritance diagram for flutter::FlutterPlatformNodeDelegateMac:
flutter::FlutterPlatformNodeDelegate ui::AXPlatformNodeDelegateBase ui::AXPlatformNodeDelegate

Public Member Functions

 FlutterPlatformNodeDelegateMac (std::weak_ptr< AccessibilityBridge > bridge, __weak FlutterViewController *view_controller)
 
virtual ~FlutterPlatformNodeDelegateMac ()
 
void Init (std::weak_ptr< OwnerBridge > bridge, ui::AXNode *node) override
 Called only once, immediately after construction. The constructor doesn't take any arguments because in the Windows subclass we use a special function to construct a COM object. Subclasses must call super.
 
std::string GetLiveRegionText () const
 Gets the live region text of this node in UTF-8 format. This is useful to determine the changes in between semantics updates when generating accessibility events.
 
gfx::NativeViewAccessible GetNativeViewAccessible () override
 
gfx::NativeViewAccessible GetNSWindow () override
 
gfx::NativeViewAccessible GetParent () override
 
gfx::Rect GetBoundsRect (const ui::AXCoordinateSystem coordinate_system, const ui::AXClippingBehavior clipping_behavior, ui::AXOffscreenResult *offscreen_result) const override
 
- Public Member Functions inherited from flutter::FlutterPlatformNodeDelegate
 FlutterPlatformNodeDelegate ()
 
virtual ~FlutterPlatformNodeDelegate () override
 
const ui::AXUniqueIdGetUniqueId () const override
 
const ui::AXNodeDataGetData () const override
 
bool AccessibilityPerformAction (const ui::AXActionData &data) override
 
gfx::NativeViewAccessible GetFocus () override
 
int GetChildCount () const override
 
gfx::NativeViewAccessible ChildAtIndex (int index) override
 
gfx::NativeViewAccessible GetLowestPlatformAncestor () const override
 
ui::AXNodePosition::AXPositionInstance CreateTextPositionAt (int offset) const override
 
ui::AXNodeGetAXNode () const
 Gets the underlying ax node for this platform node delegate.
 
std::weak_ptr< OwnerBridgeGetOwnerBridge () const
 Gets the owner of this platform node delegate. This is useful when you want to get the information about surrounding nodes of this platform node delegate, e.g. the global rect of this platform node delegate. This pointer is only safe in the platform thread.
 
virtual ui::AXPlatformNodeGetPlatformNode () const
 
virtual ui::AXPlatformNodeGetFromNodeID (int32_t id) override
 
virtual ui::AXPlatformNodeGetFromTreeIDAndNodeID (const ui::AXTreeID &tree_id, int32_t node_id) override
 
virtual const ui::AXTree::Selection GetUnignoredSelection () const override
 
- Public Member Functions inherited from ui::AXPlatformNodeDelegateBase
 AXPlatformNodeDelegateBase ()
 
 ~AXPlatformNodeDelegateBase () override
 
const AXTreeDataGetTreeData () const override
 
std::u16string GetInnerText () const override
 
int GetIndexInParent () override
 
bool HasModalDialog () const override
 
gfx::NativeViewAccessible GetFirstChild () override
 
gfx::NativeViewAccessible GetLastChild () override
 
gfx::NativeViewAccessible GetNextSibling () override
 
gfx::NativeViewAccessible GetPreviousSibling () override
 
bool IsChildOfLeaf () const override
 
bool IsChildOfPlainTextField () const override
 
bool IsLeaf () const override
 
bool IsToplevelBrowserWindow () override
 
gfx::NativeViewAccessible GetClosestPlatformObject () const override
 
std::unique_ptr< AXPlatformNodeDelegate::ChildIteratorChildrenBegin () override
 
std::unique_ptr< AXPlatformNodeDelegate::ChildIteratorChildrenEnd () override
 
std::string GetName () const override
 
std::u16string GetHypertext () const override
 
bool SetHypertextSelection (int start_offset, int end_offset) override
 
TextAttributeMap ComputeTextAttributeMap (const TextAttributeList &default_attributes) const override
 
std::string GetInheritedFontFamilyName () const override
 
gfx::Rect GetHypertextRangeBoundsRect (const int start_offset, const int end_offset, const AXCoordinateSystem coordinate_system, const AXClippingBehavior clipping_behavior, AXOffscreenResult *offscreen_result) const override
 
gfx::Rect GetInnerTextRangeBoundsRect (const int start_offset, const int end_offset, const AXCoordinateSystem coordinate_system, const AXClippingBehavior clipping_behavior, AXOffscreenResult *offscreen_result) const override
 
gfx::Rect GetClippedScreenBoundsRect (AXOffscreenResult *offscreen_result=nullptr) const override
 
gfx::Rect GetUnclippedScreenBoundsRect (AXOffscreenResult *offscreen_result=nullptr) const
 
gfx::NativeViewAccessible HitTestSync (int screen_physical_pixel_x, int screen_physical_pixel_y) const override
 
bool IsOffscreen () const override
 
bool IsMinimized () const override
 
bool IsText () const override
 
bool IsWebContent () const override
 
bool HasVisibleCaretOrSelection () const override
 
AXPlatformNodeGetTargetNodeForRelation (ax::mojom::IntAttribute attr) override
 
std::vector< AXPlatformNode * > GetTargetNodesForRelation (ax::mojom::IntListAttribute attr) override
 
std::set< AXPlatformNode * > GetReverseRelations (ax::mojom::IntAttribute attr) override
 
std::set< AXPlatformNode * > GetReverseRelations (ax::mojom::IntListAttribute attr) override
 
std::u16string GetAuthorUniqueId () const override
 
std::optional< intFindTextBoundary (ax::mojom::TextBoundary boundary, int offset, ax::mojom::MoveDirection direction, ax::mojom::TextAffinity affinity) const override
 
const std::vector< gfx::NativeViewAccessibleGetUIADescendants () const override
 
std::string GetLanguage () const override
 
bool IsTable () const override
 
std::optional< intGetTableColCount () const override
 
std::optional< intGetTableRowCount () const override
 
std::optional< intGetTableAriaColCount () const override
 
std::optional< intGetTableAriaRowCount () const override
 
std::optional< intGetTableCellCount () const override
 
std::optional< bool > GetTableHasColumnOrRowHeaderNode () const override
 
std::vector< int32_t > GetColHeaderNodeIds () const override
 
std::vector< int32_t > GetColHeaderNodeIds (int col_index) const override
 
std::vector< int32_t > GetRowHeaderNodeIds () const override
 
std::vector< int32_t > GetRowHeaderNodeIds (int row_index) const override
 
AXPlatformNodeGetTableCaption () const override
 
bool IsTableRow () const override
 
std::optional< intGetTableRowRowIndex () const override
 
bool IsTableCellOrHeader () const override
 
std::optional< intGetTableCellIndex () const override
 
std::optional< intGetTableCellColIndex () const override
 
std::optional< intGetTableCellRowIndex () const override
 
std::optional< intGetTableCellColSpan () const override
 
std::optional< intGetTableCellRowSpan () const override
 
std::optional< intGetTableCellAriaColIndex () const override
 
std::optional< intGetTableCellAriaRowIndex () const override
 
std::optional< int32_t > GetCellId (int row_index, int col_index) const override
 
std::optional< int32_t > CellIndexToId (int cell_index) const override
 
bool IsCellOrHeaderOfARIATable () const override
 
bool IsCellOrHeaderOfARIAGrid () const override
 
bool IsOrderedSetItem () const override
 
bool IsOrderedSet () const override
 
std::optional< intGetPosInSet () const override
 
std::optional< intGetSetSize () const override
 
gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent () override
 
std::u16string GetLocalizedStringForImageAnnotationStatus (ax::mojom::ImageAnnotationStatus status) const override
 
std::u16string GetLocalizedRoleDescriptionForUnlabeledImage () const override
 
std::u16string GetLocalizedStringForLandmarkType () const override
 
std::u16string GetLocalizedStringForRoleDescription () const override
 
std::u16string GetStyleNameAttributeAsLocalizedString () const override
 
bool ShouldIgnoreHoveredStateForTesting () override
 
- Public Member Functions inherited from ui::AXPlatformNodeDelegate
virtual ~AXPlatformNodeDelegate ()=default
 
std::string ToString ()
 
std::string SubtreeToString ()
 

Additional Inherited Members

- Protected Member Functions inherited from ui::AXPlatformNodeDelegateBase
std::string SubtreeToStringHelper (size_t level) override
 
std::set< ui::AXPlatformNode * > GetNodesForNodeIds (const std::set< int32_t > &ids)
 
AXPlatformNodeDelegateGetParentDelegate ()
 
- Protected Member Functions inherited from ui::AXPlatformNodeDelegate
 AXPlatformNodeDelegate ()=default
 

Detailed Description

The macOS implementation of FlutterPlatformNodeDelegate. This class uses AXPlatformNodeMac to manage the macOS-specific accessibility objects.

Definition at line 22 of file FlutterPlatformNodeDelegateMac.h.

Constructor & Destructor Documentation

◆ FlutterPlatformNodeDelegateMac()

flutter::FlutterPlatformNodeDelegateMac::FlutterPlatformNodeDelegateMac ( std::weak_ptr< AccessibilityBridge bridge,
__weak FlutterViewController view_controller 
)

Definition at line 23 of file FlutterPlatformNodeDelegateMac.mm.

26 : bridge_(std::move(bridge)), view_controller_(view_controller) {}

◆ ~FlutterPlatformNodeDelegateMac()

flutter::FlutterPlatformNodeDelegateMac::~FlutterPlatformNodeDelegateMac ( )
virtual

Definition at line 38 of file FlutterPlatformNodeDelegateMac.mm.

38 {
39 // Destroy() also calls delete on itself.
40 ax_platform_node_->Destroy();
41}
virtual void Destroy()

Member Function Documentation

◆ GetBoundsRect()

gfx::Rect flutter::FlutterPlatformNodeDelegateMac::GetBoundsRect ( const ui::AXCoordinateSystem  coordinate_system,
const ui::AXClippingBehavior  clipping_behavior,
ui::AXOffscreenResult offscreen_result 
) const
overridevirtual

Reimplemented from flutter::FlutterPlatformNodeDelegate.

Definition at line 57 of file FlutterPlatformNodeDelegateMac.mm.

60 {
62 coordinate_system, clipping_behavior, offscreen_result);
63 gfx::RectF local_bounds_f(local_bounds);
64 gfx::RectF screen_bounds = ConvertBoundsFromLocalToScreen(local_bounds_f);
65 return gfx::ToEnclosingRect(ConvertBoundsFromScreenToGlobal(screen_bounds));
66}
gfx::Rect GetBoundsRect(const ui::AXCoordinateSystem coordinate_system, const ui::AXClippingBehavior clipping_behavior, ui::AXOffscreenResult *offscreen_result) const override
Rect ToEnclosingRect(const RectF &r)

◆ GetLiveRegionText()

std::string flutter::FlutterPlatformNodeDelegateMac::GetLiveRegionText ( ) const

Gets the live region text of this node in UTF-8 format. This is useful to determine the changes in between semantics updates when generating accessibility events.

Definition at line 73 of file FlutterPlatformNodeDelegateMac.mm.

73 {
74 if (GetAXNode()->IsIgnored()) {
75 return "";
76 }
77
79 if (!text.empty()) {
80 return text;
81 };
82 auto bridge_ptr = bridge_.lock();
83 NSCAssert(bridge_ptr, @"Accessibility bridge in flutter engine must not be null.");
84 for (int32_t child : GetData().child_ids) {
85 auto delegate_child = bridge_ptr->GetFlutterPlatformNodeDelegateFromID(child).lock();
86 if (!delegate_child) {
87 continue;
88 }
89 text += std::static_pointer_cast<FlutterPlatformNodeDelegateMac>(delegate_child)
90 ->GetLiveRegionText();
91 }
92 return text;
93}
ui::AXNode * GetAXNode() const
Gets the underlying ax node for this platform node delegate.
const ui::AXNodeData & GetData() const override
std::u16string text
const std::string & GetStringAttribute(ax::mojom::StringAttribute attribute) const

◆ GetNativeViewAccessible()

gfx::NativeViewAccessible flutter::FlutterPlatformNodeDelegateMac::GetNativeViewAccessible ( )
overridevirtual

Reimplemented from ui::AXPlatformNodeDelegateBase.

Definition at line 43 of file FlutterPlatformNodeDelegateMac.mm.

43 {
44 NSCAssert(ax_platform_node_, @"Platform node does not exist.");
45 return ax_platform_node_->GetNativeViewAccessible();
46}
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0

◆ GetNSWindow()

gfx::NativeViewAccessible flutter::FlutterPlatformNodeDelegateMac::GetNSWindow ( )
overridevirtual

Reimplemented from ui::AXPlatformNodeDelegateBase.

Definition at line 68 of file FlutterPlatformNodeDelegateMac.mm.

68 {
69 FlutterAppDelegate* appDelegate = (FlutterAppDelegate*)[NSApp delegate];
70 return appDelegate.mainFlutterWindow;
71}
IBOutlet NSWindow * mainFlutterWindow

◆ GetParent()

gfx::NativeViewAccessible flutter::FlutterPlatformNodeDelegateMac::GetParent ( )
overridevirtual

Reimplemented from flutter::FlutterPlatformNodeDelegate.

Definition at line 48 of file FlutterPlatformNodeDelegateMac.mm.

48 {
50 if (!parent) {
51 NSCAssert(view_controller_.viewLoaded, @"Flutter view must be loaded");
52 return view_controller_.flutterView;
53 }
54 return parent;
55}
gfx::NativeViewAccessible GetParent() override
UnimplementedNativeViewAccessible * NativeViewAccessible

◆ Init()

void flutter::FlutterPlatformNodeDelegateMac::Init ( std::weak_ptr< OwnerBridge bridge,
ui::AXNode node 
)
overridevirtual

Called only once, immediately after construction. The constructor doesn't take any arguments because in the Windows subclass we use a special function to construct a COM object. Subclasses must call super.

Reimplemented from flutter::FlutterPlatformNodeDelegate.

Definition at line 28 of file FlutterPlatformNodeDelegateMac.mm.

28 {
30 if (GetData().IsTextField()) {
31 ax_platform_node_ = new FlutterTextPlatformNode(this, view_controller_);
32 } else {
33 ax_platform_node_ = ui::AXPlatformNode::Create(this);
34 }
35 NSCAssert(ax_platform_node_, @"Failed to create platform node.");
36}
virtual void Init(std::weak_ptr< OwnerBridge > bridge, ui::AXNode *node)
Called only once, immediately after construction. The constructor doesn't take any arguments because ...
static AXPlatformNode * Create(AXPlatformNodeDelegate *delegate)

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