diff --git a/Source/WebCore/Modules/modern-media-controls/controls/media-controls.js b/Source/WebCore/Modules/modern-media-controls/controls/media-controls.js index da549e80c6a34..679191d4e46f3 100644 --- a/Source/WebCore/Modules/modern-media-controls/controls/media-controls.js +++ b/Source/WebCore/Modules/modern-media-controls/controls/media-controls.js @@ -248,4 +248,16 @@ class MediaControls extends LayoutNode else super.commitProperty(propertyName); } + + disable() + { + this.element.removeEventListener("focusin", this); + window.removeEventListener("dragstart", this, true); + } + + reenable() + { + this.element.addEventListener("focusin", this); + window.addEventListener("dragstart", this, true); + } } diff --git a/Source/WebCore/Modules/modern-media-controls/media/media-controller.js b/Source/WebCore/Modules/modern-media-controls/media/media-controller.js index 8ed8708690836..13f0450736f1a 100644 --- a/Source/WebCore/Modules/modern-media-controls/media/media-controller.js +++ b/Source/WebCore/Modules/modern-media-controls/media/media-controller.js @@ -222,6 +222,9 @@ class MediaController deinitialize() { this.shadowRoot.removeChild(this.container); + window.removeEventListener("keydown", this); + if (this.controls) + this.controls.disable(); return true; } @@ -232,6 +235,9 @@ class MediaController this.mediaWeakRef = new WeakRef(media); this.host = host; shadowRoot.appendChild(this.container); + window.addEventListener("keydown", this); + if (this.controls) + this.controls.reenable(); return true; } @@ -269,6 +275,9 @@ class MediaController supportingObject.disable(); } + if (previousControls) + previousControls.disable(); + this.controls = new ControlsClass; this.controls.delegate = this;