Flutter Engine
fl_view_accessible.cc File Reference
#include "flutter/shell/platform/linux/fl_view_accessible.h"
#include "flutter/shell/platform/linux/fl_accessible_node.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"

Go to the source code of this file.

Classes

struct  _FlViewAccessible
 

Functions

 G_DEFINE_TYPE (FlViewAccessible, fl_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE) static FlAccessibleNode *get_node(FlViewAccessible *self
 
 if (node !=nullptr)
 
 if (id==0)
 
 g_hash_table_insert (self->semantics_nodes_by_id, GINT_TO_POINTER(id), reinterpret_cast< gpointer >(node))
 
static gint fl_view_accessible_get_n_children (AtkObject *accessible)
 
static AtkObject * fl_view_accessible_ref_child (AtkObject *accessible, gint i)
 
static AtkRole fl_view_accessible_get_role (AtkObject *accessible)
 
static void fl_view_accessible_class_init (FlViewAccessibleClass *klass)
 
static void fl_view_accessible_init (FlViewAccessible *self)
 
void fl_view_accessible_handle_update_semantics_node (FlViewAccessible *self, const FlutterSemanticsNode *node)
 

Variables

int32_t id
 
FlView * view = FL_VIEW(gtk_accessible_get_widget(GTK_ACCESSIBLE(self)))
 
 node = fl_accessible_node_new(fl_view_get_engine(view), id)
 

Function Documentation

◆ fl_view_accessible_class_init()

static void fl_view_accessible_class_init ( FlViewAccessibleClass *  klass)
static

Definition at line 62 of file fl_view_accessible.cc.

References fl_view_accessible_get_n_children(), fl_view_accessible_get_role(), and fl_view_accessible_ref_child().

62  {
63  ATK_OBJECT_CLASS(klass)->get_n_children = fl_view_accessible_get_n_children;
64  ATK_OBJECT_CLASS(klass)->ref_child = fl_view_accessible_ref_child;
65  ATK_OBJECT_CLASS(klass)->get_role = fl_view_accessible_get_role;
66 }
static AtkRole fl_view_accessible_get_role(AtkObject *accessible)
static gint fl_view_accessible_get_n_children(AtkObject *accessible)
static AtkObject * fl_view_accessible_ref_child(AtkObject *accessible, gint i)

◆ fl_view_accessible_get_n_children()

static gint fl_view_accessible_get_n_children ( AtkObject *  accessible)
static

Definition at line 41 of file fl_view_accessible.cc.

Referenced by fl_view_accessible_class_init().

41  {
42  return 1;
43 }

◆ fl_view_accessible_get_role()

static AtkRole fl_view_accessible_get_role ( AtkObject *  accessible)
static

Definition at line 58 of file fl_view_accessible.cc.

Referenced by fl_view_accessible_class_init().

58  {
59  return ATK_ROLE_FRAME;
60 }

◆ fl_view_accessible_handle_update_semantics_node()

void fl_view_accessible_handle_update_semantics_node ( FlViewAccessible *  self,
const FlutterSemanticsNode node 
)

Definition at line 73 of file fl_view_accessible.cc.

References FlutterSemanticsNode::actions, FlutterRect::bottom, FlutterSemanticsNode::child_count, FlutterSemanticsNode::children_in_traversal_order, fl_accessible_node_set_actions(), fl_accessible_node_set_children(), fl_accessible_node_set_extents(), fl_accessible_node_set_flags(), fl_accessible_node_set_name(), fl_accessible_node_set_parent(), FlutterSemanticsNode::flags, FlutterSemanticsNode::id, kFlutterSemanticsCustomActionIdBatchEnd, FlutterSemanticsNode::label, FlutterRect::left, FlutterSemanticsNode::rect, FlutterRect::right, FlutterRect::top, FlutterSemanticsNode::transform, FlutterTransformation::transX, and FlutterTransformation::transY.

Referenced by fl_accessibility_plugin_handle_update_semantics_node().

75  {
77  return;
78  }
79 
80  FlAccessibleNode* atk_node = get_node(self, node->id);
81 
82  fl_accessible_node_set_flags(atk_node, node->flags);
83  fl_accessible_node_set_actions(atk_node, node->actions);
84  fl_accessible_node_set_name(atk_node, node->label);
86  atk_node, node->rect.left + node->transform.transX,
87  node->rect.top + node->transform.transY,
88  node->rect.right - node->rect.left, node->rect.bottom - node->rect.top);
89 
90  g_autoptr(GPtrArray) children = g_ptr_array_new();
91  for (size_t i = 0; i < node->child_count; i++) {
92  FlAccessibleNode* child =
93  get_node(self, node->children_in_traversal_order[i]);
94  fl_accessible_node_set_parent(child, ATK_OBJECT(atk_node));
95  g_ptr_array_add(children, child);
96  }
97  fl_accessible_node_set_children(atk_node, children);
98 }
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlag flags)
FlutterRect rect
The bounding box for this node in its coordinate system.
Definition: embedder.h:839
double right
Definition: embedder.h:336
double top
Definition: embedder.h:335
double left
Definition: embedder.h:334
FlutterSemanticsFlag flags
The set of semantics flags associated with this node.
Definition: embedder.h:800
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
double transX
horizontal translation
Definition: embedder.h:236
const int32_t * children_in_traversal_order
Array of child node IDs in traversal order. Has length child_count.
Definition: embedder.h:846
int32_t id
The unique identifier for this node.
Definition: embedder.h:798
FlutterTransformation transform
Definition: embedder.h:842
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent)
double bottom
Definition: embedder.h:337
size_t child_count
The number of children this node has.
Definition: embedder.h:844
const char * label
A textual description of the node.
Definition: embedder.h:824
double transY
vertical translation
Definition: embedder.h:242
FlutterSemanticsAction actions
The set of semantics actions applicable to this node.
Definition: embedder.h:802
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
const int32_t kFlutterSemanticsCustomActionIdBatchEnd
Definition: embedder.cc:70

◆ fl_view_accessible_init()

static void fl_view_accessible_init ( FlViewAccessible *  self)
static

Definition at line 68 of file fl_view_accessible.cc.

68  {
69  self->semantics_nodes_by_id = g_hash_table_new_full(
70  g_direct_hash, g_direct_equal, nullptr, g_object_unref);
71 }

◆ fl_view_accessible_ref_child()

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

Definition at line 46 of file fl_view_accessible.cc.

Referenced by fl_view_accessible_class_init().

46  {
47  FlViewAccessible* self = FL_VIEW_ACCESSIBLE(accessible);
48 
49  if (i != 0) {
50  return nullptr;
51  }
52 
53  FlAccessibleNode* node = get_node(self, 0);
54  return ATK_OBJECT(g_object_ref(node));
55 }

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( FlViewAccessible  ,
fl_view_accessible  ,
GTK_TYPE_CONTAINER_ACCESSIBLE   
)

◆ g_hash_table_insert()

g_hash_table_insert ( self->  semantics_nodes_by_id,
GINT_TO_POINTER(id ,
reinterpret_cast< gpointer >  node 
)

◆ if() [1/2]

if ( node = nullptr)

Definition at line 25 of file fl_view_accessible.cc.

References node.

25  {
26  return node;
27  }

◆ if() [2/2]

if ( id  = = 0)

Definition at line 31 of file fl_view_accessible.cc.

References fl_accessible_node_set_parent(), g_hash_table_insert(), and node.

31  {
32  fl_accessible_node_set_parent(node, ATK_OBJECT(self));
33  }
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent)

Variable Documentation

◆ id

int32_t id
Initial value:
{
FlAccessibleNode* node = FL_ACCESSIBLE_NODE(
g_hash_table_lookup(self->semantics_nodes_by_id, GINT_TO_POINTER(id)))

Definition at line 22 of file fl_view_accessible.cc.

◆ node

Definition at line 30 of file fl_view_accessible.cc.

Referenced by if().

◆ view

FlView* view = FL_VIEW(gtk_accessible_get_widget(GTK_ACCESSIBLE(self)))