@@ -206,8 +206,11 @@ bool FlutterTizenEngine::RunEngine() {
206206 args.custom_dart_entrypoint = project_->custom_dart_entrypoint ().c_str ();
207207 }
208208#ifndef WEARABLE_PROFILE
209- args.update_semantics_node_callback = OnUpdateSemanticsNode;
210- args.update_semantics_custom_action_callback = OnUpdateSemanticsCustomActions;
209+ args.update_semantics_callback = [](const FlutterSemanticsUpdate* update,
210+ void * user_data) {
211+ auto * engine = static_cast <FlutterTizenEngine*>(user_data);
212+ engine->OnUpdateSemantics (update);
213+ };
211214
212215 if (IsHeaded () && dynamic_cast <TizenRendererEgl*>(renderer_.get ())) {
213216 vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this );
@@ -520,51 +523,34 @@ void FlutterTizenEngine::SetSemanticsEnabled(bool enabled) {
520523 embedder_api_.UpdateSemanticsEnabled (engine_, enabled);
521524}
522525
523- void FlutterTizenEngine::OnUpdateSemanticsNode (const FlutterSemanticsNode* node,
524- void * user_data) {
525- if (node->id == kFlutterSemanticsNodeIdBatchEnd ) {
526+ void FlutterTizenEngine::OnUpdateSemantics (
527+ const FlutterSemanticsUpdate* update) {
528+ if (!accessibility_bridge_) {
529+ FT_LOG (Error) << " The accessibility bridge must be initialized." ;
526530 return ;
527531 }
528532
529- FT_LOG (Debug) << " Update semantics node [id=" << node->id
530- << " , label=" << node->label << " , hint=" << node->hint
531- << " , value=" << node->value << " ]" ;
532- auto * engine = reinterpret_cast <FlutterTizenEngine*>(user_data);
533- if (engine->accessibility_bridge_ ) {
534- engine->accessibility_bridge_ ->AddFlutterSemanticsNodeUpdate (node);
535- } else {
536- FT_LOG (Error) << " Accessibility bridge must be initialized." ;
533+ for (size_t i = 0 ; i < update->nodes_count ; i++) {
534+ const FlutterSemanticsNode* node = &update->nodes [i];
535+ accessibility_bridge_->AddFlutterSemanticsNodeUpdate (node);
537536 }
538- }
539537
540- void FlutterTizenEngine::OnUpdateSemanticsCustomActions (
541- const FlutterSemanticsCustomAction* action,
542- void * user_data) {
543- auto * engine = reinterpret_cast <FlutterTizenEngine*>(user_data);
544- std::shared_ptr<AccessibilityBridge> bridge = engine->accessibility_bridge_ ;
545- if (bridge) {
546- if (action->id == kFlutterSemanticsCustomActionIdBatchEnd ) {
547- // Custom action with id = kFlutterSemanticsCustomActionIdBatchEnd
548- // indicates this is the end of the update batch.
549- bridge->CommitUpdates ();
550- // Attaches the accessibility root to the window delegate.
551- std::weak_ptr<FlutterPlatformNodeDelegate> root =
552- bridge->GetFlutterPlatformNodeDelegateFromID (0 );
553- std::shared_ptr<FlutterPlatformWindowDelegateTizen> window =
554- FlutterPlatformAppDelegateTizen::GetInstance ().GetWindow ().lock ();
555- TizenGeometry geometry = engine->view_ ->tizen_view ()->GetGeometry ();
556- window->SetGeometry (geometry.left , geometry.top , geometry.width ,
557- geometry.height );
558- window->SetRootNode (root);
559- return ;
560- }
561- FT_LOG (Debug) << " Update semantics custom action [id=" << action->id
562- << " , label=" << action->label << " , hint=" << action->hint
563- << " ]" ;
564- bridge->AddFlutterSemanticsCustomActionUpdate (action);
565- } else {
566- FT_LOG (Error) << " Accessibility bridge must be initialized." ;
538+ for (size_t i = 0 ; i < update->custom_actions_count ; i++) {
539+ const FlutterSemanticsCustomAction* action = &update->custom_actions [i];
540+ accessibility_bridge_->AddFlutterSemanticsCustomActionUpdate (action);
567541 }
542+
543+ accessibility_bridge_->CommitUpdates ();
544+
545+ // Attaches the accessibility root to the window delegate.
546+ std::weak_ptr<FlutterPlatformNodeDelegate> root =
547+ accessibility_bridge_->GetFlutterPlatformNodeDelegateFromID (0 );
548+ std::shared_ptr<FlutterPlatformWindowDelegateTizen> window =
549+ FlutterPlatformAppDelegateTizen::GetInstance ().GetWindow ().lock ();
550+ TizenGeometry geometry = view_->tizen_view ()->GetGeometry ();
551+ window->SetGeometry (geometry.left , geometry.top , geometry.width ,
552+ geometry.height );
553+ window->SetRootNode (root);
568554}
569555#endif
570556
0 commit comments