Flutter Engine
The Flutter Engine
accessibility_bridge_windows.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/platform/windows/accessibility_bridge_windows.h"
6
7#include "flutter/fml/logging.h"
8#include "flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h"
9#include "flutter/third_party/accessibility/ax/platform/ax_platform_node_delegate_base.h"
10
11namespace flutter {
12
14 : view_(view) {
15 FML_DCHECK(view_);
16}
17
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}
161
166 view_->GetEngine()->DispatchSemanticsAction(target, action, std::move(data));
167}
168
169std::shared_ptr<FlutterPlatformNodeDelegate>
171 return std::make_shared<FlutterPlatformNodeDelegateWindows>(
172 shared_from_this(), view_);
173}
174
176 std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate,
178 node_delegate->DispatchWinAccessibilityEvent(event_type);
179}
180
182 std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate) {
183 node_delegate->SetFocus();
184}
185
188 ui::AXPlatformNodeDelegate* root_delegate = RootDelegate();
189 if (!root_delegate) {
190 return nullptr;
191 }
192
193 return root_delegate->GetNativeViewAccessible();
194}
195
198 return nullptr;
199}
200
202 return true;
203}
204
205std::weak_ptr<FlutterPlatformNodeDelegate>
209}
210
211} // namespace flutter
std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate
ax::mojom::Event event_type
virtual void DispatchWinAccessibilityEvent(std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate, ax::mojom::Event event_type)
virtual std::weak_ptr< FlutterPlatformNodeDelegate > GetFocusedNode()
std::shared_ptr< FlutterPlatformNodeDelegate > CreateFlutterPlatformNodeDelegate() override
Creates a platform specific FlutterPlatformNodeDelegate. Ownership passes to the caller....
void DispatchAccessibilityAction(AccessibilityNodeId target, FlutterSemanticsAction action, fml::MallocMapping data) override
Dispatch accessibility action back to the Flutter framework. These actions are generated in the nativ...
virtual void SetFocus(std::shared_ptr< FlutterPlatformNodeDelegateWindows > node_delegate)
gfx::NativeViewAccessible GetChildOfAXFragmentRoot() override
gfx::NativeViewAccessible GetParentOfAXFragmentRoot() override
void OnAccessibilityEvent(ui::AXEventGenerator::TargetedEvent targeted_event) override
Handle accessibility events generated due to accessibility tree changes. These events are needed to b...
ui::AXPlatformNodeDelegate * RootDelegate() const override
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...
bool DispatchSemanticsAction(uint64_t id, FlutterSemanticsAction action, fml::MallocMapping data)
FlutterWindowsEngine * GetEngine() const
A Mapping like NonOwnedMapping, but uses Free as its release proc.
Definition: mapping.h:144
AXID id() const
Definition: ax_node.h:110
int32_t AXID
Definition: ax_node.h:36
bool IsIgnored() const
Definition: ax_node.cc:1074
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0
FlutterSemanticsAction
Definition: embedder.h:113
uint32_t * target
#define FML_DCHECK(condition)
Definition: logging.h:103
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
ui::AXNode::AXID AccessibilityNodeId
UnimplementedNativeViewAccessible * NativeViewAccessible
AXNode::AXID sel_focus_object_id
Definition: ax_tree_data.h:65