| Flutter Linux Embedder |

fl_accessible_node.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/linux/fl_accessible_node.h"
6 #include "flutter/shell/platform/linux/fl_engine_private.h"
7
8 // Maps Flutter semantics flags to ATK flags.
9 static struct {
10 AtkStateType state;
11 FlutterSemanticsFlag flag;
12 gboolean invert;
13 } flag_mapping[] = {
14 {ATK_STATE_SHOWING, kFlutterSemanticsFlagIsObscured, TRUE},
15 {ATK_STATE_VISIBLE, kFlutterSemanticsFlagIsHidden, TRUE},
16 {ATK_STATE_CHECKABLE, kFlutterSemanticsFlagHasCheckedState, FALSE},
17 {ATK_STATE_FOCUSABLE, kFlutterSemanticsFlagIsFocusable, FALSE},
18 {ATK_STATE_FOCUSED, kFlutterSemanticsFlagIsFocused, FALSE},
19 {ATK_STATE_CHECKED,
20 static_cast<FlutterSemanticsFlag>(kFlutterSemanticsFlagIsChecked |
21 kFlutterSemanticsFlagIsToggled),
22 FALSE},
23 {ATK_STATE_SELECTED, kFlutterSemanticsFlagIsSelected, FALSE},
24 {ATK_STATE_ENABLED, kFlutterSemanticsFlagIsEnabled, FALSE},
25 {ATK_STATE_SENSITIVE, kFlutterSemanticsFlagIsEnabled, FALSE},
26 {ATK_STATE_READ_ONLY, kFlutterSemanticsFlagIsReadOnly, FALSE},
27 {ATK_STATE_EDITABLE, kFlutterSemanticsFlagIsTextField, FALSE},
28 {ATK_STATE_INVALID, static_cast<FlutterSemanticsFlag>(0), FALSE},
29 };
30
31 // Maps Flutter semantics actions to ATK actions.
32 typedef struct {
33 FlutterSemanticsAction action;
34 const gchar* name;
35 } ActionData;
36 static ActionData action_mapping[] = {
37 {kFlutterSemanticsActionTap, "Tap"},
38 {kFlutterSemanticsActionLongPress, "LongPress"},
39 {kFlutterSemanticsActionScrollLeft, "ScrollLeft"},
40 {kFlutterSemanticsActionScrollRight, "ScrollRight"},
41 {kFlutterSemanticsActionScrollUp, "ScrollUp"},
42 {kFlutterSemanticsActionScrollDown, "ScrollDown"},
43 {kFlutterSemanticsActionIncrease, "Increase"},
44 {kFlutterSemanticsActionDecrease, "Decrease"},
45 {kFlutterSemanticsActionShowOnScreen, "ShowOnScreen"},
46 {kFlutterSemanticsActionMoveCursorForwardByCharacter,
47 "MoveCursorForwardByCharacter"},
48 {kFlutterSemanticsActionMoveCursorBackwardByCharacter,
49 "MoveCursorBackwardByCharacter"},
50 {kFlutterSemanticsActionCopy, "Copy"},
51 {kFlutterSemanticsActionCut, "Cut"},
52 {kFlutterSemanticsActionPaste, "Paste"},
53 {kFlutterSemanticsActionDidGainAccessibilityFocus,
54 "DidGainAccessibilityFocus"},
55 {kFlutterSemanticsActionDidLoseAccessibilityFocus,
56 "DidLoseAccessibilityFocus"},
57 {kFlutterSemanticsActionCustomAction, "CustomAction"},
58 {kFlutterSemanticsActionDismiss, "Dismiss"},
59 {kFlutterSemanticsActionMoveCursorForwardByWord, "MoveCursorForwardByWord"},
60 {kFlutterSemanticsActionMoveCursorBackwardByWord,
61 "MoveCursorBackwardByWord"},
62 {static_cast<FlutterSemanticsAction>(0), nullptr}};
63
64 struct FlAccessibleNodePrivate {
65 AtkObject parent_instance;
66
67 // Weak reference to the engine this node is created for.
68 FlEngine* engine;
69
70 // Weak reference to the parent node of this one or %NULL.
71 AtkObject* parent;
72
73 int32_t id;
74 gchar* name;
75 gint index;
76 gint x, y, width, height;
77 GPtrArray* actions;
78 gsize actions_length;
79 GPtrArray* children;
80 FlutterSemanticsFlag flags;
81 };
82
83 enum { kProp0, kPropEngine, kPropId, kPropLast };
84
85 #define FL_ACCESSIBLE_NODE_GET_PRIVATE(node) \
86 ((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
87 FL_ACCESSIBLE_NODE(node)))
88
89 static void fl_accessible_node_component_interface_init(
90 AtkComponentIface* iface);
91 static void fl_accessible_node_action_interface_init(AtkActionIface* iface);
92
93 G_DEFINE_TYPE_WITH_CODE(
94 FlAccessibleNode,
95 fl_accessible_node,
96 ATK_TYPE_OBJECT,
97 G_ADD_PRIVATE(FlAccessibleNode)
98 G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
99 fl_accessible_node_component_interface_init)
100 G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
101 fl_accessible_node_action_interface_init))
102
103 // Returns TRUE if [flag] has changed between [old_flags] and [flags].
104 static gboolean flag_is_changed(FlutterSemanticsFlag old_flags,
105 FlutterSemanticsFlag flags,
106 FlutterSemanticsFlag flag) {
107 return (old_flags & flag) != (flags & flag);
108 }
109
110 // Returns TRUE if [flag] is set in [flags].
111 static gboolean has_flag(FlutterSemanticsFlag flags,
112 FlutterSemanticsFlag flag) {
113 return (flags & flag) != 0;
114 }
115
116 // Returns TRUE if [action] is set in [actions].
117 static gboolean has_action(FlutterSemanticsAction actions,
118 FlutterSemanticsAction action) {
119 return (actions & action) != 0;
120 }
121
122 // Gets the nth action.
123 static ActionData* get_action(FlAccessibleNodePrivate* priv, gint index) {
124 if (index < 0 || static_cast<guint>(index) >= priv->actions->len) {
125 return nullptr;
126 }
127 return static_cast<ActionData*>(g_ptr_array_index(priv->actions, index));
128 }
129
130 // Checks if [object] is in [children].
131 static gboolean has_child(GPtrArray* children, AtkObject* object) {
132 for (guint i = 0; i < children->len; i++) {
133 if (g_ptr_array_index(children, i) == object) {
134 return TRUE;
135 }
136 }
137
138 return FALSE;
139 }
140
141 static void fl_accessible_node_set_property(GObject* object,
142 guint prop_id,
143 const GValue* value,
144 GParamSpec* pspec) {
145 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(object);
146 switch (prop_id) {
147 case kPropEngine:
148 g_assert(priv->engine == nullptr);
149 priv->engine = FL_ENGINE(g_value_get_object(value));
150 g_object_add_weak_pointer(object,
151 reinterpret_cast<gpointer*>(&priv->engine));
152 break;
153 case kPropId:
154 priv->id = g_value_get_int(value);
155 break;
156 default:
157 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
158 break;
159 }
160 }
161
162 static void fl_accessible_node_dispose(GObject* object) {
163 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(object);
164
165 if (priv->engine != nullptr) {
166 g_object_remove_weak_pointer(object,
167 reinterpret_cast<gpointer*>(&(priv->engine)));
168 priv->engine = nullptr;
169 }
170 if (priv->parent != nullptr) {
171 g_object_remove_weak_pointer(object,
172 reinterpret_cast<gpointer*>(&(priv->parent)));
173 priv->parent = nullptr;
174 }
175 g_clear_pointer(&priv->name, g_free);
176 g_clear_pointer(&priv->actions, g_ptr_array_unref);
177 g_clear_pointer(&priv->children, g_ptr_array_unref);
178
179 G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(object);
180 }
181
182 // Implements AtkObject::get_name.
183 static const gchar* fl_accessible_node_get_name(AtkObject* accessible) {
184 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(accessible);
185 return priv->name;
186 }
187
188 // Implements AtkObject::get_parent.
189 static AtkObject* fl_accessible_node_get_parent(AtkObject* accessible) {
190 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(accessible);
191 return priv->parent;
192 }
193
194 // Implements AtkObject::get_index_in_parent.
195 static gint fl_accessible_node_get_index_in_parent(AtkObject* accessible) {
196 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(accessible);
197 return priv->index;
198 }
199
200 // Implements AtkObject::get_n_children.
201 static gint fl_accessible_node_get_n_children(AtkObject* accessible) {
202 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(accessible);
203 return priv->children->len;
204 }
205
206 // Implements AtkObject::ref_child.
207 static AtkObject* fl_accessible_node_ref_child(AtkObject* accessible, gint i) {
208 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(accessible);
209
210 if (i < 0 || static_cast<guint>(i) >= priv->children->len) {
211 return nullptr;
212 }
213
214 return ATK_OBJECT(g_object_ref(g_ptr_array_index(priv->children, i)));
215 }
216
217 // Implements AtkObject::get_role.
218 static AtkRole fl_accessible_node_get_role(AtkObject* accessible) {
219 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(accessible);
220 if ((priv->flags & kFlutterSemanticsFlagIsButton) != 0) {
221 return ATK_ROLE_PUSH_BUTTON;
222 }
223 if ((priv->flags & kFlutterSemanticsFlagIsInMutuallyExclusiveGroup) != 0 &&
224 (priv->flags & kFlutterSemanticsFlagHasCheckedState) != 0) {
225 return ATK_ROLE_RADIO_BUTTON;
226 }
227 if ((priv->flags & kFlutterSemanticsFlagHasCheckedState) != 0) {
228 return ATK_ROLE_CHECK_BOX;
229 }
230 if ((priv->flags & kFlutterSemanticsFlagHasToggledState) != 0) {
231 return ATK_ROLE_TOGGLE_BUTTON;
232 }
233 if ((priv->flags & kFlutterSemanticsFlagIsSlider) != 0) {
234 return ATK_ROLE_SLIDER;
235 }
236 if ((priv->flags & kFlutterSemanticsFlagIsTextField) != 0 &&
237 (priv->flags & kFlutterSemanticsFlagIsObscured) != 0) {
238 return ATK_ROLE_PASSWORD_TEXT;
239 }
240 if ((priv->flags & kFlutterSemanticsFlagIsTextField) != 0) {
241 return ATK_ROLE_TEXT;
242 }
243 if ((priv->flags & kFlutterSemanticsFlagIsHeader) != 0) {
244 return ATK_ROLE_HEADER;
245 }
246 if ((priv->flags & kFlutterSemanticsFlagIsLink) != 0) {
247 return ATK_ROLE_LINK;
248 }
249 if ((priv->flags & kFlutterSemanticsFlagIsImage) != 0) {
250 return ATK_ROLE_IMAGE;
251 }
252
253 return ATK_ROLE_PANEL;
254 }
255
256 // Implements AtkObject::ref_state_set.
257 static AtkStateSet* fl_accessible_node_ref_state_set(AtkObject* accessible) {
258 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(accessible);
259
260 AtkStateSet* state_set = atk_state_set_new();
261
262 for (int i = 0; flag_mapping[i].state != ATK_STATE_INVALID; i++) {
263 gboolean enabled = has_flag(priv->flags, flag_mapping[i].flag);
264 if (flag_mapping[i].invert) {
265 enabled = !enabled;
266 }
267 if (enabled) {
268 atk_state_set_add_state(state_set, flag_mapping[i].state);
269 }
270 }
271
272 return state_set;
273 }
274
275 // Implements AtkComponent::get_extents.
276 static void fl_accessible_node_get_extents(AtkComponent* component,
277 gint* x,
278 gint* y,
279 gint* width,
280 gint* height,
281 AtkCoordType coord_type) {
282 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(component);
283
284 *x = 0;
285 *y = 0;
286 if (priv->parent != nullptr) {
287 atk_component_get_extents(ATK_COMPONENT(priv->parent), x, y, nullptr,
288 nullptr, coord_type);
289 }
290
291 *x += priv->x;
292 *y += priv->y;
293 *width = priv->width;
294 *height = priv->height;
295 }
296
297 // Implements AtkComponent::get_layer.
298 static AtkLayer fl_accessible_node_get_layer(AtkComponent* component) {
299 return ATK_LAYER_WIDGET;
300 }
301
302 // Implements AtkAction::do_action.
303 static gboolean fl_accessible_node_do_action(AtkAction* action, gint i) {
304 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(action);
305
306 if (priv->engine == nullptr) {
307 return FALSE;
308 }
309
310 ActionData* data = get_action(priv, i);
311 if (data == nullptr) {
312 return FALSE;
313 }
314
315 fl_accessible_node_perform_action(FL_ACCESSIBLE_NODE(action), data->action,
316 nullptr);
317 return TRUE;
318 }
319
320 // Implements AtkAction::get_n_actions.
321 static gint fl_accessible_node_get_n_actions(AtkAction* action) {
322 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(action);
323 return priv->actions->len;
324 }
325
326 // Implements AtkAction::get_name.
327 static const gchar* fl_accessible_node_get_name(AtkAction* action, gint i) {
328 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(action);
329
330 ActionData* data = get_action(priv, i);
331 if (data == nullptr) {
332 return nullptr;
333 }
334
335 return data->name;
336 }
337
338 // Implements FlAccessibleNode::set_name.
339 static void fl_accessible_node_set_name_impl(FlAccessibleNode* self,
340 const gchar* name) {
341 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
342 g_free(priv->name);
343 priv->name = g_strdup(name);
344 }
345
346 // Implements FlAccessibleNode::set_extents.
347 static void fl_accessible_node_set_extents_impl(FlAccessibleNode* self,
348 gint x,
349 gint y,
350 gint width,
351 gint height) {
352 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
353 priv->x = x;
354 priv->y = y;
355 priv->width = width;
356 priv->height = height;
357 }
358
359 // Implements FlAccessibleNode::set_flags.
360 static void fl_accessible_node_set_flags_impl(FlAccessibleNode* self,
361 FlutterSemanticsFlag flags) {
362 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
363
364 FlutterSemanticsFlag old_flags = priv->flags;
365 priv->flags = flags;
366
367 for (int i = 0; flag_mapping[i].state != ATK_STATE_INVALID; i++) {
368 if (flag_is_changed(old_flags, flags, flag_mapping[i].flag)) {
369 gboolean enabled = has_flag(flags, flag_mapping[i].flag);
370 if (flag_mapping[i].invert) {
371 enabled = !enabled;
372 }
373
374 atk_object_notify_state_change(ATK_OBJECT(self), flag_mapping[i].state,
375 enabled);
376 }
377 }
378 }
379
380 // Implements FlAccessibleNode::set_actions.
381 static void fl_accessible_node_set_actions_impl(
382 FlAccessibleNode* self,
383 FlutterSemanticsAction actions) {
384 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
385
386 // NOTE(robert-ancell): It appears that AtkAction doesn't have a method of
387 // notifying that actions have changed, and even if it did an ATK client
388 // might access the old IDs before checking for new ones. Keep an eye
389 // out for a case where Flutter changes the actions on an item and see
390 // if we can resolve this in another way.
391 g_ptr_array_remove_range(priv->actions, 0, priv->actions->len);
392 for (int i = 0; action_mapping[i].name != nullptr; i++) {
393 if (has_action(actions, action_mapping[i].action)) {
394 g_ptr_array_add(priv->actions, &action_mapping[i]);
395 }
396 }
397 }
398
399 // Implements FlAccessibleNode::set_value.
400 static void fl_accessible_node_set_value_impl(FlAccessibleNode* self,
401 const gchar* value) {}
402
403 // Implements FlAccessibleNode::set_text_selection.
404 static void fl_accessible_node_set_text_selection_impl(FlAccessibleNode* self,
405 gint base,
406 gint extent) {}
407
408 // Implements FlAccessibleNode::set_text_direction.
409 static void fl_accessible_node_set_text_direction_impl(
410 FlAccessibleNode* self,
411 FlutterTextDirection direction) {}
412
413 // Implements FlAccessibleNode::perform_action.
414 static void fl_accessible_node_perform_action_impl(
415 FlAccessibleNode* self,
416 FlutterSemanticsAction action,
417 GBytes* data) {
418 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
419 fl_engine_dispatch_semantics_action(priv->engine, priv->id, action, data);
420 }
421
422 static void fl_accessible_node_class_init(FlAccessibleNodeClass* klass) {
423 G_OBJECT_CLASS(klass)->set_property = fl_accessible_node_set_property;
424 G_OBJECT_CLASS(klass)->dispose = fl_accessible_node_dispose;
425 ATK_OBJECT_CLASS(klass)->get_name = fl_accessible_node_get_name;
426 ATK_OBJECT_CLASS(klass)->get_parent = fl_accessible_node_get_parent;
427 ATK_OBJECT_CLASS(klass)->get_index_in_parent =
428 fl_accessible_node_get_index_in_parent;
429 ATK_OBJECT_CLASS(klass)->get_n_children = fl_accessible_node_get_n_children;
430 ATK_OBJECT_CLASS(klass)->ref_child = fl_accessible_node_ref_child;
431 ATK_OBJECT_CLASS(klass)->get_role = fl_accessible_node_get_role;
432 ATK_OBJECT_CLASS(klass)->ref_state_set = fl_accessible_node_ref_state_set;
433 FL_ACCESSIBLE_NODE_CLASS(klass)->set_name = fl_accessible_node_set_name_impl;
434 FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
435 fl_accessible_node_set_extents_impl;
436 FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
437 fl_accessible_node_set_flags_impl;
438 FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
439 fl_accessible_node_set_actions_impl;
440 FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
441 fl_accessible_node_set_value_impl;
442 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
443 fl_accessible_node_set_text_selection_impl;
444 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
445 fl_accessible_node_set_text_direction_impl;
446 FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
447 fl_accessible_node_perform_action_impl;
448
449 g_object_class_install_property(
450 G_OBJECT_CLASS(klass), kPropEngine,
451 g_param_spec_object(
452 "engine", "engine", "Flutter engine", fl_engine_get_type(),
453 static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
454 G_PARAM_STATIC_STRINGS)));
455 g_object_class_install_property(
456 G_OBJECT_CLASS(klass), kPropId,
457 g_param_spec_int(
458 "id", "id", "Accessibility node ID", 0, G_MAXINT, 0,
459 static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
460 G_PARAM_STATIC_STRINGS)));
461 }
462
463 static void fl_accessible_node_component_interface_init(
464 AtkComponentIface* iface) {
465 iface->get_extents = fl_accessible_node_get_extents;
466 iface->get_layer = fl_accessible_node_get_layer;
467 }
468
469 static void fl_accessible_node_action_interface_init(AtkActionIface* iface) {
470 iface->do_action = fl_accessible_node_do_action;
471 iface->get_n_actions = fl_accessible_node_get_n_actions;
472 iface->get_name = fl_accessible_node_get_name;
473 }
474
475 static void fl_accessible_node_init(FlAccessibleNode* self) {
476 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
477 priv->actions = g_ptr_array_new();
478 priv->children = g_ptr_array_new_with_free_func(g_object_unref);
479 }
480
481 FlAccessibleNode* fl_accessible_node_new(FlEngine* engine, int32_t id) {
482 FlAccessibleNode* self = FL_ACCESSIBLE_NODE(g_object_new(
483 fl_accessible_node_get_type(), "engine", engine, "id", id, nullptr));
484 return self;
485 }
486
487 void fl_accessible_node_set_parent(FlAccessibleNode* self,
488 AtkObject* parent,
489 gint index) {
490 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
491 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
492 priv->parent = parent;
493 priv->index = index;
494 g_object_add_weak_pointer(G_OBJECT(self),
495 reinterpret_cast<gpointer*>(&(priv->parent)));
496 }
497
498 void fl_accessible_node_set_children(FlAccessibleNode* self,
499 GPtrArray* children) {
500 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
501 FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
502
503 // Remove nodes that are no longer required.
504 for (guint i = 0; i < priv->children->len;) {
505 AtkObject* object = ATK_OBJECT(g_ptr_array_index(priv->children, i));
506 if (has_child(children, object)) {
507 i++;
508 } else {
509 g_signal_emit_by_name(self, "children-changed::remove", i, object,
510 nullptr);
511 g_ptr_array_remove_index(priv->children, i);
512 }
513 }
514
515 // Add new nodes.
516 for (guint i = 0; i < children->len; i++) {
517 AtkObject* object = ATK_OBJECT(g_ptr_array_index(children, i));
518 if (!has_child(priv->children, object)) {
519 g_ptr_array_add(priv->children, g_object_ref(object));
520 g_signal_emit_by_name(self, "children-changed::add", i, object, nullptr);
521 }
522 }
523 }
524
525 void fl_accessible_node_set_name(FlAccessibleNode* self, const gchar* name) {
526 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
527
528 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_name(self, name);
529 }
530
531 void fl_accessible_node_set_extents(FlAccessibleNode* self,
532 gint x,
533 gint y,
534 gint width,
535 gint height) {
536 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
537
538 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_extents(self, x, y, width,
539 height);
540 }
541
542 void fl_accessible_node_set_flags(FlAccessibleNode* self,
543 FlutterSemanticsFlag flags) {
544 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
545
546 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_flags(self, flags);
547 }
548
549 void fl_accessible_node_set_actions(FlAccessibleNode* self,
550 FlutterSemanticsAction actions) {
551 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
552
553 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_actions(self, actions);
554 }
555
556 void fl_accessible_node_set_value(FlAccessibleNode* self, const gchar* value) {
557 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
558
559 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_value(self, value);
560 }
561
562 void fl_accessible_node_set_text_selection(FlAccessibleNode* self,
563 gint base,
564 gint extent) {
565 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
566
567 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_selection(self, base,
568 extent);
569 }
570
571 void fl_accessible_node_set_text_direction(FlAccessibleNode* self,
572 FlutterTextDirection direction) {
573 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
574
575 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_direction(self,
576 direction);
577 }
578
579 void fl_accessible_node_perform_action(FlAccessibleNode* self,
580 FlutterSemanticsAction action,
581 GBytes* data) {
582 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
583
584 return FL_ACCESSIBLE_NODE_GET_CLASS(self)->perform_action(self, action, data);
585 }
fl_accessible_node_set_text_direction_impl
static void fl_accessible_node_set_text_direction_impl(FlAccessibleNode *self, FlutterTextDirection direction)
Definition: fl_accessible_node.cc:409
fl_accessible_node_set_actions_impl
static void fl_accessible_node_set_actions_impl(FlAccessibleNode *self, FlutterSemanticsAction actions)
Definition: fl_accessible_node.cc:381
invert
gboolean invert
Definition: fl_accessible_node.cc:12
fl_accessible_node_init
static void fl_accessible_node_init(FlAccessibleNode *self)
Definition: fl_accessible_node.cc:475
fl_accessible_node_set_property
static void fl_accessible_node_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Definition: fl_accessible_node.cc:141
flag_mapping
static struct @0 flag_mapping[]
FL_ACCESSIBLE_NODE_GET_PRIVATE
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
Definition: fl_accessible_node.cc:85
fl_accessible_node_do_action
static gboolean fl_accessible_node_do_action(AtkAction *action, gint i)
Definition: fl_accessible_node.cc:303
fl_accessible_node_set_text_selection
void fl_accessible_node_set_text_selection(FlAccessibleNode *self, gint base, gint extent)
Definition: fl_accessible_node.cc:562
fl_accessible_node_dispose
static void fl_accessible_node_dispose(GObject *object)
Definition: fl_accessible_node.cc:162
kPropEngine
@ kPropEngine
Definition: fl_accessible_node.cc:83
fl_accessible_node_get_parent
static AtkObject * fl_accessible_node_get_parent(AtkObject *accessible)
Definition: fl_accessible_node.cc:189
fl_accessible_node_set_flags
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlag flags)
Definition: fl_accessible_node.cc:542
fl_accessible_node_set_name_impl
static void fl_accessible_node_set_name_impl(FlAccessibleNode *self, const gchar *name)
Definition: fl_accessible_node.cc:339
fl_accessible_node_set_parent
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
Definition: fl_accessible_node.cc:487
fl_accessible_node_set_flags_impl
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlag flags)
Definition: fl_accessible_node.cc:360
fl_accessible_node_get_role
static AtkRole fl_accessible_node_get_role(AtkObject *accessible)
Definition: fl_accessible_node.cc:218
fl_accessible_node_set_text_selection_impl
static void fl_accessible_node_set_text_selection_impl(FlAccessibleNode *self, gint base, gint extent)
Definition: fl_accessible_node.cc:404
priv
FlPixelBufferTexturePrivate * priv
Definition: fl_pixel_buffer_texture.cc:30
kPropId
@ kPropId
Definition: fl_accessible_node.cc:83
FlAccessibleNodePrivate::id
int32_t id
Definition: fl_accessible_node.cc:73
fl_accessible_node_get_index_in_parent
static gint fl_accessible_node_get_index_in_parent(AtkObject *accessible)
Definition: fl_accessible_node.cc:195
flags
FlutterSemanticsFlag flags
Definition: fl_accessible_node.cc:105
FlAccessibleNodePrivate::index
gint index
Definition: fl_accessible_node.cc:75
FlAccessibleNodePrivate::y
gint y
Definition: fl_accessible_node.cc:76
fl_engine_dispatch_semantics_action
void fl_engine_dispatch_semantics_action(FlEngine *self, uint64_t id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:851
fl_accessible_node_set_children
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
Definition: fl_accessible_node.cc:498
height
G_BEGIN_DECLS int height
Definition: fl_backing_store_provider.h:37
action_mapping
static ActionData action_mapping[]
Definition: fl_accessible_node.cc:36
FlAccessibleNodePrivate::children
GPtrArray * children
Definition: fl_accessible_node.cc:79
state
AtkStateType state
Definition: fl_accessible_node.cc:10
fl_accessible_node_component_interface_init
static void fl_accessible_node_component_interface_init(AtkComponentIface *iface)
Definition: fl_accessible_node.cc:463
fl_accessible_node_ref_child
static AtkObject * fl_accessible_node_ref_child(AtkObject *accessible, gint i)
Definition: fl_accessible_node.cc:207
kPropLast
@ kPropLast
Definition: fl_accessible_node.cc:83
ActionData
Definition: fl_accessible_node.cc:32
fl_accessible_node_perform_action_impl
static void fl_accessible_node_perform_action_impl(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.cc:414
fl_accessible_node_class_init
static void fl_accessible_node_class_init(FlAccessibleNodeClass *klass)
Definition: fl_accessible_node.cc:422
has_child
static gboolean has_child(GPtrArray *children, AtkObject *object)
Definition: fl_accessible_node.cc:131
fl_accessible_node_perform_action
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.cc:579
FlAccessibleNodePrivate::height
gint height
Definition: fl_accessible_node.cc:76
fl_accessible_node_set_extents
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.cc:531
FlAccessibleNodePrivate::x
gint x
Definition: fl_accessible_node.cc:76
fl_accessible_node_set_text_direction
void fl_accessible_node_set_text_direction(FlAccessibleNode *self, FlutterTextDirection direction)
Definition: fl_accessible_node.cc:571
kProp0
@ kProp0
Definition: fl_accessible_node.cc:83
fl_engine_private.h
FlAccessibleNodePrivate::width
gint width
Definition: fl_accessible_node.cc:76
flag
FlutterSemanticsFlag flag
Definition: fl_accessible_node.cc:11
fl_accessible_node_get_layer
static AtkLayer fl_accessible_node_get_layer(AtkComponent *component)
Definition: fl_accessible_node.cc:298
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
fl_accessible_node_get_extents
static void fl_accessible_node_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)
Definition: fl_accessible_node.cc:276
has_flag
static gboolean has_flag(FlutterSemanticsFlag flags, FlutterSemanticsFlag flag)
Definition: fl_accessible_node.cc:111
ActionData::name
const gchar * name
Definition: fl_accessible_node.cc:34
fl_accessible_node_set_value
void fl_accessible_node_set_value(FlAccessibleNode *self, const gchar *value)
Definition: fl_accessible_node.cc:556
FlPixelBufferTexturePrivate::id
int64_t id
Definition: fl_pixel_buffer_texture.cc:13
g_object_add_weak_pointer
g_object_add_weak_pointer(G_OBJECT(self), reinterpret_cast< gpointer * >(&self->engine))
FlAccessibleNodePrivate
Definition: fl_accessible_node.cc:64
fl_accessible_node.h
fl_accessible_node_set_value_impl
static void fl_accessible_node_set_value_impl(FlAccessibleNode *self, const gchar *value)
Definition: fl_accessible_node.cc:400
get_action
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
Definition: fl_accessible_node.cc:123
fl_accessible_node_new
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, int32_t id)
Definition: fl_accessible_node.cc:481
FlAccessibleNodePrivate::parent
AtkObject * parent
Definition: fl_accessible_node.cc:71
FlAccessibleNodePrivate::engine
FlEngine * engine
Definition: fl_accessible_node.cc:68
fl_accessible_node_set_extents_impl
static void fl_accessible_node_set_extents_impl(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.cc:347
fl_accessible_node_get_name
static const gchar * fl_accessible_node_get_name(AtkObject *accessible)
Definition: fl_accessible_node.cc:183
FlAccessibleNodePrivate::name
gchar * name
Definition: fl_accessible_node.cc:74
ActionData::action
FlutterSemanticsAction action
Definition: fl_accessible_node.cc:33
FlAccessibleNodePrivate::actions
GPtrArray * actions
Definition: fl_accessible_node.cc:77
FlAccessibleNodePrivate::actions_length
gsize actions_length
Definition: fl_accessible_node.cc:78
fl_accessible_node_ref_state_set
static AtkStateSet * fl_accessible_node_ref_state_set(AtkObject *accessible)
Definition: fl_accessible_node.cc:257
fl_accessible_node_get_n_children
static gint fl_accessible_node_get_n_children(AtkObject *accessible)
Definition: fl_accessible_node.cc:201
engine
FlEngine * engine
Definition: fl_view_accessible.cc:29
fl_accessible_node_set_name
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
Definition: fl_accessible_node.cc:525
fl_accessible_node_set_actions
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
Definition: fl_accessible_node.cc:549
fl_accessible_node_get_n_actions
static gint fl_accessible_node_get_n_actions(AtkAction *action)
Definition: fl_accessible_node.cc:321
fl_accessible_node_action_interface_init
static void fl_accessible_node_action_interface_init(AtkActionIface *iface)
Definition: fl_accessible_node.cc:469
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
has_action
static gboolean has_action(FlutterSemanticsAction actions, FlutterSemanticsAction action)
Definition: fl_accessible_node.cc:117
FlAccessibleNodePrivate::flags
FlutterSemanticsFlag flags
Definition: fl_accessible_node.cc:80
FlAccessibleNodePrivate::parent_instance
AtkObject parent_instance
Definition: fl_accessible_node.cc:65
value
uint8_t value
Definition: fl_standard_message_codec.cc:41
G_DEFINE_TYPE_WITH_CODE
G_DEFINE_TYPE_WITH_CODE(FlAccessibleNode, fl_accessible_node, ATK_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT, fl_accessible_node_component_interface_init) G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION, fl_accessible_node_action_interface_init)) static gboolean flag_is_changed(FlutterSemanticsFlag old_flags