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