Flutter Linux Embedder
fl_accessible_node.cc File Reference

Go to the source code of this file.

Classes

struct  ActionData
 
struct  FlAccessibleNodePrivate
 

Macros

#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
 

Enumerations

enum  {
  kProp0,
  kPropEngine,
  kPropId,
  kPropLast
}
 

Functions

static void fl_accessible_node_component_interface_init (AtkComponentIface *iface)
 
static void fl_accessible_node_action_interface_init (AtkActionIface *iface)
 
 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
 
static gboolean has_flag (FlutterSemanticsFlag flags, FlutterSemanticsFlag flag)
 
static gboolean has_action (FlutterSemanticsAction actions, FlutterSemanticsAction action)
 
static ActionDataget_action (FlAccessibleNodePrivate *priv, gint index)
 
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)
 
static void fl_accessible_node_dispose (GObject *object)
 
static const gchar * fl_accessible_node_get_name (AtkObject *accessible)
 
static AtkObject * fl_accessible_node_get_parent (AtkObject *accessible)
 
static gint fl_accessible_node_get_index_in_parent (AtkObject *accessible)
 
static gint fl_accessible_node_get_n_children (AtkObject *accessible)
 
static AtkObject * fl_accessible_node_ref_child (AtkObject *accessible, gint i)
 
static AtkRole fl_accessible_node_get_role (AtkObject *accessible)
 
static AtkStateSet * fl_accessible_node_ref_state_set (AtkObject *accessible)
 
static void fl_accessible_node_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)
 
static AtkLayer fl_accessible_node_get_layer (AtkComponent *component)
 
static gboolean fl_accessible_node_do_action (AtkAction *action, gint i)
 
static gint fl_accessible_node_get_n_actions (AtkAction *action)
 
static const gchar * fl_accessible_node_get_name (AtkAction *action, gint i)
 
static void fl_accessible_node_set_name_impl (FlAccessibleNode *self, const gchar *name)
 
static void fl_accessible_node_set_extents_impl (FlAccessibleNode *self, gint x, gint y, gint width, gint height)
 
static void fl_accessible_node_set_flags_impl (FlAccessibleNode *self, FlutterSemanticsFlag flags)
 
static void fl_accessible_node_set_actions_impl (FlAccessibleNode *self, FlutterSemanticsAction actions)
 
static void fl_accessible_node_set_value_impl (FlAccessibleNode *self, const gchar *value)
 
static void fl_accessible_node_set_text_selection_impl (FlAccessibleNode *self, gint base, gint extent)
 
static void fl_accessible_node_set_text_direction_impl (FlAccessibleNode *self, FlutterTextDirection direction)
 
static void fl_accessible_node_perform_action_impl (FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
 
static void fl_accessible_node_class_init (FlAccessibleNodeClass *klass)
 
static void fl_accessible_node_init (FlAccessibleNode *self)
 
FlAccessibleNode * fl_accessible_node_new (FlEngine *engine, int32_t id)
 
void fl_accessible_node_set_parent (FlAccessibleNode *self, AtkObject *parent, gint index)
 
void fl_accessible_node_set_children (FlAccessibleNode *self, GPtrArray *children)
 
void fl_accessible_node_set_name (FlAccessibleNode *self, const gchar *name)
 
void fl_accessible_node_set_extents (FlAccessibleNode *self, gint x, gint y, gint width, gint height)
 
void fl_accessible_node_set_flags (FlAccessibleNode *self, FlutterSemanticsFlag flags)
 
void fl_accessible_node_set_actions (FlAccessibleNode *self, FlutterSemanticsAction actions)
 
void fl_accessible_node_set_value (FlAccessibleNode *self, const gchar *value)
 
void fl_accessible_node_set_text_selection (FlAccessibleNode *self, gint base, gint extent)
 
void fl_accessible_node_set_text_direction (FlAccessibleNode *self, FlutterTextDirection direction)
 
void fl_accessible_node_perform_action (FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
 

Variables

struct {
   AtkStateType   state
 
   FlutterSemanticsFlag   flag
 
   gboolean   invert
 
flag_mapping []
 
static ActionData action_mapping []
 
FlutterSemanticsFlag flags
 

Macro Definition Documentation

◆ FL_ACCESSIBLE_NODE_GET_PRIVATE

#define FL_ACCESSIBLE_NODE_GET_PRIVATE (   node)
Value:
((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
FL_ACCESSIBLE_NODE(node)))

Definition at line 86 of file fl_accessible_node.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kProp0 
kPropEngine 
kPropId 
kPropLast 

Definition at line 84 of file fl_accessible_node.cc.

Function Documentation

◆ fl_accessible_node_action_interface_init()

static void fl_accessible_node_action_interface_init ( AtkActionIface *  iface)
static

Definition at line 470 of file fl_accessible_node.cc.

470  {
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 }

References fl_accessible_node_do_action(), fl_accessible_node_get_n_actions(), and fl_accessible_node_get_name().

◆ fl_accessible_node_class_init()

static void fl_accessible_node_class_init ( FlAccessibleNodeClass *  klass)
static

Definition at line 423 of file fl_accessible_node.cc.

423  {
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 =
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 =
437  FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
439  FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
441  FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
443  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
445  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
447  FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
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 }

References fl_accessible_node_dispose(), fl_accessible_node_get_index_in_parent(), fl_accessible_node_get_n_children(), fl_accessible_node_get_name(), fl_accessible_node_get_parent(), fl_accessible_node_get_role(), fl_accessible_node_perform_action_impl(), fl_accessible_node_ref_child(), fl_accessible_node_ref_state_set(), fl_accessible_node_set_actions_impl(), fl_accessible_node_set_extents_impl(), fl_accessible_node_set_flags_impl(), fl_accessible_node_set_name_impl(), fl_accessible_node_set_property(), fl_accessible_node_set_text_direction_impl(), fl_accessible_node_set_text_selection_impl(), fl_accessible_node_set_value_impl(), kPropEngine, and kPropId.

◆ fl_accessible_node_component_interface_init()

static void fl_accessible_node_component_interface_init ( AtkComponentIface *  iface)
static

Definition at line 464 of file fl_accessible_node.cc.

465  {
466  iface->get_extents = fl_accessible_node_get_extents;
467  iface->get_layer = fl_accessible_node_get_layer;
468 }

References fl_accessible_node_get_extents(), and fl_accessible_node_get_layer().

◆ fl_accessible_node_dispose()

static void fl_accessible_node_dispose ( GObject *  object)
static

Definition at line 163 of file fl_accessible_node.cc.

163  {
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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_do_action()

static gboolean fl_accessible_node_do_action ( AtkAction *  action,
gint  i 
)
static

Definition at line 304 of file fl_accessible_node.cc.

304  {
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 }

References ActionData::action, FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_accessible_node_perform_action(), get_action(), i, priv, and TRUE.

Referenced by fl_accessible_node_action_interface_init().

◆ 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 
)
static

Definition at line 277 of file fl_accessible_node.cc.

282  {
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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, height, priv, and width.

Referenced by fl_accessible_node_component_interface_init().

◆ fl_accessible_node_get_index_in_parent()

static gint fl_accessible_node_get_index_in_parent ( AtkObject *  accessible)
static

Definition at line 196 of file fl_accessible_node.cc.

196  {
198  return priv->index;
199 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_layer()

static AtkLayer fl_accessible_node_get_layer ( AtkComponent *  component)
static

Definition at line 299 of file fl_accessible_node.cc.

299  {
300  return ATK_LAYER_WIDGET;
301 }

Referenced by fl_accessible_node_component_interface_init().

◆ fl_accessible_node_get_n_actions()

static gint fl_accessible_node_get_n_actions ( AtkAction *  action)
static

Definition at line 322 of file fl_accessible_node.cc.

322  {
324  return priv->actions->len;
325 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_action_interface_init().

◆ fl_accessible_node_get_n_children()

static gint fl_accessible_node_get_n_children ( AtkObject *  accessible)
static

Definition at line 202 of file fl_accessible_node.cc.

202  {
204  return priv->children->len;
205 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_name() [1/2]

static const gchar* fl_accessible_node_get_name ( AtkAction *  action,
gint  i 
)
static

Definition at line 328 of file fl_accessible_node.cc.

328  {
330 
331  ActionData* data = get_action(priv, i);
332  if (data == nullptr) {
333  return nullptr;
334  }
335 
336  return data->name;
337 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, get_action(), i, ActionData::name, and priv.

◆ fl_accessible_node_get_name() [2/2]

static const gchar* fl_accessible_node_get_name ( AtkObject *  accessible)
static

Definition at line 184 of file fl_accessible_node.cc.

184  {
186  return priv->name;
187 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_action_interface_init(), and fl_accessible_node_class_init().

◆ fl_accessible_node_get_parent()

static AtkObject* fl_accessible_node_get_parent ( AtkObject *  accessible)
static

Definition at line 190 of file fl_accessible_node.cc.

190  {
192  return priv->parent;
193 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_role()

static AtkRole fl_accessible_node_get_role ( AtkObject *  accessible)
static

Definition at line 219 of file fl_accessible_node.cc.

219  {
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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_init()

static void fl_accessible_node_init ( FlAccessibleNode *  self)
static

Definition at line 476 of file fl_accessible_node.cc.

476  {
478  priv->actions = g_ptr_array_new();
479  priv->children = g_ptr_array_new_with_free_func(g_object_unref);
480 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

◆ fl_accessible_node_new()

FlAccessibleNode* fl_accessible_node_new ( FlEngine *  engine,
int32_t  id 
)

fl_accessible_node_new: @engine: the #FlEngine this node came from. @id: the semantics node ID this object represents.

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

Returns: a new #FlAccessibleNode.

Definition at line 482 of file fl_accessible_node.cc.

482  {
483  FlAccessibleNode* self = FL_ACCESSIBLE_NODE(g_object_new(
484  fl_accessible_node_get_type(), "engine", engine, "id", id, nullptr));
485  return self;
486 }

Referenced by create_node(), and TEST().

◆ fl_accessible_node_perform_action()

void fl_accessible_node_perform_action ( FlAccessibleNode *  node,
FlutterSemanticsAction  action,
GBytes *  data 
)

fl_accessible_node_dispatch_action: @node: an #FlAccessibleNode. @action: the action being dispatched. @data: (allow-none): data associated with the action.

Performs a semantic action for this node.

Definition at line 580 of file fl_accessible_node.cc.

582  {
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 }

Referenced by fl_accessible_node_do_action(), fl_accessible_text_field_copy_text(), fl_accessible_text_field_cut_text(), fl_accessible_text_field_paste_text(), perform_set_selection_action(), and perform_set_text_action().

◆ fl_accessible_node_perform_action_impl()

static void fl_accessible_node_perform_action_impl ( FlAccessibleNode *  self,
FlutterSemanticsAction  action,
GBytes *  data 
)
static

◆ fl_accessible_node_ref_child()

static AtkObject* fl_accessible_node_ref_child ( AtkObject *  accessible,
gint  i 
)
static

Definition at line 208 of file fl_accessible_node.cc.

208  {
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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, i, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_ref_state_set()

static AtkStateSet* fl_accessible_node_ref_state_set ( AtkObject *  accessible)
static

Definition at line 258 of file fl_accessible_node.cc.

258  {
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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, flag_mapping, has_flag(), i, invert, priv, and state.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_actions()

void fl_accessible_node_set_actions ( FlAccessibleNode *  node,
FlutterSemanticsAction  actions 
)

fl_accessible_node_set_actions: @node: an #FlAccessibleNode. @actions: the actions this node can perform.

Sets the actions that this node can perform.

Definition at line 550 of file fl_accessible_node.cc.

551  {
552  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
553 
554  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_actions(self, actions);
555 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_actions_impl()

static void fl_accessible_node_set_actions_impl ( FlAccessibleNode *  self,
FlutterSemanticsAction  actions 
)
static

Definition at line 382 of file fl_accessible_node.cc.

384  {
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 }

References action_mapping, FL_ACCESSIBLE_NODE_GET_PRIVATE, has_action(), i, ActionData::name, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_children()

void fl_accessible_node_set_children ( FlAccessibleNode *  node,
GPtrArray *  children 
)

fl_accessible_node_set_children: @node: an #FlAccessibleNode. @children: (transfer none) (element-type AtkObject): a list of #AtkObject.

Sets the children of this node. The children can be changed at any time.

Definition at line 499 of file fl_accessible_node.cc.

500  {
501  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, has_child(), i, and priv.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_extents()

void fl_accessible_node_set_extents ( FlAccessibleNode *  node,
gint  x,
gint  y,
gint  width,
gint  height 
)

fl_accessible_node_set_extents: @node: an #FlAccessibleNode. @x: x co-ordinate of this node relative to its parent. @y: y co-ordinate of this node relative to its parent. @width: width of this node in pixels. @height: height of this node in pixels.

Sets the position and size of this node.

Definition at line 532 of file fl_accessible_node.cc.

536  {
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 }

References height, and width.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_extents_impl()

static void fl_accessible_node_set_extents_impl ( FlAccessibleNode *  self,
gint  x,
gint  y,
gint  width,
gint  height 
)
static

Definition at line 348 of file fl_accessible_node.cc.

352  {
354  priv->x = x;
355  priv->y = y;
356  priv->width = width;
357  priv->height = height;
358 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, height, priv, and width.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_flags()

void fl_accessible_node_set_flags ( FlAccessibleNode *  node,
FlutterSemanticsFlag  flags 
)

fl_accessible_node_set_flags: @node: an #FlAccessibleNode. @flags: the flags for this node.

Sets the flags for this node.

Definition at line 543 of file fl_accessible_node.cc.

544  {
545  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
546 
547  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_flags(self, flags);
548 }

References flags.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_flags_impl()

static void fl_accessible_node_set_flags_impl ( FlAccessibleNode *  self,
FlutterSemanticsFlag  flags 
)
static

Definition at line 361 of file fl_accessible_node.cc.

362  {
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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, flag, flag_mapping, flags, has_flag(), i, invert, priv, and state.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_name()

void fl_accessible_node_set_name ( FlAccessibleNode *  self,
const gchar *  name 
)

Definition at line 526 of file fl_accessible_node.cc.

526  {
527  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
528 
529  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_name(self, name);
530 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_name_impl()

static void fl_accessible_node_set_name_impl ( FlAccessibleNode *  self,
const gchar *  name 
)
static

Definition at line 340 of file fl_accessible_node.cc.

341  {
343  g_free(priv->name);
344  priv->name = g_strdup(name);
345 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_parent()

void fl_accessible_node_set_parent ( FlAccessibleNode *  node,
AtkObject *  parent,
gint  index 
)

fl_accessible_node_set_parent: @node: an #FlAccessibleNode. @parent: an #AtkObject. @index: the index of this node in the parent.

Sets the parent of this node. The parent can be changed at any time.

Definition at line 488 of file fl_accessible_node.cc.

490  {
491  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_view_accessible_handle_update_semantics(), get_node(), and TEST().

◆ fl_accessible_node_set_property()

static void fl_accessible_node_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 142 of file fl_accessible_node.cc.

145  {
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 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, FlPixelBufferTexturePrivate::id, kPropEngine, kPropId, priv, prop_id, pspec, and value.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_text_direction()

void fl_accessible_node_set_text_direction ( FlAccessibleNode *  node,
FlutterTextDirection  direction 
)

fl_accessible_node_set_text_direction: @node: an #FlAccessibleNode. @direction: the direction of the text.

Sets the text direction of this node.

Definition at line 572 of file fl_accessible_node.cc.

573  {
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 }

Referenced by fl_view_accessible_handle_update_semantics().

◆ fl_accessible_node_set_text_direction_impl()

static void fl_accessible_node_set_text_direction_impl ( FlAccessibleNode *  self,
FlutterTextDirection  direction 
)
static

Definition at line 410 of file fl_accessible_node.cc.

412  {}

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_text_selection()

void fl_accessible_node_set_text_selection ( FlAccessibleNode *  node,
gint  base,
gint  extent 
)

fl_accessible_node_set_text_selection: @node: an #FlAccessibleNode. @base: the position at which the text selection originates. @extent: the position at which the text selection terminates.

Sets the text selection of this node.

Definition at line 563 of file fl_accessible_node.cc.

565  {
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 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_text_selection_impl()

static void fl_accessible_node_set_text_selection_impl ( FlAccessibleNode *  self,
gint  base,
gint  extent 
)
static

Definition at line 405 of file fl_accessible_node.cc.

407  {}

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_value()

void fl_accessible_node_set_value ( FlAccessibleNode *  node,
const gchar *  value 
)

fl_accessible_node_set_value: @node: an #FlAccessibleNode. @value: a node value.

Sets the value of this node.

Definition at line 557 of file fl_accessible_node.cc.

557  {
558  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
559 
560  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_value(self, value);
561 }

References value.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_value_impl()

static void fl_accessible_node_set_value_impl ( FlAccessibleNode *  self,
const gchar *  value 
)
static

Definition at line 401 of file fl_accessible_node.cc.

402  {}

Referenced by fl_accessible_node_class_init().

◆ 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  
)

◆ get_action()

static ActionData* get_action ( FlAccessibleNodePrivate priv,
gint  index 
)
static

Definition at line 124 of file fl_accessible_node.cc.

124  {
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 }

References priv.

Referenced by fl_accessible_node_do_action(), and fl_accessible_node_get_name().

◆ has_action()

static gboolean has_action ( FlutterSemanticsAction  actions,
FlutterSemanticsAction  action 
)
static

Definition at line 118 of file fl_accessible_node.cc.

119  {
120  return (actions & action) != 0;
121 }

Referenced by fl_accessible_node_set_actions_impl().

◆ has_child()

static gboolean has_child ( GPtrArray *  children,
AtkObject *  object 
)
static

Definition at line 132 of file fl_accessible_node.cc.

132  {
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 }

References i, and TRUE.

Referenced by fl_accessible_node_set_children().

◆ has_flag()

static gboolean has_flag ( FlutterSemanticsFlag  flags,
FlutterSemanticsFlag  flag 
)
static

Definition at line 112 of file fl_accessible_node.cc.

113  {
114  return (flags & flag) != 0;
115 }

References flag, and flags.

Referenced by fl_accessible_node_ref_state_set(), and fl_accessible_node_set_flags_impl().

Variable Documentation

◆ action_mapping

ActionData action_mapping[]
static
Initial value:
= {
{kFlutterSemanticsActionTap, "Tap"},
{kFlutterSemanticsActionLongPress, "LongPress"},
{kFlutterSemanticsActionScrollLeft, "ScrollLeft"},
{kFlutterSemanticsActionScrollRight, "ScrollRight"},
{kFlutterSemanticsActionScrollUp, "ScrollUp"},
{kFlutterSemanticsActionScrollDown, "ScrollDown"},
{kFlutterSemanticsActionIncrease, "Increase"},
{kFlutterSemanticsActionDecrease, "Decrease"},
{kFlutterSemanticsActionShowOnScreen, "ShowOnScreen"},
{kFlutterSemanticsActionMoveCursorForwardByCharacter,
"MoveCursorForwardByCharacter"},
{kFlutterSemanticsActionMoveCursorBackwardByCharacter,
"MoveCursorBackwardByCharacter"},
{kFlutterSemanticsActionCopy, "Copy"},
{kFlutterSemanticsActionCut, "Cut"},
{kFlutterSemanticsActionPaste, "Paste"},
{kFlutterSemanticsActionDidGainAccessibilityFocus,
"DidGainAccessibilityFocus"},
{kFlutterSemanticsActionDidLoseAccessibilityFocus,
"DidLoseAccessibilityFocus"},
{kFlutterSemanticsActionCustomAction, "CustomAction"},
{kFlutterSemanticsActionDismiss, "Dismiss"},
{kFlutterSemanticsActionMoveCursorForwardByWord, "MoveCursorForwardByWord"},
{kFlutterSemanticsActionMoveCursorBackwardByWord,
"MoveCursorBackwardByWord"},
{kFlutterSemanticsActionFocus, "Focus"},
{static_cast<FlutterSemanticsAction>(0), nullptr}}

Definition at line 36 of file fl_accessible_node.cc.

Referenced by fl_accessible_node_set_actions_impl().

◆ flag

FlutterSemanticsFlag FlutterSemanticsFlag flag
Initial value:
{
return (old_flags & flag) != (flags & flag)

Definition at line 11 of file fl_accessible_node.cc.

Referenced by flutter::StandardMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), fl_accessible_node_set_flags_impl(), and has_flag().

◆ flag_mapping

struct { ... } flag_mapping[]
Initial value:
= {
{ATK_STATE_SHOWING, kFlutterSemanticsFlagIsObscured, TRUE},
{ATK_STATE_VISIBLE, kFlutterSemanticsFlagIsHidden, TRUE},
{ATK_STATE_CHECKABLE, kFlutterSemanticsFlagHasCheckedState, FALSE},
{ATK_STATE_FOCUSABLE, kFlutterSemanticsFlagIsFocusable, FALSE},
{ATK_STATE_FOCUSED, kFlutterSemanticsFlagIsFocused, FALSE},
{ATK_STATE_CHECKED,
static_cast<FlutterSemanticsFlag>(kFlutterSemanticsFlagIsChecked |
kFlutterSemanticsFlagIsToggled),
FALSE},
{ATK_STATE_SELECTED, kFlutterSemanticsFlagIsSelected, FALSE},
{ATK_STATE_ENABLED, kFlutterSemanticsFlagIsEnabled, FALSE},
{ATK_STATE_SENSITIVE, kFlutterSemanticsFlagIsEnabled, FALSE},
{ATK_STATE_READ_ONLY, kFlutterSemanticsFlagIsReadOnly, FALSE},
{ATK_STATE_EDITABLE, kFlutterSemanticsFlagIsTextField, FALSE},
{ATK_STATE_INVALID, static_cast<FlutterSemanticsFlag>(0), FALSE},
}

Referenced by fl_accessible_node_ref_state_set(), and fl_accessible_node_set_flags_impl().

◆ flags

◆ invert

gboolean invert

◆ state

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_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_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_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_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
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
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
action_mapping
static ActionData action_mapping[]
Definition: fl_accessible_node.cc:36
state
AtkStateType state
Definition: fl_accessible_node.cc:10
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
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
kProp0
@ kProp0
Definition: fl_accessible_node.cc:84
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
FlPixelBufferTexturePrivate::id
int64_t id
Definition: fl_pixel_buffer_texture.cc:13
FlAccessibleNodePrivate
Definition: fl_accessible_node.cc:65
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
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
ActionData::action
FlutterSemanticsAction action
Definition: fl_accessible_node.cc:33
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_get_n_actions
static gint fl_accessible_node_get_n_actions(AtkAction *action)
Definition: fl_accessible_node.cc:322
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
value
uint8_t value
Definition: fl_standard_message_codec.cc:36