rebuild-Linux-frame-button-cache-when-activation.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From d10f885b9327399be9348b780967ebd6b7f2c4bc Mon Sep 17 00:00:00 2001
  2. From: Tom Anderson <thomasanderson@chromium.org>
  3. Date: Fri, 7 Feb 2020 22:44:54 +0000
  4. Subject: [PATCH] Rebuild Linux frame button cache when activation state
  5. changes
  6. This fixes an issue where the frame buttons would always render in an
  7. inactive state on Linux (see repro steps in bug 1049258).
  8. Bug: 1049258
  9. R=sky
  10. CC=pkasting
  11. Change-Id: Ic5af33199003e1d1cdf6cedf506e32388ea11fa9
  12. Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2044538
  13. Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
  14. Commit-Queue: Scott Violet <sky@chromium.org>
  15. Reviewed-by: Scott Violet <sky@chromium.org>
  16. Cr-Commit-Position: refs/heads/master@{#739585}
  17. ---
  18. .../ui/views/frame/desktop_linux_browser_frame_view.cc | 6 +++---
  19. .../desktop_aura/desktop_window_tree_host_platform.cc | 3 +++
  20. 2 files changed, 6 insertions(+), 3 deletions(-)
  21. diff --git a/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc b/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc
  22. index 954e776057f..4f579955675 100644
  23. --- a/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc
  24. +++ b/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view.cc
  25. @@ -22,13 +22,13 @@ DesktopLinuxBrowserFrameView::DesktopLinuxBrowserFrameView(
  26. : OpaqueBrowserFrameView(frame, browser_view, layout),
  27. nav_button_provider_(std::move(nav_button_provider)) {}
  28. -DesktopLinuxBrowserFrameView::~DesktopLinuxBrowserFrameView() {}
  29. +DesktopLinuxBrowserFrameView::~DesktopLinuxBrowserFrameView() = default;
  30. void DesktopLinuxBrowserFrameView::Layout() {
  31. // Calling MaybeUpdateCachedFrameButtonImages() from Layout() is sufficient to
  32. // catch all cases that could update the appearance, since
  33. - // DesktopWindowTreeHostPlatform::OnWindowStateChanged() does a layout any
  34. - // time any properties change.
  35. + // DesktopWindowTreeHostPlatform::On{Window,Activation}StateChanged() does a
  36. + // layout any time the maximized and activation state changes, respectively.
  37. MaybeUpdateCachedFrameButtonImages();
  38. OpaqueBrowserFrameView::Layout();
  39. }
  40. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
  41. index 9c695d8e5b1..9662f19aa90 100644
  42. --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
  43. +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
  44. @@ -677,9 +677,12 @@ void DesktopWindowTreeHostPlatform::OnCloseRequest() {
  45. }
  46. void DesktopWindowTreeHostPlatform::OnActivationChanged(bool active) {
  47. + if (is_active_ == active)
  48. + return;
  49. is_active_ = active;
  50. aura::WindowTreeHostPlatform::OnActivationChanged(active);
  51. desktop_native_widget_aura_->HandleActivationChanged(active);
  52. + ScheduleRelayout();
  53. }
  54. base::Optional<gfx::Size>