Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 92539f3

Browse files
[fuchsia][scenic] Fix logical size in flatland platform view. (#37053)
This PR fixes a bug identified after DPR feature was added in flatland where currently we do not multiple the logical size of the view by the pixel ratio. This change is getting tested in input tests like mouse-input-test, touch-input-test
1 parent 9915434 commit 92539f3

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

shell/platform/fuchsia/flutter/flatland_platform_view.cc

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,27 @@ void FlatlandPlatformView::OnGetLayout(
8484
}
8585

8686
SetViewportMetrics({
87-
pixel_ratio, // device_pixel_ratio
88-
view_logical_size_.value()[0], // physical_width
89-
view_logical_size_.value()[1], // physical_height
90-
0.0f, // physical_padding_top
91-
0.0f, // physical_padding_right
92-
0.0f, // physical_padding_bottom
93-
0.0f, // physical_padding_left
94-
0.0f, // physical_view_inset_top
95-
0.0f, // physical_view_inset_right
96-
0.0f, // physical_view_inset_bottom
97-
0.0f, // physical_view_inset_left
98-
0.0f, // p_physical_system_gesture_inset_top
99-
0.0f, // p_physical_system_gesture_inset_right
100-
0.0f, // p_physical_system_gesture_inset_bottom
101-
0.0f, // p_physical_system_gesture_inset_left,
102-
-1.0, // p_physical_touch_slop,
103-
{}, // p_physical_display_features_bounds
104-
{}, // p_physical_display_features_type
105-
{}, // p_physical_display_features_state
87+
pixel_ratio, // device_pixel_ratio
88+
std::round(view_logical_size_.value()[0] *
89+
pixel_ratio), // physical_width
90+
std::round(view_logical_size_.value()[1] *
91+
pixel_ratio), // physical_height
92+
0.0f, // physical_padding_top
93+
0.0f, // physical_padding_right
94+
0.0f, // physical_padding_bottom
95+
0.0f, // physical_padding_left
96+
0.0f, // physical_view_inset_top
97+
0.0f, // physical_view_inset_right
98+
0.0f, // physical_view_inset_bottom
99+
0.0f, // physical_view_inset_left
100+
0.0f, // p_physical_system_gesture_inset_top
101+
0.0f, // p_physical_system_gesture_inset_right
102+
0.0f, // p_physical_system_gesture_inset_bottom
103+
0.0f, // p_physical_system_gesture_inset_left,
104+
-1.0, // p_physical_touch_slop,
105+
{}, // p_physical_display_features_bounds
106+
{}, // p_physical_display_features_type
107+
{}, // p_physical_display_features_state
106108
});
107109

108110
parent_viewport_watcher_->GetLayout(

shell/platform/fuchsia/flutter/tests/flatland_platform_view_unittest.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,8 @@ TEST_F(FlatlandPlatformViewTests, SetViewportMetrics) {
672672
watcher.SetLayout(width, height, kDPR);
673673
RunLoopUntilIdle();
674674
EXPECT_EQ(delegate.metrics(),
675-
flutter::ViewportMetrics(kDPR, width, height, -1.0));
675+
flutter::ViewportMetrics(kDPR, std::round(width * kDPR),
676+
std::round(height * kDPR), -1.0));
676677
}
677678

678679
// This test makes sure that the PlatformView correctly registers semantics

0 commit comments

Comments
 (0)