Title: [211807] trunk
Revision
211807
Author
commit-qu...@webkit.org
Date
2017-02-07 06:30:29 -0800 (Tue, 07 Feb 2017)

Log Message

[Modern Media Controls] Handle media durations of an hour or more gracefully
https://bugs.webkit.org/show_bug.cgi?id=167882
<rdar://problem/29601260>

Patch by Antoine Quint <grao...@apple.com> on 2017-02-07
Reviewed by Eric Carlson.

Source/WebCore:

We add a new "labelsMayDisplayTimesOverAnHour" to TimeControl so that time labels
to the left and right of the scrubber may have extra room to display to account for
the extra "xx:" characters that may appear. We don't lay the time out dynamically
such that we don't see layout jumps as the times shown in the labels go around
the hour mark.

We also refactor the ElapsedTimeSupport and RemainingTimeSupport in a single
TimeLabelsSupport class which updates both elapsed and remaining time labels
and sets the "labelsMayDisplayTimesOverAnHour" on the TimeControl should a
"durationchange" happen to make the media duration reach or go past the hour mark.

Tests: http/tests/media/modern-media-controls/time-labels-support/long-time.html
       media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html
       media/modern-media-controls/time-labels-support/elapsed-time.html
       media/modern-media-controls/time-labels-support/remaining-time.html

* Modules/modern-media-controls/controls/time-control.js:
(TimeControl.prototype.get labelsMayDisplayTimesOverAnHour):
(TimeControl.prototype.set labelsMayDisplayTimesOverAnHour):
(TimeControl.prototype.set width):
* Modules/modern-media-controls/controls/time-label.css:
(.time-label):
* Modules/modern-media-controls/js-files:
* Modules/modern-media-controls/media/elapsed-time-support.js: Removed.
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype._updateControlsIfNeeded):
* Modules/modern-media-controls/media/time-labels-support.js: Renamed from Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js.
(TimeLabelsSupport.prototype.get control):
(TimeLabelsSupport.prototype.syncControl):
(TimeLabelsSupport):
* WebCore.xcodeproj/project.pbxproj:

LayoutTests:

Add new tests to check that we correctly handle times at or past the hour mark.

* http/tests/media/modern-media-controls/time-labels-support/long-time-expected.txt: Added.
* http/tests/media/modern-media-controls/time-labels-support/long-time.html: Added.
* media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour-expected.txt: Added.
* media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html: Added.
* media/modern-media-controls/time-labels-support/elapsed-time-expected.txt: Renamed from LayoutTests/media/modern-media-controls/elapsed-time-support/elapsed-time-support-expected.txt.
* media/modern-media-controls/time-labels-support/elapsed-time.html: Renamed from LayoutTests/media/modern-media-controls/elapsed-time-support/elapsed-time-support.html.
* media/modern-media-controls/time-labels-support/remaining-time-expected.txt: Renamed from LayoutTests/media/modern-media-controls/remaining-time-support/remaining-time-support-expected.txt.
* media/modern-media-controls/time-labels-support/remaining-time.html: Renamed from LayoutTests/media/modern-media-controls/remaining-time-support/remaining-time-support.html.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (211806 => 211807)


--- trunk/LayoutTests/ChangeLog	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/LayoutTests/ChangeLog	2017-02-07 14:30:29 UTC (rev 211807)
@@ -1,5 +1,24 @@
 2017-02-07  Antoine Quint  <grao...@apple.com>
 
+        [Modern Media Controls] Handle media durations of an hour or more gracefully
+        https://bugs.webkit.org/show_bug.cgi?id=167882
+        <rdar://problem/29601260>
+
+        Reviewed by Eric Carlson.
+
+        Add new tests to check that we correctly handle times at or past the hour mark.
+
+        * http/tests/media/modern-media-controls/time-labels-support/long-time-expected.txt: Added.
+        * http/tests/media/modern-media-controls/time-labels-support/long-time.html: Added.
+        * media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour-expected.txt: Added.
+        * media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html: Added.
+        * media/modern-media-controls/time-labels-support/elapsed-time-expected.txt: Renamed from LayoutTests/media/modern-media-controls/elapsed-time-support/elapsed-time-support-expected.txt.
+        * media/modern-media-controls/time-labels-support/elapsed-time.html: Renamed from LayoutTests/media/modern-media-controls/elapsed-time-support/elapsed-time-support.html.
+        * media/modern-media-controls/time-labels-support/remaining-time-expected.txt: Renamed from LayoutTests/media/modern-media-controls/remaining-time-support/remaining-time-support-expected.txt.
+        * media/modern-media-controls/time-labels-support/remaining-time.html: Renamed from LayoutTests/media/modern-media-controls/remaining-time-support/remaining-time-support.html.
+
+2017-02-07  Antoine Quint  <grao...@apple.com>
+
         LayoutTet media/modern-media-controls/tracks-support/tracks-support-show-panel-after-dragging-controls.html is flaky
         https://bugs.webkit.org/show_bug.cgi?id=167275
 

Added: trunk/LayoutTests/http/tests/media/modern-media-controls/time-labels-support/long-time-expected.txt (0 => 211807)


--- trunk/LayoutTests/http/tests/media/modern-media-controls/time-labels-support/long-time-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/time-labels-support/long-time-expected.txt	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,11 @@
+Testing the display of time labels with a video that lasts an hour or more.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS mediaController.controls.timeControl.labelsMayDisplayTimesOverAnHour is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/media/modern-media-controls/time-labels-support/long-time.html (0 => 211807)


--- trunk/LayoutTests/http/tests/media/modern-media-controls/time-labels-support/long-time.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/time-labels-support/long-time.html	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,26 @@
+<script src=""
+<script src=""
+<body>
+<video src="" style="width: 320px; height: 240px;"></video>
+<div id="shadow"></div>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing the display of time labels with a video that lasts an hour or more.");
+
+const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
+const media = document.querySelector("video");
+const mediaController = createControls(shadowRoot, media, null);
+
+media.addEventListener("durationchange", function() {
+    shouldBeTrue("mediaController.controls.timeControl.labelsMayDisplayTimesOverAnHour");
+    debug("");
+    shadowRoot.host.remove();
+    media.remove();
+    finishJSTest();
+});
+
+</script>
+<script src=""
+</body>

Added: trunk/LayoutTests/media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour-expected.txt (0 => 211807)


--- trunk/LayoutTests/media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour-expected.txt	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,20 @@
+Testing the TimeControl class property labelsMayDisplayTimesOverAnHour.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing default value
+PASS timeControl.labelsMayDisplayTimesOverAnHour is false
+
+Setting timeControl.labelsMayDisplayTimesOverAnHour = true
+PASS timeControl.labelsMayDisplayTimesOverAnHour is true
+
+PASS timeControl.elapsedTimeLabel.x is -2
+PASS timeControl.scrubber.x is 65
+PASS timeControl.scrubber.width is 362
+PASS timeControl.remainingTimeLabel.x is 432
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html (0 => 211807)


--- trunk/LayoutTests/media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,30 @@
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<script src="" type="text/_javascript_"></script>
+<body>
+<script type="text/_javascript_">
+
+description("Testing the <code>TimeControl</code> class property labelsMayDisplayTimesOverAnHour.");
+
+const timeControl = new TimeControl;
+
+debug("Testing default value");
+shouldBeFalse("timeControl.labelsMayDisplayTimesOverAnHour");
+
+debug("");
+debug("Setting timeControl.labelsMayDisplayTimesOverAnHour = true");
+timeControl.labelsMayDisplayTimesOverAnHour = true;
+shouldBeTrue("timeControl.labelsMayDisplayTimesOverAnHour");
+
+timeControl.width = 500;
+debug("");
+shouldBe("timeControl.elapsedTimeLabel.x", "-2");
+shouldBe("timeControl.scrubber.x", "65");
+shouldBe("timeControl.scrubber.width", "362");
+shouldBe("timeControl.remainingTimeLabel.x", "432");
+
+debug("");
+
+</script>
+<script src=""
+</body>

Copied: trunk/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time-expected.txt (from rev 211806, trunk/LayoutTests/media/modern-media-controls/elapsed-time-support/elapsed-time-support-expected.txt) (0 => 211807)


--- trunk/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time-expected.txt	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,12 @@
+Testing the ElapsedTimeSupport behavior.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+timeupdate event was dispatched
+PASS mediaController.controls.timeControl.elapsedTimeLabel.value is media.currentTime
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time.html (from rev 211806, trunk/LayoutTests/media/modern-media-controls/elapsed-time-support/elapsed-time-support.html) (0 => 211807)


--- trunk/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/time-labels-support/elapsed-time.html	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,30 @@
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<body>
+<video src="" style="width: 320px; height: 240px;"></video>
+<div id="shadow"></div>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing the <code>ElapsedTimeSupport</code> behavior.");
+
+const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
+const media = document.querySelector("video");
+const mediaController = createControls(shadowRoot, media, null);
+
+media.addEventListener("timeupdate", function() {
+    debug("timeupdate event was dispatched");
+    shouldBe("mediaController.controls.timeControl.elapsedTimeLabel.value", "media.currentTime");
+
+    debug("");
+    shadowRoot.host.remove();
+    media.remove();
+    finishJSTest();
+});
+
+media.addEventListener("loadedmetadata", event => media.currentTime = 2);
+
+</script>
+<script src=""
+</body>

Copied: trunk/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time-expected.txt (from rev 211806, trunk/LayoutTests/media/modern-media-controls/remaining-time-support/remaining-time-support-expected.txt) (0 => 211807)


--- trunk/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time-expected.txt	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,15 @@
+Testing the RemainingTimeSupport behavior.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+durationchange event was dispatched
+PASS mediaController.controls.timeControl.remainingTimeLabel.value is -media.duration
+
+timeupdate event was dispatched
+PASS mediaController.controls.timeControl.remainingTimeLabel.value is media.currentTime - media.duration
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html (from rev 211806, trunk/LayoutTests/media/modern-media-controls/remaining-time-support/remaining-time-support.html) (0 => 211807)


--- trunk/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/time-labels-support/remaining-time.html	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,35 @@
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<body>
+<video src="" style="width: 320px; height: 240px;"></video>
+<div id="shadow"></div>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing the <code>RemainingTimeSupport</code> behavior.");
+
+const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
+const media = document.querySelector("video");
+const mediaController = createControls(shadowRoot, media, null);
+
+media.addEventListener("timeupdate", (event) => {
+    debug("");
+    debug("timeupdate event was dispatched");
+    shouldBe("mediaController.controls.timeControl.remainingTimeLabel.value", "media.currentTime - media.duration");
+
+    debug("");
+    shadowRoot.host.remove();
+    media.remove();
+    finishJSTest();
+});
+
+media.addEventListener("durationchange", event => {
+    debug("durationchange event was dispatched");
+    shouldBe("mediaController.controls.timeControl.remainingTimeLabel.value", "-media.duration");
+    media.currentTime = 2;
+});
+
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (211806 => 211807)


--- trunk/Source/WebCore/ChangeLog	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/ChangeLog	2017-02-07 14:30:29 UTC (rev 211807)
@@ -1,3 +1,43 @@
+2017-02-07  Antoine Quint  <grao...@apple.com>
+
+        [Modern Media Controls] Handle media durations of an hour or more gracefully
+        https://bugs.webkit.org/show_bug.cgi?id=167882
+        <rdar://problem/29601260>
+
+        Reviewed by Eric Carlson.
+
+        We add a new "labelsMayDisplayTimesOverAnHour" to TimeControl so that time labels
+        to the left and right of the scrubber may have extra room to display to account for
+        the extra "xx:" characters that may appear. We don't lay the time out dynamically
+        such that we don't see layout jumps as the times shown in the labels go around
+        the hour mark.
+
+        We also refactor the ElapsedTimeSupport and RemainingTimeSupport in a single
+        TimeLabelsSupport class which updates both elapsed and remaining time labels
+        and sets the "labelsMayDisplayTimesOverAnHour" on the TimeControl should a
+        "durationchange" happen to make the media duration reach or go past the hour mark.
+
+        Tests: http/tests/media/modern-media-controls/time-labels-support/long-time.html
+               media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html
+               media/modern-media-controls/time-labels-support/elapsed-time.html
+               media/modern-media-controls/time-labels-support/remaining-time.html
+
+        * Modules/modern-media-controls/controls/time-control.js:
+        (TimeControl.prototype.get labelsMayDisplayTimesOverAnHour):
+        (TimeControl.prototype.set labelsMayDisplayTimesOverAnHour):
+        (TimeControl.prototype.set width):
+        * Modules/modern-media-controls/controls/time-label.css:
+        (.time-label):
+        * Modules/modern-media-controls/js-files:
+        * Modules/modern-media-controls/media/elapsed-time-support.js: Removed.
+        * Modules/modern-media-controls/media/media-controller.js:
+        (MediaController.prototype._updateControlsIfNeeded):
+        * Modules/modern-media-controls/media/time-labels-support.js: Renamed from Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js.
+        (TimeLabelsSupport.prototype.get control):
+        (TimeLabelsSupport.prototype.syncControl):
+        (TimeLabelsSupport):
+        * WebCore.xcodeproj/project.pbxproj:
+
 2017-02-06  Per Arne Vollan  <pvol...@apple.com>
 
         Read stroke width of subtitles from MediaAccessibility framework.

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/time-control.js (211806 => 211807)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/time-control.js	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/time-control.js	2017-02-07 14:30:29 UTC (rev 211807)
@@ -25,9 +25,10 @@
 
 const MinimumScrubberWidth = 168;
 const ElapsedTimeLabelLeftMargin = -2;
-const ElapsedTimeLabelWidth = 45;
+const ElapsedTimeLabelWidth = 40;
 const RemainingTimeLabelWidth = 49;
-const RemainingTimeLabelLeftMargin = 5;
+const AdditionalTimeLabelWidthOverAnHour = 22;
+const ScrubberMargin = 5;
 
 class TimeControl extends LayoutItem
 {
@@ -43,10 +44,26 @@
         this.remainingTimeLabel = new TimeLabel;
 
         this.children = [this.elapsedTimeLabel, this.scrubber, this.remainingTimeLabel];
+
+        this._labelsMayDisplayTimesOverAnHour = false;
     }
 
     // Public
 
+    get labelsMayDisplayTimesOverAnHour()
+    {
+        return this._labelsMayDisplayTimesOverAnHour;
+    }
+
+    set labelsMayDisplayTimesOverAnHour(flag)
+    {
+        if (this._labelsMayDisplayTimesOverAnHour === flag)
+            return;
+
+        this._labelsMayDisplayTimesOverAnHour = flag;
+        this.layout();
+    }
+
     get width()
     {
         return super.width;
@@ -56,10 +73,15 @@
     {
         super.width = width;
 
+        const extraWidth = this._labelsMayDisplayTimesOverAnHour ? AdditionalTimeLabelWidthOverAnHour : 0;
+        const elapsedTimeLabelWidth = ElapsedTimeLabelWidth + extraWidth;
+        const remainingTimeLabelWidth = RemainingTimeLabelWidth + extraWidth;
+
         this.elapsedTimeLabel.x = ElapsedTimeLabelLeftMargin;
-        this.scrubber.x = this.elapsedTimeLabel.x + ElapsedTimeLabelWidth;
-        this.scrubber.width = this._width - ElapsedTimeLabelWidth - RemainingTimeLabelWidth;
-        this.remainingTimeLabel.x = this.scrubber.x + this.scrubber.width + RemainingTimeLabelLeftMargin;
+        this.elapsedTimeLabel.width = elapsedTimeLabelWidth;
+        this.scrubber.x = this.elapsedTimeLabel.x + elapsedTimeLabelWidth + ScrubberMargin;
+        this.scrubber.width = this._width - elapsedTimeLabelWidth - ScrubberMargin - remainingTimeLabelWidth;
+        this.remainingTimeLabel.x = this.scrubber.x + this.scrubber.width + ScrubberMargin;
     }
 
     get isSufficientlyWide()

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.css (211806 => 211807)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.css	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.css	2017-02-07 14:30:29 UTC (rev 211807)
@@ -30,4 +30,5 @@
     font-size: 14px;
 
     color: rgba(255, 255, 255, 0.572);
+    text-align: right;
 }

Modified: trunk/Source/WebCore/Modules/modern-media-controls/js-files (211806 => 211807)


--- trunk/Source/WebCore/Modules/modern-media-controls/js-files	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/Modules/modern-media-controls/js-files	2017-02-07 14:30:29 UTC (rev 211807)
@@ -42,13 +42,11 @@
 media/media-controller-support.js
 media/airplay-support.js
 media/controls-visibility-support.js
-media/elapsed-time-support.js
 media/fullscreen-support.js
 media/mute-support.js
 media/pip-support.js
 media/placard-support.js
 media/playback-support.js
-media/remaining-time-support.js
 media/scrubbing-support.js
 media/seek-support.js
 media/seek-backward-support.js
@@ -56,6 +54,7 @@
 media/skip-back-support.js
 media/start-support.js
 media/status-support.js
+media/time-labels-support.js
 media/tracks-support.js
 media/volume-down-support.js
 media/volume-support.js

Deleted: trunk/Source/WebCore/Modules/modern-media-controls/media/elapsed-time-support.js (211806 => 211807)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/elapsed-time-support.js	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/elapsed-time-support.js	2017-02-07 14:30:29 UTC (rev 211807)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-class ElapsedTimeSupport extends MediaControllerSupport
-{
-
-    // Protected
-
-    get control()
-    {
-        return this.mediaController.controls.timeControl.elapsedTimeLabel;
-    }
-
-    get mediaEvents()
-    {
-        return ["timeupdate"];
-    }
-
-    syncControl()
-    {
-        this.control.value = this.mediaController.media.currentTime;
-    }
-
-}

Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (211806 => 211807)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2017-02-07 14:30:29 UTC (rev 211807)
@@ -133,7 +133,7 @@
 
         this._updateControlsSize();
 
-        this._supportingObjects = [AirplaySupport, ControlsVisibilitySupport, ElapsedTimeSupport, FullscreenSupport, MuteSupport, PiPSupport, PlacardSupport, PlaybackSupport, RemainingTimeSupport, ScrubbingSupport, SeekBackwardSupport, SeekForwardSupport, SkipBackSupport, StartSupport, StatusSupport, TracksSupport, VolumeSupport, VolumeDownSupport, VolumeUpSupport].map(SupportClass => {
+        this._supportingObjects = [AirplaySupport, ControlsVisibilitySupport, FullscreenSupport, MuteSupport, PiPSupport, PlacardSupport, PlaybackSupport, ScrubbingSupport, SeekBackwardSupport, SeekForwardSupport, SkipBackSupport, StartSupport, StatusSupport, TimeLabelsSupport, TracksSupport, VolumeSupport, VolumeDownSupport, VolumeUpSupport].map(SupportClass => {
             return new SupportClass(this);
         }, this);
     }

Deleted: trunk/Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js (211806 => 211807)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js	2017-02-07 14:30:29 UTC (rev 211807)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-class RemainingTimeSupport extends MediaControllerSupport
-{
-
-    // Protected
-
-    get control()
-    {
-        return this.mediaController.controls.timeControl.remainingTimeLabel;
-    }
-
-    get mediaEvents()
-    {
-        return ["timeupdate", "durationchange"];
-    }
-
-    syncControl()
-    {
-        const media = this.mediaController.media;
-        if (isNaN(media.duration))
-            return;
-
-        this.control.value = media.currentTime - media.duration;
-    }
-
-}

Copied: trunk/Source/WebCore/Modules/modern-media-controls/media/time-labels-support.js (from rev 211806, trunk/Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js) (0 => 211807)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/time-labels-support.js	                        (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/time-labels-support.js	2017-02-07 14:30:29 UTC (rev 211807)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class TimeLabelsSupport extends MediaControllerSupport
+{
+
+    // Protected
+
+    get control()
+    {
+        return this.mediaController.controls.timeControl;
+    }
+
+    get mediaEvents()
+    {
+        return ["timeupdate", "durationchange"];
+    }
+
+    syncControl()
+    {
+        const media = this.mediaController.media;
+        if (isNaN(media.duration))
+            return;
+
+        this.control.elapsedTimeLabel.value = media.currentTime;
+        this.control.remainingTimeLabel.value = media.currentTime - media.duration;
+        this.control.labelsMayDisplayTimesOverAnHour = media.duration >= (60 * 60);
+    }
+
+}

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (211806 => 211807)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-02-07 14:07:48 UTC (rev 211806)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-02-07 14:30:29 UTC (rev 211807)
@@ -10080,8 +10080,6 @@
 		6F995A301A70833700A735F4 /* JSWebGLVertexArrayObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLVertexArrayObject.h; sourceTree = "<group>"; };
 		6FAD4A561A9D0FAE009F7D3C /* OpenGLESSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenGLESSPI.h; sourceTree = "<group>"; };
 		709A01FD1E3D0BCC006B0D4C /* ModuleFetchFailureKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleFetchFailureKind.h; sourceTree = "<group>"; };
-		71004B9A1DC1109300A52A38 /* elapsed-time-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "elapsed-time-support.js"; sourceTree = "<group>"; };
-		71004B9B1DC1109300A52A38 /* remaining-time-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "remaining-time-support.js"; sourceTree = "<group>"; };
 		71004B9D1DC1398800A52A38 /* playback-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "playback-support.js"; sourceTree = "<group>"; };
 		710FA74B1DEE576D004C715E /* controls-bar.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "controls-bar.js"; sourceTree = "<group>"; };
 		710FA74C1DEE577E004C715E /* controls-visibility-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "controls-visibility-support.js"; sourceTree = "<group>"; };
@@ -10188,6 +10186,7 @@
 		718675461DF101C60033D7F3 /* seek-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "seek-support.js"; sourceTree = "<group>"; };
 		718C7F561DD385C500B733C8 /* status-label.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "status-label.css"; sourceTree = "<group>"; };
 		718C7F571DD385C500B733C8 /* status-label.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "status-label.js"; sourceTree = "<group>"; };
+		71909BF41E4906A70057F99D /* time-labels-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "time-labels-support.js"; sourceTree = "<group>"; };
 		71A1B6071DEE5A820073BCFB /* English */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; name = English; path = "English.lproj/modern-media-controls-localized-strings.js"; sourceTree = SOURCE_ROOT; };
 		71A57DEF154BE25C0009D120 /* SVGPathUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathUtilities.cpp; sourceTree = "<group>"; };
 		71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathUtilities.h; sourceTree = "<group>"; };
@@ -18426,7 +18425,6 @@
 			children = (
 				717F90581DC4BB600006F520 /* airplay-support.js */,
 				710FA74C1DEE577E004C715E /* controls-visibility-support.js */,
-				71004B9A1DC1109300A52A38 /* elapsed-time-support.js */,
 				714131471DC9D6AF00336107 /* fullscreen-support.js */,
 				7177E2461DB80D2F00919A0B /* media-controller-support.js */,
 				71D02D921DB55C4E00DD5CF5 /* media-controller.js */,
@@ -18434,7 +18432,6 @@
 				7130141D1DC9C08600CA3A88 /* pip-support.js */,
 				711FB0751DC7688F00C4C708 /* placard-support.js */,
 				71004B9D1DC1398800A52A38 /* playback-support.js */,
-				71004B9B1DC1109300A52A38 /* remaining-time-support.js */,
 				7157E3D11DC1EE4B0094550E /* scrubbing-support.js */,
 				718675441DF101C60033D7F3 /* seek-backward-support.js */,
 				718675451DF101C60033D7F3 /* seek-forward-support.js */,
@@ -18442,6 +18439,7 @@
 				71D2554F1DB900020004D76B /* skip-back-support.js */,
 				7177E2481DB80D2F00919A0B /* start-support.js */,
 				71B0460A1DD3C2EE00EE19CF /* status-support.js */,
+				71909BF41E4906A70057F99D /* time-labels-support.js */,
 				71F936F71DD4F99B00922CC7 /* tracks-support.js */,
 				716C8DF11E48B269005BD0DA /* volume-down-support.js */,
 				717F90571DC40ED60006F520 /* volume-support.js */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to