Changeset 279547 in webkit
- Timestamp:
- Jul 3, 2021, 2:29:20 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-controls-bar-styles.html
r227979 r279547 21 21 22 22 let style, bounds; 23 let frameCount = 0; 23 24 scheduler.frameDidFire = function() 24 25 { 25 document.body.appendChild(mediaControls.element); 26 if (frameCount == 0) 27 document.body.appendChild(mediaControls.element); 28 else if (frameCount == 3) { 29 style = window.getComputedStyle(mediaControls.bottomControlsBar.element); 30 bounds = mediaControls.bottomControlsBar.element.getBoundingClientRect(); 26 31 27 style = window.getComputedStyle(mediaControls.bottomControlsBar.element); 28 bounds = mediaControls.bottomControlsBar.element.getBoundingClientRect(); 29 30 shouldBeEqualToString("style.left", "6px"); 31 shouldBeEqualToString("style.bottom", "6px"); 32 shouldBeEqualToString("style.width", "668px"); 33 shouldBeEqualToString("style.height", "31px"); 32 shouldBeEqualToString("style.left", "6px"); 33 shouldBeEqualToString("style.bottom", "6px"); 34 shouldBeEqualToString("style.width", "668px"); 35 shouldBeEqualToString("style.height", "31px"); 34 36 35 shouldBe("bounds.left", "6");36 shouldBe("bounds.top", "263");37 shouldBe("bounds.width", "668");38 shouldBe("bounds.height", "31");37 shouldBe("bounds.left", "6"); 38 shouldBe("bounds.top", "263"); 39 shouldBe("bounds.width", "668"); 40 shouldBe("bounds.height", "31"); 39 41 40 mediaControls.element.remove();42 mediaControls.element.remove(); 41 43 42 debug(""); 43 finishMediaControlsTest(); 44 debug(""); 45 finishMediaControlsTest(); 46 } 47 48 mediaControls.needsLayout = true; 49 frameCount++; 44 50 }; 45 51 -
trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html
r275456 r279547 33 33 34 34 shouldBecomeEqual("ready()", "true", () => { 35 document.body.appendChild(mediaControls.element); 35 36 debug(""); 36 37 while (droppableControls.length) { … … 44 45 mediaControls.width--; 45 46 } 47 mediaControls.element.remove(); 46 48 debug(""); 47 49 finishJSTest(); -
trunk/LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-controls-bar-styles.html
r227953 r279547 10 10 left: 0; 11 11 } 12 13 12 </style> 14 13 <script type="text/javascript"> … … 21 20 22 21 let style, bounds; 22 let frameCount = 0; 23 23 scheduler.frameDidFire = function() 24 24 { 25 document.body.appendChild(mediaControls.element); 25 if (frameCount == 0) 26 document.body.appendChild(mediaControls.element); 27 else if (frameCount == 3) { 28 style = window.getComputedStyle(mediaControls.bottomControlsBar.element); 29 bounds = mediaControls.bottomControlsBar.element.getBoundingClientRect(); 26 30 27 style = window.getComputedStyle(mediaControls.bottomControlsBar.element); 28 bounds = mediaControls.bottomControlsBar.element.getBoundingClientRect(); 29 30 shouldBeEqualToString("style.left", "6px"); 31 shouldBeEqualToString("style.bottom", "6px"); 32 shouldBeEqualToString("style.width", "668px"); 33 shouldBeEqualToString("style.height", "31px"); 31 shouldBeEqualToString("style.left", "6px"); 32 shouldBeEqualToString("style.bottom", "6px"); 33 shouldBeEqualToString("style.width", "668px"); 34 shouldBeEqualToString("style.height", "31px"); 34 35 35 shouldBe("bounds.left", "6");36 shouldBe("bounds.top", "263");37 shouldBe("bounds.width", "668");38 shouldBe("bounds.height", "31");36 shouldBe("bounds.left", "6"); 37 shouldBe("bounds.top", "263"); 38 shouldBe("bounds.width", "668"); 39 shouldBe("bounds.height", "31"); 39 40 40 mediaControls.element.remove();41 mediaControls.element.remove(); 41 42 42 debug(""); 43 finishMediaControlsTest(); 43 debug(""); 44 finishMediaControlsTest(); 45 } 46 47 mediaControls.needsLayout = true; 48 frameCount++; 44 49 }; 45 50 -
trunk/Source/WebCore/ChangeLog
r279546 r279547 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-03 Alexey Shvayka <shvaikalesh@gmail.com> 2 22 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js
r279489 r279547 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
r279489 r279547 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
r279489 r279547 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
r279489 r279547 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.