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)
 
static void fl_accessible_node_text_interface_init (AtkTextIface *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) G_IMPLEMENT_INTERFACE(ATK_TYPE_TEXT, fl_accessible_node_text_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 gint fl_accessible_node_get_text_length (FlAccessibleNodePrivate *priv)
 
static gint fl_accessible_node_get_character_count (AtkText *text)
 
static gchar * fl_accessible_node_get_text (AtkText *text, gint start_offset, gint end_offset)
 
static gunichar fl_accessible_node_get_character_at_offset (AtkText *text, gint offset)
 
static gint fl_accessible_node_get_caret_offset (AtkText *text)
 
static gint fl_accessible_node_get_n_selections (AtkText *text)
 
static gchar * fl_accessible_node_get_selection (AtkText *text, gint selection_num, gint *start_offset, gint *end_offset)
 
static gchar * fl_accessible_node_get_string_at_offset (AtkText *text, gint offset, AtkTextGranularity granularity, gint *start_offset, gint *end_offset)
 
static gchar * fl_accessible_node_get_text_at_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset)
 
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 547 of file fl_accessible_node.cc.

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

494  {
495  G_OBJECT_CLASS(klass)->set_property = fl_accessible_node_set_property;
496  G_OBJECT_CLASS(klass)->dispose = fl_accessible_node_dispose;
497  ATK_OBJECT_CLASS(klass)->get_name = fl_accessible_node_get_name;
498  ATK_OBJECT_CLASS(klass)->get_parent = fl_accessible_node_get_parent;
499  ATK_OBJECT_CLASS(klass)->get_index_in_parent =
501  ATK_OBJECT_CLASS(klass)->get_n_children = fl_accessible_node_get_n_children;
502  ATK_OBJECT_CLASS(klass)->ref_child = fl_accessible_node_ref_child;
503  ATK_OBJECT_CLASS(klass)->get_role = fl_accessible_node_get_role;
504  ATK_OBJECT_CLASS(klass)->ref_state_set = fl_accessible_node_ref_state_set;
505  FL_ACCESSIBLE_NODE_CLASS(klass)->set_name = fl_accessible_node_set_name_impl;
506  FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
508  FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
510  FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
512  FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
514  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
516  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
518  FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
520 
521  g_object_class_install_property(
522  G_OBJECT_CLASS(klass), PROP_ENGINE,
523  g_param_spec_object(
524  "engine", "engine", "Flutter engine", fl_engine_get_type(),
525  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
526  G_PARAM_STATIC_STRINGS)));
527  g_object_class_install_property(
528  G_OBJECT_CLASS(klass), PROP_VIEW_ID,
529  g_param_spec_int64(
530  "view-id", "view-id", "View ID that this node belongs to", 0,
531  G_MAXINT64, 0,
532  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
533  g_object_class_install_property(
534  G_OBJECT_CLASS(klass), PROP_ID,
535  g_param_spec_int(
536  "node-id", "node-id", "Accessibility node ID", 0, G_MAXINT, 0,
537  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
538  G_PARAM_STATIC_STRINGS)));
539 }
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 541 of file fl_accessible_node.cc.

542  {
543  iface->get_extents = fl_accessible_node_get_extents;
544  iface->get_layer = fl_accessible_node_get_layer;
545 }
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  g_weak_ref_clear(&priv->engine);
176  g_weak_ref_clear(&priv->parent);
177  g_clear_pointer(&priv->name, g_free);
178  g_clear_pointer(&priv->actions, g_ptr_array_unref);
179  g_clear_pointer(&priv->children, g_ptr_array_unref);
180 
181  G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(object);
182 }
FlAccessibilityHandlerPrivate * priv
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)

References FlAccessibilityHandlerPrivate::engine, 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 330 of file fl_accessible_node.cc.

330  {
332 
333  g_autoptr(FlEngine) engine = FL_ENGINE(g_weak_ref_get(&priv->engine));
334  if (engine == nullptr) {
335  return FALSE;
336  }
337 
338  ActionData* data = get_action(priv, i);
339  if (data == nullptr) {
340  return FALSE;
341  }
342 
343  fl_accessible_node_perform_action(FL_ACCESSIBLE_NODE(action), data->action,
344  nullptr);
345  return TRUE;
346 }
g_autoptr(FlEngine) engine
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, FlAccessibilityHandlerPrivate::engine, FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_accessible_node_perform_action(), g_autoptr(), get_action(), i, priv, and TRUE.

Referenced by fl_accessible_node_action_interface_init().

◆ fl_accessible_node_get_caret_offset()

static gint fl_accessible_node_get_caret_offset ( AtkText *  text)
static

Definition at line 600 of file fl_accessible_node.cc.

600  {
601  (void)text;
602  return -1;
603 }

Referenced by fl_accessible_node_text_interface_init().

◆ fl_accessible_node_get_character_at_offset()

static gunichar fl_accessible_node_get_character_at_offset ( AtkText *  text,
gint  offset 
)
static

Definition at line 587 of file fl_accessible_node.cc.

588  {
590  if (priv->name == nullptr || offset < 0 ||
592  return 0;
593  }
594 
595  return g_utf8_get_char(g_utf8_offset_to_pointer(priv->name, offset));
596 }
static gint fl_accessible_node_get_text_length(FlAccessibleNodePrivate *priv)

References FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_accessible_node_get_text_length(), and priv.

Referenced by fl_accessible_node_text_interface_init().

◆ fl_accessible_node_get_character_count()

static gint fl_accessible_node_get_character_count ( AtkText *  text)
static

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

307  {
309 
310  *x = 0;
311  *y = 0;
312  g_autoptr(AtkObject) parent = ATK_OBJECT(g_weak_ref_get(&priv->parent));
313  if (parent != nullptr) {
314  atk_component_get_extents(ATK_COMPONENT(parent), x, y, nullptr, nullptr,
315  coord_type);
316  }
317 
318  *x += priv->x;
319  *y += priv->y;
320  *width = priv->width;
321  *height = priv->height;
322 }
FlFramebuffer double double int int height
FlFramebuffer double x
FlFramebuffer double double int width
FlFramebuffer double double y

References FL_ACCESSIBLE_NODE_GET_PRIVATE, g_autoptr(), height, priv, width, x, and y.

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

198  {
200  return priv->index;
201 }
FlViewAccessible * accessible

References accessible, 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 325 of file fl_accessible_node.cc.

325  {
326  return ATK_LAYER_WIDGET;
327 }

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

349  {
351  return priv->actions->len;
352 }

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

204  {
206  return priv->children->len;
207 }

References accessible, FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_n_selections()

static gint fl_accessible_node_get_n_selections ( AtkText *  text)
static

Definition at line 607 of file fl_accessible_node.cc.

607  {
608  (void)text;
609  return 0;
610 }

Referenced by fl_accessible_node_text_interface_init().

◆ fl_accessible_node_get_name() [1/2]

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

Definition at line 355 of file fl_accessible_node.cc.

355  {
357 
358  ActionData* data = get_action(priv, i);
359  if (data == nullptr) {
360  return nullptr;
361  }
362 
363  return data->name;
364 }
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

◆ fl_accessible_node_get_parent()

static AtkObject* fl_accessible_node_get_parent ( AtkObject *  accessible)
static

Definition at line 191 of file fl_accessible_node.cc.

191  {
193  g_autoptr(AtkObject) parent = ATK_OBJECT(g_weak_ref_get(&priv->parent));
194  return parent;
195 }

References accessible, FL_ACCESSIBLE_NODE_GET_PRIVATE, g_autoptr(), 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 221 of file fl_accessible_node.cc.

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

References accessible, FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_selection()

static gchar* fl_accessible_node_get_selection ( AtkText *  text,
gint  selection_num,
gint *  start_offset,
gint *  end_offset 
)
static

Definition at line 613 of file fl_accessible_node.cc.

616  {
617  (void)text;
618  (void)selection_num;
619  if (start_offset != nullptr) {
620  *start_offset = 0;
621  }
622  if (end_offset != nullptr) {
623  *end_offset = 0;
624  }
625  return nullptr;
626 }

Referenced by fl_accessible_node_text_interface_init().

◆ fl_accessible_node_get_string_at_offset()

static gchar* fl_accessible_node_get_string_at_offset ( AtkText *  text,
gint  offset,
AtkTextGranularity  granularity,
gint *  start_offset,
gint *  end_offset 
)
static

Definition at line 629 of file fl_accessible_node.cc.

634  {
637  if (offset < 0 || offset >= count) {
638  if (start_offset != nullptr) {
639  *start_offset = 0;
640  }
641  if (end_offset != nullptr) {
642  *end_offset = 0;
643  }
644  return nullptr;
645  }
646 
647  switch (granularity) {
648  case ATK_TEXT_GRANULARITY_CHAR:
649  if (start_offset != nullptr) {
650  *start_offset = offset;
651  }
652  if (end_offset != nullptr) {
653  *end_offset = offset + 1;
654  }
655  return g_utf8_substring(priv->name, offset, offset + 1);
656  case ATK_TEXT_GRANULARITY_WORD:
657  case ATK_TEXT_GRANULARITY_SENTENCE:
658  case ATK_TEXT_GRANULARITY_LINE:
659  case ATK_TEXT_GRANULARITY_PARAGRAPH:
660  if (start_offset != nullptr) {
661  *start_offset = 0;
662  }
663  if (end_offset != nullptr) {
664  *end_offset = count;
665  }
666  return g_strdup(priv->name != nullptr ? priv->name : "");
667  default:
668  return nullptr;
669  }
670 }
return g_utf8_substring(value, start, end)

References FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_accessible_node_get_text_length(), g_utf8_substring(), and priv.

Referenced by fl_accessible_node_get_text_at_offset(), and fl_accessible_node_text_interface_init().

◆ fl_accessible_node_get_text()

static gchar* fl_accessible_node_get_text ( AtkText *  text,
gint  start_offset,
gint  end_offset 
)
static

Definition at line 568 of file fl_accessible_node.cc.

570  {
572  if (priv->name == nullptr) {
573  return g_strdup("");
574  }
575 
577  start_offset = CLAMP(start_offset, 0, count);
578  if (end_offset < 0) {
579  end_offset = count;
580  }
581  end_offset = CLAMP(end_offset, start_offset, count);
582 
583  return g_utf8_substring(priv->name, start_offset, end_offset);
584 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_accessible_node_get_text_length(), g_utf8_substring(), and priv.

Referenced by fl_accessible_node_text_interface_init().

◆ fl_accessible_node_get_text_at_offset()

static gchar* fl_accessible_node_get_text_at_offset ( AtkText *  text,
gint  offset,
AtkTextBoundary  boundary_type,
gint *  start_offset,
gint *  end_offset 
)
static

Definition at line 675 of file fl_accessible_node.cc.

680  {
681  switch (boundary_type) {
682  case ATK_TEXT_BOUNDARY_CHAR:
684  text, offset, ATK_TEXT_GRANULARITY_CHAR, start_offset, end_offset);
685  case ATK_TEXT_BOUNDARY_WORD_START:
686  case ATK_TEXT_BOUNDARY_WORD_END:
688  text, offset, ATK_TEXT_GRANULARITY_WORD, start_offset, end_offset);
689  case ATK_TEXT_BOUNDARY_SENTENCE_START:
690  case ATK_TEXT_BOUNDARY_SENTENCE_END:
692  text, offset, ATK_TEXT_GRANULARITY_SENTENCE, start_offset,
693  end_offset);
694  case ATK_TEXT_BOUNDARY_LINE_START:
695  case ATK_TEXT_BOUNDARY_LINE_END:
697  text, offset, ATK_TEXT_GRANULARITY_LINE, start_offset, end_offset);
698  default:
699  return nullptr;
700  }
701 }
static gchar * fl_accessible_node_get_string_at_offset(AtkText *text, gint offset, AtkTextGranularity granularity, gint *start_offset, gint *end_offset)

References fl_accessible_node_get_string_at_offset().

Referenced by fl_accessible_node_text_interface_init().

◆ fl_accessible_node_get_text_length()

static gint fl_accessible_node_get_text_length ( FlAccessibleNodePrivate priv)
static

Definition at line 555 of file fl_accessible_node.cc.

555  {
556  return priv->name != nullptr
557  ? static_cast<gint>(g_utf8_strlen(priv->name, -1))
558  : 0;
559 }

References priv.

Referenced by fl_accessible_node_get_character_at_offset(), fl_accessible_node_get_character_count(), fl_accessible_node_get_string_at_offset(), and fl_accessible_node_get_text().

◆ fl_accessible_node_init()

static void fl_accessible_node_init ( FlAccessibleNode *  self)
static

Definition at line 714 of file fl_accessible_node.cc.

714  {
716  g_weak_ref_init(&priv->engine, nullptr);
717  g_weak_ref_init(&priv->parent, nullptr);
718  priv->actions = g_ptr_array_new();
719  priv->children = g_ptr_array_new_with_free_func(g_object_unref);
720 }

References FlAccessibilityHandlerPrivate::engine, 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 722 of file fl_accessible_node.cc.

724  {
725  FlAccessibleNode* self = FL_ACCESSIBLE_NODE(
726  g_object_new(fl_accessible_node_get_type(), "engine", engine, "view-id",
727  view_id, "node-id", node_id, nullptr));
728  return self;
729 }
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 821 of file fl_accessible_node.cc.

823  {
824  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
825 
826  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->perform_action(self, action, data);
827 }

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

484  {
486  g_autoptr(FlEngine) engine = FL_ENGINE(g_weak_ref_get(&priv->engine));
487  if (engine == nullptr) {
488  return;
489  }
490  fl_engine_dispatch_semantics_action(engine, priv->view_id, priv->node_id,
491  action, data);
492 }
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:1491

References FlAccessibilityHandlerPrivate::engine, FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_engine_dispatch_semantics_action(), g_autoptr(), 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 210 of file fl_accessible_node.cc.

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

References accessible, 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 259 of file fl_accessible_node.cc.

259  {
261 
262  AtkStateSet* state_set = atk_state_set_new();
263 
264  if (!priv->flags.is_obscured) {
265  atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
266  }
267  if (!priv->flags.is_hidden) {
268  atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
269  }
270  if (is_checkable(priv->flags)) {
271  atk_state_set_add_state(state_set, ATK_STATE_CHECKABLE);
272  }
273  if (is_checked(priv->flags)) {
274  atk_state_set_add_state(state_set, ATK_STATE_CHECKED);
275  }
276  if (is_focusable(priv->flags)) {
277  atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
278  }
279  if (is_focused(priv->flags)) {
280  atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);
281  }
282  if (is_selected(priv->flags)) {
283  atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
284  }
285  if (is_enabled(priv->flags)) {
286  atk_state_set_add_state(state_set, ATK_STATE_ENABLED);
287  }
288  if (is_sensitive(priv->flags)) {
289  atk_state_set_add_state(state_set, ATK_STATE_SENSITIVE);
290  }
291  if (priv->flags.is_read_only) {
292  atk_state_set_add_state(state_set, ATK_STATE_READ_ONLY);
293  }
294  if (priv->flags.is_text_field) {
295  atk_state_set_add_state(state_set, ATK_STATE_EDITABLE);
296  }
297 
298  return state_set;
299 }
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 accessible, 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 791 of file fl_accessible_node.cc.

792  {
793  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
794 
795  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_actions(self, actions);
796 }

Referenced by fl_view_accessible_handle_update_semantics(), 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 448 of file fl_accessible_node.cc.

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

741  {
742  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
744 
745  // Remove nodes that are no longer required.
746  for (guint i = 0; i < priv->children->len;) {
747  AtkObject* object = ATK_OBJECT(g_ptr_array_index(priv->children, i));
748  if (has_child(children, object)) {
749  i++;
750  } else {
751  g_signal_emit_by_name(self, "children-changed::remove", i, object,
752  nullptr);
753  g_ptr_array_remove_index(priv->children, i);
754  }
755  }
756 
757  // Add new nodes.
758  for (guint i = 0; i < children->len; i++) {
759  AtkObject* object = ATK_OBJECT(g_ptr_array_index(children, i));
760  if (!has_child(priv->children, object)) {
761  g_ptr_array_add(priv->children, g_object_ref(object));
762  g_signal_emit_by_name(self, "children-changed::add", i, object, nullptr);
763  }
764  }
765 }
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 773 of file fl_accessible_node.cc.

777  {
778  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
779 
780  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_extents(self, x, y, width,
781  height);
782 }

References height, width, x, and y.

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

379  {
381  priv->x = x;
382  priv->y = y;
383  priv->width = width;
384  priv->height = height;
385 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, height, priv, width, x, and y.

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

785  {
786  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
787 
788  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_flags(self, flags);
789 }

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

395  {
397 
398  FlutterSemanticsFlags old_flags = priv->flags;
399  priv->flags = *flags;
400 
401  if (flag_changed(old_flags.is_obscured, flags->is_obscured)) {
402  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SHOWING,
403  !flags->is_obscured);
404  }
405  if (flag_changed(old_flags.is_hidden, flags->is_hidden)) {
406  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_VISIBLE,
407  !flags->is_hidden);
408  }
409  if (flag_changed(is_checkable(old_flags), is_checkable(priv->flags))) {
410  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKABLE,
411  is_checkable(priv->flags));
412  }
413  if (flag_changed(is_checked(old_flags), is_checked(priv->flags))) {
414  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKED,
415  is_checked(priv->flags));
416  }
417  if (flag_changed(is_focusable(old_flags), is_focusable(priv->flags))) {
418  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSABLE,
419  is_focusable(priv->flags));
420  }
421  if (flag_changed(is_focused(old_flags), is_focused(priv->flags))) {
422  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSED,
423  is_focused(priv->flags));
424  }
425  if (flag_changed(is_selected(old_flags), is_selected(priv->flags))) {
426  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SELECTED,
427  is_selected(priv->flags));
428  }
429  if (flag_changed(is_sensitive(old_flags), is_sensitive(priv->flags))) {
430  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SENSITIVE,
431  is_sensitive(priv->flags));
432  }
433  if (flag_changed(is_enabled(old_flags), is_enabled(priv->flags))) {
434  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_ENABLED,
435  is_enabled(priv->flags));
436  }
437  if (flag_changed(old_flags.is_read_only, flags->is_read_only)) {
438  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_READ_ONLY,
439  flags->is_read_only);
440  }
441  if (flag_changed(old_flags.is_text_field, flags->is_text_field)) {
442  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_EDITABLE,
443  flags->is_text_field);
444  }
445 }
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 767 of file fl_accessible_node.cc.

767  {
768  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
769 
770  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_name(self, name);
771 }

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

368  {
370  g_free(priv->name);
371  priv->name = g_strdup(name);
372 }

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

733  {
734  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
736  g_weak_ref_set(&priv->parent, parent);
737  priv->index = index;
738 }

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

154  {
156  switch (prop_id) {
157  case PROP_ENGINE:
158  g_weak_ref_set(&priv->engine, g_value_get_object(value));
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 FlAccessibilityHandlerPrivate::engine, 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 813 of file fl_accessible_node.cc.

814  {
815  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
816 
817  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_direction(self,
818  direction);
819 }

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

478  {}

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

806  {
807  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
808 
809  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_selection(self, base,
810  extent);
811 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST_F().

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

473  {}

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

798  {
799  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
800 
801  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_value(self, value);
802 }

References value.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST_F().

◆ fl_accessible_node_set_value_impl()

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

Definition at line 467 of file fl_accessible_node.cc.

468  {}

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_text_interface_init()

static void fl_accessible_node_text_interface_init ( AtkTextIface *  iface)
static

Definition at line 703 of file fl_accessible_node.cc.

703  {
704  iface->get_character_count = fl_accessible_node_get_character_count;
705  iface->get_text = fl_accessible_node_get_text;
706  iface->get_character_at_offset = fl_accessible_node_get_character_at_offset;
707  iface->get_caret_offset = fl_accessible_node_get_caret_offset;
708  iface->get_n_selections = fl_accessible_node_get_n_selections;
709  iface->get_selection = fl_accessible_node_get_selection;
710  iface->get_text_at_offset = fl_accessible_node_get_text_at_offset;
711  iface->get_string_at_offset = fl_accessible_node_get_string_at_offset;
712 }
static gchar * fl_accessible_node_get_text_at_offset(AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset)
static gchar * fl_accessible_node_get_selection(AtkText *text, gint selection_num, gint *start_offset, gint *end_offset)
static gint fl_accessible_node_get_character_count(AtkText *text)
static gint fl_accessible_node_get_caret_offset(AtkText *text)
static gint fl_accessible_node_get_n_selections(AtkText *text)
static gunichar fl_accessible_node_get_character_at_offset(AtkText *text, gint offset)
static gchar * fl_accessible_node_get_text(AtkText *text, gint start_offset, gint end_offset)

References fl_accessible_node_get_caret_offset(), fl_accessible_node_get_character_at_offset(), fl_accessible_node_get_character_count(), fl_accessible_node_get_n_selections(), fl_accessible_node_get_selection(), fl_accessible_node_get_string_at_offset(), fl_accessible_node_get_text(), and fl_accessible_node_get_text_at_offset().

◆ flag_changed()

static bool flag_changed ( bool  old_flag,
bool  new_flag 
)
static

Definition at line 389 of file fl_accessible_node.cc.

389  {
390  return !old_flag != !new_flag;
391 }

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) G_IMPLEMENT_INTERFACE(ATK_TYPE_TEXT, fl_accessible_node_text_interface_init  
)

Definition at line 77 of file fl_accessible_node.cc.

90  {
91  return flags.is_checked != kFlutterCheckStateNone ||
92  flags.is_toggled != kFlutterTristateNone;
93 }

◆ get_action()

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

Definition at line 133 of file fl_accessible_node.cc.

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

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

128  {
129  return (actions & action) != 0;
130 }

Referenced by fl_accessible_node_set_actions_impl().

◆ has_child()

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

Definition at line 141 of file fl_accessible_node.cc.

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

References i, and TRUE.

Referenced by fl_accessible_node_set_children().

◆ is_checked()

static gboolean is_checked ( FlutterSemanticsFlags  flags)
static

Definition at line 96 of file fl_accessible_node.cc.

96  {
97  return flags.is_checked == kFlutterCheckStateTrue ||
98  flags.is_toggled == kFlutterTristateTrue;
99 }

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

122  {
123  return flags.is_enabled == kFlutterTristateTrue;
124 }

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

102  {
103  return flags.is_focused != kFlutterTristateNone;
104 }

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

107  {
108  return flags.is_focused == kFlutterTristateTrue;
109 }

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

112  {
113  return flags.is_selected == kFlutterTristateTrue;
114 }

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

117  {
118  return flags.is_enabled != kFlutterTristateNone;
119 }

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