Skip to content

Commit

Permalink
[Linux] remove AtkText stub implementation (flutter#34839)
Browse files Browse the repository at this point in the history
When Orca has "Speak object under mouse" enabled, it tries to get the
text range extents for any object that implements the AtkText interface
and gets a bit confused by our AtkText stub implementation that merely
returns null for `get_text`.

Removing the stub implementation helps to avoid the issue that Orca
would try to call `atk_text_get_range_extents()` with `start_offset=0`
and `end_offset=0`:

> Atk-CRITICAL **: atk_text_get_range_extents: assertion 'start_offset >= 0 && start_offset < end_offset' failed
  • Loading branch information
jpnurmi authored Aug 4, 2022
1 parent 0f4afe8 commit e179256
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions shell/platform/linux/fl_accessible_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ enum { kProp0, kPropEngine, kPropId, kPropLast };
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,
Expand All @@ -99,9 +98,7 @@ G_DEFINE_TYPE_WITH_CODE(
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))
fl_accessible_node_action_interface_init))

// Returns TRUE if [flag] has changed between [old_flags] and [flags].
static gboolean flag_is_changed(FlutterSemanticsFlag old_flags,
Expand Down Expand Up @@ -338,13 +335,6 @@ static const gchar* fl_accessible_node_get_name(AtkAction* action, gint i) {
return data->name;
}

// Implements AtkText::get_text.
static gchar* fl_accessible_node_get_text(AtkText* text,
gint start_offset,
gint end_offset) {
return nullptr;
}

// Implements FlAccessibleNode::set_name.
static void fl_accessible_node_set_name_impl(FlAccessibleNode* self,
const gchar* name) {
Expand Down Expand Up @@ -475,10 +465,6 @@ static void fl_accessible_node_action_interface_init(AtkActionIface* iface) {
iface->get_name = fl_accessible_node_get_name;
}

static void fl_accessible_node_text_interface_init(AtkTextIface* iface) {
iface->get_text = fl_accessible_node_get_text;
}

static void fl_accessible_node_init(FlAccessibleNode* self) {
FlAccessibleNodePrivate* priv = FL_ACCESSIBLE_NODE_GET_PRIVATE(self);
priv->actions = g_ptr_array_new();
Expand Down

0 comments on commit e179256

Please sign in to comment.