-
Notifications
You must be signed in to change notification settings - Fork 6k
Make updating window metrics multi-view #43366
Conversation
@@ -330,7 +332,8 @@ TEST_F(EngineTest, SpawnResetsViewportMetrics) { | |||
const double kViewHeight = 1024; | |||
old_viewport_metrics.physical_width = kViewWidth; | |||
old_viewport_metrics.physical_height = kViewHeight; | |||
mock_runtime_controller->SetViewportMetrics(old_viewport_metrics); | |||
mock_runtime_controller->SetViewportMetrics(kDefaultViewId, | |||
old_viewport_metrics); |
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.
This test uses PlatformData.viewport_metrics
to check the metrics, which appears to be a single-view assumption. Should we update PlatformData
as part of this change? I'm fine with punting this until later, but I'd consider adding a TODO with a tracking issue.
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.
Yeah I added a TODO at RuntimeController::FlushRuntimeStateToIsolate
. I can add one more 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.
Actually, I don't think an extra one is needed here. PlatformData.viewport_metrics
is definitely something we need to change in the future, which will for sure affect this test. The TODO
I mentioned above should be enough.
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.
Could you put a TODO on PlatformData::viewport_metrics
as well? Skipping the TODO here sounds good though 👍
shell/common/shell.cc
Outdated
@@ -978,9 +979,9 @@ void Shell::OnPlatformViewSetViewportMetrics(const ViewportMetrics& metrics) { | |||
}); | |||
|
|||
task_runners_.GetUITaskRunner()->PostTask( | |||
[engine = engine_->GetWeakPtr(), metrics]() { | |||
[engine = engine_->GetWeakPtr(), metrics, view_id]() { |
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.
Consider swapping captures to match argument order:
[engine = engine_->GetWeakPtr(), metrics, view_id]() { | |
[engine = engine_->GetWeakPtr(), view_id, metrics]() { |
I don't feel strongly about this.
@@ -413,9 +413,10 @@ class PlatformConfiguration final { | |||
/// | |||
/// @param[in] window_id The id of the window to find and return. | |||
/// | |||
/// @return a pointer to the Window. | |||
/// @return a pointer to the Window. Nullptr if the ID is not registered | |||
/// yet. |
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.
Do you remember what our plan is for Canvas::drawShadow
? It uses the implicit view's device pixel ratio:
engine/lib/ui/painting/canvas.cc
Lines 624 to 628 in 1fa222f
SkScalar dpr = static_cast<float>(UIDartState::Current() | |
->platform_configuration() | |
->get_window(0) | |
->viewport_metrics() | |
.device_pixel_ratio); |
If the implicit view is disabled, this will crash
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.
Oh right, I totally forgot. I'll open an issue to discuss this.
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.
…o multiview-window-metrics
@loic-sharma I think I've addressed all of your comments. Would you like to take another look? |
/// rendering viewport in texels as well as edge insets if | ||
/// present. | ||
/// @brief Updates the viewport metrics for a view. The viewport metrics | ||
/// detail the size of the rendering viewport in texels as well as |
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 texels correct here? It looks like that's a thing but it seems like pixels would make more sense.
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.
This comment was written by @/chinmaygarde. Maybe you can ask him for details? (Since I'm not really familiar with texels either...)
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.
LGTM, nice work!
auto label is removed for flutter/engine, pr: 43366, due to - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…130195) flutter/engine@4ca6191...9006633 2023-07-08 [email protected] Make updating window metrics multi-view (flutter/engine#43366) 2023-07-08 [email protected] Rename default views to implicit views (flutter/engine#43364) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR adds multi-view support to various methods that updates the window metrics by adding a `view_id` parameter. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This PR adds multi-view support to various methods that updates the window metrics by adding a
view_id
parameter.Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.