fix: allow contextmenu event in draggable regions (#37386)

This commit is contained in:
Jeremy Rose 2023-02-23 16:05:30 -08:00 committed by GitHub
parent a3e3efe4c4
commit e27905c765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 23 deletions

View file

@ -442,7 +442,13 @@ class WebContents : public ExclusiveAccessContext,
// content::RenderWidgetHost::InputEventObserver:
void OnInputEvent(const blink::WebInputEvent& event) override;
SkRegion* draggable_region() { return draggable_region_.get(); }
SkRegion* draggable_region() {
return force_non_draggable_ ? nullptr : draggable_region_.get();
}
void SetForceNonDraggable(bool force_non_draggable) {
force_non_draggable_ = force_non_draggable;
}
// disable copy
WebContents(const WebContents&) = delete;
@ -826,6 +832,8 @@ class WebContents : public ExclusiveAccessContext,
std::unique_ptr<SkRegion> draggable_region_;
bool force_non_draggable_ = false;
base::WeakPtrFactory<WebContents> weak_factory_{this};
};