From 0026fdb78a68c6a4067191826bd1bfc1d9700998 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 26 Jan 2023 14:04:19 +0100 Subject: [PATCH] fix: resizing borders in nondraggable regions (#37016) * fix: resizing borders in nondraggable regions * chore: remove frame handling from ShouldDescendIntoChildForEventHandling --- shell/browser/native_window.cc | 15 +++++++++++++++ shell/browser/native_window_views.cc | 14 +------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index a566ee8cfb13..3a6654e00da6 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -24,6 +24,10 @@ #include "ui/base/hit_test.h" #include "ui/views/widget/widget.h" +#if !BUILDFLAG(IS_MAC) +#include "shell/browser/ui/views/frameless_view.h" +#endif + #if BUILDFLAG(IS_WIN) #include "ui/base/win/shell.h" #include "ui/display/win/screen_win.h" @@ -693,6 +697,17 @@ void NativeWindow::NotifyWindowMessage(UINT message, #endif int NativeWindow::NonClientHitTest(const gfx::Point& point) { +#if !BUILDFLAG(IS_MAC) + // We need to ensure we account for resizing borders on Windows and Linux. + if ((!has_frame() || has_client_frame()) && IsResizable()) { + auto* frame = + static_cast(widget()->non_client_view()->frame_view()); + int border_hit = frame->ResizingBorderHitTest(point); + if (border_hit != HTNOWHERE) + return border_hit; + } +#endif + for (auto* provider : draggable_region_providers_) { int hit = provider->NonClientHitTest(point); if (hit != HTNOWHERE) diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 436f9d9d137b..19b3b76b223b 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -1592,19 +1592,7 @@ views::View* NativeWindowViews::GetContentsView() { bool NativeWindowViews::ShouldDescendIntoChildForEventHandling( gfx::NativeView child, const gfx::Point& location) { - // App window should claim mouse events that fall within any BrowserViews' - // draggable region. - if (NonClientHitTest(location) != HTNOWHERE) - return false; - - // And the events on border for dragging resizable frameless window. - if ((!has_frame() || has_client_frame()) && resizable_) { - auto* frame = - static_cast(widget()->non_client_view()->frame_view()); - return frame->ResizingBorderHitTest(location) == HTNOWHERE; - } - - return true; + return NonClientHitTest(location) == HTNOWHERE; } views::ClientView* NativeWindowViews::CreateClientView(views::Widget* widget) {