refactor: move draggable regions to WebContents (#36230)
This commit is contained in:
parent
2008c9a5d0
commit
184ac2b382
22 changed files with 96 additions and 202 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue