5#include "flutter/shell/platform/linux/fl_accessible_node.h"
6#include "flutter/shell/platform/linux/fl_engine_private.h"
47 "MoveCursorForwardByCharacter"},
49 "MoveCursorBackwardByCharacter"},
54 "DidGainAccessibilityFocus"},
56 "DidLoseAccessibilityFocus"},
61 "MoveCursorBackwardByWord"},
85#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node) \
86 ((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
87 FL_ACCESSIBLE_NODE(node)))
90 AtkComponentIface* iface);
97 G_ADD_PRIVATE(FlAccessibleNode)
98 G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
100 G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
119 return (actions &
action) != 0;
124 if (index < 0 ||
static_cast<guint
>(index) >=
priv->actions->len) {
127 return static_cast<ActionData*
>(g_ptr_array_index(
priv->actions, index));
131static gboolean
has_child(GPtrArray* children, AtkObject*
object) {
132 for (guint i = 0; i < children->len; i++) {
133 if (g_ptr_array_index(children, i) ==
object) {
148 g_assert(
priv->engine ==
nullptr);
149 priv->engine = FL_ENGINE(g_value_get_object(
value));
151 reinterpret_cast<gpointer*
>(&
priv->engine));
157 G_OBJECT_WARN_INVALID_PROPERTY_ID(
object,
prop_id,
pspec);
165 if (
priv->engine !=
nullptr) {
166 g_object_remove_weak_pointer(
object,
167 reinterpret_cast<gpointer*
>(&(
priv->engine)));
168 priv->engine =
nullptr;
170 if (
priv->parent !=
nullptr) {
171 g_object_remove_weak_pointer(
object,
172 reinterpret_cast<gpointer*
>(&(
priv->parent)));
173 priv->parent =
nullptr;
175 g_clear_pointer(&
priv->name, g_free);
176 g_clear_pointer(&
priv->actions, g_ptr_array_unref);
177 g_clear_pointer(&
priv->children, g_ptr_array_unref);
179 G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(
object);
203 return priv->children->len;
210 if (i < 0 ||
static_cast<guint
>(i) >=
priv->children->len) {
214 return ATK_OBJECT(g_object_ref(g_ptr_array_index(
priv->children, i)));
221 return ATK_ROLE_PUSH_BUTTON;
225 return ATK_ROLE_RADIO_BUTTON;
228 return ATK_ROLE_CHECK_BOX;
231 return ATK_ROLE_TOGGLE_BUTTON;
234 return ATK_ROLE_SLIDER;
238 return ATK_ROLE_PASSWORD_TEXT;
241 return ATK_ROLE_TEXT;
244 return ATK_ROLE_HEADER;
247 return ATK_ROLE_LINK;
250 return ATK_ROLE_IMAGE;
253 return ATK_ROLE_PANEL;
260 AtkStateSet* state_set = atk_state_set_new();
262 for (
int i = 0;
flag_mapping[i].state != ATK_STATE_INVALID; i++) {
281 AtkCoordType coord_type) {
286 if (
priv->parent !=
nullptr) {
287 atk_component_get_extents(ATK_COMPONENT(
priv->parent),
x,
y,
nullptr,
288 nullptr, coord_type);
299 return ATK_LAYER_WIDGET;
306 if (
priv->engine ==
nullptr) {
311 if (data ==
nullptr) {
323 return priv->actions->len;
331 if (data ==
nullptr) {
367 for (
int i = 0;
flag_mapping[i].state != ATK_STATE_INVALID; i++) {
382 FlAccessibleNode*
self,
391 g_ptr_array_remove_range(
priv->actions, 0,
priv->actions->len);
401 const gchar* value) {}
410 FlAccessibleNode*
self,
415 FlAccessibleNode*
self,
427 ATK_OBJECT_CLASS(klass)->get_index_in_parent =
434 FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
436 FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
438 FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
440 FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
442 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
444 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
446 FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
449 g_object_class_install_property(
452 "engine",
"engine",
"Flutter engine", fl_engine_get_type(),
453 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
454 G_PARAM_STATIC_STRINGS)));
455 g_object_class_install_property(
456 G_OBJECT_CLASS(klass),
kPropId,
458 "id",
"id",
"Accessibility node ID", 0, G_MAXINT, 0,
459 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
460 G_PARAM_STATIC_STRINGS)));
464 AtkComponentIface* iface) {
477 priv->actions = g_ptr_array_new();
478 priv->children = g_ptr_array_new_with_free_func(g_object_unref);
482 FlAccessibleNode*
self = FL_ACCESSIBLE_NODE(g_object_new(
483 fl_accessible_node_get_type(),
"engine",
engine,
"id",
id,
nullptr));
490 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
492 priv->parent = parent;
495 reinterpret_cast<gpointer*
>(&(
priv->parent)));
499 GPtrArray* children) {
500 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
504 for (guint i = 0; i <
priv->children->len;) {
505 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(
priv->children, i));
509 g_signal_emit_by_name(
self,
"children-changed::remove", i,
object,
511 g_ptr_array_remove_index(
priv->children, i);
516 for (guint i = 0; i < children->len; i++) {
517 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(children, i));
519 g_ptr_array_add(
priv->children, g_object_ref(
object));
520 g_signal_emit_by_name(
self,
"children-changed::add", i,
object,
nullptr);
526 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
528 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_name(
self,
name);
536 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
538 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_extents(
self,
x,
y,
width,
544 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
546 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_flags(
self,
flags);
551 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
553 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_actions(
self, actions);
557 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
559 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_value(
self,
value);
565 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
567 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_selection(
self,
base,
573 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
575 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_direction(
self,
582 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
584 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->perform_action(
self,
action, data);
@ kFlutterSemanticsActionMoveCursorForwardByCharacter
Move the cursor forward by one character.
@ kFlutterSemanticsActionDidLoseAccessibilityFocus
Indicate that the node has lost accessibility focus.
@ kFlutterSemanticsActionDecrease
Decrease the value represented by the semantics node.
@ kFlutterSemanticsActionScrollDown
@ kFlutterSemanticsActionMoveCursorBackwardByCharacter
Move the cursor backward by one character.
@ kFlutterSemanticsActionMoveCursorForwardByWord
Move the cursor forward by one word.
@ kFlutterSemanticsActionLongPress
@ kFlutterSemanticsActionScrollRight
@ kFlutterSemanticsActionShowOnScreen
A request to fully show the semantics node on screen.
@ kFlutterSemanticsActionDismiss
A request that the node should be dismissed.
@ kFlutterSemanticsActionPaste
Paste the current content of the clipboard.
@ kFlutterSemanticsActionScrollUp
@ kFlutterSemanticsActionCut
Cut the current selection and place it in the clipboard.
@ kFlutterSemanticsActionCustomAction
Indicate that the user has invoked a custom accessibility action.
@ kFlutterSemanticsActionCopy
Copy the current selection to the clipboard.
@ kFlutterSemanticsActionMoveCursorBackwardByWord
Move the cursor backward by one word.
@ kFlutterSemanticsActionIncrease
Increase the value represented by the semantics node.
@ kFlutterSemanticsActionScrollLeft
@ kFlutterSemanticsActionDidGainAccessibilityFocus
Indicate that the node has gained accessibility focus.
@ kFlutterSemanticsActionTap
@ kFlutterSemanticsFlagIsHidden
Whether the semantics node is considered hidden.
@ kFlutterSemanticsFlagIsHeader
Whether a semantic node is a header that divides content into sections.
@ kFlutterSemanticsFlagIsSlider
Whether the semantics node represents a slider.
@ kFlutterSemanticsFlagHasToggledState
The semantics node has the quality of either being "on" or "off".
@ kFlutterSemanticsFlagIsSelected
Whether a semantics node is selected.
@ kFlutterSemanticsFlagIsInMutuallyExclusiveGroup
Whether a semantic node is in a mutually exclusive group.
@ kFlutterSemanticsFlagIsChecked
Whether a semantics node is checked.
@ kFlutterSemanticsFlagIsToggled
@ kFlutterSemanticsFlagIsButton
Whether the semantic node represents a button.
@ kFlutterSemanticsFlagIsObscured
Whether the value of the semantics node is obscured.
@ kFlutterSemanticsFlagIsReadOnly
@ kFlutterSemanticsFlagIsLink
Whether the semantics node represents a link.
@ kFlutterSemanticsFlagIsFocused
Whether the semantic node currently holds the user's focus.
@ kFlutterSemanticsFlagIsEnabled
Whether a semantic node that hasEnabledState is currently enabled.
@ kFlutterSemanticsFlagIsImage
Whether the semantics node represents an image.
@ kFlutterSemanticsFlagIsFocusable
Whether the semantic node can hold the user's focus.
@ kFlutterSemanticsFlagIsTextField
Whether the semantic node represents a text field.
@ kFlutterSemanticsFlagHasCheckedState
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)
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
static gboolean fl_accessible_node_do_action(AtkAction *action, gint i)
static void fl_accessible_node_action_interface_init(AtkActionIface *iface)
static void fl_accessible_node_set_text_direction_impl(FlAccessibleNode *self, FlutterTextDirection direction)
FlutterSemanticsFlag flag
void fl_accessible_node_set_text_direction(FlAccessibleNode *self, FlutterTextDirection direction)
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static AtkStateSet * fl_accessible_node_ref_state_set(AtkObject *accessible)
static AtkRole fl_accessible_node_get_role(AtkObject *accessible)
static void fl_accessible_node_set_value_impl(FlAccessibleNode *self, const gchar *value)
void fl_accessible_node_set_text_selection(FlAccessibleNode *self, gint base, gint extent)
static AtkObject * fl_accessible_node_get_parent(AtkObject *accessible)
static void fl_accessible_node_class_init(FlAccessibleNodeClass *klass)
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 void fl_accessible_node_set_actions_impl(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_component_interface_init(AtkComponentIface *iface)
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_dispose(GObject *object)
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlag flags)
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
static AtkLayer fl_accessible_node_get_layer(AtkComponent *component)
void fl_accessible_node_set_value(FlAccessibleNode *self, const gchar *value)
static void fl_accessible_node_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)
static gint fl_accessible_node_get_n_actions(AtkAction *action)
FlutterSemanticsFlag flags
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlag flags)
static const gchar * fl_accessible_node_get_name(AtkObject *accessible)
static gboolean has_action(FlutterSemanticsAction actions, FlutterSemanticsAction action)
static gint fl_accessible_node_get_index_in_parent(AtkObject *accessible)
static void fl_accessible_node_init(FlAccessibleNode *self)
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
static struct @68 flag_mapping[]
static void fl_accessible_node_perform_action_impl(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static ActionData action_mapping[]
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 gboolean has_flag(FlutterSemanticsFlag flags, FlutterSemanticsFlag flag)
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, int32_t id)
static void fl_accessible_node_set_name_impl(FlAccessibleNode *self, const gchar *name)
static AtkObject * fl_accessible_node_ref_child(AtkObject *accessible, gint i)
void fl_engine_dispatch_semantics_action(FlEngine *self, uint64_t id, FlutterSemanticsAction action, GBytes *data)
FlPixelBufferTexturePrivate * priv
guint const GValue GParamSpec * pspec
g_object_add_weak_pointer(G_OBJECT(self), reinterpret_cast< gpointer * >(&self->engine))
FlutterSemanticsAction action
FlutterSemanticsFlag flags
AtkObject parent_instance