New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bottom view inset to FlutterWindowMetricsEvent #26442
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chinmaygarde can help with the review approvals.
@@ -572,6 +572,8 @@ typedef struct { | |||
size_t left; | |||
/// Vertical physical location of the top of the window on the screen. | |||
size_t top; | |||
/// Bottom inset of window. | |||
double physical_view_inset_bottom; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest adding all 4 inset parameters (top, left, bottom, right) while you're at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can help with the review approvals.
Sure thing. Especially for changes to the public embedder API, it'd be good to be thorough.
shell/common/engine.cc
Outdated
@@ -289,7 +289,15 @@ void Engine::SetViewportMetrics(const ViewportMetrics& metrics) { | |||
bool dimensions_changed = | |||
viewport_metrics_.physical_height != metrics.physical_height || | |||
viewport_metrics_.physical_width != metrics.physical_width || | |||
viewport_metrics_.device_pixel_ratio != metrics.device_pixel_ratio; | |||
viewport_metrics_.device_pixel_ratio != metrics.device_pixel_ratio || | |||
viewport_metrics_.physical_view_inset_top != |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? The dimensions of the view itself aren't changing. It's only that the application now has to account for additional insets like notches and such. The new metrics will get delivered to the application no matter what.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't needed. Removed.
@@ -1388,6 +1388,14 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent( | |||
metrics.physical_width = SAFE_ACCESS(flutter_metrics, width, 0.0); | |||
metrics.physical_height = SAFE_ACCESS(flutter_metrics, height, 0.0); | |||
metrics.device_pixel_ratio = SAFE_ACCESS(flutter_metrics, pixel_ratio, 1.0); | |||
metrics.physical_view_inset_top = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this is just plumbing things through, but, you could add a test for this in the embedder_unittests
harness. Any of the tests in embedder_unittests.cc
could be a fine starting point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
e9fe2e5
to
befaf20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is tested meaningfully, but neither was the old payload. If you want to land this, go for it and I'll add another test for the entire payload. Thanks!
@@ -984,6 +992,10 @@ TEST_F(EmbedderTest, VerifyB143464703WithSoftwareBackend) { | |||
event.width = 1024; | |||
event.height = 600; | |||
event.pixel_ratio = 1.0; | |||
event.physical_view_inset_top = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't asserted that these values are actually checked in Dart code. I mean, wouldn't this test pass no matter what values you specified here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I'll add a better test in this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also add a test with non-zero values.
This pull request is not suitable for automatic merging in its current state.
|
Hi, the test failure has been fixed ToT, could you please rebase. Thanks. |
This is needed to propagate inset values through Flutter. Bug: b/181683254
This is needed to propagate inset values through Flutter. Bug: b/181683254
This is needed to propagate inset values through Flutter.
Bug: b/181683254