@@ -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 );
@@ -521,51 +524,34 @@ void FlutterTizenEngine::SetSemanticsEnabled(bool enabled) {
521524 embedder_api_.UpdateSemanticsEnabled (engine_, enabled);
522525}
523526
524- void FlutterTizenEngine::OnUpdateSemanticsNode (const FlutterSemanticsNode* node,
525- void * user_data) {
526- if (node->id == kFlutterSemanticsNodeIdBatchEnd ) {
527+ void FlutterTizenEngine::OnUpdateSemantics (
528+ const FlutterSemanticsUpdate* update) {
529+ if (!accessibility_bridge_) {
530+ FT_LOG (Error) << " The accessibility bridge must be initialized." ;
527531 return ;
528532 }
529533
530- FT_LOG (Debug) << " Update semantics node [id=" << node->id
531- << " , label=" << node->label << " , hint=" << node->hint
532- << " , value=" << node->value << " ]" ;
533- auto * engine = reinterpret_cast <FlutterTizenEngine*>(user_data);
534- if (engine->accessibility_bridge_ ) {
535- engine->accessibility_bridge_ ->AddFlutterSemanticsNodeUpdate (node);
536- } else {
537- FT_LOG (Error) << " Accessibility bridge must be initialized." ;
534+ for (size_t i = 0 ; i < update->nodes_count ; i++) {
535+ const FlutterSemanticsNode* node = &update->nodes [i];
536+ accessibility_bridge_->AddFlutterSemanticsNodeUpdate (node);
538537 }
539- }
540538
541- void FlutterTizenEngine::OnUpdateSemanticsCustomActions (
542- const FlutterSemanticsCustomAction* action,
543- void * user_data) {
544- auto * engine = reinterpret_cast <FlutterTizenEngine*>(user_data);
545- std::shared_ptr<AccessibilityBridge> bridge = engine->accessibility_bridge_ ;
546- if (bridge) {
547- if (action->id == kFlutterSemanticsCustomActionIdBatchEnd ) {
548- // Custom action with id = kFlutterSemanticsCustomActionIdBatchEnd
549- // indicates this is the end of the update batch.
550- bridge->CommitUpdates ();
551- // Attaches the accessibility root to the window delegate.
552- std::weak_ptr<FlutterPlatformNodeDelegate> root =
553- bridge->GetFlutterPlatformNodeDelegateFromID (0 );
554- std::shared_ptr<FlutterPlatformWindowDelegateTizen> window =
555- FlutterPlatformAppDelegateTizen::GetInstance ().GetWindow ().lock ();
556- TizenGeometry geometry = engine->view_ ->tizen_view ()->GetGeometry ();
557- window->SetGeometry (geometry.left , geometry.top , geometry.width ,
558- geometry.height );
559- window->SetRootNode (root);
560- return ;
561- }
562- FT_LOG (Debug) << " Update semantics custom action [id=" << action->id
563- << " , label=" << action->label << " , hint=" << action->hint
564- << " ]" ;
565- bridge->AddFlutterSemanticsCustomActionUpdate (action);
566- } else {
567- FT_LOG (Error) << " Accessibility bridge must be initialized." ;
539+ for (size_t i = 0 ; i < update->custom_actions_count ; i++) {
540+ const FlutterSemanticsCustomAction* action = &update->custom_actions [i];
541+ accessibility_bridge_->AddFlutterSemanticsCustomActionUpdate (action);
568542 }
543+
544+ accessibility_bridge_->CommitUpdates ();
545+
546+ // Attaches the accessibility root to the window delegate.
547+ std::weak_ptr<FlutterPlatformNodeDelegate> root =
548+ accessibility_bridge_->GetFlutterPlatformNodeDelegateFromID (0 );
549+ std::shared_ptr<FlutterPlatformWindowDelegateTizen> window =
550+ FlutterPlatformAppDelegateTizen::GetInstance ().GetWindow ().lock ();
551+ TizenGeometry geometry = view_->tizen_view ()->GetGeometry ();
552+ window->SetGeometry (geometry.left , geometry.top , geometry.width ,
553+ geometry.height );
554+ window->SetRootNode (root);
569555}
570556#endif
571557
0 commit comments