From cd9c25b331c492953acefb98967400564e2fb644 Mon Sep 17 00:00:00 2001 From: "Wenzhao (Colin) Zang" Date: Tue, 12 Mar 2019 22:45:45 +0000 Subject: [PATCH] Revert "Prevent sending client area for custom-frame widgets" This reverts commit 9f396dd7d7b11da58fc805527d70b5233db0fb96. Reason for revert: crbug.com/939663 Original change's description: > Prevent sending client area for custom-frame widgets > > When custom frame is used for a widget, the "client area" shouldn't > be sent based on the client-area, otherwise the located event on the > frame will be handled incorrectly. > > With this CL, DesktopWindowTreeHostMus checks remove_standard_frame > of Widget::InitParams and adopts that behavior, thus dialogs of > using custom frame and bubbles will not send client area anymore. > > This property is already used in BrowserFrameMash, so > set_auto_update_client_area method is now gone. > > Bug: 935338 > Test: manually > Change-Id: I285954a53fea3f9f32d2fc24847cd869e5d5f939 > Reviewed-on: https://chromium-review.googlesource.com/c/1488179 > Auto-Submit: Jun Mukai > Reviewed-by: Scott Violet > Reviewed-by: Evan Stade > Commit-Queue: Jun Mukai > Cr-Commit-Position: refs/heads/master@{#636248} TBR=mukai@chromium.org,sky@chromium.org,estade@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 935338 Change-Id: I58f0c9ac298485ff8603e52af3a15f3b51f75452 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1510757 Reviewed-by: Wenzhao (Colin) Zang Commit-Queue: Wenzhao (Colin) Zang Cr-Original-Commit-Position: refs/heads/master@{#638916}(cherry picked from commit 9f2aff2392146f578449a2413c91512d838bc12d) Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1519123 Reviewed-by: Jun Mukai Cr-Commit-Position: refs/branch-heads/3729@{#65} Cr-Branched-From: d4a8972e30b604f090aeda5dfff68386ae656267-refs/heads/master@{#638880} --- chrome/browser/ui/views/frame/browser_frame_mash.cc | 3 +++ ui/views/bubble/bubble_dialog_delegate_view.cc | 1 - ui/views/mus/desktop_window_tree_host_mus.cc | 5 ----- ui/views/mus/desktop_window_tree_host_mus.h | 5 +++++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/chrome/browser/ui/views/frame/browser_frame_mash.cc b/chrome/browser/ui/views/frame/browser_frame_mash.cc index 0536dcb426e4..92eb1c3ea958 100644 --- a/chrome/browser/ui/views/frame/browser_frame_mash.cc +++ b/chrome/browser/ui/views/frame/browser_frame_mash.cc @@ -88,6 +88,9 @@ views::Widget::InitParams BrowserFrameMash::GetWidgetParams() { std::unique_ptr desktop_window_tree_host = std::make_unique( std::move(window_tree_host_init_params), browser_frame_, this); + // BrowserNonClientFrameViewAsh::OnBoundsChanged() takes care of updating + // the insets. + desktop_window_tree_host->set_auto_update_client_area(false); SetDesktopWindowTreeHost(std::move(desktop_window_tree_host)); return params; } diff --git a/ui/views/bubble/bubble_dialog_delegate_view.cc b/ui/views/bubble/bubble_dialog_delegate_view.cc index de7bb17532be..c27df5f99247 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view.cc +++ b/ui/views/bubble/bubble_dialog_delegate_view.cc @@ -66,7 +66,6 @@ Widget* CreateBubbleWidget(BubbleDialogDelegateView* bubble) { ? Widget::InitParams::TRANSLUCENT_WINDOW : Widget::InitParams::OPAQUE_WINDOW; bubble_params.accept_events = bubble->accept_events(); - bubble_params.remove_standard_frame = true; // Use a window default shadow if the bubble doesn't provides its own. if (bubble->GetShadow() == BubbleBorder::NO_ASSETS) bubble_params.shadow_type = Widget::InitParams::SHADOW_TYPE_DEFAULT; diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc index 3b0cda498159..14a9bc208b73 100644 --- a/ui/views/mus/desktop_window_tree_host_mus.cc +++ b/ui/views/mus/desktop_window_tree_host_mus.cc @@ -347,11 +347,6 @@ void DesktopWindowTreeHostMus::Init(const Widget::InitParams& params) { SetBoundsInDIP(params.bounds); } - // If the standard frame is not used, the frame area (rendered by the client) - // should be handled by the client, so it shouldn't update the client area - // by itself. See https://crbug.com/935338. - auto_update_client_area_ = !params.remove_standard_frame; - cursor_manager_owner_ = std::make_unique(window()); InitHost(); diff --git a/ui/views/mus/desktop_window_tree_host_mus.h b/ui/views/mus/desktop_window_tree_host_mus.h index 5df1a1cd918f..56cea18185d6 100644 --- a/ui/views/mus/desktop_window_tree_host_mus.h +++ b/ui/views/mus/desktop_window_tree_host_mus.h @@ -40,6 +40,11 @@ class VIEWS_MUS_EXPORT DesktopWindowTreeHostMus // Called when the window was deleted on the server. void ServerDestroyedWindow() { CloseNow(); } + // Controls whether the client area is automatically updated as necessary. + void set_auto_update_client_area(bool value) { + auto_update_client_area_ = value; + } + private: class WindowTreeHostWindowObserver;