fix: context-menu emitted twice (#44997)

* fix: context-menu emitted twice

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* refactor: simplify disabling draggable regions

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* cleanup

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
This commit is contained in:
trop[bot] 2024-12-11 13:24:32 -05:00 committed by GitHub
parent cfe549c739
commit 521835d70b
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
@ -485,13 +489,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;
@ -888,8 +886,6 @@ class WebContents final : public ExclusiveAccessContext,
std::unique_ptr<SkRegion> draggable_region_;
bool force_non_draggable_ = false;
base::WeakPtrFactory<WebContents> weak_factory_{this};
};