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 
7 
8 // Maps Flutter semantics actions to ATK actions.
9 typedef struct {
10  FlutterSemanticsAction action;
11  const gchar* name;
12 } ActionData;
14  {kFlutterSemanticsActionTap, "Tap"},
15  {kFlutterSemanticsActionLongPress, "LongPress"},
16  {kFlutterSemanticsActionScrollLeft, "ScrollLeft"},
17  {kFlutterSemanticsActionScrollRight, "ScrollRight"},
18  {kFlutterSemanticsActionScrollUp, "ScrollUp"},
19  {kFlutterSemanticsActionScrollDown, "ScrollDown"},
20  {kFlutterSemanticsActionIncrease, "Increase"},
21  {kFlutterSemanticsActionDecrease, "Decrease"},
22  {kFlutterSemanticsActionShowOnScreen, "ShowOnScreen"},
23  {kFlutterSemanticsActionMoveCursorForwardByCharacter,
24  "MoveCursorForwardByCharacter"},
25  {kFlutterSemanticsActionMoveCursorBackwardByCharacter,
26  "MoveCursorBackwardByCharacter"},
27  {kFlutterSemanticsActionCopy, "Copy"},
28  {kFlutterSemanticsActionCut, "Cut"},
29  {kFlutterSemanticsActionPaste, "Paste"},
30  {kFlutterSemanticsActionDidGainAccessibilityFocus,
31  "DidGainAccessibilityFocus"},
32  {kFlutterSemanticsActionDidLoseAccessibilityFocus,
33  "DidLoseAccessibilityFocus"},
34  {kFlutterSemanticsActionCustomAction, "CustomAction"},
35  {kFlutterSemanticsActionDismiss, "Dismiss"},
36  {kFlutterSemanticsActionMoveCursorForwardByWord, "MoveCursorForwardByWord"},
37  {kFlutterSemanticsActionMoveCursorBackwardByWord,
38  "MoveCursorBackwardByWord"},
39  {kFlutterSemanticsActionFocus, "Focus"},
40  {kFlutterSemanticsActionExpand, "Expand"},
41  {kFlutterSemanticsActionCollapse, "Collapse"},
42  {static_cast<FlutterSemanticsAction>(0), nullptr}};
43 
45  AtkObject parent_instance;
46 
47  // Weak reference to the engine this node is created for.
48  FlEngine* engine;
49 
50  /// The unique identifier of the view to which this node belongs.
51  FlutterViewId view_id;
52 
53  // Weak reference to the parent node of this one or %NULL.
54  AtkObject* parent;
55 
56  int32_t node_id;
57  gchar* name;
58  gint index;
59  gint x, y, width, height;
60  GPtrArray* actions;
62  GPtrArray* children;
63  FlutterSemanticsFlags flags;
64 };
65 
67 
68 #define FL_ACCESSIBLE_NODE_GET_PRIVATE(node) \
69  ((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
70  FL_ACCESSIBLE_NODE(node)))
71 
73  AtkComponentIface* iface);
74 static void fl_accessible_node_action_interface_init(AtkActionIface* iface);
75 
77  FlAccessibleNode,
78  fl_accessible_node,
79  ATK_TYPE_OBJECT,
80  G_ADD_PRIVATE(FlAccessibleNode)
81  G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
83  G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
85 
86 // Returns TRUE if [flags] indicate this element is checkable.
87 static gboolean is_checkable(FlutterSemanticsFlags flags) {
88  return flags.is_checked != kFlutterCheckStateNone ||
89  flags.is_toggled != kFlutterTristateNone;
90 }
91 
92 // Returns TRUE if [flags] indicate this element is checked.
93 static gboolean is_checked(FlutterSemanticsFlags flags) {
94  return flags.is_checked == kFlutterCheckStateTrue ||
95  flags.is_toggled == kFlutterTristateTrue;
96 }
97 
98 // Returns TRUE if [flags] indicate this element is focusable.
99 static gboolean is_focusable(FlutterSemanticsFlags flags) {
100  return flags.is_focused != kFlutterTristateNone;
101 }
102 
103 // Returns TRUE if [flags] indicate this element is focused.
104 static gboolean is_focused(FlutterSemanticsFlags flags) {
105  return flags.is_focused == kFlutterTristateTrue;
106 }
107 
108 // Returns TRUE if [flags] indicate this element is selected.
109 static gboolean is_selected(FlutterSemanticsFlags flags) {
110  return flags.is_selected == kFlutterTristateTrue;
111 }
112 
113 // Returns TRUE if [flags] indicate this element is sensitive.
114 static gboolean is_sensitive(FlutterSemanticsFlags flags) {
115  return flags.is_enabled != kFlutterTristateNone;
116 }
117 
118 // Returns TRUE if [flags] indicate this element is enabled.
119 static gboolean is_enabled(FlutterSemanticsFlags flags) {
120  return flags.is_enabled == kFlutterTristateTrue;
121 }
122 
123 // Returns TRUE if [action] is set in [actions].
124 static gboolean has_action(FlutterSemanticsAction actions,
125  FlutterSemanticsAction action) {
126  return (actions & action) != 0;
127 }
128 
129 // Gets the nth action.
131  if (index < 0 || static_cast<guint>(index) >= priv->actions->len) {
132  return nullptr;
133  }
134  return static_cast<ActionData*>(g_ptr_array_index(priv->actions, index));
135 }
136 
137 // Checks if [object] is in [children].
138 static gboolean has_child(GPtrArray* children, AtkObject* object) {
139  for (guint i = 0; i < children->len; i++) {
140  if (g_ptr_array_index(children, i) == object) {
141  return TRUE;
142  }
143  }
144 
145  return FALSE;
146 }
147 
148 static void fl_accessible_node_set_property(GObject* object,
149  guint prop_id,
150  const GValue* value,
151  GParamSpec* pspec) {
153  switch (prop_id) {
154  case PROP_ENGINE:
155  g_assert(priv->engine == nullptr);
156  priv->engine = FL_ENGINE(g_value_get_object(value));
157  g_object_add_weak_pointer(object,
158  reinterpret_cast<gpointer*>(&priv->engine));
159  break;
160  case PROP_VIEW_ID:
161  priv->view_id = g_value_get_int64(value);
162  break;
163  case PROP_ID:
164  priv->node_id = g_value_get_int(value);
165  break;
166  default:
167  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
168  break;
169  }
170 }
171 
172 static void fl_accessible_node_dispose(GObject* object) {
174 
175  if (priv->engine != nullptr) {
176  g_object_remove_weak_pointer(object,
177  reinterpret_cast<gpointer*>(&(priv->engine)));
178  priv->engine = nullptr;
179  }
180  if (priv->parent != nullptr) {
181  g_object_remove_weak_pointer(object,
182  reinterpret_cast<gpointer*>(&(priv->parent)));
183  priv->parent = nullptr;
184  }
185  g_clear_pointer(&priv->name, g_free);
186  g_clear_pointer(&priv->actions, g_ptr_array_unref);
187  g_clear_pointer(&priv->children, g_ptr_array_unref);
188 
189  G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(object);
190 }
191 
192 // Implements AtkObject::get_name.
193 static const gchar* fl_accessible_node_get_name(AtkObject* accessible) {
195  return priv->name;
196 }
197 
198 // Implements AtkObject::get_parent.
199 static AtkObject* fl_accessible_node_get_parent(AtkObject* accessible) {
201  return priv->parent;
202 }
203 
204 // Implements AtkObject::get_index_in_parent.
205 static gint fl_accessible_node_get_index_in_parent(AtkObject* accessible) {
207  return priv->index;
208 }
209 
210 // Implements AtkObject::get_n_children.
211 static gint fl_accessible_node_get_n_children(AtkObject* accessible) {
213  return priv->children->len;
214 }
215 
216 // Implements AtkObject::ref_child.
217 static AtkObject* fl_accessible_node_ref_child(AtkObject* accessible, gint i) {
219 
220  if (i < 0 || static_cast<guint>(i) >= priv->children->len) {
221  return nullptr;
222  }
223 
224  return ATK_OBJECT(g_object_ref(g_ptr_array_index(priv->children, i)));
225 }
226 
227 // Implements AtkObject::get_role.
228 static AtkRole fl_accessible_node_get_role(AtkObject* accessible) {
230  if (priv->flags.is_button) {
231  return ATK_ROLE_PUSH_BUTTON;
232  }
233  if (priv->flags.is_in_mutually_exclusive_group &&
234  priv->flags.is_checked != kFlutterCheckStateNone) {
235  return ATK_ROLE_RADIO_BUTTON;
236  }
237  if (priv->flags.is_checked != kFlutterCheckStateNone) {
238  return ATK_ROLE_CHECK_BOX;
239  }
240  if (priv->flags.is_toggled != kFlutterTristateNone) {
241  return ATK_ROLE_TOGGLE_BUTTON;
242  }
243  if (priv->flags.is_slider) {
244  return ATK_ROLE_SLIDER;
245  }
246  if (priv->flags.is_text_field && priv->flags.is_obscured) {
247  return ATK_ROLE_PASSWORD_TEXT;
248  }
249  if (priv->flags.is_text_field) {
250  return ATK_ROLE_TEXT;
251  }
252  if (priv->flags.is_header) {
253  return ATK_ROLE_HEADER;
254  }
255  if (priv->flags.is_link) {
256  return ATK_ROLE_LINK;
257  }
258  if (priv->flags.is_image) {
259  return ATK_ROLE_IMAGE;
260  }
261 
262  return ATK_ROLE_PANEL;
263 }
264 
265 // Implements AtkObject::ref_state_set.
266 static AtkStateSet* fl_accessible_node_ref_state_set(AtkObject* accessible) {
268 
269  AtkStateSet* state_set = atk_state_set_new();
270 
271  if (!priv->flags.is_obscured) {
272  atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
273  }
274  if (!priv->flags.is_hidden) {
275  atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
276  }
277  if (is_checkable(priv->flags)) {
278  atk_state_set_add_state(state_set, ATK_STATE_CHECKABLE);
279  }
280  if (is_checked(priv->flags)) {
281  atk_state_set_add_state(state_set, ATK_STATE_CHECKED);
282  }
283  if (is_focusable(priv->flags)) {
284  atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
285  }
286  if (is_focused(priv->flags)) {
287  atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);
288  }
289  if (is_selected(priv->flags)) {
290  atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
291  }
292  if (is_enabled(priv->flags)) {
293  atk_state_set_add_state(state_set, ATK_STATE_ENABLED);
294  }
295  if (is_sensitive(priv->flags)) {
296  atk_state_set_add_state(state_set, ATK_STATE_SENSITIVE);
297  }
298  if (priv->flags.is_read_only) {
299  atk_state_set_add_state(state_set, ATK_STATE_READ_ONLY);
300  }
301  if (priv->flags.is_text_field) {
302  atk_state_set_add_state(state_set, ATK_STATE_EDITABLE);
303  }
304 
305  return state_set;
306 }
307 
308 // Implements AtkComponent::get_extents.
309 static void fl_accessible_node_get_extents(AtkComponent* component,
310  gint* x,
311  gint* y,
312  gint* width,
313  gint* height,
314  AtkCoordType coord_type) {
316 
317  *x = 0;
318  *y = 0;
319  if (priv->parent != nullptr) {
320  atk_component_get_extents(ATK_COMPONENT(priv->parent), x, y, nullptr,
321  nullptr, coord_type);
322  }
323 
324  *x += priv->x;
325  *y += priv->y;
326  *width = priv->width;
327  *height = priv->height;
328 }
329 
330 // Implements AtkComponent::get_layer.
331 static AtkLayer fl_accessible_node_get_layer(AtkComponent* component) {
332  return ATK_LAYER_WIDGET;
333 }
334 
335 // Implements AtkAction::do_action.
336 static gboolean fl_accessible_node_do_action(AtkAction* action, gint i) {
338 
339  if (priv->engine == nullptr) {
340  return FALSE;
341  }
342 
343  ActionData* data = get_action(priv, i);
344  if (data == nullptr) {
345  return FALSE;
346  }
347 
348  fl_accessible_node_perform_action(FL_ACCESSIBLE_NODE(action), data->action,
349  nullptr);
350  return TRUE;
351 }
352 
353 // Implements AtkAction::get_n_actions.
354 static gint fl_accessible_node_get_n_actions(AtkAction* action) {
356  return priv->actions->len;
357 }
358 
359 // Implements AtkAction::get_name.
360 static const gchar* fl_accessible_node_get_name(AtkAction* action, gint i) {
362 
363  ActionData* data = get_action(priv, i);
364  if (data == nullptr) {
365  return nullptr;
366  }
367 
368  return data->name;
369 }
370 
371 // Implements FlAccessibleNode::set_name.
372 static void fl_accessible_node_set_name_impl(FlAccessibleNode* self,
373  const gchar* name) {
375  g_free(priv->name);
376  priv->name = g_strdup(name);
377 }
378 
379 // Implements FlAccessibleNode::set_extents.
380 static void fl_accessible_node_set_extents_impl(FlAccessibleNode* self,
381  gint x,
382  gint y,
383  gint width,
384  gint height) {
386  priv->x = x;
387  priv->y = y;
388  priv->width = width;
389  priv->height = height;
390 }
391 
392 // Check two boolean flags are different, in a way that handles true values
393 // being different (e.g. 1 and 2).
394 static bool flag_changed(bool old_flag, bool new_flag) {
395  return !old_flag != !new_flag;
396 }
397 
398 // Implements FlAccessibleNode::set_flags.
399 static void fl_accessible_node_set_flags_impl(FlAccessibleNode* self,
400  FlutterSemanticsFlags* flags) {
402 
403  FlutterSemanticsFlags old_flags = priv->flags;
404  priv->flags = *flags;
405 
406  if (flag_changed(old_flags.is_obscured, flags->is_obscured)) {
407  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SHOWING,
408  !flags->is_obscured);
409  }
410  if (flag_changed(old_flags.is_hidden, flags->is_hidden)) {
411  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_VISIBLE,
412  !flags->is_hidden);
413  }
414  if (flag_changed(is_checkable(old_flags), is_checkable(priv->flags))) {
415  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKABLE,
416  is_checkable(priv->flags));
417  }
418  if (flag_changed(is_checked(old_flags), is_checked(priv->flags))) {
419  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKED,
420  is_checked(priv->flags));
421  }
422  if (flag_changed(is_focusable(old_flags), is_focusable(priv->flags))) {
423  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSABLE,
424  is_focusable(priv->flags));
425  }
426  if (flag_changed(is_focused(old_flags), is_focused(priv->flags))) {
427  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSED,
428  is_focused(priv->flags));
429  }
430  if (flag_changed(is_selected(old_flags), is_selected(priv->flags))) {
431  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SELECTED,
432  is_selected(priv->flags));
433  }
434  if (flag_changed(is_sensitive(old_flags), is_sensitive(priv->flags))) {
435  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SENSITIVE,
436  is_sensitive(priv->flags));
437  }
438  if (flag_changed(is_enabled(old_flags), is_enabled(priv->flags))) {
439  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_ENABLED,
440  is_enabled(priv->flags));
441  }
442  if (flag_changed(old_flags.is_read_only, flags->is_read_only)) {
443  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_READ_ONLY,
444  flags->is_read_only);
445  }
446  if (flag_changed(old_flags.is_text_field, flags->is_text_field)) {
447  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_EDITABLE,
448  flags->is_text_field);
449  }
450 }
451 
452 // Implements FlAccessibleNode::set_actions.
454  FlAccessibleNode* self,
455  FlutterSemanticsAction actions) {
457 
458  // NOTE(robert-ancell): It appears that AtkAction doesn't have a method of
459  // notifying that actions have changed, and even if it did an ATK client
460  // might access the old IDs before checking for new ones. Keep an eye
461  // out for a case where Flutter changes the actions on an item and see
462  // if we can resolve this in another way.
463  g_ptr_array_remove_range(priv->actions, 0, priv->actions->len);
464  for (int i = 0; action_mapping[i].name != nullptr; i++) {
465  if (has_action(actions, action_mapping[i].action)) {
466  g_ptr_array_add(priv->actions, &action_mapping[i]);
467  }
468  }
469 }
470 
471 // Implements FlAccessibleNode::set_value.
472 static void fl_accessible_node_set_value_impl(FlAccessibleNode* self,
473  const gchar* value) {}
474 
475 // Implements FlAccessibleNode::set_text_selection.
476 static void fl_accessible_node_set_text_selection_impl(FlAccessibleNode* self,
477  gint base,
478  gint extent) {}
479 
480 // Implements FlAccessibleNode::set_text_direction.
482  FlAccessibleNode* self,
483  FlutterTextDirection direction) {}
484 
485 // Implements FlAccessibleNode::perform_action.
487  FlAccessibleNode* self,
488  FlutterSemanticsAction action,
489  GBytes* data) {
492  priv->node_id, action, data);
493 }
494 
495 static void fl_accessible_node_class_init(FlAccessibleNodeClass* klass) {
496  G_OBJECT_CLASS(klass)->set_property = fl_accessible_node_set_property;
497  G_OBJECT_CLASS(klass)->dispose = fl_accessible_node_dispose;
498  ATK_OBJECT_CLASS(klass)->get_name = fl_accessible_node_get_name;
499  ATK_OBJECT_CLASS(klass)->get_parent = fl_accessible_node_get_parent;
500  ATK_OBJECT_CLASS(klass)->get_index_in_parent =
502  ATK_OBJECT_CLASS(klass)->get_n_children = fl_accessible_node_get_n_children;
503  ATK_OBJECT_CLASS(klass)->ref_child = fl_accessible_node_ref_child;
504  ATK_OBJECT_CLASS(klass)->get_role = fl_accessible_node_get_role;
505  ATK_OBJECT_CLASS(klass)->ref_state_set = fl_accessible_node_ref_state_set;
506  FL_ACCESSIBLE_NODE_CLASS(klass)->set_name = fl_accessible_node_set_name_impl;
507  FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
509  FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
511  FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
513  FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
515  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
517  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
519  FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
521 
522  g_object_class_install_property(
523  G_OBJECT_CLASS(klass), PROP_ENGINE,
524  g_param_spec_object(
525  "engine", "engine", "Flutter engine", fl_engine_get_type(),
526  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
527  G_PARAM_STATIC_STRINGS)));
528  g_object_class_install_property(
529  G_OBJECT_CLASS(klass), PROP_VIEW_ID,
530  g_param_spec_int64(
531  "view-id", "view-id", "View ID that this node belongs to", 0,
532  G_MAXINT64, 0,
533  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
534  g_object_class_install_property(
535  G_OBJECT_CLASS(klass), PROP_ID,
536  g_param_spec_int(
537  "node-id", "node-id", "Accessibility node ID", 0, G_MAXINT, 0,
538  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
539  G_PARAM_STATIC_STRINGS)));
540 }
541 
543  AtkComponentIface* iface) {
544  iface->get_extents = fl_accessible_node_get_extents;
545  iface->get_layer = fl_accessible_node_get_layer;
546 }
547 
548 static void fl_accessible_node_action_interface_init(AtkActionIface* iface) {
549  iface->do_action = fl_accessible_node_do_action;
550  iface->get_n_actions = fl_accessible_node_get_n_actions;
551  iface->get_name = fl_accessible_node_get_name;
552 }
553 
554 static void fl_accessible_node_init(FlAccessibleNode* self) {
556  priv->actions = g_ptr_array_new();
557  priv->children = g_ptr_array_new_with_free_func(g_object_unref);
558 }
559 
560 FlAccessibleNode* fl_accessible_node_new(FlEngine* engine,
561  FlutterViewId view_id,
562  int32_t node_id) {
563  FlAccessibleNode* self = FL_ACCESSIBLE_NODE(
564  g_object_new(fl_accessible_node_get_type(), "engine", engine, "view-id",
565  view_id, "node-id", node_id, nullptr));
566  return self;
567 }
568 
569 void fl_accessible_node_set_parent(FlAccessibleNode* self,
570  AtkObject* parent,
571  gint index) {
572  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
574  priv->parent = parent;
575  priv->index = index;
576  g_object_add_weak_pointer(G_OBJECT(self),
577  reinterpret_cast<gpointer*>(&(priv->parent)));
578 }
579 
580 void fl_accessible_node_set_children(FlAccessibleNode* self,
581  GPtrArray* children) {
582  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
584 
585  // Remove nodes that are no longer required.
586  for (guint i = 0; i < priv->children->len;) {
587  AtkObject* object = ATK_OBJECT(g_ptr_array_index(priv->children, i));
588  if (has_child(children, object)) {
589  i++;
590  } else {
591  g_signal_emit_by_name(self, "children-changed::remove", i, object,
592  nullptr);
593  g_ptr_array_remove_index(priv->children, i);
594  }
595  }
596 
597  // Add new nodes.
598  for (guint i = 0; i < children->len; i++) {
599  AtkObject* object = ATK_OBJECT(g_ptr_array_index(children, i));
600  if (!has_child(priv->children, object)) {
601  g_ptr_array_add(priv->children, g_object_ref(object));
602  g_signal_emit_by_name(self, "children-changed::add", i, object, nullptr);
603  }
604  }
605 }
606 
607 void fl_accessible_node_set_name(FlAccessibleNode* self, const gchar* name) {
608  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
609 
610  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_name(self, name);
611 }
612 
613 void fl_accessible_node_set_extents(FlAccessibleNode* self,
614  gint x,
615  gint y,
616  gint width,
617  gint height) {
618  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
619 
620  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_extents(self, x, y, width,
621  height);
622 }
623 
624 void fl_accessible_node_set_flags(FlAccessibleNode* self,
625  FlutterSemanticsFlags* flags) {
626  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
627 
628  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_flags(self, flags);
629 }
630 
631 void fl_accessible_node_set_actions(FlAccessibleNode* self,
632  FlutterSemanticsAction actions) {
633  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
634 
635  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_actions(self, actions);
636 }
637 
638 void fl_accessible_node_set_value(FlAccessibleNode* self, const gchar* value) {
639  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
640 
641  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_value(self, value);
642 }
643 
644 void fl_accessible_node_set_text_selection(FlAccessibleNode* self,
645  gint base,
646  gint extent) {
647  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
648 
649  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_selection(self, base,
650  extent);
651 }
652 
653 void fl_accessible_node_set_text_direction(FlAccessibleNode* self,
654  FlutterTextDirection direction) {
655  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
656 
657  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_direction(self,
658  direction);
659 }
660 
661 void fl_accessible_node_perform_action(FlAccessibleNode* self,
662  FlutterSemanticsAction action,
663  GBytes* data) {
664  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
665 
666  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->perform_action(self, action, data);
667 }
static gboolean has_child(GPtrArray *children, AtkObject *object)
static void fl_accessible_node_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
static gboolean fl_accessible_node_do_action(AtkAction *action, gint i)
static void fl_accessible_node_action_interface_init(AtkActionIface *iface)
static void fl_accessible_node_set_text_direction_impl(FlAccessibleNode *self, FlutterTextDirection direction)
@ PROP_ENGINE
@ PROP_VIEW_ID
@ PROP_LAST
@ PROP_0
@ PROP_ID
void fl_accessible_node_set_text_direction(FlAccessibleNode *self, FlutterTextDirection direction)
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static gboolean is_sensitive(FlutterSemanticsFlags flags)
static AtkRole fl_accessible_node_get_role(AtkObject *accessible)
static bool flag_changed(bool old_flag, bool new_flag)
static void fl_accessible_node_set_value_impl(FlAccessibleNode *self, const gchar *value)
void fl_accessible_node_set_text_selection(FlAccessibleNode *self, gint base, gint extent)
static void fl_accessible_node_class_init(FlAccessibleNodeClass *klass)
static void fl_accessible_node_set_actions_impl(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_component_interface_init(AtkComponentIface *iface)
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_dispose(GObject *object)
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
static const gchar * fl_accessible_node_get_name(AtkObject *accessible)
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
static AtkLayer fl_accessible_node_get_layer(AtkComponent *component)
void fl_accessible_node_set_value(FlAccessibleNode *self, const gchar *value)
static gboolean is_enabled(FlutterSemanticsFlags flags)
static void fl_accessible_node_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)
static gint fl_accessible_node_get_n_actions(AtkAction *action)
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 is_checkable(FlutterSemanticsFlags flags)
static AtkObject * fl_accessible_node_ref_child(AtkObject *accessible, gint i)
static gboolean is_selected(FlutterSemanticsFlags flags)
static gboolean has_action(FlutterSemanticsAction actions, FlutterSemanticsAction action)
static gint fl_accessible_node_get_index_in_parent(AtkObject *accessible)
static AtkObject * fl_accessible_node_get_parent(AtkObject *accessible)
static gboolean is_focusable(FlutterSemanticsFlags flags)
static void fl_accessible_node_init(FlAccessibleNode *self)
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
static AtkStateSet * fl_accessible_node_ref_state_set(AtkObject *accessible)
static void fl_accessible_node_perform_action_impl(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static ActionData action_mapping[]
static void fl_accessible_node_set_text_selection_impl(FlAccessibleNode *self, gint base, gint extent)
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlags *flags)
static gint fl_accessible_node_get_n_children(AtkObject *accessible)
static gboolean is_checked(FlutterSemanticsFlags flags)
static void fl_accessible_node_set_extents_impl(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, FlutterViewId view_id, int32_t node_id)
static void fl_accessible_node_set_name_impl(FlAccessibleNode *self, const gchar *name)
static gboolean is_focused(FlutterSemanticsFlags flags)
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlags *flags)
self height
self width
return TRUE
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:1396
FlPixelBufferTexturePrivate * priv
uint8_t value
guint prop_id
guint const GValue GParamSpec * pspec
G_BEGIN_DECLS FlutterViewId view_id
const gchar * name
FlutterSemanticsAction action
FlutterSemanticsFlags flags
FlutterViewId view_id
The unique identifier of the view to which this node belongs.