fix: context-menu emitted twice (#44978)

* fix: context-menu emitted twice

* refactor: simplify disabling draggable regions

* cleanup
This commit is contained in:
Sam Maddock 2024-12-11 11:42:48 -05:00 committed by GitHub
parent cf5a4640f5
commit 2c698d3f75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 51 additions and 65 deletions

View file

@ -151,6 +151,10 @@ class WebContents final : public ExclusiveAccessContext,
static WebContents* FromID(int32_t id);
static std::list<WebContents*> GetWebContentsList();
// Whether to disable draggable regions globally. This can be used to allow
// events to skip client region hit tests.
static void SetDisableDraggableRegions(bool disable);
// Get the V8 wrapper of the |web_contents|, or create one if not existed.
//
// The lifetime of |web_contents| is NOT managed by this class, and the type
@ -486,13 +490,7 @@ class WebContents final : public ExclusiveAccessContext,
void PDFReadyToPrint();
SkRegion* draggable_region() {
return force_non_draggable_ ? nullptr : draggable_region_.get();
}
void SetForceNonDraggable(bool force_non_draggable) {
force_non_draggable_ = force_non_draggable;
}
SkRegion* draggable_region();
// disable copy
WebContents(const WebContents&) = delete;
@ -892,8 +890,6 @@ class WebContents final : public ExclusiveAccessContext,
std::unique_ptr<SkRegion> draggable_region_;
bool force_non_draggable_ = false;
base::WeakPtrFactory<WebContents> weak_factory_{this};
};