| Flutter macOS Embedder |

Public Member Functions | List of all members
flutter::FlutterPlatformNodeDelegateMac Class Reference

`#include <FlutterPlatformNodeDelegateMac.h>`

Inheritance diagram for flutter::FlutterPlatformNodeDelegateMac:

## 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. More...
void | NodeDataChanged (const ui::AXNodeData &old_node_data, const ui::AXNodeData &new_node_data) override
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. More...
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::AXUniqueId & | GetUniqueId () const override
const ui::AXNodeData & | GetData () const override
bool | AccessibilityPerformAction (const ui::AXActionData &data) override
gfx::NativeViewAccessible | GetParent () override
gfx::NativeViewAccessible | GetFocus () override
int | GetChildCount () const override
gfx::NativeViewAccessible | ChildAtIndex (int index) override
gfx::Rect | GetBoundsRect (const ui::AXCoordinateSystem coordinate_system, const ui::AXClippingBehavior clipping_behavior, ui::AXOffscreenResult *offscreen_result) const override
gfx::NativeViewAccessible | GetLowestPlatformAncestor () const override
ui::AXNodePosition::AXPositionInstance | CreateTextPositionAt (int offset) const override
ui::AXNode * | GetAXNode () const
| Gets the underlying ax node for this platform node delegate. More...
std::weak_ptr< OwnerBridge > | GetOwnerBridge () 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. More...
virtual ui::AXPlatformNode * | GetPlatformNode () const
virtual ui::AXPlatformNode * | GetFromNodeID (int32_t id) override
virtual ui::AXPlatformNode * | GetFromTreeIDAndNodeID (const ui::AXTreeID &tree_id, int32_t node_id) override
virtual const ui::AXTree::Selection | GetUnignoredSelection () const override

## 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 49 of file FlutterPlatformNodeDelegateMac.mm.

49 {
50 // Destroy() also calls delete on itself.
51 ax_platform_node_->Destroy();
52 }

## Member Function Documentation

## ◆ GetBoundsRect()

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

Definition at line 68 of file FlutterPlatformNodeDelegateMac.mm.

71 {
72 gfx::Rect local_bounds = FlutterPlatformNodeDelegate::GetBoundsRect(
73 coordinate_system, clipping_behavior, offscreen_result);
74 gfx::RectF local_bounds_f(local_bounds);
75 gfx::RectF screen_bounds = ConvertBoundsFromLocalToScreen(local_bounds_f);
76 return gfx::ToEnclosingRect(ConvertBoundsFromScreenToGlobal(screen_bounds));
77 }
flutter::FlutterPlatformNodeDelegate::GetBoundsRect
gfx::Rect GetBoundsRect(const ui::AXCoordinateSystem coordinate_system, const ui::AXClippingBehavior clipping_behavior, ui::AXOffscreenResult *offscreen_result) const override
Definition: flutter_platform_node_delegate.cc:94

References flutter::FlutterPlatformNodeDelegate::GetBoundsRect().

## ◆ 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 84 of file FlutterPlatformNodeDelegateMac.mm.

84 {
85 if (GetAXNode()->IsIgnored()) {
86 return "";
87 }
88
89 std::string text = GetData().GetStringAttribute(ax::mojom::StringAttribute::kName);
90 if (!text.empty()) {
91 return text;
92 };
93 auto bridge_ptr = bridge_.lock();
94 NSCAssert(bridge_ptr, @"Accessibility bridge in flutter engine must not be null.");
95 for (int32_t child : GetData().child_ids) {
96 auto delegate_child = bridge_ptr->GetFlutterPlatformNodeDelegateFromID(child).lock();
97 if (!delegate_child) {
98 continue;
99 }
100 text += std::static_pointer_cast<FlutterPlatformNodeDelegateMac>(delegate_child)
101 ->GetLiveRegionText();
102 }
103 return text;
104 }
flutter::FlutterPlatformNodeDelegate::GetAXNode
ui::AXNode * GetAXNode() const
Gets the underlying ax node for this platform node delegate.
Definition: flutter_platform_node_delegate.cc:26
flutter::FlutterPlatformNodeDelegate::GetData
const ui::AXNodeData & GetData() const override
Definition: flutter_platform_node_delegate.cc:60

References flutter::FlutterPlatformNodeDelegate::GetAXNode(), and flutter::FlutterPlatformNodeDelegate::GetData().

## ◆ GetNativeViewAccessible()

gfx::NativeViewAccessible flutter::FlutterPlatformNodeDelegateMac::GetNativeViewAccessible | ( |  | ) |
| override

Definition at line 54 of file FlutterPlatformNodeDelegateMac.mm.

54 {
55 NSCAssert(ax_platform_node_, @"Platform node does not exist.");
56 return ax_platform_node_->GetNativeViewAccessible();
57 }

## ◆ GetNSWindow()

gfx::NativeViewAccessible flutter::FlutterPlatformNodeDelegateMac::GetNSWindow | ( |  | ) |
| override

Definition at line 79 of file FlutterPlatformNodeDelegateMac.mm.

79 {
80 FlutterAppDelegate* appDelegate = (FlutterAppDelegate*)[NSApp delegate];
81 return appDelegate.mainFlutterWindow;
82 }
FlutterAppDelegate
Definition: FlutterAppDelegate.h:54
FlutterAppDelegate::mainFlutterWindow
IBOutlet NSWindow * mainFlutterWindow
Definition: FlutterAppDelegate.h:65

References FlutterAppDelegate::mainFlutterWindow.

## ◆ GetParent()

gfx::NativeViewAccessible flutter::FlutterPlatformNodeDelegateMac::GetParent | ( |  | ) |
| override

Definition at line 59 of file FlutterPlatformNodeDelegateMac.mm.

59 {
60 gfx::NativeViewAccessible parent = FlutterPlatformNodeDelegate::GetParent();
61 if (!parent) {
62 NSCAssert(view_controller_.viewLoaded, @"Flutter view must be loaded");
63 return view_controller_.flutterView;
64 }
65 return parent;
66 }
flutter::FlutterPlatformNodeDelegate::GetParent
gfx::NativeViewAccessible GetParent() override
Definition: flutter_platform_node_delegate.cc:64

References flutter::FlutterPlatformNodeDelegate::GetParent().

## ◆ 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 {
29 FlutterPlatformNodeDelegate::Init(bridge, node);
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 }
flutter::FlutterPlatformNodeDelegate::Init
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 ...
Definition: flutter_platform_node_delegate.cc:20

References flutter::FlutterPlatformNodeDelegate::GetData(), and flutter::FlutterPlatformNodeDelegate::Init().

Referenced by flutter::testing::TEST().

## ◆ NodeDataChanged()

void flutter::FlutterPlatformNodeDelegateMac::NodeDataChanged | ( | const ui::AXNodeData & | old_node_data,
|  | const ui::AXNodeData & | new_node_data
| ) |  |
| overridevirtual

Reimplemented from flutter::FlutterPlatformNodeDelegate.

Definition at line 38 of file FlutterPlatformNodeDelegateMac.mm.

39 {
40 if (old_node_data.IsTextField() && !new_node_data.IsTextField()) {
41 ax_platform_node_->Destroy();
42 ax_platform_node_ = ui::AXPlatformNode::Create(this);
43 } else if (!old_node_data.IsTextField() && new_node_data.IsTextField()) {
44 ax_platform_node_->Destroy();
45 ax_platform_node_ = new FlutterTextPlatformNode(this, view_controller_);
46 }
47 }

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

- shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMac.h
- shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMac.mm