Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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.
 
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.
 
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().
 
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().
 
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.
 
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.
 
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.
 
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.
 
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
 
- Public Member Functions inherited from ui::AXPlatformTreeManager
virtual ~AXPlatformTreeManager ()=default
 
- Public Member Functions inherited from ui::AXTreeManager
virtual ~AXTreeManager ()=default
 
- Public Member Functions inherited from flutter::AccessibilityBridgeIos
virtual ~AccessibilityBridgeIos ()=default
 

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.
 
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.
 
virtual std::weak_ptr< FlutterPlatformNodeDelegateGetFocusedNode ()
 

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

◆ 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) {
32 case ui::AXEventGenerator::Event::ALERT:
33 DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kAlert);
34 break;
35 case ui::AXEventGenerator::Event::CHECKED_STATE_CHANGED:
37 ax::mojom::Event::kValueChanged);
38 break;
39 case ui::AXEventGenerator::Event::CHILDREN_CHANGED:
41 ax::mojom::Event::kChildrenChanged);
42 break;
43 case ui::AXEventGenerator::Event::DOCUMENT_SELECTION_CHANGED: {
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 }
55 win_delegate, ax::mojom::Event::kDocumentSelectionChanged);
56 break;
57 }
58 case ui::AXEventGenerator::Event::FOCUS_CHANGED:
59 DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kFocus);
60 SetFocus(win_delegate);
61 break;
62 case ui::AXEventGenerator::Event::IGNORED_CHANGED:
63 if (ax_node->IsIgnored()) {
64 DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kHide);
65 }
66 break;
67 case ui::AXEventGenerator::Event::IMAGE_ANNOTATION_CHANGED:
69 ax::mojom::Event::kTextChanged);
70 break;
71 case ui::AXEventGenerator::Event::LIVE_REGION_CHANGED:
73 ax::mojom::Event::kLiveRegionChanged);
74 break;
75 case ui::AXEventGenerator::Event::NAME_CHANGED:
77 ax::mojom::Event::kTextChanged);
78 break;
79 case ui::AXEventGenerator::Event::SCROLL_HORIZONTAL_POSITION_CHANGED:
81 ax::mojom::Event::kScrollPositionChanged);
82 break;
83 case ui::AXEventGenerator::Event::SCROLL_VERTICAL_POSITION_CHANGED:
85 ax::mojom::Event::kScrollPositionChanged);
86 break;
87 case ui::AXEventGenerator::Event::SELECTED_CHANGED:
89 ax::mojom::Event::kValueChanged);
90 break;
91 case ui::AXEventGenerator::Event::SELECTED_CHILDREN_CHANGED:
93 ax::mojom::Event::kSelectedChildrenChanged);
94 break;
95 case ui::AXEventGenerator::Event::SUBTREE_CREATED:
96 DispatchWinAccessibilityEvent(win_delegate, ax::mojom::Event::kShow);
97 break;
98 case ui::AXEventGenerator::Event::VALUE_CHANGED:
100 ax::mojom::Event::kValueChanged);
101 break;
102 case ui::AXEventGenerator::Event::WIN_IACCESSIBLE_STATE_CHANGED:
104 ax::mojom::Event::kStateChanged);
105 break;
106 case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED:
107 case ui::AXEventGenerator::Event::ACTIVE_DESCENDANT_CHANGED:
108 case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
109 case ui::AXEventGenerator::Event::ATOMIC_CHANGED:
110 case ui::AXEventGenerator::Event::AUTO_COMPLETE_CHANGED:
111 case ui::AXEventGenerator::Event::BUSY_CHANGED:
112 case ui::AXEventGenerator::Event::CLASS_NAME_CHANGED:
113 case ui::AXEventGenerator::Event::COLLAPSED:
114 case ui::AXEventGenerator::Event::CONTROLS_CHANGED:
115 case ui::AXEventGenerator::Event::DESCRIBED_BY_CHANGED:
116 case ui::AXEventGenerator::Event::DESCRIPTION_CHANGED:
117 case ui::AXEventGenerator::Event::DOCUMENT_TITLE_CHANGED:
118 case ui::AXEventGenerator::Event::DROPEFFECT_CHANGED:
119 case ui::AXEventGenerator::Event::ENABLED_CHANGED:
120 case ui::AXEventGenerator::Event::EXPANDED:
121 case ui::AXEventGenerator::Event::FLOW_FROM_CHANGED:
122 case ui::AXEventGenerator::Event::FLOW_TO_CHANGED:
123 case ui::AXEventGenerator::Event::GRABBED_CHANGED:
124 case ui::AXEventGenerator::Event::HASPOPUP_CHANGED:
125 case ui::AXEventGenerator::Event::HIERARCHICAL_LEVEL_CHANGED:
126 case ui::AXEventGenerator::Event::INVALID_STATUS_CHANGED:
127 case ui::AXEventGenerator::Event::KEY_SHORTCUTS_CHANGED:
128 case ui::AXEventGenerator::Event::LABELED_BY_CHANGED:
129 case ui::AXEventGenerator::Event::LANGUAGE_CHANGED:
130 case ui::AXEventGenerator::Event::LAYOUT_INVALIDATED:
131 case ui::AXEventGenerator::Event::LIVE_REGION_CREATED:
132 case ui::AXEventGenerator::Event::LIVE_REGION_NODE_CHANGED:
133 case ui::AXEventGenerator::Event::LIVE_RELEVANT_CHANGED:
134 case ui::AXEventGenerator::Event::LIVE_STATUS_CHANGED:
135 case ui::AXEventGenerator::Event::LOAD_COMPLETE:
136 case ui::AXEventGenerator::Event::LOAD_START:
137 case ui::AXEventGenerator::Event::MENU_ITEM_SELECTED:
138 case ui::AXEventGenerator::Event::MULTILINE_STATE_CHANGED:
139 case ui::AXEventGenerator::Event::MULTISELECTABLE_STATE_CHANGED:
140 case ui::AXEventGenerator::Event::OBJECT_ATTRIBUTE_CHANGED:
141 case ui::AXEventGenerator::Event::OTHER_ATTRIBUTE_CHANGED:
142 case ui::AXEventGenerator::Event::PLACEHOLDER_CHANGED:
143 case ui::AXEventGenerator::Event::PORTAL_ACTIVATED:
144 case ui::AXEventGenerator::Event::POSITION_IN_SET_CHANGED:
145 case ui::AXEventGenerator::Event::READONLY_CHANGED:
146 case ui::AXEventGenerator::Event::RELATED_NODE_CHANGED:
147 case ui::AXEventGenerator::Event::REQUIRED_STATE_CHANGED:
148 case ui::AXEventGenerator::Event::ROLE_CHANGED:
149 case ui::AXEventGenerator::Event::ROW_COUNT_CHANGED:
150 case ui::AXEventGenerator::Event::SET_SIZE_CHANGED:
151 case ui::AXEventGenerator::Event::SORT_CHANGED:
152 case ui::AXEventGenerator::Event::STATE_CHANGED:
153 case ui::AXEventGenerator::Event::TEXT_ATTRIBUTE_CHANGED:
154 case ui::AXEventGenerator::Event::VALUE_MAX_CHANGED:
155 case ui::AXEventGenerator::Event::VALUE_MIN_CHANGED:
156 case ui::AXEventGenerator::Event::VALUE_STEP_CHANGED:
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: