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  {
  PROP_0 ,
  PROP_ENGINE ,
  PROP_VIEW_ID ,
  PROP_ID ,
  PROP_LAST
}
 

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, FlutterViewId view_id, int32_t node_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 89 of file fl_accessible_node.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROP_0 
PROP_ENGINE 
PROP_VIEW_ID 
PROP_ID 
PROP_LAST 

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

483  {
484  iface->do_action = fl_accessible_node_do_action;
485  iface->get_n_actions = fl_accessible_node_get_n_actions;
486  iface->get_name = fl_accessible_node_get_name;
487 }
static gboolean fl_accessible_node_do_action(AtkAction *action, gint i)
static const gchar * fl_accessible_node_get_name(AtkObject *accessible)
static gint fl_accessible_node_get_n_actions(AtkAction *action)

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

430  {
431  G_OBJECT_CLASS(klass)->set_property = fl_accessible_node_set_property;
432  G_OBJECT_CLASS(klass)->dispose = fl_accessible_node_dispose;
433  ATK_OBJECT_CLASS(klass)->get_name = fl_accessible_node_get_name;
434  ATK_OBJECT_CLASS(klass)->get_parent = fl_accessible_node_get_parent;
435  ATK_OBJECT_CLASS(klass)->get_index_in_parent =
437  ATK_OBJECT_CLASS(klass)->get_n_children = fl_accessible_node_get_n_children;
438  ATK_OBJECT_CLASS(klass)->ref_child = fl_accessible_node_ref_child;
439  ATK_OBJECT_CLASS(klass)->get_role = fl_accessible_node_get_role;
440  ATK_OBJECT_CLASS(klass)->ref_state_set = fl_accessible_node_ref_state_set;
441  FL_ACCESSIBLE_NODE_CLASS(klass)->set_name = fl_accessible_node_set_name_impl;
442  FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
444  FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
446  FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
448  FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
450  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
452  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
454  FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
456 
457  g_object_class_install_property(
458  G_OBJECT_CLASS(klass), PROP_ENGINE,
459  g_param_spec_object(
460  "engine", "engine", "Flutter engine", fl_engine_get_type(),
461  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
462  G_PARAM_STATIC_STRINGS)));
463  g_object_class_install_property(
464  G_OBJECT_CLASS(klass), PROP_VIEW_ID,
465  g_param_spec_int64(
466  "view-id", "view-id", "View ID that this node belongs to", 0,
467  G_MAXINT64, 0,
468  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
469  g_object_class_install_property(
470  G_OBJECT_CLASS(klass), PROP_ID,
471  g_param_spec_int(
472  "node-id", "node-id", "Accessibility node ID", 0, G_MAXINT, 0,
473  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
474  G_PARAM_STATIC_STRINGS)));
475 }
static void fl_accessible_node_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
static void fl_accessible_node_set_text_direction_impl(FlAccessibleNode *self, FlutterTextDirection direction)
static AtkRole fl_accessible_node_get_role(AtkObject *accessible)
static void fl_accessible_node_set_value_impl(FlAccessibleNode *self, const gchar *value)
static void fl_accessible_node_set_actions_impl(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_dispose(GObject *object)
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlag flags)
static AtkObject * fl_accessible_node_ref_child(AtkObject *accessible, gint i)
static gint fl_accessible_node_get_index_in_parent(AtkObject *accessible)
static AtkObject * fl_accessible_node_get_parent(AtkObject *accessible)
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 void fl_accessible_node_set_text_selection_impl(FlAccessibleNode *self, gint base, gint extent)
static gint fl_accessible_node_get_n_children(AtkObject *accessible)
static void fl_accessible_node_set_extents_impl(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
static void fl_accessible_node_set_name_impl(FlAccessibleNode *self, const gchar *name)

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(), PROP_ENGINE, PROP_ID, and PROP_VIEW_ID.

◆ fl_accessible_node_component_interface_init()

static void fl_accessible_node_component_interface_init ( AtkComponentIface *  iface)
static

Definition at line 477 of file fl_accessible_node.cc.

478  {
479  iface->get_extents = fl_accessible_node_get_extents;
480  iface->get_layer = fl_accessible_node_get_layer;
481 }
static AtkLayer fl_accessible_node_get_layer(AtkComponent *component)
static void fl_accessible_node_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)

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

169  {
171 
172  if (priv->engine != nullptr) {
173  g_object_remove_weak_pointer(object,
174  reinterpret_cast<gpointer*>(&(priv->engine)));
175  priv->engine = nullptr;
176  }
177  if (priv->parent != nullptr) {
178  g_object_remove_weak_pointer(object,
179  reinterpret_cast<gpointer*>(&(priv->parent)));
180  priv->parent = nullptr;
181  }
182  g_clear_pointer(&priv->name, g_free);
183  g_clear_pointer(&priv->actions, g_ptr_array_unref);
184  g_clear_pointer(&priv->children, g_ptr_array_unref);
185 
186  G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(object);
187 }
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
FlPixelBufferTexturePrivate * priv

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

310  {
312 
313  if (priv->engine == nullptr) {
314  return FALSE;
315  }
316 
317  ActionData* data = get_action(priv, i);
318  if (data == nullptr) {
319  return FALSE;
320  }
321 
322  fl_accessible_node_perform_action(FL_ACCESSIBLE_NODE(action), data->action,
323  nullptr);
324  return TRUE;
325 }
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
FlutterSemanticsAction action

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

288  {
290 
291  *x = 0;
292  *y = 0;
293  if (priv->parent != nullptr) {
294  atk_component_get_extents(ATK_COMPONENT(priv->parent), x, y, nullptr,
295  nullptr, coord_type);
296  }
297 
298  *x += priv->x;
299  *y += priv->y;
300  *width = priv->width;
301  *height = priv->height;
302 }
const uint8_t uint32_t uint32_t * height
const uint8_t uint32_t * width

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

202  {
204  return priv->index;
205 }

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

305  {
306  return ATK_LAYER_WIDGET;
307 }

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

328  {
330  return priv->actions->len;
331 }

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

208  {
210  return priv->children->len;
211 }

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

334  {
336 
337  ActionData* data = get_action(priv, i);
338  if (data == nullptr) {
339  return nullptr;
340  }
341 
342  return data->name;
343 }
const gchar * name

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

190  {
192  return priv->name;
193 }

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

196  {
198  return priv->parent;
199 }

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

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

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

489  {
491  priv->actions = g_ptr_array_new();
492  priv->children = g_ptr_array_new_with_free_func(g_object_unref);
493 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

◆ fl_accessible_node_new()

FlAccessibleNode* fl_accessible_node_new ( FlEngine *  engine,
FlutterViewId  view_id,
int32_t  node_id 
)

fl_accessible_node_new: @engine: the #FlEngine this node came from. @view_id: the view ID this object represents. @node_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 495 of file fl_accessible_node.cc.

497  {
498  FlAccessibleNode* self = FL_ACCESSIBLE_NODE(
499  g_object_new(fl_accessible_node_get_type(), "engine", engine, "view-id",
500  view_id, "node-id", node_id, nullptr));
501  return self;
502 }
G_BEGIN_DECLS FlutterViewId view_id

References view_id.

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

598  {
599  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
600 
601  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->perform_action(self, action, data);
602 }

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

Definition at line 421 of file fl_accessible_node.cc.

424  {
427  priv->node_id, action, data);
428 }
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:1232

References FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_engine_dispatch_semantics_action(), and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_ref_child()

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

Definition at line 214 of file fl_accessible_node.cc.

214  {
216 
217  if (i < 0 || static_cast<guint>(i) >= priv->children->len) {
218  return nullptr;
219  }
220 
221  return ATK_OBJECT(g_object_ref(g_ptr_array_index(priv->children, i)));
222 }

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

264  {
266 
267  AtkStateSet* state_set = atk_state_set_new();
268 
269  for (int i = 0; flag_mapping[i].state != ATK_STATE_INVALID; i++) {
270  gboolean enabled = has_flag(priv->flags, flag_mapping[i].flag);
271  if (flag_mapping[i].invert) {
272  enabled = !enabled;
273  }
274  if (enabled) {
275  atk_state_set_add_state(state_set, flag_mapping[i].state);
276  }
277  }
278 
279  return state_set;
280 }
AtkStateType state
gboolean invert
static struct @0 flag_mapping[]
static gboolean has_flag(FlutterSemanticsFlag flags, FlutterSemanticsFlag flag)

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

567  {
568  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
569 
570  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_actions(self, actions);
571 }

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

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

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

516  {
517  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
519 
520  // Remove nodes that are no longer required.
521  for (guint i = 0; i < priv->children->len;) {
522  AtkObject* object = ATK_OBJECT(g_ptr_array_index(priv->children, i));
523  if (has_child(children, object)) {
524  i++;
525  } else {
526  g_signal_emit_by_name(self, "children-changed::remove", i, object,
527  nullptr);
528  g_ptr_array_remove_index(priv->children, i);
529  }
530  }
531 
532  // Add new nodes.
533  for (guint i = 0; i < children->len; i++) {
534  AtkObject* object = ATK_OBJECT(g_ptr_array_index(children, i));
535  if (!has_child(priv->children, object)) {
536  g_ptr_array_add(priv->children, g_object_ref(object));
537  g_signal_emit_by_name(self, "children-changed::add", i, object, nullptr);
538  }
539  }
540 }
static gboolean has_child(GPtrArray *children, AtkObject *object)

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

552  {
553  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
554 
555  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_extents(self, x, y, width,
556  height);
557 }

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

358  {
360  priv->x = x;
361  priv->y = y;
362  priv->width = width;
363  priv->height = height;
364 }

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

560  {
561  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
562 
563  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_flags(self, flags);
564 }
FlutterSemanticsFlag flags

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

368  {
370 
371  FlutterSemanticsFlag old_flags = priv->flags;
372  priv->flags = flags;
373 
374  for (int i = 0; flag_mapping[i].state != ATK_STATE_INVALID; i++) {
375  if (flag_is_changed(old_flags, flags, flag_mapping[i].flag)) {
376  gboolean enabled = has_flag(flags, flag_mapping[i].flag);
377  if (flag_mapping[i].invert) {
378  enabled = !enabled;
379  }
380 
381  atk_object_notify_state_change(ATK_OBJECT(self), flag_mapping[i].state,
382  enabled);
383  }
384  }
385 }
FlutterSemanticsFlag flag

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

542  {
543  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
544 
545  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_name(self, name);
546 }

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

347  {
349  g_free(priv->name);
350  priv->name = g_strdup(name);
351 }

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

506  {
507  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
509  priv->parent = parent;
510  priv->index = index;
511  g_object_add_weak_pointer(G_OBJECT(self),
512  reinterpret_cast<gpointer*>(&(priv->parent)));
513 }

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

148  {
150  switch (prop_id) {
151  case PROP_ENGINE:
152  g_assert(priv->engine == nullptr);
153  priv->engine = FL_ENGINE(g_value_get_object(value));
154  g_object_add_weak_pointer(object,
155  reinterpret_cast<gpointer*>(&priv->engine));
156  break;
157  case PROP_VIEW_ID:
158  priv->view_id = g_value_get_int64(value);
159  break;
160  case PROP_ID:
161  priv->node_id = g_value_get_int(value);
162  break;
163  default:
164  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
165  break;
166  }
167 }
uint8_t value
guint prop_id
guint const GValue GParamSpec * pspec

References FL_ACCESSIBLE_NODE_GET_PRIVATE, priv, PROP_ENGINE, PROP_ID, prop_id, PROP_VIEW_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 588 of file fl_accessible_node.cc.

589  {
590  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
591 
592  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_direction(self,
593  direction);
594 }

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

418  {}

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 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)->set_text_selection(self, base,
585  extent);
586 }

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

413  {}

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 573 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_value(self, value);
577 }

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

408  {}

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

127  {
128  if (index < 0 || static_cast<guint>(index) >= priv->actions->len) {
129  return nullptr;
130  }
131  return static_cast<ActionData*>(g_ptr_array_index(priv->actions, index));
132 }

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

122  {
123  return (actions & action) != 0;
124 }

Referenced by fl_accessible_node_set_actions_impl().

◆ has_child()

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

Definition at line 135 of file fl_accessible_node.cc.

135  {
136  for (guint i = 0; i < children->len; i++) {
137  if (g_ptr_array_index(children, i) == object) {
138  return TRUE;
139  }
140  }
141 
142  return FALSE;
143 }

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

116  {
117  return (flags & flag) != 0;
118 }

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().

◆ 

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