chore: Move draggable regions implementation from NativeBrowserView into InspectableWebContentsView (#35007)

* hore: Move draggable regions implementation from NativeBrowserView into InspectableWebContentsView

The draggable regions implementation is related to WebView, so
InspectableWebContentsView is a more appropriate place to put it there.
Also, this refactoring will allow the subsequent extension of the
WebContentsView API, which will eventually replace BrowserView API.

* fix: Lint error

* fix: Adjusted owner-window
This commit is contained in:
Daniel Kocielinski 2022-10-17 11:10:07 -04:00 committed by GitHub
parent f2c341b655
commit 23d4a252c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 397 additions and 360 deletions

View file

@ -20,7 +20,7 @@
#include "shell/browser/api/electron_api_web_contents.h"
#include "shell/browser/native_browser_view_views.h"
#include "shell/browser/ui/inspectable_web_contents.h"
#include "shell/browser/ui/inspectable_web_contents_view.h"
#include "shell/browser/ui/views/inspectable_web_contents_view_views.h"
#include "shell/browser/ui/views/root_view.h"
#include "shell/browser/web_contents_preferences.h"
#include "shell/browser/web_view_manager.h"
@ -1594,11 +1594,11 @@ bool NativeWindowViews::ShouldDescendIntoChildForEventHandling(
const gfx::Point& location) {
// App window should claim mouse events that fall within any BrowserViews'
// draggable region.
for (auto* view : browser_views()) {
auto* native_view = static_cast<NativeBrowserViewViews*>(view);
auto* view_draggable_region = native_view->draggable_region();
if (view_draggable_region &&
view_draggable_region->contains(location.x(), location.y()))
for (auto* view : inspectable_views()) {
auto* inspectable_view =
static_cast<InspectableWebContentsViewViews*>(view);
if (inspectable_view->IsContainedInDraggableRegion(content_view(),
location))
return false;
}