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 is_checkable(FlutterSemanticsFlags flags)
 
static gboolean is_checked (FlutterSemanticsFlags flags)
 
static gboolean is_focusable (FlutterSemanticsFlags flags)
 
static gboolean is_focused (FlutterSemanticsFlags flags)
 
static gboolean is_selected (FlutterSemanticsFlags flags)
 
static gboolean is_sensitive (FlutterSemanticsFlags flags)
 
static gboolean is_enabled (FlutterSemanticsFlags flags)
 
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 bool flag_changed (bool old_flag, bool new_flag)
 
static void fl_accessible_node_set_flags_impl (FlAccessibleNode *self, FlutterSemanticsFlags *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, FlutterSemanticsFlags *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

static ActionData action_mapping []
 

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

548  {
549  iface->do_action = fl_accessible_node_do_action;
550  iface->get_n_actions = fl_accessible_node_get_n_actions;
551  iface->get_name = fl_accessible_node_get_name;
552 }
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 495 of file fl_accessible_node.cc.

495  {
496  G_OBJECT_CLASS(klass)->set_property = fl_accessible_node_set_property;
497  G_OBJECT_CLASS(klass)->dispose = fl_accessible_node_dispose;
498  ATK_OBJECT_CLASS(klass)->get_name = fl_accessible_node_get_name;
499  ATK_OBJECT_CLASS(klass)->get_parent = fl_accessible_node_get_parent;
500  ATK_OBJECT_CLASS(klass)->get_index_in_parent =
502  ATK_OBJECT_CLASS(klass)->get_n_children = fl_accessible_node_get_n_children;
503  ATK_OBJECT_CLASS(klass)->ref_child = fl_accessible_node_ref_child;
504  ATK_OBJECT_CLASS(klass)->get_role = fl_accessible_node_get_role;
505  ATK_OBJECT_CLASS(klass)->ref_state_set = fl_accessible_node_ref_state_set;
506  FL_ACCESSIBLE_NODE_CLASS(klass)->set_name = fl_accessible_node_set_name_impl;
507  FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
509  FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
511  FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
513  FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
515  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
517  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
519  FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
521 
522  g_object_class_install_property(
523  G_OBJECT_CLASS(klass), PROP_ENGINE,
524  g_param_spec_object(
525  "engine", "engine", "Flutter engine", fl_engine_get_type(),
526  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
527  G_PARAM_STATIC_STRINGS)));
528  g_object_class_install_property(
529  G_OBJECT_CLASS(klass), PROP_VIEW_ID,
530  g_param_spec_int64(
531  "view-id", "view-id", "View ID that this node belongs to", 0,
532  G_MAXINT64, 0,
533  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
534  g_object_class_install_property(
535  G_OBJECT_CLASS(klass), PROP_ID,
536  g_param_spec_int(
537  "node-id", "node-id", "Accessibility node ID", 0, G_MAXINT, 0,
538  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
539  G_PARAM_STATIC_STRINGS)));
540 }
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 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)
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlags *flags)

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

543  {
544  iface->get_extents = fl_accessible_node_get_extents;
545  iface->get_layer = fl_accessible_node_get_layer;
546 }
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 172 of file fl_accessible_node.cc.

172  {
174 
175  if (priv->engine != nullptr) {
176  g_object_remove_weak_pointer(object,
177  reinterpret_cast<gpointer*>(&(priv->engine)));
178  priv->engine = nullptr;
179  }
180  if (priv->parent != nullptr) {
181  g_object_remove_weak_pointer(object,
182  reinterpret_cast<gpointer*>(&(priv->parent)));
183  priv->parent = nullptr;
184  }
185  g_clear_pointer(&priv->name, g_free);
186  g_clear_pointer(&priv->actions, g_ptr_array_unref);
187  g_clear_pointer(&priv->children, g_ptr_array_unref);
188 
189  G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(object);
190 }
#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 336 of file fl_accessible_node.cc.

336  {
338 
339  if (priv->engine == nullptr) {
340  return FALSE;
341  }
342 
343  ActionData* data = get_action(priv, i);
344  if (data == nullptr) {
345  return FALSE;
346  }
347 
348  fl_accessible_node_perform_action(FL_ACCESSIBLE_NODE(action), data->action,
349  nullptr);
350  return TRUE;
351 }
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
return TRUE
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 309 of file fl_accessible_node.cc.

314  {
316 
317  *x = 0;
318  *y = 0;
319  if (priv->parent != nullptr) {
320  atk_component_get_extents(ATK_COMPONENT(priv->parent), x, y, nullptr,
321  nullptr, coord_type);
322  }
323 
324  *x += priv->x;
325  *y += priv->y;
326  *width = priv->width;
327  *height = priv->height;
328 }
self height
self 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 205 of file fl_accessible_node.cc.

205  {
207  return priv->index;
208 }

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

331  {
332  return ATK_LAYER_WIDGET;
333 }

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

354  {
356  return priv->actions->len;
357 }

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

211  {
213  return priv->children->len;
214 }

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

360  {
362 
363  ActionData* data = get_action(priv, i);
364  if (data == nullptr) {
365  return nullptr;
366  }
367 
368  return data->name;
369 }
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 193 of file fl_accessible_node.cc.

193  {
195  return priv->name;
196 }

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

199  {
201  return priv->parent;
202 }

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

228  {
230  if (priv->flags.is_button) {
231  return ATK_ROLE_PUSH_BUTTON;
232  }
233  if (priv->flags.is_in_mutually_exclusive_group &&
234  priv->flags.is_checked != kFlutterCheckStateNone) {
235  return ATK_ROLE_RADIO_BUTTON;
236  }
237  if (priv->flags.is_checked != kFlutterCheckStateNone) {
238  return ATK_ROLE_CHECK_BOX;
239  }
240  if (priv->flags.is_toggled != kFlutterTristateNone) {
241  return ATK_ROLE_TOGGLE_BUTTON;
242  }
243  if (priv->flags.is_slider) {
244  return ATK_ROLE_SLIDER;
245  }
246  if (priv->flags.is_text_field && priv->flags.is_obscured) {
247  return ATK_ROLE_PASSWORD_TEXT;
248  }
249  if (priv->flags.is_text_field) {
250  return ATK_ROLE_TEXT;
251  }
252  if (priv->flags.is_header) {
253  return ATK_ROLE_HEADER;
254  }
255  if (priv->flags.is_link) {
256  return ATK_ROLE_LINK;
257  }
258  if (priv->flags.is_image) {
259  return ATK_ROLE_IMAGE;
260  }
261 
262  return ATK_ROLE_PANEL;
263 }

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

554  {
556  priv->actions = g_ptr_array_new();
557  priv->children = g_ptr_array_new_with_free_func(g_object_unref);
558 }

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

562  {
563  FlAccessibleNode* self = FL_ACCESSIBLE_NODE(
564  g_object_new(fl_accessible_node_get_type(), "engine", engine, "view-id",
565  view_id, "node-id", node_id, nullptr));
566  return self;
567 }
G_BEGIN_DECLS FlutterViewId view_id

References view_id.

Referenced by create_node(), and TEST_F().

◆ fl_accessible_node_perform_action()

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

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

663  {
664  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
665 
666  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->perform_action(self, action, data);
667 }

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

489  {
492  priv->node_id, action, data);
493 }
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:1396

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

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

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

266  {
268 
269  AtkStateSet* state_set = atk_state_set_new();
270 
271  if (!priv->flags.is_obscured) {
272  atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
273  }
274  if (!priv->flags.is_hidden) {
275  atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
276  }
277  if (is_checkable(priv->flags)) {
278  atk_state_set_add_state(state_set, ATK_STATE_CHECKABLE);
279  }
280  if (is_checked(priv->flags)) {
281  atk_state_set_add_state(state_set, ATK_STATE_CHECKED);
282  }
283  if (is_focusable(priv->flags)) {
284  atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
285  }
286  if (is_focused(priv->flags)) {
287  atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);
288  }
289  if (is_selected(priv->flags)) {
290  atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
291  }
292  if (is_enabled(priv->flags)) {
293  atk_state_set_add_state(state_set, ATK_STATE_ENABLED);
294  }
295  if (is_sensitive(priv->flags)) {
296  atk_state_set_add_state(state_set, ATK_STATE_SENSITIVE);
297  }
298  if (priv->flags.is_read_only) {
299  atk_state_set_add_state(state_set, ATK_STATE_READ_ONLY);
300  }
301  if (priv->flags.is_text_field) {
302  atk_state_set_add_state(state_set, ATK_STATE_EDITABLE);
303  }
304 
305  return state_set;
306 }
static gboolean is_sensitive(FlutterSemanticsFlags flags)
static gboolean is_enabled(FlutterSemanticsFlags flags)
static gboolean is_selected(FlutterSemanticsFlags flags)
static gboolean is_focusable(FlutterSemanticsFlags flags)
static gboolean is_checked(FlutterSemanticsFlags flags)
static gboolean is_focused(FlutterSemanticsFlags flags)

References FL_ACCESSIBLE_NODE_GET_PRIVATE, is_checked(), is_enabled(), is_focusable(), is_focused(), is_selected(), is_sensitive(), and priv.

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

632  {
633  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
634 
635  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_actions(self, actions);
636 }

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

◆ fl_accessible_node_set_actions_impl()

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

Definition at line 453 of file fl_accessible_node.cc.

455  {
457 
458  // NOTE(robert-ancell): It appears that AtkAction doesn't have a method of
459  // notifying that actions have changed, and even if it did an ATK client
460  // might access the old IDs before checking for new ones. Keep an eye
461  // out for a case where Flutter changes the actions on an item and see
462  // if we can resolve this in another way.
463  g_ptr_array_remove_range(priv->actions, 0, priv->actions->len);
464  for (int i = 0; action_mapping[i].name != nullptr; i++) {
465  if (has_action(actions, action_mapping[i].action)) {
466  g_ptr_array_add(priv->actions, &action_mapping[i]);
467  }
468  }
469 }
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 580 of file fl_accessible_node.cc.

581  {
582  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
584 
585  // Remove nodes that are no longer required.
586  for (guint i = 0; i < priv->children->len;) {
587  AtkObject* object = ATK_OBJECT(g_ptr_array_index(priv->children, i));
588  if (has_child(children, object)) {
589  i++;
590  } else {
591  g_signal_emit_by_name(self, "children-changed::remove", i, object,
592  nullptr);
593  g_ptr_array_remove_index(priv->children, i);
594  }
595  }
596 
597  // Add new nodes.
598  for (guint i = 0; i < children->len; i++) {
599  AtkObject* object = ATK_OBJECT(g_ptr_array_index(children, i));
600  if (!has_child(priv->children, object)) {
601  g_ptr_array_add(priv->children, g_object_ref(object));
602  g_signal_emit_by_name(self, "children-changed::add", i, object, nullptr);
603  }
604  }
605 }
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_F().

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

617  {
618  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
619 
620  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_extents(self, x, y, width,
621  height);
622 }

References height, and width.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST_F().

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

384  {
386  priv->x = x;
387  priv->y = y;
388  priv->width = width;
389  priv->height = height;
390 }

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,
FlutterSemanticsFlags *  flags 
)

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

Sets the flags for this node.

Definition at line 624 of file fl_accessible_node.cc.

625  {
626  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
627 
628  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_flags(self, flags);
629 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST_F().

◆ fl_accessible_node_set_flags_impl()

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

Definition at line 399 of file fl_accessible_node.cc.

400  {
402 
403  FlutterSemanticsFlags old_flags = priv->flags;
404  priv->flags = *flags;
405 
406  if (flag_changed(old_flags.is_obscured, flags->is_obscured)) {
407  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SHOWING,
408  !flags->is_obscured);
409  }
410  if (flag_changed(old_flags.is_hidden, flags->is_hidden)) {
411  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_VISIBLE,
412  !flags->is_hidden);
413  }
414  if (flag_changed(is_checkable(old_flags), is_checkable(priv->flags))) {
415  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKABLE,
416  is_checkable(priv->flags));
417  }
418  if (flag_changed(is_checked(old_flags), is_checked(priv->flags))) {
419  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKED,
420  is_checked(priv->flags));
421  }
422  if (flag_changed(is_focusable(old_flags), is_focusable(priv->flags))) {
423  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSABLE,
424  is_focusable(priv->flags));
425  }
426  if (flag_changed(is_focused(old_flags), is_focused(priv->flags))) {
427  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSED,
428  is_focused(priv->flags));
429  }
430  if (flag_changed(is_selected(old_flags), is_selected(priv->flags))) {
431  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SELECTED,
432  is_selected(priv->flags));
433  }
434  if (flag_changed(is_sensitive(old_flags), is_sensitive(priv->flags))) {
435  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SENSITIVE,
436  is_sensitive(priv->flags));
437  }
438  if (flag_changed(is_enabled(old_flags), is_enabled(priv->flags))) {
439  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_ENABLED,
440  is_enabled(priv->flags));
441  }
442  if (flag_changed(old_flags.is_read_only, flags->is_read_only)) {
443  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_READ_ONLY,
444  flags->is_read_only);
445  }
446  if (flag_changed(old_flags.is_text_field, flags->is_text_field)) {
447  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_EDITABLE,
448  flags->is_text_field);
449  }
450 }
static bool flag_changed(bool old_flag, bool new_flag)

References FL_ACCESSIBLE_NODE_GET_PRIVATE, flag_changed(), is_checked(), is_enabled(), is_focusable(), is_focused(), is_selected(), is_sensitive(), and priv.

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

607  {
608  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
609 
610  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_name(self, name);
611 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST_F().

◆ fl_accessible_node_set_name_impl()

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

Definition at line 372 of file fl_accessible_node.cc.

373  {
375  g_free(priv->name);
376  priv->name = g_strdup(name);
377 }

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

571  {
572  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
574  priv->parent = parent;
575  priv->index = index;
576  g_object_add_weak_pointer(G_OBJECT(self),
577  reinterpret_cast<gpointer*>(&(priv->parent)));
578 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

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

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

151  {
153  switch (prop_id) {
154  case PROP_ENGINE:
155  g_assert(priv->engine == nullptr);
156  priv->engine = FL_ENGINE(g_value_get_object(value));
157  g_object_add_weak_pointer(object,
158  reinterpret_cast<gpointer*>(&priv->engine));
159  break;
160  case PROP_VIEW_ID:
161  priv->view_id = g_value_get_int64(value);
162  break;
163  case PROP_ID:
164  priv->node_id = g_value_get_int(value);
165  break;
166  default:
167  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
168  break;
169  }
170 }
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 653 of file fl_accessible_node.cc.

654  {
655  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
656 
657  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_direction(self,
658  direction);
659 }

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

483  {}

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

646  {
647  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
648 
649  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_selection(self, base,
650  extent);
651 }

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

478  {}

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

638  {
639  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
640 
641  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_value(self, value);
642 }

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

473  {}

Referenced by fl_accessible_node_class_init().

◆ flag_changed()

static bool flag_changed ( bool  old_flag,
bool  new_flag 
)
static

Definition at line 394 of file fl_accessible_node.cc.

394  {
395  return !old_flag != !new_flag;
396 }

Referenced by fl_accessible_node_set_flags_impl().

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

Definition at line 76 of file fl_accessible_node.cc.

87  {
88  return flags.is_checked != kFlutterCheckStateNone ||
89  flags.is_toggled != kFlutterTristateNone;
90 }

◆ get_action()

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

Definition at line 130 of file fl_accessible_node.cc.

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

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

125  {
126  return (actions & action) != 0;
127 }

Referenced by fl_accessible_node_set_actions_impl().

◆ has_child()

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

Definition at line 138 of file fl_accessible_node.cc.

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

References i, and TRUE.

Referenced by fl_accessible_node_set_children().

◆ is_checked()

static gboolean is_checked ( FlutterSemanticsFlags  flags)
static

Definition at line 93 of file fl_accessible_node.cc.

93  {
94  return flags.is_checked == kFlutterCheckStateTrue ||
95  flags.is_toggled == kFlutterTristateTrue;
96 }

Referenced by fl_accessible_node_ref_state_set(), and fl_accessible_node_set_flags_impl().

◆ is_enabled()

static gboolean is_enabled ( FlutterSemanticsFlags  flags)
static

Definition at line 119 of file fl_accessible_node.cc.

119  {
120  return flags.is_enabled == kFlutterTristateTrue;
121 }

Referenced by find_stage_by_record(), fl_accessible_node_ref_state_set(), and fl_accessible_node_set_flags_impl().

◆ is_focusable()

static gboolean is_focusable ( FlutterSemanticsFlags  flags)
static

Definition at line 99 of file fl_accessible_node.cc.

99  {
100  return flags.is_focused != kFlutterTristateNone;
101 }

Referenced by fl_accessible_node_ref_state_set(), and fl_accessible_node_set_flags_impl().

◆ is_focused()

static gboolean is_focused ( FlutterSemanticsFlags  flags)
static

Definition at line 104 of file fl_accessible_node.cc.

104  {
105  return flags.is_focused == kFlutterTristateTrue;
106 }

Referenced by fl_accessible_node_ref_state_set(), fl_accessible_node_set_flags_impl(), and window_state_event_cb().

◆ is_selected()

static gboolean is_selected ( FlutterSemanticsFlags  flags)
static

Definition at line 109 of file fl_accessible_node.cc.

109  {
110  return flags.is_selected == kFlutterTristateTrue;
111 }

Referenced by fl_accessible_node_ref_state_set(), and fl_accessible_node_set_flags_impl().

◆ is_sensitive()

static gboolean is_sensitive ( FlutterSemanticsFlags  flags)
static

Definition at line 114 of file fl_accessible_node.cc.

114  {
115  return flags.is_enabled != kFlutterTristateNone;
116 }

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"},
{kFlutterSemanticsActionExpand, "Expand"},
{kFlutterSemanticsActionCollapse, "Collapse"},
{static_cast<FlutterSemanticsAction>(0), nullptr}}

Definition at line 13 of file fl_accessible_node.cc.

Referenced by fl_accessible_node_set_actions_impl().