Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
fl_view_accessible.h File Reference
#include <atk/atk.h>
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"

Go to the source code of this file.

Functions

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (FlViewAccessible, fl_view_accessible, FL, VIEW_ACCESSIBLE, AtkPlug) FlViewAccessible *fl_view_accessible_new(FlEngine *engine)
 
void fl_view_accessible_handle_update_semantics (FlViewAccessible *accessible, const FlutterSemanticsUpdate2 *update)
 

Function Documentation

◆ fl_view_accessible_handle_update_semantics()

void fl_view_accessible_handle_update_semantics ( FlViewAccessible *  accessible,
const FlutterSemanticsUpdate2 update 
)

fl_view_accessible_handle_update_semantics: @accessible: an #FlViewAccessible. @update: semantic update information.

Handle a semantics update from Flutter.

Definition at line 142 of file fl_view_accessible.cc.

144 {
145 g_autoptr(GHashTable) pending_children =
146 g_hash_table_new_full(g_direct_hash, g_direct_equal, nullptr,
147 reinterpret_cast<GDestroyNotify>(fl_value_unref));
148 for (size_t i = 0; i < update->node_count; i++) {
149 FlutterSemanticsNode2* node = update->nodes[i];
150 FlAccessibleNode* atk_node = get_node(self, node);
151
152 fl_accessible_node_set_flags(atk_node, node->flags);
154 fl_accessible_node_set_name(atk_node, node->label);
156 atk_node, node->rect.left + node->transform.transX,
157 node->rect.top + node->transform.transY,
158 node->rect.right - node->rect.left, node->rect.bottom - node->rect.top);
159 fl_accessible_node_set_value(atk_node, node->value);
163
166 g_hash_table_insert(pending_children, atk_node, children);
167 }
168
169 g_hash_table_foreach_remove(
170 pending_children,
171 [](gpointer key, gpointer value, gpointer user_data) -> gboolean {
172 FlViewAccessible* self = FL_VIEW_ACCESSIBLE(user_data);
173
174 FlAccessibleNode* parent = FL_ACCESSIBLE_NODE(key);
175
176 size_t child_count = fl_value_get_length(static_cast<FlValue*>(value));
177 const int32_t* children_in_traversal_order =
178 fl_value_get_int32_list(static_cast<FlValue*>(value));
179
180 g_autoptr(GPtrArray) children = g_ptr_array_new();
181 for (size_t i = 0; i < child_count; i++) {
182 FlAccessibleNode* child =
183 lookup_node(self, children_in_traversal_order[i]);
184 g_assert(child != nullptr);
185 fl_accessible_node_set_parent(child, ATK_OBJECT(parent), i);
186 g_ptr_array_add(children, child);
187 }
188 fl_accessible_node_set_children(parent, children);
189
190 return true;
191 },
192 self);
193}
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
void fl_accessible_node_set_text_direction(FlAccessibleNode *self, FlutterTextDirection direction)
void fl_accessible_node_set_text_selection(FlAccessibleNode *self, gint base, gint extent)
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
void fl_accessible_node_set_value(FlAccessibleNode *self, const gchar *value)
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlag flags)
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
uint8_t value
G_MODULE_EXPORT void fl_value_unref(FlValue *self)
Definition: fl_value.cc:400
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:309
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:696
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
static FlAccessibleNode * get_node(FlViewAccessible *self, FlutterSemanticsNode2 *semantics)
static FlAccessibleNode * lookup_node(FlViewAccessible *self, int32_t id)
Definition: update.py:1
double bottom
Definition: embedder.h:441
double top
Definition: embedder.h:439
double left
Definition: embedder.h:438
double right
Definition: embedder.h:440
const int32_t * children_in_traversal_order
Array of child node IDs in traversal order. Has length child_count.
Definition: embedder.h:1385
int32_t text_selection_extent
The position at which the text selection terminates.
Definition: embedder.h:1345
FlutterTextDirection text_direction
Definition: embedder.h:1376
FlutterSemanticsAction actions
The set of semantics actions applicable to this node.
Definition: embedder.h:1341
FlutterRect rect
The bounding box for this node in its coordinate system.
Definition: embedder.h:1378
FlutterTransformation transform
Definition: embedder.h:1381
size_t child_count
The number of children this node has.
Definition: embedder.h:1383
const char * label
A textual description of the node.
Definition: embedder.h:1363
int32_t text_selection_base
The position at which the text selection originates.
Definition: embedder.h:1343
const char * value
A textual description of the current value of the node.
Definition: embedder.h:1367
FlutterSemanticsFlag flags
The set of semantics flags associated with this node.
Definition: embedder.h:1339
double transY
vertical translation
Definition: embedder.h:289
double transX
horizontal translation
Definition: embedder.h:283
void * user_data

◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE ( FlViewAccessible  ,
fl_view_accessible  ,
FL  ,
VIEW_ACCESSIBLE  ,
AtkPlug   
)

FlViewAccessible:

#FlViewAccessible is an object that exposes accessibility information for an #FlView. fl_view_accessible_new:

Creates a new accessibility object that exposes Flutter accessibility information to ATK.

Returns: a new #FlViewAccessible.