Changeset 279481 in webkit
- Timestamp:
- Jul 1, 2021, 1:28:32 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
Modules/modern-media-controls/controls/inline-media-controls.js (modified) (3 diffs)
-
Modules/modern-media-controls/controls/layout-node.js (modified) (1 diff)
-
Modules/modern-media-controls/controls/macos-inline-media-controls.js (modified) (1 diff)
-
Modules/modern-media-controls/controls/media-controls.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r279480 r279481 1 2021-07-01 Dean Jackson <dino@apple.com> 2 3 Move BottomControlsBarHeight and InsideMargin to be computed at runtime 4 https://bugs.webkit.org/show_bug.cgi?id=227505 5 <rdar://problem/79932256> 6 7 Reviewed by Devin Rousso. 8 9 Rather than having two JS constants that have to be kept in sync 10 with CSS, simply retrieve the value from the computed style. 11 12 No change in behaviour. 13 14 * Modules/modern-media-controls/controls/inline-media-controls.js: 15 (InlineMediaControls.prototype.layout): 16 * Modules/modern-media-controls/controls/media-controls.css: 17 (:host(audio), :host(video.media-document.audio), *): 18 * Modules/modern-media-controls/controls/layout-node.js: Add two helpers to 19 retrive computed style values. 20 1 21 2021-07-01 Brady Eidson <beidson@apple.com> 2 22 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js
r275358 r279481 24 24 */ 25 25 26 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.27 const BottomControlsBarHeight = 31; // This constant needs to stay in sync with the --inline-controls-bar-height CSS variable.28 29 26 class InlineMediaControls extends MediaControls 30 27 { … … 134 131 135 132 // Compute the visible size for the controls bar. 136 this.bottomControlsBar.width = this._shouldUseAudioLayout ? this.width : (this.width - 2 * InsideMargin); 133 if (!this._inlineInsideMargin) 134 this._inlineInsideMargin = this.computedValueForStylePropertyInPx("--inline-controls-inside-margin"); 135 this.bottomControlsBar.width = this._shouldUseAudioLayout ? this.width : (this.width - 2 * this._inlineInsideMargin); 137 136 138 137 // Compute the absolute minimum width to display the center control (status label or time control). … … 219 218 // Ensure we position the bottom controls bar at the bottom of the frame, accounting for 220 219 // the inside margin, unless this would yield a position outside of the frame. 221 this.bottomControlsBar.y = Math.max(0, this.height - BottomControlsBarHeight - InsideMargin); 220 if (!this._inlineBottomControlsBarHeight) 221 this._inlineBottomControlsBarHeight = this.computedValueForStylePropertyInPx("--inline-controls-bar-height"); 222 this.bottomControlsBar.y = Math.max(0, this.height - this._inlineBottomControlsBarHeight - this._inlineInsideMargin); 222 223 223 224 this.bottomControlsBar.children = controlsBarChildren; -
trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js
r227904 r279481 230 230 } 231 231 232 computedValueForStyleProperty(propertyName) 233 { 234 return window.getComputedStyle(this.element).getPropertyValue(propertyName); 235 } 236 237 computedValueForStylePropertyInPx(propertyName) 238 { 239 const value = this.computedValueForStyleProperty(propertyName); 240 if (!value) 241 return 0; 242 if (!value.endsWith("px")) 243 return 0; 244 return parseFloat(value); 245 } 246 232 247 // Protected 233 248 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-inline-media-controls.js
r279309 r279481 60 60 return; 61 61 62 if (!this._inlineInsideMargin) 63 this._inlineInsideMargin = this.computedValueForStylePropertyInPx("--inline-controls-inside-margin"); 64 if (!this._inlineBottomControlsBarHeight) 65 this._inlineBottomControlsBarHeight = this.computedValueForStylePropertyInPx("--inline-controls-bar-height"); 66 62 67 this._volumeSliderContainer.x = this.rightContainer.x + this.muteButton.x; 63 this._volumeSliderContainer.y = this.bottomControlsBar.y - BottomControlsBarHeight -InsideMargin;68 this._volumeSliderContainer.y = this.bottomControlsBar.y - this._inlineBottomControlsBarHeight - this._inlineInsideMargin; 64 69 } 65 70 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/media-controls.css
r274521 r279481 38 38 39 39 * { 40 /* This constant needs to stay in sync with the InsideMargin JS constant. */41 40 --inline-controls-inside-margin: 6px; 42 41 --fullscreen-controls-bar-height: 75px; … … 46 45 47 46 :host(audio), :host(video.media-document.audio), * { 48 /* This constant needs to stay in sync with the BottomControlsBarHeight JS constant. */49 47 --inline-controls-bar-height: 31px; 50 48 }
Note:
See TracChangeset
for help on using the changeset viewer.