@@ -36,6 +36,17 @@ AccessibilityBridge::~AccessibilityBridge() {
36
36
tree_->RemoveObserver (static_cast <ui::AXTreeObserver*>(this ));
37
37
}
38
38
39
+ void AccessibilityBridge::AddFlutterSemanticsNodeUpdate (
40
+ const FlutterSemanticsNode2* node) {
41
+ pending_semantics_node_updates_[node->id ] = FromFlutterSemanticsNode (node);
42
+ }
43
+
44
+ void AccessibilityBridge::AddFlutterSemanticsCustomActionUpdate (
45
+ const FlutterSemanticsCustomAction2* action) {
46
+ pending_semantics_custom_action_updates_[action->id ] =
47
+ FromFlutterSemanticsCustomAction (action);
48
+ }
49
+
39
50
void AccessibilityBridge::AddFlutterSemanticsNodeUpdate (
40
51
const FlutterSemanticsNode* node) {
41
52
pending_semantics_node_updates_[node->id ] = FromFlutterSemanticsNode (node);
@@ -576,6 +587,74 @@ void AccessibilityBridge::SetTreeData(const SemanticsNode& node,
576
587
}
577
588
}
578
589
590
+ AccessibilityBridge::SemanticsNode
591
+ AccessibilityBridge::FromFlutterSemanticsNode (
592
+ const FlutterSemanticsNode2* flutter_node) {
593
+ SemanticsNode result;
594
+ result.id = flutter_node->id ;
595
+ result.flags = flutter_node->flags ;
596
+ result.actions = flutter_node->actions ;
597
+ result.text_selection_base = flutter_node->text_selection_base ;
598
+ result.text_selection_extent = flutter_node->text_selection_extent ;
599
+ result.scroll_child_count = flutter_node->scroll_child_count ;
600
+ result.scroll_index = flutter_node->scroll_index ;
601
+ result.scroll_position = flutter_node->scroll_position ;
602
+ result.scroll_extent_max = flutter_node->scroll_extent_max ;
603
+ result.scroll_extent_min = flutter_node->scroll_extent_min ;
604
+ result.elevation = flutter_node->elevation ;
605
+ result.thickness = flutter_node->thickness ;
606
+ if (flutter_node->label ) {
607
+ result.label = std::string (flutter_node->label );
608
+ }
609
+ if (flutter_node->hint ) {
610
+ result.hint = std::string (flutter_node->hint );
611
+ }
612
+ if (flutter_node->value ) {
613
+ result.value = std::string (flutter_node->value );
614
+ }
615
+ if (flutter_node->increased_value ) {
616
+ result.increased_value = std::string (flutter_node->increased_value );
617
+ }
618
+ if (flutter_node->decreased_value ) {
619
+ result.decreased_value = std::string (flutter_node->decreased_value );
620
+ }
621
+ if (flutter_node->tooltip ) {
622
+ result.tooltip = std::string (flutter_node->tooltip );
623
+ }
624
+ result.text_direction = flutter_node->text_direction ;
625
+ result.rect = flutter_node->rect ;
626
+ result.transform = flutter_node->transform ;
627
+ if (flutter_node->child_count > 0 ) {
628
+ result.children_in_traversal_order = std::vector<int32_t >(
629
+ flutter_node->children_in_traversal_order ,
630
+ flutter_node->children_in_traversal_order + flutter_node->child_count );
631
+ }
632
+ if (flutter_node->custom_accessibility_actions_count > 0 ) {
633
+ result.custom_accessibility_actions = std::vector<int32_t >(
634
+ flutter_node->custom_accessibility_actions ,
635
+ flutter_node->custom_accessibility_actions +
636
+ flutter_node->custom_accessibility_actions_count );
637
+ }
638
+ return result;
639
+ }
640
+
641
+ AccessibilityBridge::SemanticsCustomAction
642
+ AccessibilityBridge::FromFlutterSemanticsCustomAction (
643
+ const FlutterSemanticsCustomAction2* flutter_custom_action) {
644
+ SemanticsCustomAction result;
645
+ result.id = flutter_custom_action->id ;
646
+ result.override_action = flutter_custom_action->override_action ;
647
+ if (flutter_custom_action->label ) {
648
+ result.label = std::string (flutter_custom_action->label );
649
+ }
650
+ if (flutter_custom_action->hint ) {
651
+ result.hint = std::string (flutter_custom_action->hint );
652
+ }
653
+ return result;
654
+ }
655
+
656
+ // TODO(loicsharma): Remove this as FlutterSemanticsNode is deprecated.
657
+ // See: https://github.com/flutter/flutter/issues/121176
579
658
AccessibilityBridge::SemanticsNode
580
659
AccessibilityBridge::FromFlutterSemanticsNode (
581
660
const FlutterSemanticsNode* flutter_node) {
@@ -627,6 +706,9 @@ AccessibilityBridge::FromFlutterSemanticsNode(
627
706
return result;
628
707
}
629
708
709
+ // TODO(loicsharma): Remove this as FlutterSemanticsCustomAction is
710
+ // deprecated.
711
+ // See: https://github.com/flutter/flutter/issues/121176
630
712
AccessibilityBridge::SemanticsCustomAction
631
713
AccessibilityBridge::FromFlutterSemanticsCustomAction (
632
714
const FlutterSemanticsCustomAction* flutter_custom_action) {
0 commit comments