fix: resizing borders in nondraggable regions (#37016)

* fix: resizing borders in nondraggable regions

* chore: remove frame handling from ShouldDescendIntoChildForEventHandling
This commit is contained in:
Shelley Vohr 2023-01-26 14:04:19 +01:00 committed by GitHub
parent 1486cbdf64
commit 0026fdb78a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View file

@ -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<FramelessView*>(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)

View file

@ -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<FramelessView*>(widget()->non_client_view()->frame_view());
return frame->ResizingBorderHitTest(location) == HTNOWHERE;
}
return true;
return NonClientHitTest(location) == HTNOWHERE;
}
views::ClientView* NativeWindowViews::CreateClientView(views::Widget* widget) {