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"},
86#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node) \
87 ((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
88 FL_ACCESSIBLE_NODE(node)))
91 AtkComponentIface* iface);
98 G_ADD_PRIVATE(FlAccessibleNode)
99 G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
101 G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
120 return (actions &
action) != 0;
125 if (index < 0 ||
static_cast<guint
>(index) >=
priv->actions->len) {
128 return static_cast<ActionData*
>(g_ptr_array_index(
priv->actions, index));
132static gboolean
has_child(GPtrArray* children, AtkObject*
object) {
133 for (guint
i = 0;
i < children->len;
i++) {
134 if (g_ptr_array_index(children,
i) ==
object) {
149 g_assert(
priv->engine ==
nullptr);
150 priv->engine = FL_ENGINE(g_value_get_object(
value));
151 g_object_add_weak_pointer(
object,
152 reinterpret_cast<gpointer*
>(&
priv->engine));
158 G_OBJECT_WARN_INVALID_PROPERTY_ID(
object,
prop_id,
pspec);
166 if (
priv->engine !=
nullptr) {
167 g_object_remove_weak_pointer(
object,
168 reinterpret_cast<gpointer*
>(&(
priv->engine)));
169 priv->engine =
nullptr;
171 if (
priv->parent !=
nullptr) {
172 g_object_remove_weak_pointer(
object,
173 reinterpret_cast<gpointer*
>(&(
priv->parent)));
174 priv->parent =
nullptr;
176 g_clear_pointer(&
priv->name, g_free);
177 g_clear_pointer(&
priv->actions, g_ptr_array_unref);
178 g_clear_pointer(&
priv->children, g_ptr_array_unref);
180 G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(
object);
204 return priv->children->len;
211 if (
i < 0 ||
static_cast<guint
>(
i) >=
priv->children->len) {
215 return ATK_OBJECT(g_object_ref(g_ptr_array_index(
priv->children,
i)));
222 return ATK_ROLE_PUSH_BUTTON;
226 return ATK_ROLE_RADIO_BUTTON;
229 return ATK_ROLE_CHECK_BOX;
232 return ATK_ROLE_TOGGLE_BUTTON;
235 return ATK_ROLE_SLIDER;
239 return ATK_ROLE_PASSWORD_TEXT;
242 return ATK_ROLE_TEXT;
245 return ATK_ROLE_HEADER;
248 return ATK_ROLE_LINK;
251 return ATK_ROLE_IMAGE;
254 return ATK_ROLE_PANEL;
261 AtkStateSet* state_set = atk_state_set_new();
282 AtkCoordType coord_type) {
287 if (
priv->parent !=
nullptr) {
288 atk_component_get_extents(ATK_COMPONENT(
priv->parent),
x,
y,
nullptr,
289 nullptr, coord_type);
300 return ATK_LAYER_WIDGET;
307 if (
priv->engine ==
nullptr) {
312 if (
data ==
nullptr) {
324 return priv->actions->len;
332 if (
data ==
nullptr) {
383 FlAccessibleNode*
self,
392 g_ptr_array_remove_range(
priv->actions, 0,
priv->actions->len);
402 const gchar*
value) {}
411 FlAccessibleNode*
self,
416 FlAccessibleNode*
self,
428 ATK_OBJECT_CLASS(klass)->get_index_in_parent =
435 FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
437 FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
439 FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
441 FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
443 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
445 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
447 FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
450 g_object_class_install_property(
453 "engine",
"engine",
"Flutter engine", fl_engine_get_type(),
454 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
455 G_PARAM_STATIC_STRINGS)));
456 g_object_class_install_property(
457 G_OBJECT_CLASS(klass),
kPropId,
459 "id",
"id",
"Accessibility node ID", 0, G_MAXINT, 0,
460 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
461 G_PARAM_STATIC_STRINGS)));
465 AtkComponentIface* iface) {
478 priv->actions = g_ptr_array_new();
479 priv->children = g_ptr_array_new_with_free_func(g_object_unref);
483 FlAccessibleNode*
self = FL_ACCESSIBLE_NODE(g_object_new(
484 fl_accessible_node_get_type(),
"engine",
engine,
"id",
id,
nullptr));
491 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
493 priv->parent = parent;
495 g_object_add_weak_pointer(G_OBJECT(
self),
496 reinterpret_cast<gpointer*
>(&(
priv->parent)));
500 GPtrArray* children) {
501 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
505 for (guint
i = 0;
i <
priv->children->len;) {
506 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(
priv->children,
i));
510 g_signal_emit_by_name(
self,
"children-changed::remove",
i,
object,
512 g_ptr_array_remove_index(
priv->children,
i);
517 for (guint
i = 0;
i < children->len;
i++) {
518 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(children,
i));
520 g_ptr_array_add(
priv->children, g_object_ref(
object));
521 g_signal_emit_by_name(
self,
"children-changed::add",
i,
object,
nullptr);
527 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
529 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_name(
self,
name);
537 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
539 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_extents(
self,
x,
y,
width,
545 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
547 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_flags(
self,
flags);
552 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
554 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_actions(
self, actions);
558 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
560 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_value(
self,
value);
566 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
568 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_selection(
self,
base,
574 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
576 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_direction(
self,
583 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
@ 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.
@ kFlutterSemanticsActionFocus
Request that the respective focusable widget gain input focus.
@ 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
DEF_SWITCHES_START aot vmservice shared library name
FlutterSemanticsAction action
FlutterSemanticsFlag flags
AtkObject parent_instance
std::shared_ptr< const fml::Mapping > data