5#ifndef FLUTTER_SHELL_PLATFORM_COMMON_ACCESSIBILITY_BRIDGE_H_
6#define FLUTTER_SHELL_PLATFORM_COMMON_ACCESSIBILITY_BRIDGE_H_
8#include <unordered_map>
10#include "flutter/fml/mapping.h"
11#include "flutter/shell/platform/embedder/embedder.h"
13#include "flutter/third_party/accessibility/ax/ax_event_generator.h"
14#include "flutter/third_party/accessibility/ax/ax_tree.h"
15#include "flutter/third_party/accessibility/ax/ax_tree_observer.h"
16#include "flutter/third_party/accessibility/ax/platform/ax_platform_node_delegate.h"
17#include "flutter/third_party/accessibility/ax/platform/ax_platform_tree_manager.h"
41 :
public std::enable_shared_from_this<AccessibilityBridge>,
88 std::weak_ptr<FlutterPlatformNodeDelegate>
157 virtual std::shared_ptr<FlutterPlatformNodeDelegate>
166 int32_t text_selection_base;
167 int32_t text_selection_extent;
168 int32_t scroll_child_count;
169 int32_t scroll_index;
170 double scroll_position;
171 double scroll_extent_max;
172 double scroll_extent_min;
178 std::string increased_value;
179 std::string decreased_value;
184 std::vector<int32_t> children_in_traversal_order;
185 std::vector<int32_t> custom_accessibility_actions;
194 } SemanticsCustomAction;
197 std::shared_ptr<FlutterPlatformNodeDelegate>>
199 std::unique_ptr<ui::AXTree> tree_;
201 std::unordered_map<int32_t, SemanticsNode> pending_semantics_node_updates_;
202 std::unordered_map<int32_t, SemanticsCustomAction>
203 pending_semantics_custom_action_updates_;
210 std::optional<ui::AXTreeUpdate> CreateRemoveReparentedNodesUpdate();
212 void GetSubTreeList(
const SemanticsNode&
target,
213 std::vector<SemanticsNode>&
result);
214 void ConvertFlutterUpdate(
const SemanticsNode& node,
217 const SemanticsNode& node);
219 const SemanticsNode& node);
221 const SemanticsNode& node);
222 void SetBooleanAttributesFromFlutterUpdate(
ui::AXNodeData& node_data,
223 const SemanticsNode& node);
225 const SemanticsNode& node);
226 void SetIntListAttributesFromFlutterUpdate(
ui::AXNodeData& node_data,
227 const SemanticsNode& node);
228 void SetStringListAttributesFromFlutterUpdate(
ui::AXNodeData& node_data,
229 const SemanticsNode& node);
231 const SemanticsNode& node);
233 const SemanticsNode& node);
235 const SemanticsNode& node);
237 SemanticsNode FromFlutterSemanticsNode(
239 SemanticsCustomAction FromFlutterSemanticsCustomAction(
264 void OnAtomicUpdateFinished(
267 const std::vector<ui::AXTreeObserver::Change>& changes)
override;
282 bool clip_bounds)
override;
ui::AXTree * GetTree() const override
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....
void AddFlutterSemanticsNodeUpdate(const FlutterSemanticsNode2 &node)
Adds a semantics node update to the pending semantics update. Calling this method alone will NOT upda...
virtual std::shared_ptr< FlutterPlatformNodeDelegate > CreateFlutterPlatformNodeDelegate()=0
Creates a platform specific FlutterPlatformNodeDelegate. Ownership passes to the caller....
void AddFlutterSemanticsCustomActionUpdate(const FlutterSemanticsCustomAction2 &action)
Adds a custom semantics action update to the pending semantics update. Calling this method alone will...
ui::AXPlatformNode * GetPlatformNodeFromTree(const ui::AXNode::AXID node_id) const override
const ui::AXTreeData & GetAXTreeData() const
Get the ax tree data from this accessibility bridge. The tree data contains information such as the i...
ui::AXTreeID GetParentTreeID() const override
ui::AXNode * GetRootAsAXNode() const override
virtual ~AccessibilityBridge()
ui::AXNode * GetParentNodeFromParentTreeAsAXNode() const override
AccessibilityBridge()
Creates a new instance of a accessibility bridge.
virtual void OnAccessibilityEvent(ui::AXEventGenerator::TargetedEvent targeted_event)=0
Handle accessibility events generated due to accessibility tree changes. These events are needed to b...
ui::AXTreeID GetTreeID() const override
const std::vector< ui::AXEventGenerator::TargetedEvent > GetPendingEvents() const
Gets all pending accessibility events generated during semantics updates. This is useful when decidin...
void CommitUpdates()
Flushes the pending updates and applies them to this accessibility bridge. Calling this with no pendi...
ui::AXNode * GetNodeFromTree(const ui::AXTreeID tree_id, const ui::AXNode::AXID node_id) const override
static constexpr AXID kInvalidAXID
FlutterSemanticsFlag flags
sk_sp< SkBlender > blender SkRect rect
ui::AXNode::AXID AccessibilityNodeId
UnimplementedNativeViewAccessible * NativeViewAccessible
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
A structure to represent a rectangle.