Title: [289751] trunk/Source/WebCore
Revision
289751
Author
[email protected]
Date
2022-02-14 12:12:50 -0800 (Mon, 14 Feb 2022)

Log Message

Add a centerControlsBar in InlineMediaControls
https://bugs.webkit.org/show_bug.cgi?id=236575

Reviewed by Jer Noble.

When a subclass of `InlineMediaControls` implements `_centerContainerButtons()`
to return a list of elements, a control bar will be added as a child of the
media-controls element.

No behavior change so far.

* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls):
(InlineMediaControls.prototype.layout):
(InlineMediaControls.prototype._centerContainerButtons):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289750 => 289751)


--- trunk/Source/WebCore/ChangeLog	2022-02-14 19:57:43 UTC (rev 289750)
+++ trunk/Source/WebCore/ChangeLog	2022-02-14 20:12:50 UTC (rev 289751)
@@ -1,3 +1,21 @@
+2022-02-14  Peng Liu  <[email protected]>
+
+        Add a centerControlsBar in InlineMediaControls
+        https://bugs.webkit.org/show_bug.cgi?id=236575
+
+        Reviewed by Jer Noble.
+
+        When a subclass of `InlineMediaControls` implements `_centerContainerButtons()`
+        to return a list of elements, a control bar will be added as a child of the
+        media-controls element.
+
+        No behavior change so far.
+
+        * Modules/modern-media-controls/controls/inline-media-controls.js:
+        (InlineMediaControls):
+        (InlineMediaControls.prototype.layout):
+        (InlineMediaControls.prototype._centerContainerButtons):
+
 2022-02-14  Antti Koivisto  <[email protected]>
 
         [CSS Container Queries] Implement full query parser and evaluator

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js (289750 => 289751)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js	2022-02-14 19:57:43 UTC (rev 289750)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js	2022-02-14 20:12:50 UTC (rev 289751)
@@ -44,6 +44,9 @@
         this.leftContainer = new ButtonsContainer({ cssClassName: "left" });
         this.rightContainer = new ButtonsContainer({ cssClassName: "right" });
 
+        this.centerControlsBar = new ControlsBar("center");
+        this._centerControlsBarContainer = this.centerControlsBar.addChild(new ButtonsContainer);
+
         this._shouldUseAudioLayout = false;
         this._shouldUseSingleBarLayout = false;
         this.showsStartButton = false;
@@ -129,6 +132,11 @@
         this.topLeftControlsBar.width = this._topLeftControlsBarContainer.width;
         this.topLeftControlsBar.visible = this._topLeftControlsBarContainer.children.some(button => button.visible);
 
+        this._centerControlsBarContainer.children = this._centerContainerButtons();
+        this._centerControlsBarContainer.layout();
+        this.centerControlsBar.width = this._centerControlsBarContainer.width;
+        this.centerControlsBar.visible = this._centerControlsBarContainer.children.some(button => button.visible);
+
         // Compute the visible size for the controls bar.
         if (!this._inlineInsideMargin)
             this._inlineInsideMargin = this.computedValueForStylePropertyInPx("--inline-controls-inside-margin");
@@ -224,6 +232,8 @@
         this.bottomControlsBar.children = controlsBarChildren;
         if (!this._shouldUseAudioLayout && !this._shouldUseSingleBarLayout)
             children.push(this.topLeftControlsBar);
+        if (!this._shouldUseAudioLayout && !this._shouldUseSingleBarLayout && this._centerControlsBarContainer.children.length)
+            children.push(this.centerControlsBar);
         children.push(this.bottomControlsBar);
         if (this.muteButton.style === Button.Styles.Corner || (this.muteButton.dropped && !this._shouldUseAudioLayout && !this._shouldUseSingleBarLayout))
             this._addTopRightBarWithMuteButtonToChildren(children);
@@ -265,6 +275,10 @@
         return [this.skipBackButton, this.playPauseButton, this.skipForwardButton];
     }
 
+    _centerContainerButtons() {
+        return [];
+    }
+
     _rightContainerButtons()
     {
         if (this._shouldUseAudioLayout)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to