fix: resizing borders in nondraggable regions (#37037)

* fix: resizing borders in nondraggable regions

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: remove frame handling from ShouldDescendIntoChildForEventHandling

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2023-01-30 11:50:01 +01:00
committed by GitHub
parent 39203e93c0
commit e69270a600
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"
@@ -691,6 +695,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) {