Changeset 272352 in webkit
- Timestamp:
- Feb 3, 2021 7:55:25 PM (18 months ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js (modified) (1 diff)
-
Modules/modern-media-controls/controls/macos-inline-media-controls.js (modified) (1 diff)
-
Modules/modern-media-controls/controls/slider.css (modified) (1 diff)
-
Modules/modern-media-controls/controls/slider.js (modified) (4 diffs)
-
Modules/modern-media-controls/controls/time-control.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r272347 r272352 1 2021-02-03 Devin Rousso <drousso@apple.com> 2 3 [macOS] update media controls time scrubber styles 4 https://bugs.webkit.org/show_bug.cgi?id=221360 5 6 Reviewed by Eric Carlson. 7 8 * Modules/modern-media-controls/controls/slider.js: 9 (Slider): 10 (Slider.prototype.commit): 11 * Modules/modern-media-controls/controls/slider.css: 12 (.slider > .custom-slider > .fill): 13 (.slider > .custom-slider > .primary): 14 (.slider > .custom-slider > .secondary): 15 (.slider > .custom-slider > .knob): 16 (.slider > .custom-slider > .knob.circle): Added. 17 (.slider > .custom-slider > .knob.bar): Added. 18 (.slider > .custom-slider > .track): Deleted. 19 Add a new `KnobStyle` enum that's used to control the CSS applied to the knob. Currently 20 there are two values: `Circle` (default) and `Bar`. 21 22 * Modules/modern-media-controls/controls/time-control.js: 23 Use `Slider.KnobStyle.Bar`. 24 25 * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: 26 (MacOSInlineMediaControls): 27 * Modules/modern-media-controls/controls/macos-inline-media-controls.js: 28 (MacOSFullscreenMediaControls): 29 Set the `secondaryValue` so that the track after the knob is visible. The default value of 30 `secondaryValue` is `0`, meaning that it sets `right: 100%;` on the track after the knob. 31 By setting the `secondaryValue` to `1` it causes `right: 0%;`, which fills the space. 32 1 33 2021-02-03 Diego Pino Garcia <dpino@igalia.com> 2 34 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js
r265709 r272352 50 50 this.volumeSlider = new Slider("volume"); 51 51 this.volumeSlider.width = 60; 52 this.volumeSlider.secondaryValue = 1; 52 53 53 54 this._leftContainer = new ButtonsContainer({ -
trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-inline-media-controls.js
r218877 r272352 41 41 this.volumeSlider = new Slider("volume"); 42 42 this.volumeSlider.width = 60; 43 this.volumeSlider.secondaryValue = 1; 43 44 44 45 this._volumeSliderContainer = new LayoutNode(`<div class="volume-slider-container"></div>`); -
trunk/Source/WebCore/Modules/modern-media-controls/controls/slider.css
r220041 r272352 48 48 top: 0; 49 49 height: 100%; 50 border-radius: 4.5px;51 50 mix-blend-mode: plus-lighter; 52 }53 54 .slider > .custom-slider > .track {55 left: 0;56 width: 100%;57 background-color: rgba(255, 255, 255, 0.1);58 51 } 59 52 60 53 .slider > .custom-slider > .primary { 61 54 left: 0; 62 background-color: rgba(255, 255, 255, 0.35); 55 background-color: rgba(255, 255, 255, 0.45); 56 border-top-left-radius: 4.5px; 57 border-bottom-left-radius: 4.5px; 63 58 } 64 59 65 60 .slider > .custom-slider > .secondary { 66 background-color: rgba(255, 255, 255, 0.08); 61 background-color: rgba(255, 255, 255, 0.18); 62 border-top-right-radius: 4.5px; 63 border-bottom-right-radius: 4.5px; 67 64 } 68 65 69 66 .slider > .custom-slider > .knob { 67 background-color: white; 68 transform: translateX(-50%); 69 } 70 71 .slider > .custom-slider > .knob.circle { 70 72 top: -2px; 71 73 width: 9px; 72 74 height: 9px; 73 75 border-radius: 50%; 74 background-color: white; 75 transform: translateX(-50%); 76 } 77 78 .slider > .custom-slider > .knob.bar { 79 top: -6px; 80 width: 4px; 81 height: 17px; 82 border-radius: 4px; 76 83 } 77 84 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/slider.js
r253248 r272352 27 27 { 28 28 29 constructor(cssClassName = "" )29 constructor(cssClassName = "", knobStyle = Slider.KnobStyle.Circle) 30 30 { 31 31 super(`<div class="slider ${cssClassName}"></div>`); 32 32 33 33 this._container = new LayoutNode(`<div class="custom-slider"></div>`); 34 this._track = new LayoutNode(`<div class="track fill"></div>`);35 34 this._primaryFill = new LayoutNode(`<div class="primary fill"></div>`); 36 35 this._secondaryFill = new LayoutNode(`<div class="secondary fill"></div>`); 37 this._knob = new LayoutNode(`<div class="knob "></div>`);38 this._container.children = [this._ track, this._primaryFill, this._secondaryFill, this._knob];36 this._knob = new LayoutNode(`<div class="knob ${knobStyle}"></div>`); 37 this._container.children = [this._primaryFill, this._secondaryFill, this._knob]; 39 38 40 39 this._input = new LayoutNode(`<input type="range" min="0" max="1" step="0.001" />`); … … 49 48 this._secondaryValue = 0; 50 49 this._disabled = false; 50 this._knobStyle = knobStyle; 51 51 52 52 this.children = [this._container, this._input]; … … 143 143 super.commit(); 144 144 145 const scrubberRadius = 4.5; 146 const scrubberCenterX = scrubberRadius + Math.round((this.width - (scrubberRadius * 2)) * this.value); 147 this._primaryFill.element.style.width = `${scrubberCenterX}px`; 148 this._secondaryFill.element.style.left = `${scrubberCenterX}px`; 145 let scrubberWidth = this._knobStyle === Slider.KnobStyle.Bar ? 4 : 9; 146 let scrubberBorder = this._knobStyle === Slider.KnobStyle.Bar ? 1 : (-1 * scrubberWidth / 2); 147 let scrubberCenterX = (scrubberWidth / 2) + Math.round((this.width - scrubberWidth) * this.value); 148 this._primaryFill.element.style.width = `${scrubberCenterX - (scrubberWidth / 2) - scrubberBorder}px`; 149 this._secondaryFill.element.style.left = `${scrubberCenterX + (scrubberWidth / 2) + scrubberBorder}px`; 149 150 this._secondaryFill.element.style.right = `${(1 - this._secondaryValue) * 100}%`; 150 151 this._knob.element.style.left = `${scrubberCenterX}px`; … … 204 205 } 205 206 } 207 208 Slider.KnobStyle = { 209 Circle: "circle", 210 Bar: "bar", 211 }; -
trunk/Source/WebCore/Modules/modern-media-controls/controls/time-control.js
r217823 r272352 41 41 42 42 this.elapsedTimeLabel = new TimeLabel(TimeLabel.Types.Elapsed); 43 this.scrubber = new Slider("scrubber" );43 this.scrubber = new Slider("scrubber", this.layoutTraits & LayoutTraits.macOS ? Slider.KnobStyle.Bar : Slider.KnobStyle.Circle); 44 44 this.remainingTimeLabel = new TimeLabel(TimeLabel.Types.Remaining); 45 45
Note: See TracChangeset
for help on using the changeset viewer.