Changeset 272373 in webkit
- Timestamp:
- Feb 4, 2021 9:39:28 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 17 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles-expected.txt (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-layout-expected.txt (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-layout.html (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-time-control-styles-expected.txt (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-time-control-styles.html (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-dropping-controls-expected.txt (modified) (1 diff)
-
LayoutTests/media/modern-media-controls/time-label/ios-time-label-expected.txt (modified) (5 diffs)
-
LayoutTests/media/modern-media-controls/time-label/ios-time-label.html (modified) (4 diffs)
-
LayoutTests/media/modern-media-controls/time-label/time-label-expected.txt (modified) (5 diffs)
-
LayoutTests/media/modern-media-controls/time-label/time-label.html (modified) (5 diffs)
-
LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/modern-media-controls/controls/time-control.js (modified) (7 diffs)
-
Source/WebCore/Modules/modern-media-controls/controls/time-label.js (modified) (4 diffs)
-
Source/WebCore/en.lproj/modern-media-controls-localized-strings.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r272371 r272373 1 2021-02-04 Devin Rousso <drousso@apple.com> 2 3 [macOS] Default to showing the total duration, only switching to time remaining when clicked 4 https://bugs.webkit.org/show_bug.cgi?id=221364 5 6 Reviewed by Eric Carlson. 7 8 * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html: 9 * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles-expected.txt: 10 * media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-layout.html: 11 * media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-layout-expected.txt: 12 * media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-time-control-styles.html: 13 * media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-time-control-styles-expected.txt: 14 * media/modern-media-controls/macos-inline-media-controls/macos-inline-media-dropping-controls-expected.txt: 15 * media/modern-media-controls/time-label/ios-time-label.html: 16 * media/modern-media-controls/time-label/ios-time-label-expected.txt: 17 * media/modern-media-controls/time-label/time-label.html: 18 * media/modern-media-controls/time-label/time-label-expected.txt: 19 * media/modern-media-controls/time-labels-support/remaining-time.html: 20 1 21 2021-02-04 Nikita Vasilyev <nvasilyev@apple.com> 2 22 -
trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles-expected.txt
r227968 r272373 9 9 PASS window.getComputedStyle(mediaControls.timeControl.scrubber.element).top is "0px" 10 10 PASS window.getComputedStyle(mediaControls.timeControl.elapsedTimeLabel.element).fontSize is "12px" 11 PASS window.getComputedStyle(mediaControls.timeControl. remainingTimeLabel.element).fontSize is "12px"11 PASS window.getComputedStyle(mediaControls.timeControl.durationTimeLabel.element).fontSize is "12px" 12 12 13 13 PASS successfullyParsed is true -
trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html
r227968 r272373 17 17 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl.scrubber.element).top", "0px"); 18 18 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl.elapsedTimeLabel.element).fontSize", "12px"); 19 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl. remainingTimeLabel.element).fontSize", "12px");19 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl.durationTimeLabel.element).fontSize", "12px"); 20 20 debug(""); 21 21 -
trunk/LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-layout-expected.txt
r227953 r272373 25 25 PASS mediaControls.timeControl.children[0] is mediaControls.timeControl.elapsedTimeLabel 26 26 PASS mediaControls.timeControl.children[1] is mediaControls.timeControl.scrubber 27 PASS mediaControls.timeControl.children[2] is mediaControls.timeControl. remainingTimeLabel27 PASS mediaControls.timeControl.children[2] is mediaControls.timeControl.durationTimeLabel 28 28 PASS mediaControls.rightContainer.children.length is 3 29 29 PASS mediaControls.rightContainer.children[0] is mediaControls.muteButton -
trunk/LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-layout.html
r227953 r272373 51 51 shouldBe("mediaControls.timeControl.children[0]", "mediaControls.timeControl.elapsedTimeLabel"); 52 52 shouldBe("mediaControls.timeControl.children[1]", "mediaControls.timeControl.scrubber"); 53 shouldBe("mediaControls.timeControl.children[2]", "mediaControls.timeControl. remainingTimeLabel");53 shouldBe("mediaControls.timeControl.children[2]", "mediaControls.timeControl.durationTimeLabel"); 54 54 55 55 shouldBe("mediaControls.rightContainer.children.length", "3"); -
trunk/LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-time-control-styles-expected.txt
r227953 r272373 6 6 PASS window.getComputedStyle(mediaControls.timeControl.scrubber.element).top is "0px" 7 7 PASS window.getComputedStyle(mediaControls.timeControl.elapsedTimeLabel.element).top is "8px" 8 PASS window.getComputedStyle(mediaControls.timeControl. remainingTimeLabel.element).top is "8px"8 PASS window.getComputedStyle(mediaControls.timeControl.durationTimeLabel.element).top is "8px" 9 9 10 10 PASS successfullyParsed is true -
trunk/LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-time-control-styles.html
r227953 r272373 17 17 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl.scrubber.element).top", "0px"); 18 18 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl.elapsedTimeLabel.element).top", "8px"); 19 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl. remainingTimeLabel.element).top", "8px");19 shouldBeEqualToString("window.getComputedStyle(mediaControls.timeControl.durationTimeLabel.element).top", "8px"); 20 20 debug(""); 21 21 -
trunk/LayoutTests/media/modern-media-controls/macos-inline-media-controls/macos-inline-media-dropping-controls-expected.txt
r227953 r272373 6 6 PASS ready() became true 7 7 8 SkipForwardButton was dropped at 48 8.9 SkipBackButton was dropped at 45 9.10 AirplayButton was dropped at 4 30.11 TracksButton was dropped at 39 8.12 PiPButton was dropped at 36 6.13 FullscreenButton was dropped at 3 31.14 MuteButton was dropped at 300.8 SkipForwardButton was dropped at 482. 9 SkipBackButton was dropped at 453. 10 AirplayButton was dropped at 424. 11 TracksButton was dropped at 392. 12 PiPButton was dropped at 360. 13 FullscreenButton was dropped at 325. 14 MuteButton was dropped at 294. 15 15 16 16 PASS successfullyParsed is true -
trunk/LayoutTests/media/modern-media-controls/time-label/ios-time-label-expected.txt
r219983 r272373 15 15 PASS elaspedLabel is "Elapsed" 16 16 PASS remainingLabel is "Remaining" 17 PASS durationLabel is "Duration" 17 18 18 19 elapsedTimeLabels[3].element.textContent = 0:01 … … 20 21 remainingTimeLabels[3].element.textContent = -0:01 21 22 remainingTimeLabels[3].width = 33 23 durationTimeLabels[3].element.textContent = 0:01 24 durationTimeLabels[3].width = 27 22 25 23 26 elapsedTimeLabels[4].element.textContent = 00:01 … … 25 28 remainingTimeLabels[4].element.textContent = -00:01 26 29 remainingTimeLabels[4].width = 40 30 durationTimeLabels[4].element.textContent = 00:01 31 durationTimeLabels[4].width = 35 27 32 28 33 elapsedTimeLabels[5].element.textContent = 0:00:01 … … 30 35 remainingTimeLabels[5].element.textContent = -0:00:01 31 36 remainingTimeLabels[5].width = 52 37 durationTimeLabels[5].element.textContent = 0:00:01 38 durationTimeLabels[5].width = 46 32 39 33 40 elapsedTimeLabels[6].element.textContent = 00:00:01 … … 35 42 remainingTimeLabels[6].element.textContent = -00:00:01 36 43 remainingTimeLabels[6].width = 59 44 durationTimeLabels[6].element.textContent = 00:00:01 45 durationTimeLabels[6].width = 54 37 46 38 47 PASS successfullyParsed is true -
trunk/LayoutTests/media/modern-media-controls/time-label/ios-time-label.html
r219983 r272373 23 23 let elapsedTimeLabels = new Map; 24 24 let remainingTimeLabels = new Map; 25 let durationTimeLabels = new Map; 25 26 for (let numberOfDigits of digits) { 26 elapsedTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type s.Elapsed);27 elapsedTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type.Elapsed); 27 28 elapsedTimeLabels[numberOfDigits].setValueWithNumberOfDigits(1, numberOfDigits); 28 remainingTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type s.Remaining);29 remainingTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type.Remaining); 29 30 remainingTimeLabels[numberOfDigits].setValueWithNumberOfDigits(1, numberOfDigits); 31 durationTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type.Duration); 32 durationTimeLabels[numberOfDigits].setValueWithNumberOfDigits(1, numberOfDigits); 30 33 } 31 34 32 const remainingTimeLabel = new TimeLabel(TimeLabel.Types.Remaining); 35 const durationTimeLabel = new TimeLabel(TimeLabel.Type.Duration); 36 durationTimeLabel.element.id = "duration"; 37 durationTimeLabel.setValueWithNumberOfDigits(0, 4); 38 39 const remainingTimeLabel = new TimeLabel(TimeLabel.Type.Remaining); 33 40 remainingTimeLabel.element.id = "remaining"; 34 41 remainingTimeLabel.setValueWithNumberOfDigits(0, 4); 35 42 36 const elaspedTimeLabel = new TimeLabel(TimeLabel.Type s.Elasped);43 const elaspedTimeLabel = new TimeLabel(TimeLabel.Type.Elapsed); 37 44 elaspedTimeLabel.element.id = "elasped"; 38 45 elaspedTimeLabel.setValueWithNumberOfDigits(0, 4); … … 41 48 let elaspedLabel; 42 49 let remainingLabel; 50 let durationLabel; 43 51 scheduler.frameDidFire = function() 44 52 { 45 53 document.body.appendChild(timeLabel.element); 54 document.body.appendChild(durationTimeLabel.element); 46 55 document.body.appendChild(remainingTimeLabel.element); 47 56 document.body.appendChild(elaspedTimeLabel.element); … … 60 69 elaspedLabel = elaspedTimeLabel.element.getAttribute("aria-label").split(":")[0]; 61 70 remainingLabel = remainingTimeLabel.element.getAttribute("aria-label").split(":")[0]; 71 durationLabel = durationTimeLabel.element.getAttribute("aria-label").split(":")[0]; 62 72 shouldBeEqualToString("elaspedLabel", "Elapsed"); 63 73 shouldBeEqualToString("remainingLabel", "Remaining"); 74 shouldBeEqualToString("durationLabel", "Duration"); 64 75 65 76 timeLabel.element.remove(); 77 durationTimeLabel.element.remove(); 66 78 remainingTimeLabel.element.remove(); 67 79 elaspedTimeLabel.element.remove(); … … 73 85 debug(`remainingTimeLabels[${numberOfDigits}].element.textContent = ${remainingTimeLabels[numberOfDigits].element.textContent}`); 74 86 debug(`remainingTimeLabels[${numberOfDigits}].width = ${remainingTimeLabels[numberOfDigits].width}`); 87 debug(`durationTimeLabels[${numberOfDigits}].element.textContent = ${durationTimeLabels[numberOfDigits].element.textContent}`); 88 debug(`durationTimeLabels[${numberOfDigits}].width = ${durationTimeLabels[numberOfDigits].width}`); 75 89 } 76 90 -
trunk/LayoutTests/media/modern-media-controls/time-label/time-label-expected.txt
r219983 r272373 15 15 PASS elaspedLabel is "Elapsed" 16 16 PASS remainingLabel is "Remaining" 17 PASS durationLabel is "Duration" 18 PASS accessibilityController.accessibleElementById('duration').role is "AXRole: AXStaticText" 17 19 PASS accessibilityController.accessibleElementById('remaining').role is "AXRole: AXStaticText" 18 20 PASS accessibilityController.accessibleElementById('elasped').role is "AXRole: AXStaticText" … … 22 24 remainingTimeLabels[3].element.textContent = -0:01 23 25 remainingTimeLabels[3].width = 33 26 durationTimeLabels[3].element.textContent = 0:01 27 durationTimeLabels[3].width = 27 24 28 25 29 elapsedTimeLabels[4].element.textContent = 00:01 … … 27 31 remainingTimeLabels[4].element.textContent = -00:01 28 32 remainingTimeLabels[4].width = 40 33 durationTimeLabels[4].element.textContent = 00:01 34 durationTimeLabels[4].width = 35 29 35 30 36 elapsedTimeLabels[5].element.textContent = 0:00:01 … … 32 38 remainingTimeLabels[5].element.textContent = -0:00:01 33 39 remainingTimeLabels[5].width = 52 40 durationTimeLabels[5].element.textContent = 0:00:01 41 durationTimeLabels[5].width = 46 34 42 35 43 elapsedTimeLabels[6].element.textContent = 00:00:01 … … 37 45 remainingTimeLabels[6].element.textContent = -00:00:01 38 46 remainingTimeLabels[6].width = 59 47 durationTimeLabels[6].element.textContent = 00:00:01 48 durationTimeLabels[6].width = 54 39 49 40 50 PASS successfullyParsed is true -
trunk/LayoutTests/media/modern-media-controls/time-label/time-label.html
r219983 r272373 15 15 shouldBeEqualToString("timeLabel.element.className", "time-label"); 16 16 17 timeLabel.element.id = "elasped";18 19 17 const NaNTimeLabel = new TimeLabel; 20 18 NaNTimeLabel.setValueWithNumberOfDigits(NaN, 4); … … 23 21 let elapsedTimeLabels = new Map; 24 22 let remainingTimeLabels = new Map; 23 let durationTimeLabels = new Map; 25 24 for (let numberOfDigits of digits) { 26 elapsedTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type s.Elapsed);25 elapsedTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type.Elapsed); 27 26 elapsedTimeLabels[numberOfDigits].setValueWithNumberOfDigits(1, numberOfDigits); 28 remainingTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type s.Remaining);27 remainingTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type.Remaining); 29 28 remainingTimeLabels[numberOfDigits].setValueWithNumberOfDigits(1, numberOfDigits); 29 durationTimeLabels[numberOfDigits] = new TimeLabel(TimeLabel.Type.Duration); 30 durationTimeLabels[numberOfDigits].setValueWithNumberOfDigits(1, numberOfDigits); 30 31 } 31 32 32 const remainingTimeLabel = new TimeLabel(TimeLabel.Types.Remaining); 33 const durationTimeLabel = new TimeLabel(TimeLabel.Type.Duration); 34 durationTimeLabel.element.id = "duration"; 35 durationTimeLabel.setValueWithNumberOfDigits(0, 4); 36 37 const remainingTimeLabel = new TimeLabel(TimeLabel.Type.Remaining); 33 38 remainingTimeLabel.element.id = "remaining"; 34 39 remainingTimeLabel.setValueWithNumberOfDigits(0, 4); 35 40 36 const elaspedTimeLabel = new TimeLabel(TimeLabel.Type s.Elasped);41 const elaspedTimeLabel = new TimeLabel(TimeLabel.Type.Elapsed); 37 42 elaspedTimeLabel.element.id = "elasped"; 38 43 elaspedTimeLabel.setValueWithNumberOfDigits(0, 4); … … 41 46 let elaspedLabel; 42 47 let remainingLabel; 48 let durationLabel; 43 49 scheduler.frameDidFire = function() 44 50 { 45 51 document.body.appendChild(timeLabel.element); 52 document.body.appendChild(durationTimeLabel.element); 46 53 document.body.appendChild(remainingTimeLabel.element); 47 54 document.body.appendChild(elaspedTimeLabel.element); … … 60 67 elaspedLabel = elaspedTimeLabel.element.getAttribute("aria-label").split(":")[0]; 61 68 remainingLabel = remainingTimeLabel.element.getAttribute("aria-label").split(":")[0]; 69 durationLabel = durationTimeLabel.element.getAttribute("aria-label").split(":")[0]; 62 70 shouldBeEqualToString("elaspedLabel", "Elapsed"); 63 71 shouldBeEqualToString("remainingLabel", "Remaining"); 72 shouldBeEqualToString("durationLabel", "Duration"); 73 shouldBeEqualToString("accessibilityController.accessibleElementById('duration').role", "AXRole: AXStaticText"); 64 74 shouldBeEqualToString("accessibilityController.accessibleElementById('remaining').role", "AXRole: AXStaticText"); 65 75 shouldBeEqualToString("accessibilityController.accessibleElementById('elasped').role", "AXRole: AXStaticText"); 66 76 timeLabel.element.remove(); 77 durationTimeLabel.element.remove(); 67 78 remainingTimeLabel.element.remove(); 68 79 elaspedTimeLabel.element.remove(); … … 74 85 debug(`remainingTimeLabels[${numberOfDigits}].element.textContent = ${remainingTimeLabels[numberOfDigits].element.textContent}`); 75 86 debug(`remainingTimeLabels[${numberOfDigits}].width = ${remainingTimeLabels[numberOfDigits].width}`); 87 debug(`durationTimeLabels[${numberOfDigits}].element.textContent = ${durationTimeLabels[numberOfDigits].element.textContent}`); 88 debug(`durationTimeLabels[${numberOfDigits}].width = ${durationTimeLabels[numberOfDigits].width}`); 76 89 } 77 90 -
trunk/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html
r228445 r272373 13 13 const media = document.querySelector("video"); 14 14 const mediaController = createControls(shadowRoot, media, null); 15 16 mediaController.controls.timeControl.durationTimeLabel?.element.click(); 15 17 16 18 media.addEventListener("timeupdate", (event) => { -
trunk/Source/WebCore/ChangeLog
r272370 r272373 1 2021-02-04 Devin Rousso <drousso@apple.com> 2 3 [macOS] Default to showing the total duration, only switching to time remaining when clicked 4 https://bugs.webkit.org/show_bug.cgi?id=221364 5 6 Reviewed by Eric Carlson. 7 8 * Modules/modern-media-controls/controls/time-label.js: 9 (TimeLabel.prototype.setValueWithNumberOfDigits): 10 (TimeLabel.prototype.commitProperty): 11 (TimeLabel.prototype._formattedTime): 12 Add `TimeLabel.Type.Duration`. 13 Drive-by: rename `Types` to `Type` as most enums are singular. 14 15 * Modules/modern-media-controls/controls/time-control.js: 16 (TimeControl): 17 (TimeControl.prototype.get minimumWidth): 18 (TimeControl.prototype.get idealMinimumWidth): 19 (TimeControl.prototype.layout): 20 (TimeControl.prototype.handleEvent): Added. 21 (TimeControl.prototype._durationOrRemainingTimeLabel): Added. 22 (TimeControl.prototype._performIdealLayout): 23 Add another `TimeLabel` with the new `TimeLabel.Type.Duration` that is used instead of the 24 existing `TimeLabel.Type.Remaining` after the latter has been clicked (and the former has 25 not also been clicked to switch back). 26 27 * en.lproj/modern-media-controls-localized-strings.js: 28 Add `"Duration"`. 29 1 30 2021-02-04 Antti Koivisto <antti@apple.com> 2 31 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/time-control.js
r272352 r272373 40 40 }); 41 41 42 this.elapsedTimeLabel = new TimeLabel(TimeLabel.Type s.Elapsed);42 this.elapsedTimeLabel = new TimeLabel(TimeLabel.Type.Elapsed); 43 43 this.scrubber = new Slider("scrubber", this.layoutTraits & LayoutTraits.macOS ? Slider.KnobStyle.Bar : Slider.KnobStyle.Circle); 44 this.remainingTimeLabel = new TimeLabel(TimeLabel.Types.Remaining); 44 if (this.layoutTraits & LayoutTraits.macOS) 45 this.durationTimeLabel = new TimeLabel(TimeLabel.Type.Duration); 46 this.remainingTimeLabel = new TimeLabel(TimeLabel.Type.Remaining); 45 47 46 48 this.activityIndicator = new LayoutNode(`<div class="activity-indicator"></div>`); … … 53 55 this._currentTime = 0; 54 56 this._loading = false; 57 58 this._showDurationTimeLabel = this.layoutTraits & LayoutTraits.macOS; 59 if (this._showDurationTimeLabel) { 60 this.durationTimeLabel.element.addEventListener("click", this); 61 this.remainingTimeLabel.element.addEventListener("click", this); 62 } 55 63 } 56 64 … … 93 101 { 94 102 this._performIdealLayout(); 95 return MinimumScrubberWidth + ScrubberMargin + this. remainingTimeLabel.width;103 return MinimumScrubberWidth + ScrubberMargin + this._durationOrRemainingTimeLabel().width; 96 104 } 97 105 … … 99 107 { 100 108 this._performIdealLayout(); 101 return this.elapsedTimeLabel.width + ScrubberMargin + MinimumScrubberWidth + ScrubberMargin + this. remainingTimeLabel.width;109 return this.elapsedTimeLabel.width + ScrubberMargin + MinimumScrubberWidth + ScrubberMargin + this._durationOrRemainingTimeLabel().width; 102 110 } 103 111 … … 116 124 return; 117 125 } 126 127 let durationOrRemainingTimeLabel = this._durationOrRemainingTimeLabel(); 118 128 119 129 // We drop the elapsed time label if width is constrained and we can't guarantee 120 130 // the scrubber minimum size otherwise. 121 131 this.scrubber.x = 0; 122 this.scrubber.width = this.width - ScrubberMargin - this.remainingTimeLabel.width;123 this.remainingTimeLabel.x = this.scrubber.x + this.scrubber.width + ScrubberMargin;132 this.scrubber.width = this.width - ScrubberMargin - durationOrRemainingTimeLabel.width; 133 durationOrRemainingTimeLabel.x = this.scrubber.x + this.scrubber.width + ScrubberMargin; 124 134 this.elapsedTimeLabel.visible = false; 125 135 } 126 136 137 handleEvent(event) 138 { 139 switch (event.type) { 140 case "click": 141 switch (event.target) { 142 case this.durationTimeLabel.element: 143 this._showDurationTimeLabel = false; 144 this.needsLayout = true; 145 break; 146 147 case this.remainingTimeLabel.element: 148 this._showDurationTimeLabel = true; 149 this.needsLayout = true; 150 break; 151 } 152 } 153 } 154 127 155 // Private 128 156 157 _durationOrRemainingTimeLabel() 158 { 159 return this._showDurationTimeLabel ? this.durationTimeLabel : this.remainingTimeLabel; 160 } 161 129 162 _performIdealLayout() 130 163 { 131 164 if (this._loading) 132 this. remainingTimeLabel.setValueWithNumberOfDigits(NaN, 4);165 this._durationOrRemainingTimeLabel().setValueWithNumberOfDigits(NaN, 4); 133 166 else { 134 167 const shouldShowZeroDurations = isNaN(this._duration) || this._duration === Number.POSITIVE_INFINITY; … … 145 178 146 179 this.elapsedTimeLabel.setValueWithNumberOfDigits(shouldShowZeroDurations ? 0 : this._currentTime, numberOfDigitsForTimeLabels); 147 this.remainingTimeLabel.setValueWithNumberOfDigits(shouldShowZeroDurations ? 0 : (this._currentTime - this._duration), numberOfDigitsForTimeLabels); 180 if (this._showDurationTimeLabel) 181 this.durationTimeLabel.setValueWithNumberOfDigits(shouldShowZeroDurations ? 0 : this._duration, numberOfDigitsForTimeLabels); 182 else 183 this.remainingTimeLabel.setValueWithNumberOfDigits(shouldShowZeroDurations ? 0 : this._currentTime - this._duration, numberOfDigitsForTimeLabels); 148 184 } 149 185 … … 151 187 this.scrubber.value = this._currentTime / this._duration; 152 188 189 let durationOrRemainingTimeLabel = this._durationOrRemainingTimeLabel(); 190 153 191 this.scrubber.x = (this._loading ? this.activityIndicator.width : this.elapsedTimeLabel.width) + ScrubberMargin; 154 this.scrubber.width = this.width - this.scrubber.x - ScrubberMargin - this.remainingTimeLabel.width;155 this.remainingTimeLabel.x = this.scrubber.x + this.scrubber.width + ScrubberMargin;156 157 this.children = [this._loading ? this.activityIndicator : this.elapsedTimeLabel, this.scrubber, this.remainingTimeLabel];192 this.scrubber.width = this.width - this.scrubber.x - ScrubberMargin - durationOrRemainingTimeLabel.width; 193 durationOrRemainingTimeLabel.x = this.scrubber.x + this.scrubber.width + ScrubberMargin; 194 195 this.children = [this._loading ? this.activityIndicator : this.elapsedTimeLabel, this.scrubber, durationOrRemainingTimeLabel]; 158 196 } 159 197 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.js
r219983 r272373 60 60 this._value = value; 61 61 this._numberOfDigits = numberOfDigits; 62 this.width = WidthsForDigits[this._numberOfDigits] + (this._type === TimeLabel.Type s.Remaining && !isNaN(this._value) ? MinusSignWidthsForDigits[this._numberOfDigits] : 0);62 this.width = WidthsForDigits[this._numberOfDigits] + (this._type === TimeLabel.Type.Remaining && !isNaN(this._value) ? MinusSignWidthsForDigits[this._numberOfDigits] : 0); 63 63 this.markDirtyProperty("value"); 64 64 } … … 70 70 if (propertyName === "value") { 71 71 this.element.textContent = this._formattedTime(); 72 72 73 const timeAsString = formattedStringForDuration(this.value); 73 const ariaLabel = (this._type === TimeLabel.Types.Remaining) ? UIString("Remaining") : UIString("Elapsed"); 74 this.element.setAttribute("aria-label", `${ariaLabel}: ${timeAsString}`); 74 switch (this._type) { 75 case TimeLabel.Type.Elapsed: 76 this.element.setAttribute("aria-label", `${UIString("Elapsed")}: ${timeAsString}`); 77 break; 78 79 case TimeLabel.Type.Remaining: 80 this.element.setAttribute("aria-label", `${UIString("Remaining")}: ${timeAsString}`); 81 break; 82 83 case TimeLabel.Type.Duration: 84 this.element.setAttribute("aria-label", `${UIString("Duration")}: ${timeAsString}`); 85 break; 86 } 87 75 88 if (this.parent instanceof TimeControl) 76 89 this.parent.updateScrubberLabel(); … … 99 112 timeComponents = [doubleDigits(time.hours), doubleDigits(time.minutes), doubleDigits(time.seconds)]; 100 113 101 return (this._type === TimeLabel.Type s.Remaining ? "-" : "") + timeComponents.join(":");114 return (this._type === TimeLabel.Type.Remaining ? "-" : "") + timeComponents.join(":"); 102 115 } 103 116 … … 111 124 } 112 125 113 TimeLabel.Type s= {126 TimeLabel.Type = { 114 127 Elapsed: 0, 115 Remaining: 1 128 Remaining: 1, 129 Duration: 2, 116 130 }; -
trunk/Source/WebCore/en.lproj/modern-media-controls-localized-strings.js
r238307 r272373 4 4 "Audio": "Audio", 5 5 "Audio Controls": "Audio Controls", 6 "Duration": "Duration", 6 7 "Enter Full Screen": "Enter Full Screen", 7 8 "Enter Picture in Picture": "Enter Picture in Picture",
Note: See TracChangeset
for help on using the changeset viewer.