refactor: move draggable regions to WebContents (#36230)

This commit is contained in:
Jeremy Rose 2022-11-07 10:15:57 -08:00 committed by GitHub
parent 2008c9a5d0
commit 184ac2b382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 96 additions and 202 deletions

View file

@ -76,30 +76,19 @@ gfx::Rect FramelessView::GetWindowBoundsForClientBounds(
return window_bounds;
}
int FramelessView::NonClientHitTest(const gfx::Point& cursor) {
int FramelessView::NonClientHitTest(const gfx::Point& point) {
if (frame_->IsFullscreen())
return HTCLIENT;
// Check attached BrowserViews for potential draggable areas.
for (auto* view : window_->inspectable_views()) {
auto* inspectable_view =
static_cast<InspectableWebContentsViewViews*>(view);
if (inspectable_view->IsContainedInDraggableRegion(window_->content_view(),
cursor))
return HTCAPTION;
}
int contents_hit_test = window_->NonClientHitTest(point);
if (contents_hit_test != HTNOWHERE)
return contents_hit_test;
// Support resizing frameless window by dragging the border.
int frame_component = ResizingBorderHitTest(cursor);
int frame_component = ResizingBorderHitTest(point);
if (frame_component != HTNOWHERE)
return frame_component;
// Check for possible draggable region in the client area for the frameless
// window.
const SkRegion* draggable_region = window_->draggable_region();
if (draggable_region && draggable_region->contains(cursor.x(), cursor.y()))
return HTCAPTION;
return HTCLIENT;
}