fix: draggable region position with docked DevTools (#49846)

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]
2026-02-18 15:01:01 -05:00
committed by GitHub
parent 02e6c95754
commit 2ffb9e1e05
2 changed files with 10 additions and 2 deletions

View File

@@ -83,8 +83,16 @@ void WebContentsView::ApplyBorderRadius() {
int WebContentsView::NonClientHitTest(const gfx::Point& point) {
if (api_web_contents_) {
// Convert the point to the contents view's coordinate space rather than
// the InspectableWebContentsView's coordinate space, because the draggable
// region is relative to the web content area. When DevTools is docked
// (e.g. to the left), the contents view is offset within the parent,
// so we need to account for that offset.
auto* inspectable_view =
api_web_contents_->inspectable_web_contents()->GetView();
auto* contents_view = inspectable_view->GetContentsView();
gfx::Point local_point(point);
views::View::ConvertPointFromWidget(view(), &local_point);
views::View::ConvertPointFromWidget(contents_view, &local_point);
SkRegion* region = api_web_contents_->draggable_region();
if (region && region->contains(local_point.x(), local_point.y()))
return HTCAPTION;

View File

@@ -62,9 +62,9 @@ class InspectableWebContentsView : public views::View {
// views::View:
void Layout(PassKey) override;
private:
views::View* GetContentsView() const;
private:
// Owns us.
raw_ptr<InspectableWebContents> inspectable_web_contents_;