fix: default offset when no drag regions (#27147)

This commit is contained in:
Shelley Vohr 2021-01-04 14:01:32 -08:00 committed by GitHub
parent 3455136e9d
commit 6307b52dc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -294,11 +294,14 @@ void NativeBrowserViewMac::UpdateDraggableRegions(
draggable_regions_ = mojo::Clone(regions);
std::vector<gfx::Rect> drag_exclude_rects;
if (regions.empty()) {
drag_exclude_rects.emplace_back(0, 0, webViewWidth, webViewHeight);
if (draggable_regions_.empty()) {
const auto bounds = GetBounds();
drag_exclude_rects.emplace_back(bounds.x(), bounds.y(), webViewWidth,
webViewHeight);
} else {
drag_exclude_rects = CalculateNonDraggableRegions(
DraggableRegionsToSkRegion(regions), webViewWidth, webViewHeight);
DraggableRegionsToSkRegion(draggable_regions_), webViewWidth,
webViewHeight);
}
UpdateDraggableRegions(drag_exclude_rects);