mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: ensure WebContents before checking draggable region (#41154)
fix: ensure WebContents before checking draggable region
This commit is contained in:
@@ -81,11 +81,14 @@ void WebContentsView::SetBackgroundColor(std::optional<WrappedSkColor> color) {
|
||||
}
|
||||
|
||||
int WebContentsView::NonClientHitTest(const gfx::Point& point) {
|
||||
gfx::Point local_point(point);
|
||||
views::View::ConvertPointFromWidget(view(), &local_point);
|
||||
SkRegion* region = api_web_contents_->draggable_region();
|
||||
if (region && region->contains(local_point.x(), local_point.y()))
|
||||
return HTCAPTION;
|
||||
if (api_web_contents_) {
|
||||
gfx::Point local_point(point);
|
||||
views::View::ConvertPointFromWidget(view(), &local_point);
|
||||
SkRegion* region = api_web_contents_->draggable_region();
|
||||
if (region && region->contains(local_point.x(), local_point.y()))
|
||||
return HTCAPTION;
|
||||
}
|
||||
|
||||
return HTNOWHERE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user