@@ -83,6 +83,43 @@ G_DEFINE_TYPE_WITH_CODE(
8383 G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
8484 fl_accessible_node_action_interface_init))
8585
86+ // Returns TRUE if [flags] indicate this element is checkable.
87+ static gboolean is_checkable(FlutterSemanticsFlags flags) {
88+ return flags.is_checked != kFlutterCheckStateNone ||
89+ flags.is_toggled != kFlutterTristateNone ;
90+ }
91+
92+ // Returns TRUE if [flags] indicate this element is checked.
93+ static gboolean is_checked (FlutterSemanticsFlags flags) {
94+ return flags.is_checked == kFlutterCheckStateTrue ||
95+ flags.is_toggled == kFlutterTristateTrue ;
96+ }
97+
98+ // Returns TRUE if [flags] indicate this element is focusable.
99+ static gboolean is_focusable (FlutterSemanticsFlags flags) {
100+ return flags.is_focused != kFlutterTristateNone ;
101+ }
102+
103+ // Returns TRUE if [flags] indicate this element is focused.
104+ static gboolean is_focused (FlutterSemanticsFlags flags) {
105+ return flags.is_focused == kFlutterTristateTrue ;
106+ }
107+
108+ // Returns TRUE if [flags] indicate this element is selected.
109+ static gboolean is_selected (FlutterSemanticsFlags flags) {
110+ return flags.is_selected == kFlutterTristateTrue ;
111+ }
112+
113+ // Returns TRUE if [flags] indicate this element is sensitive.
114+ static gboolean is_sensitive (FlutterSemanticsFlags flags) {
115+ return flags.is_enabled != kFlutterTristateNone ;
116+ }
117+
118+ // Returns TRUE if [flags] indicate this element is enabled.
119+ static gboolean is_enabled (FlutterSemanticsFlags flags) {
120+ return flags.is_enabled == kFlutterTristateTrue ;
121+ }
122+
86123// Returns TRUE if [action] is set in [actions].
87124static gboolean has_action (FlutterSemanticsAction actions,
88125 FlutterSemanticsAction action) {
@@ -237,23 +274,25 @@ static AtkStateSet* fl_accessible_node_ref_state_set(AtkObject* accessible) {
237274 if (!priv->flags .is_hidden ) {
238275 atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
239276 }
240- if (priv->flags . is_checked != kFlutterCheckStateNone ) {
277+ if (is_checkable ( priv->flags ) ) {
241278 atk_state_set_add_state (state_set, ATK_STATE_CHECKABLE);
242279 }
243- if (priv->flags .is_focused != kFlutterTristateNone ) {
280+ if (is_checked (priv->flags )) {
281+ atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
282+ }
283+ if (is_focusable (priv->flags )) {
244284 atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
245285 }
246- if (priv->flags . is_focused == kFlutterTristateTrue ) {
286+ if (is_focused ( priv->flags ) ) {
247287 atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
248288 }
249- if (priv->flags .is_checked || priv->flags .is_toggled ) {
250- atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
251- }
252- if (priv->flags .is_selected ) {
289+ if (is_selected (priv->flags )) {
253290 atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
254291 }
255- if (priv->flags . is_enabled == kFlutterTristateTrue ) {
292+ if (is_enabled ( priv->flags ) ) {
256293 atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
294+ }
295+ if (is_sensitive (priv->flags )) {
257296 atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
258297 }
259298 if (priv->flags .is_read_only ) {
@@ -372,43 +411,33 @@ static void fl_accessible_node_set_flags_impl(FlAccessibleNode* self,
372411 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_VISIBLE,
373412 !flags->is_hidden );
374413 }
375- bool was_checkable = old_flags.is_checked != kFlutterCheckStateNone ;
376- bool is_checkable = flags->is_checked != kFlutterCheckStateNone ;
377- if (flag_changed (was_checkable, is_checkable)) {
414+ if (flag_changed (is_checkable (old_flags), is_checkable (priv->flags ))) {
378415 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_CHECKABLE,
379- is_checkable);
416+ is_checkable (priv-> flags ) );
380417 }
381- if (flag_changed (old_flags.is_focused , flags->is_focused )) {
418+ if (flag_changed (is_checked (old_flags), is_checked (priv->flags ))) {
419+ atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_CHECKED,
420+ is_checked (priv->flags ));
421+ }
422+ if (flag_changed (is_focusable (old_flags), is_focusable (priv->flags ))) {
382423 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_FOCUSABLE,
383- flags-> is_focused != kFlutterTristateNone );
424+ is_focusable (priv-> flags ) );
384425 }
385- if (flag_changed (old_flags. is_focused , flags-> is_focused )) {
426+ if (flag_changed (is_focused (old_flags), is_focused (priv-> flags ) )) {
386427 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_FOCUSED,
387- flags->is_focused == kFlutterTristateTrue );
388- }
389- bool old_is_checked = old_flags.is_checked || old_flags.is_toggled ;
390- bool is_checked = flags->is_checked || flags->is_toggled ;
391- if (flag_changed (old_is_checked, is_checked)) {
392- atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_CHECKED,
393- is_checked);
428+ is_focused (priv->flags ));
394429 }
395- if (flag_changed (old_flags. is_selected , flags-> is_selected )) {
430+ if (flag_changed (is_selected (old_flags), is_selected (priv-> flags ) )) {
396431 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_SELECTED,
397- flags-> is_selected );
432+ is_selected (priv-> flags ) );
398433 }
399- if (flag_changed (old_flags.is_enabled , flags->is_enabled )) {
400- atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_ENABLED,
401- flags->is_enabled );
434+ if (flag_changed (is_sensitive (old_flags), is_sensitive (priv->flags ))) {
402435 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_SENSITIVE,
403- flags->is_enabled );
404- }
405- if (flag_changed (old_flags.is_enabled , flags->is_enabled )) {
406- atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_ENABLED,
407- flags->is_enabled );
436+ is_sensitive (priv->flags ));
408437 }
409- if (flag_changed (old_flags. is_enabled , flags-> is_enabled )) {
438+ if (flag_changed (is_enabled (old_flags), is_enabled (priv-> flags ) )) {
410439 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_ENABLED,
411- flags-> is_enabled );
440+ is_enabled (priv-> flags ) );
412441 }
413442 if (flag_changed (old_flags.is_read_only , flags->is_read_only )) {
414443 atk_object_notify_state_change (ATK_OBJECT (self), ATK_STATE_READ_ONLY,
0 commit comments