diff --git a/shell/platform/fuchsia/flutter/engine.cc b/shell/platform/fuchsia/flutter/engine.cc index 24166ee1ce94d..792ccc6ee2bad 100644 --- a/shell/platform/fuchsia/flutter/engine.cc +++ b/shell/platform/fuchsia/flutter/engine.cc @@ -166,8 +166,8 @@ void Engine::Initialize( } else { gfx_protocols.set_view_focuser(focuser.NewRequest()); gfx_protocols.set_view_ref_focused(view_ref_focused.NewRequest()); - // TODO(fxbug.dev/85125): Enable TouchSource for GFX. - // gfx_protocols.set_touch_source(touch_source.NewRequest()); + gfx_protocols.set_touch_source(touch_source.NewRequest()); + // GFX used only on products without a mouse. } scenic->CreateSessionT(std::move(gfx_protocols), [] {}); diff --git a/shell/platform/fuchsia/flutter/flatland_platform_view.cc b/shell/platform/fuchsia/flutter/flatland_platform_view.cc index 07e15f8a028e3..07fc7c750438b 100644 --- a/shell/platform/fuchsia/flutter/flatland_platform_view.cc +++ b/shell/platform/fuchsia/flutter/flatland_platform_view.cc @@ -32,8 +32,7 @@ FlatlandPlatformView::FlatlandPlatformView( AwaitVsyncCallback await_vsync_callback, AwaitVsyncForSecondaryCallbackCallback await_vsync_for_secondary_callback_callback) - : PlatformView(true /* is_flatland */, - delegate, + : PlatformView(delegate, std::move(task_runners), std::move(view_ref), std::move(external_view_embedder), diff --git a/shell/platform/fuchsia/flutter/gfx_platform_view.cc b/shell/platform/fuchsia/flutter/gfx_platform_view.cc index 0b11daacf7dc2..4f1f05b1a224a 100644 --- a/shell/platform/fuchsia/flutter/gfx_platform_view.cc +++ b/shell/platform/fuchsia/flutter/gfx_platform_view.cc @@ -33,8 +33,7 @@ GfxPlatformView::GfxPlatformView( AwaitVsyncCallback await_vsync_callback, AwaitVsyncForSecondaryCallbackCallback await_vsync_for_secondary_callback_callback) - : PlatformView(false /* is_flatland */, - delegate, + : PlatformView(delegate, std::move(task_runners), std::move(view_ref), std::move(external_view_embedder), diff --git a/shell/platform/fuchsia/flutter/platform_view.cc b/shell/platform/fuchsia/flutter/platform_view.cc index 1ff88686fc70b..1311ffbdabe11 100644 --- a/shell/platform/fuchsia/flutter/platform_view.cc +++ b/shell/platform/fuchsia/flutter/platform_view.cc @@ -51,7 +51,6 @@ void SetInterfaceErrorHandler(fidl::Binding& binding, std::string name) { } PlatformView::PlatformView( - bool is_flatland, flutter::PlatformView::Delegate& delegate, flutter::TaskRunners task_runners, fuchsia::ui::views::ViewRef view_ref, @@ -122,33 +121,31 @@ PlatformView::PlatformView( }); // Begin watching for pointer events. - if (is_flatland) { // TODO(fxbug.dev/85125): make unconditional - pointer_delegate_->WatchLoop([weak = weak_factory_.GetWeakPtr()]( - std::vector events) { - if (!weak) { - FML_LOG(WARNING) << "PlatformView use-after-free attempted. Ignoring."; - return; - } + pointer_delegate_->WatchLoop([weak = weak_factory_.GetWeakPtr()]( + std::vector events) { + if (!weak) { + FML_LOG(WARNING) << "PlatformView use-after-free attempted. Ignoring."; + return; + } - if (events.size() == 0) { - return; // No work, bounce out. - } + if (events.size() == 0) { + return; // No work, bounce out. + } - // If pixel ratio hasn't been set, use a default value of 1. - const float pixel_ratio = weak->view_pixel_ratio_.value_or(1.f); - auto packet = std::make_unique(events.size()); - for (size_t i = 0; i < events.size(); ++i) { - auto& event = events[i]; - // Translate logical to physical coordinates, as per - // flutter::PointerData contract. Done here because pixel ratio comes - // from the graphics API. - event.physical_x = event.physical_x * pixel_ratio; - event.physical_y = event.physical_y * pixel_ratio; - packet->SetPointerData(i, event); - } - weak->DispatchPointerDataPacket(std::move(packet)); - }); - } + // If pixel ratio hasn't been set, use a default value of 1. + const float pixel_ratio = weak->view_pixel_ratio_.value_or(1.f); + auto packet = std::make_unique(events.size()); + for (size_t i = 0; i < events.size(); ++i) { + auto& event = events[i]; + // Translate logical to physical coordinates, as per + // flutter::PointerData contract. Done here because pixel ratio comes + // from the graphics API. + event.physical_x = event.physical_x * pixel_ratio; + event.physical_y = event.physical_y * pixel_ratio; + packet->SetPointerData(i, event); + } + weak->DispatchPointerDataPacket(std::move(packet)); + }); // Finally! Register the native platform message handlers. RegisterPlatformMessageHandlers(); diff --git a/shell/platform/fuchsia/flutter/platform_view.h b/shell/platform/fuchsia/flutter/platform_view.h index 25d8aedd6b7a8..cdf502291ed1a 100644 --- a/shell/platform/fuchsia/flutter/platform_view.h +++ b/shell/platform/fuchsia/flutter/platform_view.h @@ -64,7 +64,6 @@ class PlatformView : public flutter::PlatformView, private fuchsia::ui::input::InputMethodEditorClient { public: PlatformView( - bool is_flatland, flutter::PlatformView::Delegate& delegate, flutter::TaskRunners task_runners, fuchsia::ui::views::ViewRef view_ref, diff --git a/shell/platform/fuchsia/flutter/platform_view_unittest.cc b/shell/platform/fuchsia/flutter/platform_view_unittest.cc index 2b4e2f5938a22..2f5e8606ebec1 100644 --- a/shell/platform/fuchsia/flutter/platform_view_unittest.cc +++ b/shell/platform/fuchsia/flutter/platform_view_unittest.cc @@ -1385,8 +1385,7 @@ TEST_F(PlatformViewTests, OnShaderWarmup) { EXPECT_EQ(expected_result_string, response->result_string); } -// TODO(fxbug.dev/85125): Enable when GFX converts to TouchSource. -TEST_F(PlatformViewTests, DISABLED_TouchSourceLogicalToPhysicalConversion) { +TEST_F(PlatformViewTests, TouchSourceLogicalToPhysicalConversion) { constexpr std::array, 2> kRect = {{{0, 0}, {20, 20}}}; constexpr std::array kIdentity = {1, 0, 0, 0, 1, 0, 0, 0, 1}; constexpr fuchsia::ui::pointer::TouchInteractionId kIxnOne = { diff --git a/shell/platform/fuchsia/flutter/pointer_delegate.cc b/shell/platform/fuchsia/flutter/pointer_delegate.cc index 4e383197d7736..cec2a4cab766e 100644 --- a/shell/platform/fuchsia/flutter/pointer_delegate.cc +++ b/shell/platform/fuchsia/flutter/pointer_delegate.cc @@ -411,7 +411,9 @@ void PointerDelegate::WatchLoop( // Start watching both channels. touch_source_->Watch(std::move(touch_responses_), /*copy*/ touch_responder_); touch_responses_.clear(); - mouse_source_->Watch(/*copy*/ mouse_responder_); + if (mouse_source_) { + mouse_source_->Watch(/*copy*/ mouse_responder_); + } } } // namespace flutter_runner