diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 4bd05d1799ed9..67b7550fef3fb 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -2845,6 +2845,8 @@ ORIGIN: ../../../flutter/shell/platform/embedder/embedder_render_target_impeller ORIGIN: ../../../flutter/shell/platform/embedder/embedder_render_target_impeller.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/embedder/embedder_render_target_skia.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/embedder/embedder_render_target_skia.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/platform/embedder/embedder_semantics_update.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/platform/embedder/embedder_semantics_update.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/embedder/embedder_struct_macros.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/embedder/embedder_surface.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/embedder/embedder_surface.h + ../../../flutter/LICENSE @@ -5581,6 +5583,8 @@ FILE: ../../../flutter/shell/platform/embedder/embedder_render_target_impeller.c FILE: ../../../flutter/shell/platform/embedder/embedder_render_target_impeller.h FILE: ../../../flutter/shell/platform/embedder/embedder_render_target_skia.cc FILE: ../../../flutter/shell/platform/embedder/embedder_render_target_skia.h +FILE: ../../../flutter/shell/platform/embedder/embedder_semantics_update.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_semantics_update.h FILE: ../../../flutter/shell/platform/embedder/embedder_struct_macros.h FILE: ../../../flutter/shell/platform/embedder/embedder_surface.cc FILE: ../../../flutter/shell/platform/embedder/embedder_surface.h diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 5bfe8cad0215f..74ff35fd7b02a 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -78,6 +78,8 @@ template("embedder_source_set") { "embedder_render_target_cache.h", "embedder_render_target_skia.cc", "embedder_render_target_skia.h", + "embedder_semantics_update.cc", + "embedder_semantics_update.h", "embedder_struct_macros.h", "embedder_surface.cc", "embedder_surface.h", diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index b5a29314bb2ae..e571001a26588 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -56,6 +56,7 @@ extern const intptr_t kPlatformStrongDillSize; #include "flutter/shell/platform/embedder/embedder_platform_message_response.h" #include "flutter/shell/platform/embedder/embedder_render_target.h" #include "flutter/shell/platform/embedder/embedder_render_target_skia.h" +#include "flutter/shell/platform/embedder/embedder_semantics_update.h" #include "flutter/shell/platform/embedder/embedder_struct_macros.h" #include "flutter/shell/platform/embedder/embedder_task_runner.h" #include "flutter/shell/platform/embedder/embedder_thread_host.h" @@ -1494,214 +1495,11 @@ void PopulateAOTSnapshotMappingCallbacks( } } -// Translates engine semantic nodes to embedder semantic nodes. -FlutterSemanticsNode CreateEmbedderSemanticsNode( - const flutter::SemanticsNode& node) { - SkMatrix transform = node.transform.asM33(); - FlutterTransformation flutter_transform{ - transform.get(SkMatrix::kMScaleX), transform.get(SkMatrix::kMSkewX), - transform.get(SkMatrix::kMTransX), transform.get(SkMatrix::kMSkewY), - transform.get(SkMatrix::kMScaleY), transform.get(SkMatrix::kMTransY), - transform.get(SkMatrix::kMPersp0), transform.get(SkMatrix::kMPersp1), - transform.get(SkMatrix::kMPersp2)}; - - // Do not add new members to FlutterSemanticsNode. - // This would break the forward compatibility of FlutterSemanticsUpdate. - // All new members must be added to FlutterSemanticsNode2 instead. - return { - sizeof(FlutterSemanticsNode), - node.id, - static_cast(node.flags), - static_cast(node.actions), - node.textSelectionBase, - node.textSelectionExtent, - node.scrollChildren, - node.scrollIndex, - node.scrollPosition, - node.scrollExtentMax, - node.scrollExtentMin, - node.elevation, - node.thickness, - node.label.c_str(), - node.hint.c_str(), - node.value.c_str(), - node.increasedValue.c_str(), - node.decreasedValue.c_str(), - static_cast(node.textDirection), - FlutterRect{node.rect.fLeft, node.rect.fTop, node.rect.fRight, - node.rect.fBottom}, - flutter_transform, - node.childrenInTraversalOrder.size(), - node.childrenInTraversalOrder.data(), - node.childrenInHitTestOrder.data(), - node.customAccessibilityActions.size(), - node.customAccessibilityActions.data(), - node.platformViewId, - node.tooltip.c_str(), - }; -} - -// Translates engine semantic nodes to embedder semantic nodes. -FlutterSemanticsNode2 CreateEmbedderSemanticsNode2( - const flutter::SemanticsNode& node) { - SkMatrix transform = node.transform.asM33(); - FlutterTransformation flutter_transform{ - transform.get(SkMatrix::kMScaleX), transform.get(SkMatrix::kMSkewX), - transform.get(SkMatrix::kMTransX), transform.get(SkMatrix::kMSkewY), - transform.get(SkMatrix::kMScaleY), transform.get(SkMatrix::kMTransY), - transform.get(SkMatrix::kMPersp0), transform.get(SkMatrix::kMPersp1), - transform.get(SkMatrix::kMPersp2)}; - return { - sizeof(FlutterSemanticsNode2), - node.id, - static_cast(node.flags), - static_cast(node.actions), - node.textSelectionBase, - node.textSelectionExtent, - node.scrollChildren, - node.scrollIndex, - node.scrollPosition, - node.scrollExtentMax, - node.scrollExtentMin, - node.elevation, - node.thickness, - node.label.c_str(), - node.hint.c_str(), - node.value.c_str(), - node.increasedValue.c_str(), - node.decreasedValue.c_str(), - static_cast(node.textDirection), - FlutterRect{node.rect.fLeft, node.rect.fTop, node.rect.fRight, - node.rect.fBottom}, - flutter_transform, - node.childrenInTraversalOrder.size(), - node.childrenInTraversalOrder.data(), - node.childrenInHitTestOrder.data(), - node.customAccessibilityActions.size(), - node.customAccessibilityActions.data(), - node.platformViewId, - node.tooltip.c_str(), - }; -} - -// Translates engine semantic custom actions to embedder semantic custom -// actions. -FlutterSemanticsCustomAction CreateEmbedderSemanticsCustomAction( - const flutter::CustomAccessibilityAction& action) { - // Do not add new members to FlutterSemanticsCustomAction. - // This would break the forward compatibility of FlutterSemanticsUpdate. - // All new members must be added to FlutterSemanticsCustomAction2 instead. - return { - sizeof(FlutterSemanticsCustomAction), - action.id, - static_cast(action.overrideId), - action.label.c_str(), - action.hint.c_str(), - }; -} - -// Translates engine semantic custom actions to embedder semantic custom -// actions. -FlutterSemanticsCustomAction2 CreateEmbedderSemanticsCustomAction2( - const flutter::CustomAccessibilityAction& action) { - return { - sizeof(FlutterSemanticsCustomAction2), - action.id, - static_cast(action.overrideId), - action.label.c_str(), - action.hint.c_str(), - }; -} - -// Create a callback to notify the embedder of semantic updates -// using the deprecated embedder callback 'update_semantics_callback'. -flutter::PlatformViewEmbedder::UpdateSemanticsCallback -CreateNewEmbedderSemanticsUpdateCallback( - FlutterUpdateSemanticsCallback update_semantics_callback, - void* user_data) { - return [update_semantics_callback, user_data]( - const flutter::SemanticsNodeUpdates& nodes, - const flutter::CustomAccessibilityActionUpdates& actions) { - std::vector embedder_nodes; - for (const auto& value : nodes) { - embedder_nodes.push_back(CreateEmbedderSemanticsNode(value.second)); - } - - std::vector embedder_custom_actions; - for (const auto& value : actions) { - embedder_custom_actions.push_back( - CreateEmbedderSemanticsCustomAction(value.second)); - } - - FlutterSemanticsUpdate update{ - .struct_size = sizeof(FlutterSemanticsUpdate), - .nodes_count = embedder_nodes.size(), - .nodes = embedder_nodes.data(), - .custom_actions_count = embedder_custom_actions.size(), - .custom_actions = embedder_custom_actions.data(), - }; - - update_semantics_callback(&update, user_data); - }; -} - -// Create a callback to notify the embedder of semantic updates -// using the new embedder callback 'update_semantics_callback2'. -flutter::PlatformViewEmbedder::UpdateSemanticsCallback -CreateNewEmbedderSemanticsUpdateCallback2( - FlutterUpdateSemanticsCallback2 update_semantics_callback, - void* user_data) { - return [update_semantics_callback, user_data]( - const flutter::SemanticsNodeUpdates& nodes, - const flutter::CustomAccessibilityActionUpdates& actions) { - std::vector embedder_nodes; - std::vector embedder_custom_actions; - - embedder_nodes.reserve(nodes.size()); - embedder_custom_actions.reserve(actions.size()); - - for (const auto& value : nodes) { - embedder_nodes.push_back(CreateEmbedderSemanticsNode2(value.second)); - } - - for (const auto& value : actions) { - embedder_custom_actions.push_back( - CreateEmbedderSemanticsCustomAction2(value.second)); - } - - // Provide the embedder an array of pointers to maintain full forward and - // backward compatibility even if new members are added to semantic structs. - std::vector embedder_node_pointers; - std::vector embedder_custom_action_pointers; - - embedder_node_pointers.reserve(embedder_nodes.size()); - embedder_custom_action_pointers.reserve(embedder_custom_actions.size()); - - for (auto& node : embedder_nodes) { - embedder_node_pointers.push_back(&node); - } - - for (auto& action : embedder_custom_actions) { - embedder_custom_action_pointers.push_back(&action); - } - - FlutterSemanticsUpdate2 update{ - .struct_size = sizeof(FlutterSemanticsUpdate2), - .node_count = embedder_node_pointers.size(), - .nodes = embedder_node_pointers.data(), - .custom_action_count = embedder_custom_action_pointers.size(), - .custom_actions = embedder_custom_action_pointers.data(), - }; - - update_semantics_callback(&update, user_data); - }; -} - // Create a callback to notify the embedder of semantic updates // using the legacy embedder callbacks 'update_semantics_node_callback' and // 'update_semantics_custom_action_callback'. flutter::PlatformViewEmbedder::UpdateSemanticsCallback -CreateLegacyEmbedderSemanticsUpdateCallback( +CreateEmbedderSemanticsUpdateCallbackV1( FlutterUpdateSemanticsNodeCallback update_semantics_node_callback, FlutterUpdateSemanticsCustomActionCallback update_semantics_custom_action_callback, @@ -1710,20 +1508,20 @@ CreateLegacyEmbedderSemanticsUpdateCallback( update_semantics_custom_action_callback, user_data](const flutter::SemanticsNodeUpdates& nodes, const flutter::CustomAccessibilityActionUpdates& actions) { + flutter::EmbedderSemanticsUpdate update{nodes, actions}; + FlutterSemanticsUpdate* update_ptr = update.get(); + // First, queue all node and custom action updates. if (update_semantics_node_callback != nullptr) { - for (const auto& value : nodes) { - const FlutterSemanticsNode embedder_node = - CreateEmbedderSemanticsNode(value.second); - update_semantics_node_callback(&embedder_node, user_data); + for (size_t i = 0; i < update_ptr->nodes_count; i++) { + update_semantics_node_callback(&update_ptr->nodes[i], user_data); } } if (update_semantics_custom_action_callback != nullptr) { - for (const auto& value : actions) { - const FlutterSemanticsCustomAction embedder_action = - CreateEmbedderSemanticsCustomAction(value.second); - update_semantics_custom_action_callback(&embedder_action, user_data); + for (size_t i = 0; i < update_ptr->custom_actions_count; i++) { + update_semantics_custom_action_callback(&update_ptr->custom_actions[i], + user_data); } } @@ -1747,26 +1545,62 @@ CreateLegacyEmbedderSemanticsUpdateCallback( }; } +// Create a callback to notify the embedder of semantic updates +// using the deprecated embedder callback 'update_semantics_callback'. +flutter::PlatformViewEmbedder::UpdateSemanticsCallback +CreateEmbedderSemanticsUpdateCallbackV2( + FlutterUpdateSemanticsCallback update_semantics_callback, + void* user_data) { + return [update_semantics_callback, user_data]( + const flutter::SemanticsNodeUpdates& nodes, + const flutter::CustomAccessibilityActionUpdates& actions) { + flutter::EmbedderSemanticsUpdate update{nodes, actions}; + + update_semantics_callback(update.get(), user_data); + }; +} + +// Create a callback to notify the embedder of semantic updates +// using the new embedder callback 'update_semantics_callback2'. +flutter::PlatformViewEmbedder::UpdateSemanticsCallback +CreateEmbedderSemanticsUpdateCallbackV3( + FlutterUpdateSemanticsCallback2 update_semantics_callback, + void* user_data) { + return [update_semantics_callback, user_data]( + const flutter::SemanticsNodeUpdates& nodes, + const flutter::CustomAccessibilityActionUpdates& actions) { + flutter::EmbedderSemanticsUpdate2 update{nodes, actions}; + + update_semantics_callback(update.get(), user_data); + }; +} + // Creates a callback that receives semantic updates from the engine // and notifies the embedder's callback(s). Returns null if the embedder // did not register any callbacks. flutter::PlatformViewEmbedder::UpdateSemanticsCallback CreateEmbedderSemanticsUpdateCallback(const FlutterProjectArgs* args, void* user_data) { - // The embedder can register the new callback, or the legacy callbacks, or - // nothing at all. Handle the case where the embedder registered the 'new' - // callback. + // There are three variants for the embedder API's semantic update callbacks. + // Create a callback that maps to the embedder's desired semantic update API. + // + // Handle the case where the embedder registered the callback + // 'updated_semantics_callback2' if (SAFE_ACCESS(args, update_semantics_callback2, nullptr) != nullptr) { - return CreateNewEmbedderSemanticsUpdateCallback2( + return CreateEmbedderSemanticsUpdateCallbackV3( args->update_semantics_callback2, user_data); } + // Handle the case where the embedder registered the deprecated callback + // 'update_semantics_callback'. if (SAFE_ACCESS(args, update_semantics_callback, nullptr) != nullptr) { - return CreateNewEmbedderSemanticsUpdateCallback( + return CreateEmbedderSemanticsUpdateCallbackV2( args->update_semantics_callback, user_data); } - // Handle the case where the embedder registered 'legacy' callbacks. + // Handle the case where the embedder registered the deprecated callbacks + // 'update_semantics_node_callback' and + // 'update_semantics_custom_action_callback'. FlutterUpdateSemanticsNodeCallback update_semantics_node_callback = nullptr; if (SAFE_ACCESS(args, update_semantics_node_callback, nullptr) != nullptr) { update_semantics_node_callback = args->update_semantics_node_callback; @@ -1782,7 +1616,7 @@ CreateEmbedderSemanticsUpdateCallback(const FlutterProjectArgs* args, if (update_semantics_node_callback != nullptr || update_semantics_custom_action_callback != nullptr) { - return CreateLegacyEmbedderSemanticsUpdateCallback( + return CreateEmbedderSemanticsUpdateCallbackV1( update_semantics_node_callback, update_semantics_custom_action_callback, user_data); } diff --git a/shell/platform/embedder/embedder_semantics_update.cc b/shell/platform/embedder/embedder_semantics_update.cc new file mode 100644 index 0000000000000..a2abe3ac17327 --- /dev/null +++ b/shell/platform/embedder/embedder_semantics_update.cc @@ -0,0 +1,178 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/embedder/embedder_semantics_update.h" + +namespace flutter { + +EmbedderSemanticsUpdate::EmbedderSemanticsUpdate( + const SemanticsNodeUpdates& nodes, + const CustomAccessibilityActionUpdates& actions) { + for (const auto& value : nodes) { + AddNode(value.second); + } + + for (const auto& value : actions) { + AddAction(value.second); + } + + update_ = { + .struct_size = sizeof(FlutterSemanticsUpdate), + .nodes_count = nodes_.size(), + .nodes = nodes_.data(), + .custom_actions_count = actions_.size(), + .custom_actions = actions_.data(), + }; +} + +void EmbedderSemanticsUpdate::AddNode(const SemanticsNode& node) { + SkMatrix transform = node.transform.asM33(); + FlutterTransformation flutter_transform{ + transform.get(SkMatrix::kMScaleX), transform.get(SkMatrix::kMSkewX), + transform.get(SkMatrix::kMTransX), transform.get(SkMatrix::kMSkewY), + transform.get(SkMatrix::kMScaleY), transform.get(SkMatrix::kMTransY), + transform.get(SkMatrix::kMPersp0), transform.get(SkMatrix::kMPersp1), + transform.get(SkMatrix::kMPersp2)}; + + // Do not add new members to FlutterSemanticsNode. + // This would break the forward compatibility of FlutterSemanticsUpdate. + // All new members must be added to FlutterSemanticsNode2 instead. + nodes_.push_back({ + sizeof(FlutterSemanticsNode), + node.id, + static_cast(node.flags), + static_cast(node.actions), + node.textSelectionBase, + node.textSelectionExtent, + node.scrollChildren, + node.scrollIndex, + node.scrollPosition, + node.scrollExtentMax, + node.scrollExtentMin, + node.elevation, + node.thickness, + node.label.c_str(), + node.hint.c_str(), + node.value.c_str(), + node.increasedValue.c_str(), + node.decreasedValue.c_str(), + static_cast(node.textDirection), + FlutterRect{node.rect.fLeft, node.rect.fTop, node.rect.fRight, + node.rect.fBottom}, + flutter_transform, + node.childrenInTraversalOrder.size(), + node.childrenInTraversalOrder.data(), + node.childrenInHitTestOrder.data(), + node.customAccessibilityActions.size(), + node.customAccessibilityActions.data(), + node.platformViewId, + node.tooltip.c_str(), + }); +} + +void EmbedderSemanticsUpdate::AddAction( + const CustomAccessibilityAction& action) { + // Do not add new members to FlutterSemanticsCustomAction. + // This would break the forward compatibility of FlutterSemanticsUpdate. + // All new members must be added to FlutterSemanticsCustomAction2 instead. + actions_.push_back({ + sizeof(FlutterSemanticsCustomAction), + action.id, + static_cast(action.overrideId), + action.label.c_str(), + action.hint.c_str(), + }); +} + +EmbedderSemanticsUpdate::~EmbedderSemanticsUpdate() {} + +EmbedderSemanticsUpdate2::EmbedderSemanticsUpdate2( + const SemanticsNodeUpdates& nodes, + const CustomAccessibilityActionUpdates& actions) { + nodes_.reserve(nodes.size()); + node_pointers_.reserve(nodes.size()); + actions_.reserve(actions.size()); + action_pointers_.reserve(actions.size()); + + for (const auto& value : nodes) { + AddNode(value.second); + } + + for (const auto& value : actions) { + AddAction(value.second); + } + + for (size_t i = 0; i < nodes_.size(); i++) { + node_pointers_.push_back(&nodes_[i]); + } + + for (size_t i = 0; i < actions_.size(); i++) { + action_pointers_.push_back(&actions_[i]); + } + + update_ = { + .struct_size = sizeof(FlutterSemanticsUpdate2), + .node_count = node_pointers_.size(), + .nodes = node_pointers_.data(), + .custom_action_count = action_pointers_.size(), + .custom_actions = action_pointers_.data(), + }; +} + +EmbedderSemanticsUpdate2::~EmbedderSemanticsUpdate2() {} + +void EmbedderSemanticsUpdate2::AddNode(const SemanticsNode& node) { + SkMatrix transform = node.transform.asM33(); + FlutterTransformation flutter_transform{ + transform.get(SkMatrix::kMScaleX), transform.get(SkMatrix::kMSkewX), + transform.get(SkMatrix::kMTransX), transform.get(SkMatrix::kMSkewY), + transform.get(SkMatrix::kMScaleY), transform.get(SkMatrix::kMTransY), + transform.get(SkMatrix::kMPersp0), transform.get(SkMatrix::kMPersp1), + transform.get(SkMatrix::kMPersp2)}; + + nodes_.push_back({ + sizeof(FlutterSemanticsNode2), + node.id, + static_cast(node.flags), + static_cast(node.actions), + node.textSelectionBase, + node.textSelectionExtent, + node.scrollChildren, + node.scrollIndex, + node.scrollPosition, + node.scrollExtentMax, + node.scrollExtentMin, + node.elevation, + node.thickness, + node.label.c_str(), + node.hint.c_str(), + node.value.c_str(), + node.increasedValue.c_str(), + node.decreasedValue.c_str(), + static_cast(node.textDirection), + FlutterRect{node.rect.fLeft, node.rect.fTop, node.rect.fRight, + node.rect.fBottom}, + flutter_transform, + node.childrenInTraversalOrder.size(), + node.childrenInTraversalOrder.data(), + node.childrenInHitTestOrder.data(), + node.customAccessibilityActions.size(), + node.customAccessibilityActions.data(), + node.platformViewId, + node.tooltip.c_str(), + }); +} + +void EmbedderSemanticsUpdate2::AddAction( + const CustomAccessibilityAction& action) { + actions_.push_back({ + sizeof(FlutterSemanticsCustomAction2), + action.id, + static_cast(action.overrideId), + action.label.c_str(), + action.hint.c_str(), + }); +} + +} // namespace flutter diff --git a/shell/platform/embedder/embedder_semantics_update.h b/shell/platform/embedder/embedder_semantics_update.h new file mode 100644 index 0000000000000..9d7ae51137471 --- /dev/null +++ b/shell/platform/embedder/embedder_semantics_update.h @@ -0,0 +1,73 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SEMANTICS_UPDATE_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SEMANTICS_UPDATE_H_ + +#include "flutter/shell/platform/embedder/embedder.h" +#include "lib/ui/semantics/custom_accessibility_action.h" +#include "lib/ui/semantics/semantics_node.h" + +namespace flutter { + +// A semantic update, used by the embedder API's v1 and v2 semantic update +// callbacks. +class EmbedderSemanticsUpdate { + public: + EmbedderSemanticsUpdate(const SemanticsNodeUpdates& nodes, + const CustomAccessibilityActionUpdates& actions); + + ~EmbedderSemanticsUpdate(); + + // Get the semantic update. The pointer is only valid while + // |EmbedderSemanticsUpdate| exists. + FlutterSemanticsUpdate* get() { return &update_; } + + private: + FlutterSemanticsUpdate update_; + std::vector nodes_; + std::vector actions_; + + // Translates engine semantic nodes to embedder semantic nodes. + void AddNode(const SemanticsNode& node); + + // Translates engine semantic custom actions to embedder semantic custom + // actions. + void AddAction(const CustomAccessibilityAction& action); + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSemanticsUpdate); +}; + +// A semantic update, used by the embedder API's v3 semantic update callback. +class EmbedderSemanticsUpdate2 { + public: + EmbedderSemanticsUpdate2(const SemanticsNodeUpdates& nodes, + const CustomAccessibilityActionUpdates& actions); + + ~EmbedderSemanticsUpdate2(); + + // Get the semantic update. The pointer is only valid while + // |EmbedderSemanticsUpdate2| exists. + FlutterSemanticsUpdate2* get() { return &update_; } + + private: + FlutterSemanticsUpdate2 update_; + std::vector nodes_; + std::vector node_pointers_; + std::vector actions_; + std::vector action_pointers_; + + // Translates engine semantic nodes to embedder semantic nodes. + void AddNode(const SemanticsNode& node); + + // Translates engine semantic custom actions to embedder semantic custom + // actions. + void AddAction(const CustomAccessibilityAction& action); + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSemanticsUpdate2); +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SEMANTICS_UPDATE_H_ \ No newline at end of file diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc index 53a92dafdbdc7..181a523a07adf 100644 --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -93,7 +93,7 @@ TEST_F(EmbedderTest, CannotProvideMultipleSemanticsCallbacks) { } } -TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) { +TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingV3Callbacks) { #if defined(OS_FUCHSIA) GTEST_SKIP() << "This test crashes on Fuchsia. https://fxbug.dev/87493 "; #else @@ -272,7 +272,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) { #endif // OS_FUCHSIA } -TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingUnstableCallbacks) { +TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingV2Callbacks) { #if defined(OS_FUCHSIA) GTEST_SKIP() << "This test crashes on Fuchsia. https://fxbug.dev/87493 "; #else @@ -449,7 +449,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingUnstableCallbacks) { #endif // OS_FUCHSIA } -TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) { +TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingV1Callbacks) { auto& context = GetEmbedderContext(EmbedderTestContextType::kSoftwareContext); fml::AutoResetWaitableEvent signal_native_latch;