From 94585f5889b83d4961a57619aab4f1f041f5b857 Mon Sep 17 00:00:00 2001 From: marekharanczyk <48673767+marekharanczyk@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:17:21 +0200 Subject: [PATCH] fix: propagate layout call to all children of `InspectableWebContentsViewViews` (#39994) Propagate layout call to all children of InspectableWebContentsViewViews. When BrowserView bounds are set from js, those might not trigger layout immediately, sometimes propagating InvalidateLayout call to parent. View is marked as needing layout, expecting to receive it from parent on next layout call. The problem is that BrowserView's view is added as child of InspectableWebContentsViews which does not call setBounds (which would trigger layout) on all of it's children when doing it's layout, so it skips propagating Layout call to its children BrowserViews views, even though those were marked as needing layout. Call base class View::Layout which will iterate over views' children and call Layout on those that were marked as needing them. Fixes #39993. --- .../browser/ui/views/inspectable_web_contents_view_views.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/browser/ui/views/inspectable_web_contents_view_views.cc b/shell/browser/ui/views/inspectable_web_contents_view_views.cc index bb5085c02af82..8fb4d4c61e4f6 100644 --- a/shell/browser/ui/views/inspectable_web_contents_view_views.cc +++ b/shell/browser/ui/views/inspectable_web_contents_view_views.cc @@ -216,6 +216,8 @@ const std::u16string InspectableWebContentsViewViews::GetTitle() { void InspectableWebContentsViewViews::Layout() { if (!devtools_web_view_->GetVisible()) { contents_web_view_->SetBoundsRect(GetContentsBounds()); + // Propagate layout call to all children, for example browser views. + View::Layout(); return; } @@ -233,6 +235,9 @@ void InspectableWebContentsViewViews::Layout() { devtools_web_view_->SetBoundsRect(new_devtools_bounds); contents_web_view_->SetBoundsRect(new_contents_bounds); + // Propagate layout call to all children, for example browser views. + View::Layout(); + if (GetDelegate()) GetDelegate()->DevToolsResized(); }