Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
flutter::AccessibilityBridgeWindows Class Reference

#include <accessibility_bridge_windows.h>

Inheritance diagram for flutter::AccessibilityBridgeWindows:
flutter::AccessibilityBridge ui::AXFragmentRootDelegateWin flutter::FlutterPlatformNodeDelegate::OwnerBridge ui::AXPlatformTreeManager ui::AXTreeObserver flutter::AccessibilityBridgeIos ui::AXTreeManager

Public Member Functions

 AccessibilityBridgeWindows (FlutterWindowsView *view)
 
virtual ~AccessibilityBridgeWindows ()=default
 
void DispatchAccessibilityAction (AccessibilityNodeId target, FlutterSemanticsAction action, fml::MallocMapping data) override
 Dispatch accessibility action back to the Flutter framework. These actions are generated in the native accessibility system when users interact with the assistive technologies. For example, a FlutterSemanticsAction::kFlutterSemanticsActionTap is fired when user click or touch the screen. More...
 
virtual void DispatchWinAccessibilityEvent (std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate, ax::mojom::Event event_type)
 
virtual void SetFocus (std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate)
 
gfx::NativeViewAccessible GetChildOfAXFragmentRoot () override
 
gfx::NativeViewAccessible GetParentOfAXFragmentRoot () override
 
bool IsAXFragmentRootAControlElement () override
 
- Public Member Functions inherited from flutter::AccessibilityBridge
 AccessibilityBridge ()
 Creates a new instance of a accessibility bridge. More...
 
virtual ~AccessibilityBridge ()
 
void AddFlutterSemanticsNodeUpdate (const FlutterSemanticsNode2 &node)
 Adds a semantics node update to the pending semantics update. Calling this method alone will NOT update the semantics tree. To flush the pending updates, call the CommitUpdates(). More...
 
void AddFlutterSemanticsCustomActionUpdate (const FlutterSemanticsCustomAction2 &action)
 Adds a custom semantics action update to the pending semantics update. Calling this method alone will NOT update the semantics tree. To flush the pending updates, call the CommitUpdates(). More...
 
void CommitUpdates ()
 Flushes the pending updates and applies them to this accessibility bridge. Calling this with no pending updates does nothing, and callers should call this method at the end of an atomic batch to avoid leaving the tree in a unstable state. For example if a node reparents from A to B, callers should only call this method when both removal from A and addition to B are in the pending updates. More...
 
std::weak_ptr< FlutterPlatformNodeDelegateGetFlutterPlatformNodeDelegateFromID (AccessibilityNodeId id) const
 Get the flutter platform node delegate with the given id from this accessibility bridge. Returns expired weak_ptr if the delegate associated with the id does not exist or has been removed from the accessibility tree. More...
 
const ui::AXTreeDataGetAXTreeData () const
 Get the ax tree data from this accessibility bridge. The tree data contains information such as the id of the node that has the keyboard focus or the text selection range. More...
 
const std::vector< ui::AXEventGenerator::TargetedEventGetPendingEvents () const
 Gets all pending accessibility events generated during semantics updates. This is useful when deciding how to handle events in AccessibilityBridgeDelegate::OnAccessibilityEvent in case one may decide to handle an event differently based on all pending events. More...
 
ui::AXNodeGetNodeFromTree (const ui::AXTreeID tree_id, const ui::AXNode::AXID node_id) const override
 
ui::AXNodeGetNodeFromTree (const ui::AXNode::AXID node_id) const override
 
ui::AXTreeID GetTreeID () const override
 
ui::AXTreeID GetParentTreeID () const override
 
ui::AXNodeGetRootAsAXNode () const override
 
ui::AXNodeGetParentNodeFromParentTreeAsAXNode () const override
 
ui::AXTreeGetTree () const override
 
ui::AXPlatformNodeGetPlatformNodeFromTree (const ui::AXNode::AXID node_id) const override
 
ui::AXPlatformNodeGetPlatformNodeFromTree (const ui::AXNode &node) const override
 
ui::AXPlatformNodeDelegateRootDelegate () const override
 
 AccessibilityBridge (FlutterViewController *view_controller, PlatformViewIOS *platform_view, std::shared_ptr< FlutterPlatformViewsController > platform_views_controller, std::unique_ptr< IosDelegate > ios_delegate=nullptr)
 
 ~AccessibilityBridge ()
 
void UpdateSemantics (flutter::SemanticsNodeUpdates nodes, const flutter::CustomAccessibilityActionUpdates &actions)
 
void HandleEvent (NSDictionary< NSString *, id > *annotatedEvent)
 
void DispatchSemanticsAction (int32_t id, flutter::SemanticsAction action) override
 
void DispatchSemanticsAction (int32_t id, flutter::SemanticsAction action, fml::MallocMapping args) override
 
void AccessibilityObjectDidBecomeFocused (int32_t id) override
 
void AccessibilityObjectDidLoseFocus (int32_t id) override
 
UIView< UITextInput > * textInputView () override
 
UIView * view () const override
 
bool isVoiceOverRunning () const override
 
fml::WeakPtr< AccessibilityBridgeGetWeakPtr ()
 
std::shared_ptr< FlutterPlatformViewsControllerGetPlatformViewsController () const override
 
void clearState ()
 
- Public Member Functions inherited from flutter::FlutterPlatformNodeDelegate::OwnerBridge
virtual ~OwnerBridge ()=default
 
virtual gfx::RectF RelativeToGlobalBounds (const ui::AXNode *node, bool &offscreen, bool clip_bounds)=0
 Gets the rectangular bounds of the ax node relative to global coordinate. More...
 
- Public Member Functions inherited from ui::AXPlatformTreeManager
virtual ~AXPlatformTreeManager ()=default
 
virtual AXPlatformNodeGetPlatformNodeFromTree (const AXNode::AXID node_id) const =0
 
virtual AXPlatformNodeGetPlatformNodeFromTree (const AXNode &node) const =0
 
virtual AXPlatformNodeDelegateRootDelegate () const =0
 
- Public Member Functions inherited from ui::AXTreeManager
virtual ~AXTreeManager ()=default
 
virtual AXNodeGetNodeFromTree (const AXTreeID tree_id, const AXNode::AXID node_id) const =0
 
virtual AXNodeGetNodeFromTree (const AXNode::AXID node_id) const =0
 
virtual AXTreeID GetTreeID () const =0
 
virtual AXTreeID GetParentTreeID () const =0
 
virtual AXNodeGetRootAsAXNode () const =0
 
virtual AXNodeGetParentNodeFromParentTreeAsAXNode () const =0
 
virtual AXTreeGetTree () const =0
 
- Public Member Functions inherited from flutter::AccessibilityBridgeIos
virtual ~AccessibilityBridgeIos ()=default
 
virtual UIView * view () const =0
 
virtual bool isVoiceOverRunning () const =0
 
virtual UIView< UITextInput > * textInputView ()=0
 
virtual void DispatchSemanticsAction (int32_t id, flutter::SemanticsAction action)=0
 
virtual void DispatchSemanticsAction (int32_t id, flutter::SemanticsAction action, fml::MallocMapping args)=0
 
virtual void AccessibilityObjectDidBecomeFocused (int32_t id)=0
 
virtual void AccessibilityObjectDidLoseFocus (int32_t id)=0
 
virtual std::shared_ptr< FlutterPlatformViewsControllerGetPlatformViewsController () const =0
 
virtual gfx::NativeViewAccessible GetChildOfAXFragmentRoot ()=0
 
virtual gfx::NativeViewAccessible GetParentOfAXFragmentRoot ()=0
 
virtual bool IsAXFragmentRootAControlElement ()=0
 

Protected Member Functions

void OnAccessibilityEvent (ui::AXEventGenerator::TargetedEvent targeted_event) override
 Handle accessibility events generated due to accessibility tree changes. These events are needed to be sent to native accessibility system. See ui::AXEventGenerator::Event for possible events. More...
 
std::shared_ptr< FlutterPlatformNodeDelegateCreateFlutterPlatformNodeDelegate () override
 Creates a platform specific FlutterPlatformNodeDelegate. Ownership passes to the caller. This method will be called whenever a new AXNode is created in AXTree. Each platform needs to implement this method in order to inject its subclass into the accessibility bridge. More...
 
virtual std::weak_ptr< FlutterPlatformNodeDelegateGetFocusedNode ()
 
virtual void OnAccessibilityEvent (ui::AXEventGenerator::TargetedEvent targeted_event)=0
 Handle accessibility events generated due to accessibility tree changes. These events are needed to be sent to native accessibility system. See ui::AXEventGenerator::Event for possible events. More...
 
virtual std::shared_ptr< FlutterPlatformNodeDelegateCreateFlutterPlatformNodeDelegate ()=0
 Creates a platform specific FlutterPlatformNodeDelegate. Ownership passes to the caller. This method will be called whenever a new AXNode is created in AXTree. Each platform needs to implement this method in order to inject its subclass into the accessibility bridge. More...
 
virtual void DispatchAccessibilityAction (AccessibilityNodeId target, FlutterSemanticsAction action, fml::MallocMapping data)=0
 Dispatch accessibility action back to the Flutter framework. These actions are generated in the native accessibility system when users interact with the assistive technologies. For example, a FlutterSemanticsAction::kFlutterSemanticsActionTap is fired when user click or touch the screen. More...
 
virtual gfx::NativeViewAccessible GetNativeAccessibleFromId (AccessibilityNodeId id)=0
 Get the native accessibility node with the given id. More...
 
virtual AccessibilityNodeId GetLastFocusedId ()=0
 Get the last id of the node that received accessibility focus. More...
 
virtual void SetLastFocusedId (AccessibilityNodeId node_id)=0
 Update the id of the node that is currently foucsed by the native accessibility system. More...
 

Detailed Description

AccessibilityBridgeWindows must be created as a shared_ptr, since some methods acquires its weak_ptr.

Definition at line 27 of file accessibility_bridge_windows.h.

Constructor & Destructor Documentation

◆ AccessibilityBridgeWindows()

flutter::AccessibilityBridgeWindows::AccessibilityBridgeWindows ( FlutterWindowsView view)

Definition at line 13 of file accessibility_bridge_windows.cc.

14 : view_(view) {
15 FML_DCHECK(view_);
16}
UIView * view() const override
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ ~AccessibilityBridgeWindows()

virtual flutter::AccessibilityBridgeWindows::~AccessibilityBridgeWindows ( )
virtualdefault

Member Function Documentation

◆ CreateFlutterPlatformNodeDelegate()

std::shared_ptr< FlutterPlatformNodeDelegate > flutter::AccessibilityBridgeWindows::CreateFlutterPlatformNodeDelegate ( )
overrideprotectedvirtual

Creates a platform specific FlutterPlatformNodeDelegate. Ownership passes to the caller. This method will be called whenever a new AXNode is created in AXTree. Each platform needs to implement this method in order to inject its subclass into the accessibility bridge.

Implements flutter::AccessibilityBridge.

Definition at line 170 of file accessibility_bridge_windows.cc.

170 {
171 return std::make_shared<FlutterPlatformNodeDelegateWindows>(
172 shared_from_this(), view_);
173}

◆ DispatchAccessibilityAction()

void flutter::AccessibilityBridgeWindows::DispatchAccessibilityAction ( AccessibilityNodeId  target,
FlutterSemanticsAction  action,
fml::MallocMapping  data 
)
overridevirtual

Dispatch accessibility action back to the Flutter framework. These actions are generated in the native accessibility system when users interact with the assistive technologies. For example, a FlutterSemanticsAction::kFlutterSemanticsActionTap is fired when user click or touch the screen.

Parameters
[in]targetThe semantics node id of the action target.
[in]actionThe generated flutter semantics action.
[in]dataAdditional data associated with the action.

Implements flutter::FlutterPlatformNodeDelegate::OwnerBridge.

Definition at line 162 of file accessibility_bridge_windows.cc.

165 {
166 view_->GetEngine()->DispatchSemanticsAction(target, action, std::move(data));
167}
bool DispatchSemanticsAction(uint64_t id, FlutterSemanticsAction action, fml::MallocMapping data)
FlutterWindowsEngine * GetEngine() const
uint32_t * target
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition: switches.h:41

◆ DispatchWinAccessibilityEvent()

void flutter::AccessibilityBridgeWindows::DispatchWinAccessibilityEvent ( std::shared_ptr< FlutterPlatformNodeDelegateWindows node_delegate,
ax::mojom::Event  event_type 
)
virtual

Definition at line 175 of file accessibility_bridge_windows.cc.

177 {
178 node_delegate->DispatchWinAccessibilityEvent(event_type);
179}
std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate
ax::mojom::Event event_type

◆ GetChildOfAXFragmentRoot()

gfx::NativeViewAccessible flutter::AccessibilityBridgeWindows::GetChildOfAXFragmentRoot ( )
overridevirtual

Implements ui::AXFragmentRootDelegateWin.

Definition at line 187 of file accessibility_bridge_windows.cc.

187 {
188 ui::AXPlatformNodeDelegate* root_delegate = RootDelegate();
189 if (!root_delegate) {
190 return nullptr;
191 }
192
193 return root_delegate->GetNativeViewAccessible();
194}
ui::AXPlatformNodeDelegate * RootDelegate() const override
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0

◆ GetFocusedNode()

std::weak_ptr< FlutterPlatformNodeDelegate > flutter::AccessibilityBridgeWindows::GetFocusedNode ( )
protectedvirtual

Definition at line 206 of file accessibility_bridge_windows.cc.

206 {
209}
std::weak_ptr< FlutterPlatformNodeDelegate > GetFlutterPlatformNodeDelegateFromID(AccessibilityNodeId id) const
Get the flutter platform node delegate with the given id from this accessibility bridge....
const ui::AXTreeData & GetAXTreeData() const
Get the ax tree data from this accessibility bridge. The tree data contains information such as the i...
int32_t AXID
Definition: ax_node.h:36
AXNode::AXID sel_focus_object_id
Definition: ax_tree_data.h:65

◆ GetParentOfAXFragmentRoot()

gfx::NativeViewAccessible flutter::AccessibilityBridgeWindows::GetParentOfAXFragmentRoot ( )
overridevirtual

Implements ui::AXFragmentRootDelegateWin.

Definition at line 197 of file accessibility_bridge_windows.cc.

197 {
198 return nullptr;
199}

◆ IsAXFragmentRootAControlElement()

bool flutter::AccessibilityBridgeWindows::IsAXFragmentRootAControlElement ( )
overridevirtual

Implements ui::AXFragmentRootDelegateWin.

Definition at line 201 of file accessibility_bridge_windows.cc.

201 {
202 return true;
203}

◆ OnAccessibilityEvent()

void flutter::AccessibilityBridgeWindows::OnAccessibilityEvent ( ui::AXEventGenerator::TargetedEvent  targeted_event)
overrideprotectedvirtual

Handle accessibility events generated due to accessibility tree changes. These events are needed to be sent to native accessibility system. See ui::AXEventGenerator::Event for possible events.

Parameters
[in]targeted_eventThe object that contains both the generated event and the event target.

Implements flutter::AccessibilityBridge.

Definition at line 18 of file accessibility_bridge_windows.cc.

19 {
20 ui::AXNode* ax_node = targeted_event.node;
22
23 auto node_delegate =
26 << "No FlutterPlatformNodeDelegate found for node ID " << ax_node->id();
27 std::shared_ptr<FlutterPlatformNodeDelegateWindows> win_delegate =
28 std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(
30
31 switch (event_type) {
34 break;
38 break;
42 break;
44 // An event indicating a change in document selection should be fired
45 // only for the focused node whose selection has changed. If a valid
46 // caret and selection exist in the app tree, they must both be within
47 // the focus node.
48 auto focus_delegate = GetFocusedNode().lock();
49 if (focus_delegate) {
50 win_delegate =
51 std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(
52 focus_delegate);
53 }
56 break;
57 }
60 SetFocus(win_delegate);
61 break;
63 if (ax_node->IsIgnored()) {
65 }
66 break;
70 break;
74 break;
78 break;
82 break;
86 break;
90 break;
94 break;
97 break;
101 break;
105 break;
157 // Unhandled event type.
158 break;
159 }
160}
virtual void DispatchWinAccessibilityEvent(std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate, ax::mojom::Event event_type)
virtual std::weak_ptr< FlutterPlatformNodeDelegate > GetFocusedNode()
virtual void SetFocus(std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate)
AXID id() const
Definition: ax_node.h:110
bool IsIgnored() const
Definition: ax_node.cc:1074

◆ SetFocus()

void flutter::AccessibilityBridgeWindows::SetFocus ( std::shared_ptr< FlutterPlatformNodeDelegateWindows node_delegate)
virtual

Definition at line 181 of file accessibility_bridge_windows.cc.

182 {
183 node_delegate->SetFocus();
184}

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