From 2c729cd0a3bba4967b6d54d3e89892a5dcf378f4 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 20 Dec 2019 14:42:24 -0800 Subject: [PATCH 1/5] start --- .../fuchsia/flutter/accessibility_bridge.cc | 81 +++++++++++++++++-- .../fuchsia/flutter/accessibility_bridge.h | 21 ++++- shell/platform/fuchsia/flutter/component.cc | 15 +--- .../fuchsia/flutter/compositor_context.cc | 2 + .../fuchsia/flutter/compositor_context.h | 3 + shell/platform/fuchsia/flutter/engine.cc | 11 ++- shell/platform/fuchsia/flutter/engine.h | 4 +- .../platform/fuchsia/flutter/platform_view.cc | 4 +- .../platform/fuchsia/flutter/platform_view.h | 2 - .../fuchsia/flutter/session_connection.cc | 3 +- .../fuchsia/flutter/session_connection.h | 2 + 11 files changed, 117 insertions(+), 31 deletions(-) diff --git a/shell/platform/fuchsia/flutter/accessibility_bridge.cc b/shell/platform/fuchsia/flutter/accessibility_bridge.cc index 8f3e28104964a..b78b0fa4a21ec 100644 --- a/shell/platform/fuchsia/flutter/accessibility_bridge.cc +++ b/shell/platform/fuchsia/flutter/accessibility_bridge.cc @@ -99,8 +99,8 @@ std::unordered_set AccessibilityBridge::GetDescendants( auto it = nodes_.find(id); if (it != nodes_.end()) { - auto const& children = it->second; - for (const auto& child : children) { + auto const& node = it->second; + for (const auto& child : node.children_in_hit_test_order) { if (descendents.find(child) == descendents.end()) { to_process.push_back(child); } else { @@ -180,10 +180,19 @@ void AccessibilityBridge::AddSemanticsNodeUpdate( for (const auto& value : update) { size_t this_node_size = sizeof(fuchsia::accessibility::semantics::Node); const auto& flutter_node = value.second; - nodes_[flutter_node.id] = - std::vector(flutter_node.childrenInTraversalOrder); + // Store the nodes in hitTestOrder for later hit testing. + nodes_[flutter_node.id] = { + .id = flutter_node.id, + .flags = flutter_node.flags, + .rect = flutter_node.rect, + .transform = flutter_node.transform, + .children_in_hit_test_order = + std::vector(flutter_node.childrenInHitTestOrder), + }; fuchsia::accessibility::semantics::Node fuchsia_node; std::vector child_ids; + // Send the nodes in traversal order, so the manager can figure out + // traversal. for (int32_t flutter_child_id : flutter_node.childrenInTraversalOrder) { child_ids.push_back(FlutterIdToFuchsiaId(flutter_child_id)); } @@ -221,6 +230,7 @@ void AccessibilityBridge::AddSemanticsNodeUpdate( } PruneUnreachableNodes(); + UpdateScreenRects(kRootNodeId, SkMatrix44::I()); tree_ptr_->UpdateSemanticNodes(std::move(nodes)); // TODO(dnfield): Implement the callback here @@ -228,6 +238,35 @@ void AccessibilityBridge::AddSemanticsNodeUpdate( tree_ptr_->CommitUpdates([]() {}); } +void AccessibilityBridge::UpdateScreenRects(int32_t node_id, + SkMatrix44 parent_transform) { + auto it = nodes_.find(node_id); + if (it == nodes_.end()) { + FML_LOG(ERROR) << "UpdateScreenRects called on unknown node"; + } + auto& node = it->second; + const auto& current_transform = parent_transform * node.transform; + + const auto& rect = node.rect; + std::vector points = { + current_transform * SkVector4(rect.left(), rect.top(), 0, 1), + current_transform * SkVector4(rect.right(), rect.top(), 0, 1), + current_transform * SkVector4(rect.right(), rect.bottom(), 0, 1), + current_transform * SkVector4(rect.left(), rect.bottom(), 0, 1), + }; + + for (SkVector4 point : points) { + node.screen_rect.setLTRB(std::min(node.screen_rect.left(), point.fData[0]), + std::min(node.screen_rect.top(), point.fData[1]), + std::min(node.screen_rect.right(), point.fData[0]), + std::min(node.screen_rect.bottom(), point.fData[1])); + } + + for (uint32_t child_id : node.children_in_hit_test_order) { + UpdateScreenRects(child_id, current_transform); + } +} + // |fuchsia::accessibility::semantics::SemanticListener| void AccessibilityBridge::OnAccessibilityActionRequested( uint32_t node_id, @@ -239,7 +278,39 @@ void AccessibilityBridge::OnAccessibilityActionRequested( void AccessibilityBridge::HitTest( fuchsia::math::PointF local_point, fuchsia::accessibility::semantics::SemanticListener::HitTestCallback - callback) {} + callback) { + fuchsia::accessibility::semantics::Hit hit; + FML_LOG(ERROR) << "Going to try to get node for point " << local_point.x << "," << local_point.y; + GetHitNode(kRootNodeId, local_point.x, local_point.y, &hit); + FML_LOG(ERROR) << "Point " << local_point.x << "," << local_point.y <<" got hit: " << hit.node_id(); + callback(std::move(hit)); +} + +void AccessibilityBridge::GetHitNode( + int32_t node_id, + float x, + float y, + fuchsia::accessibility::semantics::Hit* hit) { + auto it = nodes_.find(node_id); + if (it == nodes_.end()) { + FML_LOG(ERROR) << "Attempted to hit test unkonwn node id: " << node_id; + return; + } + auto const& node = it->second; + + if (node.flags & + static_cast(flutter::SemanticsFlags::kIsHidden) || // + x < node.screen_rect.left() || // + x >= node.screen_rect.right() || // + y < node.screen_rect.top() || // + y >= node.screen_rect.bottom()) { + return; + } + hit->set_node_id(node_id); + for (int32_t child_id : node.children_in_hit_test_order) { + GetHitNode(child_id, x, y, hit); + } +} // |fuchsia::accessibility::semantics::SemanticListener| void AccessibilityBridge::OnSemanticsModeChanged( diff --git a/shell/platform/fuchsia/flutter/accessibility_bridge.h b/shell/platform/fuchsia/flutter/accessibility_bridge.h index 58d53933b47f9..6ed3b4a737dd5 100644 --- a/shell/platform/fuchsia/flutter/accessibility_bridge.h +++ b/shell/platform/fuchsia/flutter/accessibility_bridge.h @@ -86,6 +86,15 @@ class AccessibilityBridge zx_status_t OnHoverMove(double x, double y); private: + struct SemanticsNode { + int32_t id; + int32_t flags; + SkRect rect; + SkRect screen_rect; + SkMatrix44 transform; + std::vector children_in_hit_test_order; + }; + AccessibilityBridge::Delegate& delegate_; static constexpr int32_t kRootNodeId = 0; @@ -96,7 +105,7 @@ class AccessibilityBridge bool semantics_enabled_; // This is the cache of all nodes we've sent to Fuchsia's SemanticsManager. // Assists with pruning unreachable nodes. - std::unordered_map> nodes_; + std::unordered_map nodes_; // Derives the BoundingBox of a Flutter semantics node from its // rect and elevation. @@ -127,6 +136,16 @@ class AccessibilityBridge // May result in a call to FuchsiaAccessibility::Commit(). void PruneUnreachableNodes(); + // Updates the on-screen positions of accessibility elements. + // + // This should be called from Update + void UpdateScreenRects(int32_t node_id, SkMatrix44 parent_transform); + + void GetHitNode(int32_t node_id, + float x, + float y, + fuchsia::accessibility::semantics::Hit* hit); + // |fuchsia::accessibility::semantics::SemanticListener| void OnAccessibilityActionRequested( uint32_t node_id, diff --git a/shell/platform/fuchsia/flutter/component.cc b/shell/platform/fuchsia/flutter/component.cc index 99b6ee37d506f..12bdf2a6b3682 100644 --- a/shell/platform/fuchsia/flutter/component.cc +++ b/shell/platform/fuchsia/flutter/component.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -578,17 +579,6 @@ void Application::CreateView( return; } - // TODO(MI4-2490): remove once ViewRefControl and ViewRef come as a parameters - // to CreateView - fuchsia::ui::views::ViewRefControl view_ref_control; - fuchsia::ui::views::ViewRef view_ref; - zx_status_t status = zx::eventpair::create( - /*flags*/ 0u, &view_ref_control.reference, &view_ref.reference); - FML_DCHECK(status == ZX_OK); - - status = view_ref.reference.replace(ZX_RIGHTS_BASIC, &view_ref.reference); - FML_DCHECK(status == ZX_OK); - shell_holders_.emplace(std::make_unique( *this, // delegate debug_label_, // thread label @@ -597,8 +587,7 @@ void Application::CreateView( settings_, // settings std::move(isolate_snapshot_), // isolate snapshot scenic::ToViewToken(std::move(view_token)), // view token - std::move(view_ref_control), // view ref control - std::move(view_ref), // view ref + scenic::ViewRefPair::New(), // view ref pair std::move(fdio_ns_), // FDIO namespace std::move(directory_request_) // outgoing request )); diff --git a/shell/platform/fuchsia/flutter/compositor_context.cc b/shell/platform/fuchsia/flutter/compositor_context.cc index e47720998138e..ef389dbceaef5 100644 --- a/shell/platform/fuchsia/flutter/compositor_context.cc +++ b/shell/platform/fuchsia/flutter/compositor_context.cc @@ -63,12 +63,14 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame { CompositorContext::CompositorContext( std::string debug_label, fuchsia::ui::views::ViewToken view_token, + scenic::ViewRefPair view_ref_pair, fidl::InterfaceHandle session, fml::closure session_error_callback, zx_handle_t vsync_event_handle) : debug_label_(std::move(debug_label)), session_connection_(debug_label_, std::move(view_token), + std::move(view_ref_pair), std::move(session), session_error_callback, vsync_event_handle) {} diff --git a/shell/platform/fuchsia/flutter/compositor_context.h b/shell/platform/fuchsia/flutter/compositor_context.h index ce7d16d47c411..46088f8e6fe36 100644 --- a/shell/platform/fuchsia/flutter/compositor_context.h +++ b/shell/platform/fuchsia/flutter/compositor_context.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "flutter/flow/compositor_context.h" #include "flutter/flow/embedded_views.h" @@ -22,6 +23,7 @@ class CompositorContext final : public flutter::CompositorContext { public: CompositorContext(std::string debug_label, fuchsia::ui::views::ViewToken view_token, + scenic::ViewRefPair view_ref_pair, fidl::InterfaceHandle session, fml::closure session_error_callback, zx_handle_t vsync_event_handle); @@ -36,6 +38,7 @@ class CompositorContext final : public flutter::CompositorContext { private: const std::string debug_label_; + scenic::ViewRefPair view_ref_pair_; SessionConnection session_connection_; // |flutter::CompositorContext| diff --git a/shell/platform/fuchsia/flutter/engine.cc b/shell/platform/fuchsia/flutter/engine.cc index 665cd1b74f639..79dbc8b62a45b 100644 --- a/shell/platform/fuchsia/flutter/engine.cc +++ b/shell/platform/fuchsia/flutter/engine.cc @@ -55,8 +55,7 @@ Engine::Engine(Delegate& delegate, flutter::Settings settings, fml::RefPtr isolate_snapshot, fuchsia::ui::views::ViewToken view_token, - fuchsia::ui::views::ViewRefControl view_ref_control, - fuchsia::ui::views::ViewRef view_ref, + scenic::ViewRefPair view_ref_pair, UniqueFDIONS fdio_ns, fidl::InterfaceRequest directory_request) : delegate_(delegate), @@ -114,11 +113,14 @@ Engine::Engine(Delegate& delegate, }); }; + fuchsia::ui::views::ViewRef view_ref; + view_ref_pair.view_ref.Clone(&view_ref); + + // Setup the callback that will instantiate the platform view. flutter::Shell::CreateCallback on_create_platform_view = fml::MakeCopyable( [debug_label = thread_label_, - view_ref_control = std::move(view_ref_control), view_ref = std::move(view_ref), runner_services, parent_environment_service_provider = std::move(parent_environment_service_provider), @@ -135,7 +137,6 @@ Engine::Engine(Delegate& delegate, return std::make_unique( shell, // delegate debug_label, // debug label - std::move(view_ref_control), // view control ref std::move(view_ref), // view ref shell.GetTaskRunners(), // task runners std::move(runner_services), @@ -179,6 +180,7 @@ Engine::Engine(Delegate& delegate, flutter::Shell::CreateCallback on_create_rasterizer = fml::MakeCopyable([thread_label = thread_label_, // view_token = std::move(view_token), // + view_ref_pair = std::move(view_ref_pair), // session = std::move(session), // on_session_error_callback, // vsync_event = vsync_event_.get() // @@ -190,6 +192,7 @@ Engine::Engine(Delegate& delegate, std::make_unique( thread_label, // debug label std::move(view_token), // scenic view we attach our tree to + std::move(view_ref_pair), // scenic view ref/view ref control std::move(session), // scenic session on_session_error_callback, // session did encounter error vsync_event // vsync event handle diff --git a/shell/platform/fuchsia/flutter/engine.h b/shell/platform/fuchsia/flutter/engine.h index 7b233dcfcf4b4..3dd68dbea8d9a 100644 --- a/shell/platform/fuchsia/flutter/engine.h +++ b/shell/platform/fuchsia/flutter/engine.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -36,8 +37,7 @@ class Engine final { flutter::Settings settings, fml::RefPtr isolate_snapshot, fuchsia::ui::views::ViewToken view_token, - fuchsia::ui::views::ViewRefControl view_ref_control, - fuchsia::ui::views::ViewRef view_ref, + scenic::ViewRefPair view_ref_pair, UniqueFDIONS fdio_ns, fidl::InterfaceRequest directory_request); ~Engine(); diff --git a/shell/platform/fuchsia/flutter/platform_view.cc b/shell/platform/fuchsia/flutter/platform_view.cc index 7c6886e5b6ec3..1515ff8760a2f 100644 --- a/shell/platform/fuchsia/flutter/platform_view.cc +++ b/shell/platform/fuchsia/flutter/platform_view.cc @@ -80,7 +80,6 @@ void SetInterfaceErrorHandler(fidl::Binding& binding, std::string name) { PlatformView::PlatformView( flutter::PlatformView::Delegate& delegate, std::string debug_label, - fuchsia::ui::views::ViewRefControl view_ref_control, fuchsia::ui::views::ViewRef view_ref, flutter::TaskRunners task_runners, std::shared_ptr runner_services, @@ -95,7 +94,6 @@ PlatformView::PlatformView( zx_handle_t vsync_event_handle) : flutter::PlatformView(delegate, std::move(task_runners)), debug_label_(std::move(debug_label)), - view_ref_control_(std::move(view_ref_control)), view_ref_(std::move(view_ref)), session_listener_binding_(this, std::move(session_listener_request)), session_listener_error_callback_( @@ -595,7 +593,7 @@ void PlatformView::HandlePlatformMessage( // |flutter::PlatformView| // |flutter_runner::AccessibilityBridge::Delegate| void PlatformView::SetSemanticsEnabled(bool enabled) { - flutter::PlatformView::SetSemanticsEnabled(enabled); + flutter::PlatformView::SetSemanticsEnabled(true); if (enabled) { SetAccessibilityFeatures(static_cast( flutter::AccessibilityFeatureFlag::kAccessibleNavigation)); diff --git a/shell/platform/fuchsia/flutter/platform_view.h b/shell/platform/fuchsia/flutter/platform_view.h index e02bf8d0c53d3..4e0f434e97cba 100644 --- a/shell/platform/fuchsia/flutter/platform_view.h +++ b/shell/platform/fuchsia/flutter/platform_view.h @@ -42,7 +42,6 @@ class PlatformView final : public flutter::PlatformView, public: PlatformView(flutter::PlatformView::Delegate& delegate, std::string debug_label, - fuchsia::ui::views::ViewRefControl view_ref_control, fuchsia::ui::views::ViewRef view_ref, flutter::TaskRunners task_runners, std::shared_ptr runner_services, @@ -77,7 +76,6 @@ class PlatformView final : public flutter::PlatformView, const std::string debug_label_; // TODO(MI4-2490): remove once ViewRefControl is passed to Scenic and kept // alive there - const fuchsia::ui::views::ViewRefControl view_ref_control_; const fuchsia::ui::views::ViewRef view_ref_; std::unique_ptr accessibility_bridge_; diff --git a/shell/platform/fuchsia/flutter/session_connection.cc b/shell/platform/fuchsia/flutter/session_connection.cc index f79c5579cf73f..f62cdfa5b9db8 100644 --- a/shell/platform/fuchsia/flutter/session_connection.cc +++ b/shell/platform/fuchsia/flutter/session_connection.cc @@ -15,12 +15,13 @@ namespace flutter_runner { SessionConnection::SessionConnection( std::string debug_label, fuchsia::ui::views::ViewToken view_token, + scenic::ViewRefPair view_ref_pair, fidl::InterfaceHandle session, fml::closure session_error_callback, zx_handle_t vsync_event_handle) : debug_label_(std::move(debug_label)), session_wrapper_(session.Bind(), nullptr), - root_view_(&session_wrapper_, std::move(view_token.value), debug_label), + root_view_(&session_wrapper_, std::move(view_token), std::move(view_ref_pair.control_ref), std::move(view_ref_pair.view_ref), debug_label), root_node_(&session_wrapper_), surface_producer_( std::make_unique(&session_wrapper_)), diff --git a/shell/platform/fuchsia/flutter/session_connection.h b/shell/platform/fuchsia/flutter/session_connection.h index 77a42c2f4f2ba..838e51b2b5ce6 100644 --- a/shell/platform/fuchsia/flutter/session_connection.h +++ b/shell/platform/fuchsia/flutter/session_connection.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "flutter/flow/compositor_context.h" #include "flutter/flow/scene_update_context.h" @@ -29,6 +30,7 @@ class SessionConnection final { public: SessionConnection(std::string debug_label, fuchsia::ui::views::ViewToken view_token, + scenic::ViewRefPair view_ref_pair, fidl::InterfaceHandle session, fml::closure session_error_callback, zx_handle_t vsync_event_handle); From c7aa6d5d4a9874af09177223f4ba1737a91211b4 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 20 Dec 2019 14:43:06 -0800 Subject: [PATCH 2/5] .. --- .../fuchsia/flutter/accessibility_bridge.cc | 81 ++----------------- .../fuchsia/flutter/accessibility_bridge.h | 21 +---- shell/platform/fuchsia/flutter/engine.cc | 29 ++++--- shell/platform/fuchsia/flutter/engine.h | 2 +- .../fuchsia/flutter/session_connection.cc | 6 +- 5 files changed, 26 insertions(+), 113 deletions(-) diff --git a/shell/platform/fuchsia/flutter/accessibility_bridge.cc b/shell/platform/fuchsia/flutter/accessibility_bridge.cc index b78b0fa4a21ec..8f3e28104964a 100644 --- a/shell/platform/fuchsia/flutter/accessibility_bridge.cc +++ b/shell/platform/fuchsia/flutter/accessibility_bridge.cc @@ -99,8 +99,8 @@ std::unordered_set AccessibilityBridge::GetDescendants( auto it = nodes_.find(id); if (it != nodes_.end()) { - auto const& node = it->second; - for (const auto& child : node.children_in_hit_test_order) { + auto const& children = it->second; + for (const auto& child : children) { if (descendents.find(child) == descendents.end()) { to_process.push_back(child); } else { @@ -180,19 +180,10 @@ void AccessibilityBridge::AddSemanticsNodeUpdate( for (const auto& value : update) { size_t this_node_size = sizeof(fuchsia::accessibility::semantics::Node); const auto& flutter_node = value.second; - // Store the nodes in hitTestOrder for later hit testing. - nodes_[flutter_node.id] = { - .id = flutter_node.id, - .flags = flutter_node.flags, - .rect = flutter_node.rect, - .transform = flutter_node.transform, - .children_in_hit_test_order = - std::vector(flutter_node.childrenInHitTestOrder), - }; + nodes_[flutter_node.id] = + std::vector(flutter_node.childrenInTraversalOrder); fuchsia::accessibility::semantics::Node fuchsia_node; std::vector child_ids; - // Send the nodes in traversal order, so the manager can figure out - // traversal. for (int32_t flutter_child_id : flutter_node.childrenInTraversalOrder) { child_ids.push_back(FlutterIdToFuchsiaId(flutter_child_id)); } @@ -230,7 +221,6 @@ void AccessibilityBridge::AddSemanticsNodeUpdate( } PruneUnreachableNodes(); - UpdateScreenRects(kRootNodeId, SkMatrix44::I()); tree_ptr_->UpdateSemanticNodes(std::move(nodes)); // TODO(dnfield): Implement the callback here @@ -238,35 +228,6 @@ void AccessibilityBridge::AddSemanticsNodeUpdate( tree_ptr_->CommitUpdates([]() {}); } -void AccessibilityBridge::UpdateScreenRects(int32_t node_id, - SkMatrix44 parent_transform) { - auto it = nodes_.find(node_id); - if (it == nodes_.end()) { - FML_LOG(ERROR) << "UpdateScreenRects called on unknown node"; - } - auto& node = it->second; - const auto& current_transform = parent_transform * node.transform; - - const auto& rect = node.rect; - std::vector points = { - current_transform * SkVector4(rect.left(), rect.top(), 0, 1), - current_transform * SkVector4(rect.right(), rect.top(), 0, 1), - current_transform * SkVector4(rect.right(), rect.bottom(), 0, 1), - current_transform * SkVector4(rect.left(), rect.bottom(), 0, 1), - }; - - for (SkVector4 point : points) { - node.screen_rect.setLTRB(std::min(node.screen_rect.left(), point.fData[0]), - std::min(node.screen_rect.top(), point.fData[1]), - std::min(node.screen_rect.right(), point.fData[0]), - std::min(node.screen_rect.bottom(), point.fData[1])); - } - - for (uint32_t child_id : node.children_in_hit_test_order) { - UpdateScreenRects(child_id, current_transform); - } -} - // |fuchsia::accessibility::semantics::SemanticListener| void AccessibilityBridge::OnAccessibilityActionRequested( uint32_t node_id, @@ -278,39 +239,7 @@ void AccessibilityBridge::OnAccessibilityActionRequested( void AccessibilityBridge::HitTest( fuchsia::math::PointF local_point, fuchsia::accessibility::semantics::SemanticListener::HitTestCallback - callback) { - fuchsia::accessibility::semantics::Hit hit; - FML_LOG(ERROR) << "Going to try to get node for point " << local_point.x << "," << local_point.y; - GetHitNode(kRootNodeId, local_point.x, local_point.y, &hit); - FML_LOG(ERROR) << "Point " << local_point.x << "," << local_point.y <<" got hit: " << hit.node_id(); - callback(std::move(hit)); -} - -void AccessibilityBridge::GetHitNode( - int32_t node_id, - float x, - float y, - fuchsia::accessibility::semantics::Hit* hit) { - auto it = nodes_.find(node_id); - if (it == nodes_.end()) { - FML_LOG(ERROR) << "Attempted to hit test unkonwn node id: " << node_id; - return; - } - auto const& node = it->second; - - if (node.flags & - static_cast(flutter::SemanticsFlags::kIsHidden) || // - x < node.screen_rect.left() || // - x >= node.screen_rect.right() || // - y < node.screen_rect.top() || // - y >= node.screen_rect.bottom()) { - return; - } - hit->set_node_id(node_id); - for (int32_t child_id : node.children_in_hit_test_order) { - GetHitNode(child_id, x, y, hit); - } -} + callback) {} // |fuchsia::accessibility::semantics::SemanticListener| void AccessibilityBridge::OnSemanticsModeChanged( diff --git a/shell/platform/fuchsia/flutter/accessibility_bridge.h b/shell/platform/fuchsia/flutter/accessibility_bridge.h index 6ed3b4a737dd5..58d53933b47f9 100644 --- a/shell/platform/fuchsia/flutter/accessibility_bridge.h +++ b/shell/platform/fuchsia/flutter/accessibility_bridge.h @@ -86,15 +86,6 @@ class AccessibilityBridge zx_status_t OnHoverMove(double x, double y); private: - struct SemanticsNode { - int32_t id; - int32_t flags; - SkRect rect; - SkRect screen_rect; - SkMatrix44 transform; - std::vector children_in_hit_test_order; - }; - AccessibilityBridge::Delegate& delegate_; static constexpr int32_t kRootNodeId = 0; @@ -105,7 +96,7 @@ class AccessibilityBridge bool semantics_enabled_; // This is the cache of all nodes we've sent to Fuchsia's SemanticsManager. // Assists with pruning unreachable nodes. - std::unordered_map nodes_; + std::unordered_map> nodes_; // Derives the BoundingBox of a Flutter semantics node from its // rect and elevation. @@ -136,16 +127,6 @@ class AccessibilityBridge // May result in a call to FuchsiaAccessibility::Commit(). void PruneUnreachableNodes(); - // Updates the on-screen positions of accessibility elements. - // - // This should be called from Update - void UpdateScreenRects(int32_t node_id, SkMatrix44 parent_transform); - - void GetHitNode(int32_t node_id, - float x, - float y, - fuchsia::accessibility::semantics::Hit* hit); - // |fuchsia::accessibility::semantics::SemanticListener| void OnAccessibilityActionRequested( uint32_t node_id, diff --git a/shell/platform/fuchsia/flutter/engine.cc b/shell/platform/fuchsia/flutter/engine.cc index 79dbc8b62a45b..d476070a95b3d 100644 --- a/shell/platform/fuchsia/flutter/engine.cc +++ b/shell/platform/fuchsia/flutter/engine.cc @@ -116,12 +116,11 @@ Engine::Engine(Delegate& delegate, fuchsia::ui::views::ViewRef view_ref; view_ref_pair.view_ref.Clone(&view_ref); - // Setup the callback that will instantiate the platform view. flutter::Shell::CreateCallback on_create_platform_view = fml::MakeCopyable( - [debug_label = thread_label_, - view_ref = std::move(view_ref), runner_services, + [debug_label = thread_label_, view_ref = std::move(view_ref), + runner_services, parent_environment_service_provider = std::move(parent_environment_service_provider), session_listener_request = std::move(session_listener_request), @@ -135,10 +134,10 @@ Engine::Engine(Delegate& delegate, std::move(on_enable_wireframe_callback), vsync_handle = vsync_event_.get()](flutter::Shell& shell) mutable { return std::make_unique( - shell, // delegate - debug_label, // debug label - std::move(view_ref), // view ref - shell.GetTaskRunners(), // task runners + shell, // delegate + debug_label, // debug label + std::move(view_ref), // view ref + shell.GetTaskRunners(), // task runners std::move(runner_services), std::move(parent_environment_service_provider), // services std::move(session_listener_request), // session listener @@ -178,12 +177,12 @@ Engine::Engine(Delegate& delegate, // Setup the callback that will instantiate the rasterizer. flutter::Shell::CreateCallback on_create_rasterizer = - fml::MakeCopyable([thread_label = thread_label_, // - view_token = std::move(view_token), // - view_ref_pair = std::move(view_ref_pair), // - session = std::move(session), // - on_session_error_callback, // - vsync_event = vsync_event_.get() // + fml::MakeCopyable([thread_label = thread_label_, // + view_token = std::move(view_token), // + view_ref_pair = std::move(view_ref_pair), // + session = std::move(session), // + on_session_error_callback, // + vsync_event = vsync_event_.get() // ](flutter::Shell& shell) mutable { std::unique_ptr compositor_context; { @@ -192,8 +191,8 @@ Engine::Engine(Delegate& delegate, std::make_unique( thread_label, // debug label std::move(view_token), // scenic view we attach our tree to - std::move(view_ref_pair), // scenic view ref/view ref control - std::move(session), // scenic session + std::move(view_ref_pair), // scenic view ref/view ref control + std::move(session), // scenic session on_session_error_callback, // session did encounter error vsync_event // vsync event handle ); diff --git a/shell/platform/fuchsia/flutter/engine.h b/shell/platform/fuchsia/flutter/engine.h index 3dd68dbea8d9a..6f045e330aa03 100644 --- a/shell/platform/fuchsia/flutter/engine.h +++ b/shell/platform/fuchsia/flutter/engine.h @@ -10,8 +10,8 @@ #include #include #include -#include #include +#include #include #include "flutter/fml/macros.h" diff --git a/shell/platform/fuchsia/flutter/session_connection.cc b/shell/platform/fuchsia/flutter/session_connection.cc index f62cdfa5b9db8..c60224bec31f6 100644 --- a/shell/platform/fuchsia/flutter/session_connection.cc +++ b/shell/platform/fuchsia/flutter/session_connection.cc @@ -21,7 +21,11 @@ SessionConnection::SessionConnection( zx_handle_t vsync_event_handle) : debug_label_(std::move(debug_label)), session_wrapper_(session.Bind(), nullptr), - root_view_(&session_wrapper_, std::move(view_token), std::move(view_ref_pair.control_ref), std::move(view_ref_pair.view_ref), debug_label), + root_view_(&session_wrapper_, + std::move(view_token), + std::move(view_ref_pair.control_ref), + std::move(view_ref_pair.view_ref), + debug_label), root_node_(&session_wrapper_), surface_producer_( std::make_unique(&session_wrapper_)), From 7290496cb9108a35d13c258732c8736c43867d9f Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 20 Dec 2019 14:47:38 -0800 Subject: [PATCH 3/5] oops --- shell/platform/fuchsia/flutter/platform_view.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell/platform/fuchsia/flutter/platform_view.cc b/shell/platform/fuchsia/flutter/platform_view.cc index 1515ff8760a2f..7c6886e5b6ec3 100644 --- a/shell/platform/fuchsia/flutter/platform_view.cc +++ b/shell/platform/fuchsia/flutter/platform_view.cc @@ -80,6 +80,7 @@ void SetInterfaceErrorHandler(fidl::Binding& binding, std::string name) { PlatformView::PlatformView( flutter::PlatformView::Delegate& delegate, std::string debug_label, + fuchsia::ui::views::ViewRefControl view_ref_control, fuchsia::ui::views::ViewRef view_ref, flutter::TaskRunners task_runners, std::shared_ptr runner_services, @@ -94,6 +95,7 @@ PlatformView::PlatformView( zx_handle_t vsync_event_handle) : flutter::PlatformView(delegate, std::move(task_runners)), debug_label_(std::move(debug_label)), + view_ref_control_(std::move(view_ref_control)), view_ref_(std::move(view_ref)), session_listener_binding_(this, std::move(session_listener_request)), session_listener_error_callback_( @@ -593,7 +595,7 @@ void PlatformView::HandlePlatformMessage( // |flutter::PlatformView| // |flutter_runner::AccessibilityBridge::Delegate| void PlatformView::SetSemanticsEnabled(bool enabled) { - flutter::PlatformView::SetSemanticsEnabled(true); + flutter::PlatformView::SetSemanticsEnabled(enabled); if (enabled) { SetAccessibilityFeatures(static_cast( flutter::AccessibilityFeatureFlag::kAccessibleNavigation)); From 502179de26799911dcbf91a574f0ae4e69223afc Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 20 Dec 2019 14:54:54 -0800 Subject: [PATCH 4/5] .. --- shell/platform/fuchsia/flutter/platform_view.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/shell/platform/fuchsia/flutter/platform_view.cc b/shell/platform/fuchsia/flutter/platform_view.cc index 7c6886e5b6ec3..3449cb416aba9 100644 --- a/shell/platform/fuchsia/flutter/platform_view.cc +++ b/shell/platform/fuchsia/flutter/platform_view.cc @@ -80,7 +80,6 @@ void SetInterfaceErrorHandler(fidl::Binding& binding, std::string name) { PlatformView::PlatformView( flutter::PlatformView::Delegate& delegate, std::string debug_label, - fuchsia::ui::views::ViewRefControl view_ref_control, fuchsia::ui::views::ViewRef view_ref, flutter::TaskRunners task_runners, std::shared_ptr runner_services, @@ -95,7 +94,6 @@ PlatformView::PlatformView( zx_handle_t vsync_event_handle) : flutter::PlatformView(delegate, std::move(task_runners)), debug_label_(std::move(debug_label)), - view_ref_control_(std::move(view_ref_control)), view_ref_(std::move(view_ref)), session_listener_binding_(this, std::move(session_listener_request)), session_listener_error_callback_( From bc0019f5062e6a7c595699c8324d7decfe8d3cb8 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 20 Dec 2019 15:09:27 -0800 Subject: [PATCH 5/5] update tests --- shell/platform/fuchsia/flutter/platform_view_unittest.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/shell/platform/fuchsia/flutter/platform_view_unittest.cc b/shell/platform/fuchsia/flutter/platform_view_unittest.cc index 8524df10f08e2..a66e261f11130 100644 --- a/shell/platform/fuchsia/flutter/platform_view_unittest.cc +++ b/shell/platform/fuchsia/flutter/platform_view_unittest.cc @@ -92,9 +92,6 @@ TEST_F(PlatformViewTests, ChangesAccessibilitySettings) { auto view_ref = fuchsia::ui::views::ViewRef({ .reference = std::move(a), }); - auto view_ref_control = fuchsia::ui::views::ViewRefControl({ - .reference = std::move(b), - }); flutter::TaskRunners task_runners = flutter::TaskRunners("test_runners", nullptr, nullptr, nullptr, nullptr); @@ -104,7 +101,6 @@ TEST_F(PlatformViewTests, ChangesAccessibilitySettings) { auto platform_view = flutter_runner::PlatformView( delegate, // delegate "test_platform_view", // label - std::move(view_ref_control), // view_ref_control std::move(view_ref), // view_ref std::move(task_runners), // task_runners services_provider.service_directory(), // runner_services @@ -143,9 +139,6 @@ TEST_F(PlatformViewTests, EnableWireframeTest) { auto view_ref = fuchsia::ui::views::ViewRef({ .reference = std::move(a), }); - auto view_ref_control = fuchsia::ui::views::ViewRefControl({ - .reference = std::move(b), - }); flutter::TaskRunners task_runners = flutter::TaskRunners("test_runners", nullptr, nullptr, nullptr, nullptr); @@ -160,7 +153,6 @@ TEST_F(PlatformViewTests, EnableWireframeTest) { auto platform_view = flutter_runner::PlatformView( delegate, // delegate "test_platform_view", // label - std::move(view_ref_control), // view_ref_control std::move(view_ref), // view_refs std::move(task_runners), // task_runners services_provider.service_directory(), // runner_services