Title: [279489] trunk/Source/WebCore
Revision
279489
Author
amir_m...@apple.com
Date
2021-07-01 17:22:27 -0700 (Thu, 01 Jul 2021)

Log Message

Unreviewed, reverting r279481.

Broke a pre-existing test

Reverted changeset:

"Move BottomControlsBarHeight and InsideMargin to be computed
at runtime"
https://bugs.webkit.org/show_bug.cgi?id=227505
https://commits.webkit.org/r279481

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279488 => 279489)


--- trunk/Source/WebCore/ChangeLog	2021-07-02 00:20:52 UTC (rev 279488)
+++ trunk/Source/WebCore/ChangeLog	2021-07-02 00:22:27 UTC (rev 279489)
@@ -1,3 +1,16 @@
+2021-07-01  Amir Mark Jr  <amir_m...@apple.com>
+
+        Unreviewed, reverting r279481.
+
+        Broke a pre-existing test
+
+        Reverted changeset:
+
+        "Move BottomControlsBarHeight and InsideMargin to be computed
+        at runtime"
+        https://bugs.webkit.org/show_bug.cgi?id=227505
+        https://commits.webkit.org/r279481
+
 2021-07-01  Eric Carlson  <eric.carl...@apple.com>
 
         WebAudio auto-play policy should come from top document

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


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js	2021-07-02 00:20:52 UTC (rev 279488)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js	2021-07-02 00:22:27 UTC (rev 279489)
@@ -23,6 +23,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+const InsideMargin = 6; // Minimum margin to guarantee around all controls, this constant needs to stay in sync with the --inline-controls-inside-margin CSS variable.
+const BottomControlsBarHeight = 31; // This constant needs to stay in sync with the --inline-controls-bar-height CSS variable.
+
 class InlineMediaControls extends MediaControls
 {
 
@@ -130,9 +133,7 @@
         this.topLeftControlsBar.visible = this._topLeftControlsBarContainer.children.some(button => button.visible);
 
         // Compute the visible size for the controls bar.
-        if (!this._inlineInsideMargin)
-            this._inlineInsideMargin = this.computedValueForStylePropertyInPx("--inline-controls-inside-margin");
-        this.bottomControlsBar.width = this._shouldUseAudioLayout ? this.width : (this.width - 2 * this._inlineInsideMargin);
+        this.bottomControlsBar.width = this._shouldUseAudioLayout ? this.width : (this.width - 2 * InsideMargin);
 
         // Compute the absolute minimum width to display the center control (status label or time control).
         const centerControl = this.statusLabel.enabled ? this.statusLabel : this.timeControl;
@@ -217,9 +218,7 @@
 
         // Ensure we position the bottom controls bar at the bottom of the frame, accounting for
         // the inside margin, unless this would yield a position outside of the frame.
-        if (!this._inlineBottomControlsBarHeight)
-            this._inlineBottomControlsBarHeight = this.computedValueForStylePropertyInPx("--inline-controls-bar-height");
-        this.bottomControlsBar.y = Math.max(0, this.height - this._inlineBottomControlsBarHeight - this._inlineInsideMargin);
+        this.bottomControlsBar.y = Math.max(0, this.height - BottomControlsBarHeight - InsideMargin);
 
         this.bottomControlsBar.children = controlsBarChildren;
         if (!this._shouldUseAudioLayout && !this._shouldUseSingleBarLayout)

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js (279488 => 279489)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js	2021-07-02 00:20:52 UTC (rev 279488)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js	2021-07-02 00:22:27 UTC (rev 279489)
@@ -229,21 +229,6 @@
             this._updateDirtyState();
     }
 
-    computedValueForStyleProperty(propertyName)
-    {
-        return window.getComputedStyle(this.element).getPropertyValue(propertyName);
-    }
-
-    computedValueForStylePropertyInPx(propertyName)
-    {
-        const value = this.computedValueForStyleProperty(propertyName);
-        if (!value)
-            return 0;
-        if (!value.endsWith("px"))
-            return 0;
-        return parseFloat(value);
-    }
-
     // Protected
 
     layout()

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-inline-media-controls.js (279488 => 279489)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-inline-media-controls.js	2021-07-02 00:20:52 UTC (rev 279488)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-inline-media-controls.js	2021-07-02 00:22:27 UTC (rev 279489)
@@ -59,13 +59,8 @@
         if (!this._volumeSliderContainer)
             return;
 
-        if (!this._inlineInsideMargin)
-            this._inlineInsideMargin = this.computedValueForStylePropertyInPx("--inline-controls-inside-margin");
-        if (!this._inlineBottomControlsBarHeight)
-            this._inlineBottomControlsBarHeight = this.computedValueForStylePropertyInPx("--inline-controls-bar-height");
-
         this._volumeSliderContainer.x = this.rightContainer.x + this.muteButton.x;
-        this._volumeSliderContainer.y = this.bottomControlsBar.y - this._inlineBottomControlsBarHeight - this._inlineInsideMargin;
+        this._volumeSliderContainer.y = this.bottomControlsBar.y - BottomControlsBarHeight - InsideMargin;
     }
 
     get preferredMuteButtonStyle()

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/media-controls.css (279488 => 279489)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/media-controls.css	2021-07-02 00:20:52 UTC (rev 279488)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/media-controls.css	2021-07-02 00:22:27 UTC (rev 279489)
@@ -37,6 +37,7 @@
 }
 
 * {
+    /* This constant needs to stay in sync with the InsideMargin JS constant. */
     --inline-controls-inside-margin: 6px;
     --fullscreen-controls-bar-height: 75px;
     --primary-glyph-color: rgba(255, 255, 255, 0.75);
@@ -44,6 +45,7 @@
 }
 
 :host(audio), :host(video.media-document.audio), * {
+    /* This constant needs to stay in sync with the BottomControlsBarHeight JS constant. */
     --inline-controls-bar-height: 31px;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to