5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_ACCESSIBILITY_BRIDGE_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_ACCESSIBILITY_BRIDGE_H_
12#include <fuchsia/accessibility/semantics/cpp/fidl.h>
13#include <fuchsia/ui/gfx/cpp/fidl.h>
14#include <lib/fidl/cpp/binding_set.h>
15#include <lib/inspect/component/cpp/component.h>
16#include <zircon/types.h>
21#include <unordered_map>
22#include <unordered_set>
25#include "flutter/fml/macros.h"
26#include "flutter/lib/ui/semantics/semantics_node.h"
42 :
public fuchsia::accessibility::semantics::SemanticListener {
54 static_assert(fuchsia::accessibility::semantics::MAX_LABEL_SIZE <
63 sizeof(fuchsia::accessibility::semantics::Node().node_id()),
64 "flutter::SemanticsNode::id and "
65 "fuchsia::accessibility::semantics::Node::node_id differ in size.");
74 fuchsia::accessibility::semantics::SemanticsManagerHandle
76 fuchsia::ui::views::ViewRef view_ref,
77 inspect::Node inspect_node);
91 float view_pixel_ratio);
101 fuchsia::math::PointF local_point,
102 fuchsia::accessibility::semantics::SemanticListener::HitTestCallback
109 fuchsia::accessibility::semantics::SemanticListener::
110 OnAccessibilityActionRequestedCallback
callback)
override;
114 static constexpr int32_t kRootNodeId = 0;
122 struct FuchsiaAtomicUpdate {
123 FuchsiaAtomicUpdate() =
default;
124 ~FuchsiaAtomicUpdate() =
default;
125 FuchsiaAtomicUpdate(FuchsiaAtomicUpdate&&) =
default;
129 void AddNodeUpdate(fuchsia::accessibility::semantics::Node node,
133 void AddNodeDeletion(uint32_t
id);
135 std::vector<std::pair<fuchsia::accessibility::semantics::Node, size_t>>
137 std::vector<uint32_t> deletions;
142 struct SemanticsNode {
147 fuchsia::accessibility::semantics::Node GetRootNodeUpdate(
size_t& node_size);
151 fuchsia::ui::gfx::BoundingBox GetNodeLocation(
155 fuchsia::ui::gfx::mat4 GetNodeTransform(
159 fuchsia::ui::gfx::mat4 ConvertSkiaTransformToMat4(
164 fuchsia::accessibility::semantics::Attributes GetNodeAttributes(
166 size_t* added_size)
const;
170 fuchsia::accessibility::semantics::States GetNodeStates(
172 size_t* additional_size)
const;
176 std::vector<fuchsia::accessibility::semantics::Action> GetNodeActions(
178 size_t* additional_size)
const;
186 std::unordered_set<int32_t> GetDescendants(int32_t node_id)
const;
193 void PruneUnreachableNodes(FuchsiaAtomicUpdate* atomic_update);
199 void UpdateScreenRects();
205 void UpdateScreenRects(int32_t node_id,
206 SkM44 parent_transform,
207 std::unordered_set<int32_t>* visited_nodes);
213 std::optional<int32_t> GetHitNode(int32_t node_id,
float x,
float y);
223 std::optional<flutter::SemanticsAction> GetFlutterSemanticsAction(
229 void Apply(FuchsiaAtomicUpdate* atomic_update);
232 void OnSemanticsModeChanged(
bool enabled,
233 OnSemanticsModeChangedCallback
callback)
override;
237 void FillInspectTree(int32_t flutter_node_id,
238 int32_t current_level,
239 inspect::Node inspect_node,
240 inspect::Inspector* inspector)
const;
246 float last_seen_view_pixel_ratio_ = 1.f;
248 fidl::Binding<fuchsia::accessibility::semantics::SemanticListener> binding_;
249 fuchsia::accessibility::semantics::SemanticsManagerPtr
250 fuchsia_semantics_manager_;
251 fuchsia::accessibility::semantics::SemanticTreePtr tree_ptr_;
255 std::unordered_map<int32_t, SemanticsNode> nodes_;
256 bool semantics_enabled_;
259 std::shared_ptr<std::queue<FuchsiaAtomicUpdate>> atomic_updates_;
262 inspect::Node inspect_node_;
268 inspect::LazyNode inspect_node_tree_dump_;
void AddSemanticsNodeUpdate(const flutter::SemanticsNodeUpdates update, float view_pixel_ratio)
std::function< void(bool)> SetSemanticsEnabledCallback
void SetSemanticsEnabled(bool enabled)
void OnAccessibilityActionRequested(uint32_t node_id, fuchsia::accessibility::semantics::Action action, fuchsia::accessibility::semantics::SemanticListener::OnAccessibilityActionRequestedCallback callback) override
void HitTest(fuchsia::math::PointF local_point, fuchsia::accessibility::semantics::SemanticListener::HitTestCallback callback) override
static constexpr size_t kNodeIdSize
static constexpr uint32_t kMaxMessageSize
bool GetSemanticsEnabled() const
void RequestAnnounce(const std::string message)
std::function< void(int32_t, flutter::SemanticsAction)> DispatchSemanticsActionCallback
AccessibilityBridge(SetSemanticsEnabledCallback set_semantics_enabled_callback, DispatchSemanticsActionCallback dispatch_semantics_action_callback, fuchsia::accessibility::semantics::SemanticsManagerHandle semantics_manager, fuchsia::ui::views::ViewRef view_ref, inspect::Node inspect_node)
zx_status_t OnHoverMove(double x, double y)
static constexpr size_t kMaxDeletionsPerUpdate
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
std::shared_ptr< const fml::Mapping > data