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 85 of file fl_accessible_node.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kProp0 
kPropEngine 
kPropId 
kPropLast 

Definition at line 83 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 469 of file fl_accessible_node.cc.

469  {
470  iface->do_action = fl_accessible_node_do_action;
471  iface->get_n_actions = fl_accessible_node_get_n_actions;
472  iface->get_name = fl_accessible_node_get_name;
473 }

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 422 of file fl_accessible_node.cc.

422  {
423  G_OBJECT_CLASS(klass)->set_property = fl_accessible_node_set_property;
424  G_OBJECT_CLASS(klass)->dispose = fl_accessible_node_dispose;
425  ATK_OBJECT_CLASS(klass)->get_name = fl_accessible_node_get_name;
426  ATK_OBJECT_CLASS(klass)->get_parent = fl_accessible_node_get_parent;
427  ATK_OBJECT_CLASS(klass)->get_index_in_parent =
429  ATK_OBJECT_CLASS(klass)->get_n_children = fl_accessible_node_get_n_children;
430  ATK_OBJECT_CLASS(klass)->ref_child = fl_accessible_node_ref_child;
431  ATK_OBJECT_CLASS(klass)->get_role = fl_accessible_node_get_role;
432  ATK_OBJECT_CLASS(klass)->ref_state_set = fl_accessible_node_ref_state_set;
433  FL_ACCESSIBLE_NODE_CLASS(klass)->set_name = fl_accessible_node_set_name_impl;
434  FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
436  FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
438  FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
440  FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
442  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
444  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
446  FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
448 
449  g_object_class_install_property(
450  G_OBJECT_CLASS(klass), kPropEngine,
451  g_param_spec_object(
452  "engine", "engine", "Flutter engine", fl_engine_get_type(),
453  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
454  G_PARAM_STATIC_STRINGS)));
455  g_object_class_install_property(
456  G_OBJECT_CLASS(klass), kPropId,
457  g_param_spec_int(
458  "id", "id", "Accessibility node ID", 0, G_MAXINT, 0,
459  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
460  G_PARAM_STATIC_STRINGS)));
461 }

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 463 of file fl_accessible_node.cc.

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

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 162 of file fl_accessible_node.cc.

162  {
164 
165  if (priv->engine != nullptr) {
166  g_object_remove_weak_pointer(object,
167  reinterpret_cast<gpointer*>(&(priv->engine)));
168  priv->engine = nullptr;
169  }
170  if (priv->parent != nullptr) {
171  g_object_remove_weak_pointer(object,
172  reinterpret_cast<gpointer*>(&(priv->parent)));
173  priv->parent = nullptr;
174  }
175  g_clear_pointer(&priv->name, g_free);
176  g_clear_pointer(&priv->actions, g_ptr_array_unref);
177  g_clear_pointer(&priv->children, g_ptr_array_unref);
178 
179  G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(object);
180 }

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 303 of file fl_accessible_node.cc.

303  {
305 
306  if (priv->engine == nullptr) {
307  return FALSE;
308  }
309 
310  ActionData* data = get_action(priv, i);
311  if (data == nullptr) {
312  return FALSE;
313  }
314 
315  fl_accessible_node_perform_action(FL_ACCESSIBLE_NODE(action), data->action,
316  nullptr);
317  return TRUE;
318 }

References ActionData::action, FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_accessible_node_perform_action(), get_action(), 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 276 of file fl_accessible_node.cc.

281  {
283 
284  *x = 0;
285  *y = 0;
286  if (priv->parent != nullptr) {
287  atk_component_get_extents(ATK_COMPONENT(priv->parent), x, y, nullptr,
288  nullptr, coord_type);
289  }
290 
291  *x += priv->x;
292  *y += priv->y;
293  *width = priv->width;
294  *height = priv->height;
295 }

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 195 of file fl_accessible_node.cc.

195  {
197  return priv->index;
198 }

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 298 of file fl_accessible_node.cc.

298  {
299  return ATK_LAYER_WIDGET;
300 }

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 321 of file fl_accessible_node.cc.

321  {
323  return priv->actions->len;
324 }

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 201 of file fl_accessible_node.cc.

201  {
203  return priv->children->len;
204 }

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 327 of file fl_accessible_node.cc.

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

References FL_ACCESSIBLE_NODE_GET_PRIVATE, get_action(), 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 183 of file fl_accessible_node.cc.

183  {
185  return priv->name;
186 }

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 189 of file fl_accessible_node.cc.

189  {
191  return priv->parent;
192 }

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 218 of file fl_accessible_node.cc.

218  {
220  if ((priv->flags & kFlutterSemanticsFlagIsButton) != 0) {
221  return ATK_ROLE_PUSH_BUTTON;
222  }
223  if ((priv->flags & kFlutterSemanticsFlagIsInMutuallyExclusiveGroup) != 0 &&
224  (priv->flags & kFlutterSemanticsFlagHasCheckedState) != 0) {
225  return ATK_ROLE_RADIO_BUTTON;
226  }
227  if ((priv->flags & kFlutterSemanticsFlagHasCheckedState) != 0) {
228  return ATK_ROLE_CHECK_BOX;
229  }
230  if ((priv->flags & kFlutterSemanticsFlagHasToggledState) != 0) {
231  return ATK_ROLE_TOGGLE_BUTTON;
232  }
233  if ((priv->flags & kFlutterSemanticsFlagIsSlider) != 0) {
234  return ATK_ROLE_SLIDER;
235  }
236  if ((priv->flags & kFlutterSemanticsFlagIsTextField) != 0 &&
237  (priv->flags & kFlutterSemanticsFlagIsObscured) != 0) {
238  return ATK_ROLE_PASSWORD_TEXT;
239  }
240  if ((priv->flags & kFlutterSemanticsFlagIsTextField) != 0) {
241  return ATK_ROLE_TEXT;
242  }
243  if ((priv->flags & kFlutterSemanticsFlagIsHeader) != 0) {
244  return ATK_ROLE_HEADER;
245  }
246  if ((priv->flags & kFlutterSemanticsFlagIsLink) != 0) {
247  return ATK_ROLE_LINK;
248  }
249  if ((priv->flags & kFlutterSemanticsFlagIsImage) != 0) {
250  return ATK_ROLE_IMAGE;
251  }
252 
253  return ATK_ROLE_PANEL;
254 }

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 475 of file fl_accessible_node.cc.

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

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 481 of file fl_accessible_node.cc.

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

References engine.

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 579 of file fl_accessible_node.cc.

581  {
582  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
583 
584  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->perform_action(self, action, data);
585 }

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 207 of file fl_accessible_node.cc.

207  {
209 
210  if (i < 0 || static_cast<guint>(i) >= priv->children->len) {
211  return nullptr;
212  }
213 
214  return ATK_OBJECT(g_object_ref(g_ptr_array_index(priv->children, i)));
215 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, 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 257 of file fl_accessible_node.cc.

257  {
259 
260  AtkStateSet* state_set = atk_state_set_new();
261 
262  for (int i = 0; flag_mapping[i].state != ATK_STATE_INVALID; i++) {
263  gboolean enabled = has_flag(priv->flags, flag_mapping[i].flag);
264  if (flag_mapping[i].invert) {
265  enabled = !enabled;
266  }
267  if (enabled) {
268  atk_state_set_add_state(state_set, flag_mapping[i].state);
269  }
270  }
271 
272  return state_set;
273 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, flag_mapping, has_flag(), 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 549 of file fl_accessible_node.cc.

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

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 381 of file fl_accessible_node.cc.

383  {
385 
386  // NOTE(robert-ancell): It appears that AtkAction doesn't have a method of
387  // notifying that actions have changed, and even if it did an ATK client
388  // might access the old IDs before checking for new ones. Keep an eye
389  // out for a case where Flutter changes the actions on an item and see
390  // if we can resolve this in another way.
391  g_ptr_array_remove_range(priv->actions, 0, priv->actions->len);
392  for (int i = 0; action_mapping[i].name != nullptr; i++) {
393  if (has_action(actions, action_mapping[i].action)) {
394  g_ptr_array_add(priv->actions, &action_mapping[i]);
395  }
396  }
397 }

References action_mapping, FL_ACCESSIBLE_NODE_GET_PRIVATE, has_action(), 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 498 of file fl_accessible_node.cc.

499  {
500  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
502 
503  // Remove nodes that are no longer required.
504  for (guint i = 0; i < priv->children->len;) {
505  AtkObject* object = ATK_OBJECT(g_ptr_array_index(priv->children, i));
506  if (has_child(children, object)) {
507  i++;
508  } else {
509  g_signal_emit_by_name(self, "children-changed::remove", i, object,
510  nullptr);
511  g_ptr_array_remove_index(priv->children, i);
512  }
513  }
514 
515  // Add new nodes.
516  for (guint i = 0; i < children->len; i++) {
517  AtkObject* object = ATK_OBJECT(g_ptr_array_index(children, i));
518  if (!has_child(priv->children, object)) {
519  g_ptr_array_add(priv->children, g_object_ref(object));
520  g_signal_emit_by_name(self, "children-changed::add", i, object, nullptr);
521  }
522  }
523 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, has_child(), 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 531 of file fl_accessible_node.cc.

535  {
536  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
537 
538  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_extents(self, x, y, width,
539  height);
540 }

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 347 of file fl_accessible_node.cc.

351  {
353  priv->x = x;
354  priv->y = y;
355  priv->width = width;
356  priv->height = height;
357 }

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 542 of file fl_accessible_node.cc.

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

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 360 of file fl_accessible_node.cc.

361  {
363 
364  FlutterSemanticsFlag old_flags = priv->flags;
365  priv->flags = flags;
366 
367  for (int i = 0; flag_mapping[i].state != ATK_STATE_INVALID; i++) {
368  if (flag_is_changed(old_flags, flags, flag_mapping[i].flag)) {
369  gboolean enabled = has_flag(flags, flag_mapping[i].flag);
370  if (flag_mapping[i].invert) {
371  enabled = !enabled;
372  }
373 
374  atk_object_notify_state_change(ATK_OBJECT(self), flag_mapping[i].state,
375  enabled);
376  }
377  }
378 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, flag, flag_mapping, flags, has_flag(), 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 525 of file fl_accessible_node.cc.

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

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 339 of file fl_accessible_node.cc.

340  {
342  g_free(priv->name);
343  priv->name = g_strdup(name);
344 }

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 487 of file fl_accessible_node.cc.

489  {
490  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
492  priv->parent = parent;
493  priv->index = index;
494  g_object_add_weak_pointer(G_OBJECT(self),
495  reinterpret_cast<gpointer*>(&(priv->parent)));
496 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, g_object_add_weak_pointer(), 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 141 of file fl_accessible_node.cc.

144  {
146  switch (prop_id) {
147  case kPropEngine:
148  g_assert(priv->engine == nullptr);
149  priv->engine = FL_ENGINE(g_value_get_object(value));
151  reinterpret_cast<gpointer*>(&priv->engine));
152  break;
153  case kPropId:
154  priv->id = g_value_get_int(value);
155  break;
156  default:
157  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
158  break;
159  }
160 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, g_object_add_weak_pointer(), 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 571 of file fl_accessible_node.cc.

572  {
573  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
574 
575  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_direction(self,
576  direction);
577 }

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 409 of file fl_accessible_node.cc.

411  {}

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 562 of file fl_accessible_node.cc.

564  {
565  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
566 
567  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_selection(self, base,
568  extent);
569 }

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 404 of file fl_accessible_node.cc.

406  {}

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 556 of file fl_accessible_node.cc.

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

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 400 of file fl_accessible_node.cc.

401  {}

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 123 of file fl_accessible_node.cc.

123  {
124  if (index < 0 || static_cast<guint>(index) >= priv->actions->len) {
125  return nullptr;
126  }
127  return static_cast<ActionData*>(g_ptr_array_index(priv->actions, index));
128 }

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 117 of file fl_accessible_node.cc.

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

Referenced by fl_accessible_node_set_actions_impl().

◆ has_child()

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

Definition at line 131 of file fl_accessible_node.cc.

131  {
132  for (guint i = 0; i < children->len; i++) {
133  if (g_ptr_array_index(children, i) == object) {
134  return TRUE;
135  }
136  }
137 
138  return FALSE;
139 }

References TRUE.

Referenced by fl_accessible_node_set_children().

◆ has_flag()

static gboolean has_flag ( FlutterSemanticsFlag  flags,
FlutterSemanticsFlag  flag 
)
static

Definition at line 111 of file fl_accessible_node.cc.

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

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"},
{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:409
fl_accessible_node_set_actions_impl
static void fl_accessible_node_set_actions_impl(FlAccessibleNode *self, FlutterSemanticsAction actions)
Definition: fl_accessible_node.cc:381
invert
gboolean invert
Definition: fl_accessible_node.cc:12
fl_accessible_node_set_property
static void fl_accessible_node_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Definition: fl_accessible_node.cc:141
flag_mapping
static struct @0 flag_mapping[]
FL_ACCESSIBLE_NODE_GET_PRIVATE
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
Definition: fl_accessible_node.cc:85
fl_accessible_node_do_action
static gboolean fl_accessible_node_do_action(AtkAction *action, gint i)
Definition: fl_accessible_node.cc:303
fl_accessible_node_dispose
static void fl_accessible_node_dispose(GObject *object)
Definition: fl_accessible_node.cc:162
kPropEngine
@ kPropEngine
Definition: fl_accessible_node.cc:83
fl_accessible_node_get_parent
static AtkObject * fl_accessible_node_get_parent(AtkObject *accessible)
Definition: fl_accessible_node.cc:189
fl_accessible_node_set_name_impl
static void fl_accessible_node_set_name_impl(FlAccessibleNode *self, const gchar *name)
Definition: fl_accessible_node.cc:339
fl_accessible_node_set_flags_impl
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlag flags)
Definition: fl_accessible_node.cc:360
fl_accessible_node_get_role
static AtkRole fl_accessible_node_get_role(AtkObject *accessible)
Definition: fl_accessible_node.cc:218
fl_accessible_node_set_text_selection_impl
static void fl_accessible_node_set_text_selection_impl(FlAccessibleNode *self, gint base, gint extent)
Definition: fl_accessible_node.cc:404
priv
FlPixelBufferTexturePrivate * priv
Definition: fl_pixel_buffer_texture.cc:30
kPropId
@ kPropId
Definition: fl_accessible_node.cc:83
fl_accessible_node_get_index_in_parent
static gint fl_accessible_node_get_index_in_parent(AtkObject *accessible)
Definition: fl_accessible_node.cc:195
flags
FlutterSemanticsFlag flags
Definition: fl_accessible_node.cc:105
fl_engine_dispatch_semantics_action
void fl_engine_dispatch_semantics_action(FlEngine *self, uint64_t id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:852
pspec
guint const GValue GParamSpec * pspec
Definition: fl_standard_method_codec.cc:33
height
G_BEGIN_DECLS int height
Definition: fl_backing_store_provider.h:37
action_mapping
static ActionData action_mapping[]
Definition: fl_accessible_node.cc:36
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:207
kPropLast
@ kPropLast
Definition: fl_accessible_node.cc:83
ActionData
Definition: fl_accessible_node.cc:32
fl_accessible_node_perform_action_impl
static void fl_accessible_node_perform_action_impl(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.cc:414
has_child
static gboolean has_child(GPtrArray *children, AtkObject *object)
Definition: fl_accessible_node.cc:131
fl_accessible_node_perform_action
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.cc:579
kProp0
@ kProp0
Definition: fl_accessible_node.cc:83
flag
FlutterSemanticsFlag flag
Definition: fl_accessible_node.cc:11
fl_accessible_node_get_layer
static AtkLayer fl_accessible_node_get_layer(AtkComponent *component)
Definition: fl_accessible_node.cc:298
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
fl_accessible_node_get_extents
static void fl_accessible_node_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)
Definition: fl_accessible_node.cc:276
has_flag
static gboolean has_flag(FlutterSemanticsFlag flags, FlutterSemanticsFlag flag)
Definition: fl_accessible_node.cc:111
ActionData::name
const gchar * name
Definition: fl_accessible_node.cc:34
FlPixelBufferTexturePrivate::id
int64_t id
Definition: fl_pixel_buffer_texture.cc:13
g_object_add_weak_pointer
g_object_add_weak_pointer(G_OBJECT(self), reinterpret_cast< gpointer * >(&self->engine))
FlAccessibleNodePrivate
Definition: fl_accessible_node.cc:64
fl_accessible_node_set_value_impl
static void fl_accessible_node_set_value_impl(FlAccessibleNode *self, const gchar *value)
Definition: fl_accessible_node.cc:400
get_action
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
Definition: fl_accessible_node.cc:123
fl_accessible_node_set_extents_impl
static void fl_accessible_node_set_extents_impl(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.cc:347
fl_accessible_node_get_name
static const gchar * fl_accessible_node_get_name(AtkObject *accessible)
Definition: fl_accessible_node.cc:183
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:257
fl_accessible_node_get_n_children
static gint fl_accessible_node_get_n_children(AtkObject *accessible)
Definition: fl_accessible_node.cc:201
engine
FlEngine * engine
Definition: fl_view_accessible.cc:26
fl_accessible_node_get_n_actions
static gint fl_accessible_node_get_n_actions(AtkAction *action)
Definition: fl_accessible_node.cc:321
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
has_action
static gboolean has_action(FlutterSemanticsAction actions, FlutterSemanticsAction action)
Definition: fl_accessible_node.cc:117
value
uint8_t value
Definition: fl_standard_message_codec.cc:36