mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: default offset when no drag regions (#27183)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -296,11 +296,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);
|
||||
|
||||
@@ -32,8 +32,8 @@ std::unique_ptr<SkRegion> DraggableRegionsToSkRegion(
|
||||
auto sk_region = std::make_unique<SkRegion>();
|
||||
for (const auto& region : regions) {
|
||||
sk_region->op(
|
||||
{region->bounds.x(), region->bounds.y(), region->bounds.right(),
|
||||
region->bounds.bottom()},
|
||||
SkIRect::MakeLTRB(region->bounds.x(), region->bounds.y(),
|
||||
region->bounds.right(), region->bounds.bottom()),
|
||||
region->draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
|
||||
}
|
||||
return sk_region;
|
||||
|
||||
Reference in New Issue
Block a user