[Media Controls] Allow for a single mute and volume button
Created attachment 439049 [details] Patch
<rdar://problem/79956248>
Committed r282971 (242061@main): <https://commits.webkit.org/242061@main>
Comment on attachment 439049 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=439049&action=review > Source/WebCore/Modules/modern-media-controls/controls/range-button.js:75 > + if (event.currentTarget === this.element && event.type == "pointerdown") oops `==` > Source/WebCore/Modules/modern-media-controls/controls/range-button.js:101 > + if (this.uiDelegate && typeof this.uiDelegate.controlValueWillStartChanging === "function") > + this.uiDelegate.controlValueWillStartChanging(this); NIT: you can simplify this as ``` this.uiDelegate?.controlValueWillStartChanging?.(this); ``` > Source/WebCore/Modules/modern-media-controls/controls/range-button.js:134 > + if (this.uiDelegate && typeof this.uiDelegate.controlValueDidStopChanging === "function") > + this.uiDelegate.controlValueDidStopChanging(this); ditto (:100) ``` this.uiDelegate?.controlValueDidStopChanging?.(this); ``` > Source/WebCore/Modules/modern-media-controls/controls/range-button.js:138 > + if (this._enabled && this.uiDelegate && typeof this.uiDelegate.buttonWasPressed === "function") > + this.uiDelegate.buttonWasPressed(this); ditto (:100) ``` if (this._enabled) this.uiDelegate?.buttonWasPressed?.(this); ``` > Source/WebCore/Modules/modern-media-controls/controls/volume-button.js:26 > +class VolumeButton extends RangeButton I wonder if instead of basically duplicating the entirety of `MuteButton` we could've had `MuteButton` extend from `RangeButton` and just have a `set allowsSlidingToAdjustVolume` to switch behavior at runtime or something 🤔