[fuchsia][scenic] Fix logical size in flatland platform view. (flutter/engine#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
This commit is contained in:
@@ -84,25 +84,27 @@ void FlatlandPlatformView::OnGetLayout(
|
||||
}
|
||||
|
||||
SetViewportMetrics({
|
||||
pixel_ratio, // device_pixel_ratio
|
||||
view_logical_size_.value()[0], // physical_width
|
||||
view_logical_size_.value()[1], // physical_height
|
||||
0.0f, // physical_padding_top
|
||||
0.0f, // physical_padding_right
|
||||
0.0f, // physical_padding_bottom
|
||||
0.0f, // physical_padding_left
|
||||
0.0f, // physical_view_inset_top
|
||||
0.0f, // physical_view_inset_right
|
||||
0.0f, // physical_view_inset_bottom
|
||||
0.0f, // physical_view_inset_left
|
||||
0.0f, // p_physical_system_gesture_inset_top
|
||||
0.0f, // p_physical_system_gesture_inset_right
|
||||
0.0f, // p_physical_system_gesture_inset_bottom
|
||||
0.0f, // p_physical_system_gesture_inset_left,
|
||||
-1.0, // p_physical_touch_slop,
|
||||
{}, // p_physical_display_features_bounds
|
||||
{}, // p_physical_display_features_type
|
||||
{}, // p_physical_display_features_state
|
||||
pixel_ratio, // device_pixel_ratio
|
||||
std::round(view_logical_size_.value()[0] *
|
||||
pixel_ratio), // physical_width
|
||||
std::round(view_logical_size_.value()[1] *
|
||||
pixel_ratio), // physical_height
|
||||
0.0f, // physical_padding_top
|
||||
0.0f, // physical_padding_right
|
||||
0.0f, // physical_padding_bottom
|
||||
0.0f, // physical_padding_left
|
||||
0.0f, // physical_view_inset_top
|
||||
0.0f, // physical_view_inset_right
|
||||
0.0f, // physical_view_inset_bottom
|
||||
0.0f, // physical_view_inset_left
|
||||
0.0f, // p_physical_system_gesture_inset_top
|
||||
0.0f, // p_physical_system_gesture_inset_right
|
||||
0.0f, // p_physical_system_gesture_inset_bottom
|
||||
0.0f, // p_physical_system_gesture_inset_left,
|
||||
-1.0, // p_physical_touch_slop,
|
||||
{}, // p_physical_display_features_bounds
|
||||
{}, // p_physical_display_features_type
|
||||
{}, // p_physical_display_features_state
|
||||
});
|
||||
|
||||
parent_viewport_watcher_->GetLayout(
|
||||
|
||||
@@ -672,7 +672,8 @@ TEST_F(FlatlandPlatformViewTests, SetViewportMetrics) {
|
||||
watcher.SetLayout(width, height, kDPR);
|
||||
RunLoopUntilIdle();
|
||||
EXPECT_EQ(delegate.metrics(),
|
||||
flutter::ViewportMetrics(kDPR, width, height, -1.0));
|
||||
flutter::ViewportMetrics(kDPR, std::round(width * kDPR),
|
||||
std::round(height * kDPR), -1.0));
|
||||
}
|
||||
|
||||
// This test makes sure that the PlatformView correctly registers semantics
|
||||
|
||||
Reference in New Issue
Block a user