fix: default offset when no drag regions (#27147)
This commit is contained in:
parent
3455136e9d
commit
6307b52dc5
2 changed files with 8 additions and 5 deletions
|
@ -294,11 +294,14 @@ void NativeBrowserViewMac::UpdateDraggableRegions(
|
||||||
draggable_regions_ = mojo::Clone(regions);
|
draggable_regions_ = mojo::Clone(regions);
|
||||||
|
|
||||||
std::vector<gfx::Rect> drag_exclude_rects;
|
std::vector<gfx::Rect> drag_exclude_rects;
|
||||||
if (regions.empty()) {
|
if (draggable_regions_.empty()) {
|
||||||
drag_exclude_rects.emplace_back(0, 0, webViewWidth, webViewHeight);
|
const auto bounds = GetBounds();
|
||||||
|
drag_exclude_rects.emplace_back(bounds.x(), bounds.y(), webViewWidth,
|
||||||
|
webViewHeight);
|
||||||
} else {
|
} else {
|
||||||
drag_exclude_rects = CalculateNonDraggableRegions(
|
drag_exclude_rects = CalculateNonDraggableRegions(
|
||||||
DraggableRegionsToSkRegion(regions), webViewWidth, webViewHeight);
|
DraggableRegionsToSkRegion(draggable_regions_), webViewWidth,
|
||||||
|
webViewHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateDraggableRegions(drag_exclude_rects);
|
UpdateDraggableRegions(drag_exclude_rects);
|
||||||
|
|
|
@ -32,8 +32,8 @@ std::unique_ptr<SkRegion> DraggableRegionsToSkRegion(
|
||||||
auto sk_region = std::make_unique<SkRegion>();
|
auto sk_region = std::make_unique<SkRegion>();
|
||||||
for (const auto& region : regions) {
|
for (const auto& region : regions) {
|
||||||
sk_region->op(
|
sk_region->op(
|
||||||
{region->bounds.x(), region->bounds.y(), region->bounds.right(),
|
SkIRect::MakeLTRB(region->bounds.x(), region->bounds.y(),
|
||||||
region->bounds.bottom()},
|
region->bounds.right(), region->bounds.bottom()),
|
||||||
region->draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
|
region->draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
|
||||||
}
|
}
|
||||||
return sk_region;
|
return sk_region;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue