diff --git a/shell/platform/darwin/macos/framework/Source/FlutterEngine.mm b/shell/platform/darwin/macos/framework/Source/FlutterEngine.mm index 3607cce8e50fd..64af3772290ad 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterEngine.mm @@ -455,8 +455,8 @@ - (BOOL)runWithEntrypoint:(NSString*)entrypoint { flutterArguments.command_line_argc = static_cast(argv.size()); flutterArguments.command_line_argv = argv.empty() ? nullptr : argv.data(); flutterArguments.platform_message_callback = (FlutterPlatformMessageCallback)OnPlatformMessage; - flutterArguments.update_semantics_callback = [](const FlutterSemanticsUpdate* update, - void* user_data) { + flutterArguments.update_semantics_callback2 = [](const FlutterSemanticsUpdate2* update, + void* user_data) { // TODO(dkwingsmt): This callback only supports single-view, therefore it // only operates on the default view. To support multi-view, we need a // way to pass in the ID (probably through FlutterSemanticsUpdate). diff --git a/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm b/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm index 5362c788ef703..c69679955f4f8 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm @@ -198,12 +198,12 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable FlutterEngine* engine = GetFlutterEngine(); // Capture the update callbacks before the embedder API initializes. auto original_init = engine.embedderAPI.Initialize; - std::function update_semantics_callback; + std::function update_semantics_callback; engine.embedderAPI.Initialize = MOCK_ENGINE_PROC( Initialize, ([&update_semantics_callback, &original_init]( size_t version, const FlutterRendererConfig* config, const FlutterProjectArgs* args, void* user_data, auto engine_out) { - update_semantics_callback = args->update_semantics_callback; + update_semantics_callback = args->update_semantics_callback2; return original_init(version, config, args, user_data, engine_out); })); EXPECT_TRUE([engine runWithEntrypoint:@"main"]); @@ -222,7 +222,7 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable engine.semanticsEnabled = YES; EXPECT_TRUE(enabled_called); // Send flutter semantics updates. - FlutterSemanticsNode root; + FlutterSemanticsNode2 root; root.id = 0; root.flags = static_cast(0); root.actions = static_cast(0); @@ -239,7 +239,7 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable root.children_in_traversal_order = children; root.custom_accessibility_actions_count = 0; - FlutterSemanticsNode child1; + FlutterSemanticsNode2 child1; child1.id = 1; child1.flags = static_cast(0); child1.actions = static_cast(0); @@ -254,11 +254,11 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable child1.child_count = 0; child1.custom_accessibility_actions_count = 0; - FlutterSemanticsUpdate update; - update.nodes_count = 2; - FlutterSemanticsNode nodes[] = {root, child1}; + FlutterSemanticsUpdate2 update; + update.node_count = 2; + FlutterSemanticsNode2* nodes[] = {&root, &child1}; update.nodes = nodes; - update.custom_actions_count = 0; + update.custom_action_count = 0; update_semantics_callback(&update, (__bridge void*)engine); // Verify the accessibility tree is attached to the flutter view. @@ -292,12 +292,12 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable FlutterEngine* engine = GetFlutterEngine(); // Capture the update callbacks before the embedder API initializes. auto original_init = engine.embedderAPI.Initialize; - std::function update_semantics_callback; + std::function update_semantics_callback; engine.embedderAPI.Initialize = MOCK_ENGINE_PROC( Initialize, ([&update_semantics_callback, &original_init]( size_t version, const FlutterRendererConfig* config, const FlutterProjectArgs* args, void* user_data, auto engine_out) { - update_semantics_callback = args->update_semantics_callback; + update_semantics_callback = args->update_semantics_callback2; return original_init(version, config, args, user_data, engine_out); })); EXPECT_TRUE([engine runWithEntrypoint:@"main"]); @@ -312,7 +312,7 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable engine.semanticsEnabled = YES; EXPECT_TRUE(enabled_called); // Send flutter semantics updates. - FlutterSemanticsNode root; + FlutterSemanticsNode2 root; root.id = 0; root.flags = static_cast(0); root.actions = static_cast(0); @@ -329,7 +329,7 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable root.children_in_traversal_order = children; root.custom_accessibility_actions_count = 0; - FlutterSemanticsNode child1; + FlutterSemanticsNode2 child1; child1.id = 1; child1.flags = static_cast(0); child1.actions = static_cast(0); @@ -344,11 +344,11 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable child1.child_count = 0; child1.custom_accessibility_actions_count = 0; - FlutterSemanticsUpdate update; - update.nodes_count = 2; - FlutterSemanticsNode nodes[] = {root, child1}; + FlutterSemanticsUpdate2 update; + update.node_count = 2; + FlutterSemanticsNode2* nodes[] = {&root, &child1}; update.nodes = nodes; - update.custom_actions_count = 0; + update.custom_action_count = 0; // This call updates semantics for the default view, which does not exist, // and therefore this call is invalid. But the engine should not crash. update_semantics_callback(&update, (__bridge void*)engine); diff --git a/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm b/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm index 833f4b05bff56..48e725542c40d 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm @@ -498,17 +498,19 @@ - (BOOL)attached { return _engine != nil; } -- (void)updateSemantics:(const FlutterSemanticsUpdate*)update { +- (void)updateSemantics:(const FlutterSemanticsUpdate2*)update { NSAssert(_engine.semanticsEnabled, @"Semantics must be enabled."); if (!_engine.semanticsEnabled) { return; } - for (size_t i = 0; i < update->nodes_count; i++) { - _bridge->AddFlutterSemanticsNodeUpdate(update->nodes[i]); + for (size_t i = 0; i < update->node_count; i++) { + const FlutterSemanticsNode2* node = update->nodes[i]; + _bridge->AddFlutterSemanticsNodeUpdate(*node); } - for (size_t i = 0; i < update->custom_actions_count; i++) { - _bridge->AddFlutterSemanticsCustomActionUpdate(update->custom_actions[i]); + for (size_t i = 0; i < update->custom_action_count; i++) { + const FlutterSemanticsCustomAction2* action = update->custom_actions[i]; + _bridge->AddFlutterSemanticsCustomActionUpdate(*action); } _bridge->CommitUpdates(); diff --git a/shell/platform/darwin/macos/framework/Source/FlutterViewController_Internal.h b/shell/platform/darwin/macos/framework/Source/FlutterViewController_Internal.h index c58602f219667..1281b60694765 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterViewController_Internal.h +++ b/shell/platform/darwin/macos/framework/Source/FlutterViewController_Internal.h @@ -52,7 +52,7 @@ * Notify from the framework that the semantics for this view needs to be * updated. */ -- (void)updateSemantics:(nonnull const FlutterSemanticsUpdate*)update; +- (void)updateSemantics:(nonnull const FlutterSemanticsUpdate2*)update; @end