refactor: mojofy draggable regions (#18536)
This commit is contained in:
parent
52c76d737a
commit
0b25176893
17 changed files with 59 additions and 91 deletions
|
@ -12,7 +12,6 @@
|
|||
#include "atom/browser/native_browser_view.h"
|
||||
#include "atom/browser/native_window_mac.h"
|
||||
#include "atom/browser/ui/inspectable_web_contents_view.h"
|
||||
#include "atom/common/draggable_region.h"
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
|
||||
@interface NSView (WebContentsView)
|
||||
|
@ -76,8 +75,7 @@ void BrowserWindow::OverrideNSWindowContentView(InspectableWebContents* iwc) {
|
|||
}
|
||||
|
||||
void BrowserWindow::UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions) {
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) {
|
||||
if (window_->has_frame())
|
||||
return;
|
||||
|
||||
|
@ -103,7 +101,9 @@ void BrowserWindow::UpdateDraggableRegions(
|
|||
|
||||
// Draggable regions is implemented by having the whole web view draggable
|
||||
// (mouseDownCanMoveWindow) and overlaying regions that are not draggable.
|
||||
draggable_regions_ = regions;
|
||||
draggable_regions_.clear();
|
||||
for (const auto& r : regions)
|
||||
draggable_regions_.push_back(r.Clone());
|
||||
std::vector<gfx::Rect> drag_exclude_rects;
|
||||
if (regions.empty()) {
|
||||
drag_exclude_rects.push_back(gfx::Rect(0, 0, webViewWidth, webViewHeight));
|
||||
|
@ -114,7 +114,7 @@ void BrowserWindow::UpdateDraggableRegions(
|
|||
|
||||
auto browser_views = window_->browser_views();
|
||||
for (NativeBrowserView* view : browser_views) {
|
||||
(view)->UpdateDraggableRegions(drag_exclude_rects);
|
||||
view->UpdateDraggableRegions(drag_exclude_rects);
|
||||
}
|
||||
|
||||
// Create and add a ControlRegionView for each region that needs to be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue