<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[218853] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/218853">218853</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-06-27 16:48:22 -0700 (Tue, 27 Jun 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Modern Media Controls] Accessibility labels should be formatted using NSDateComponentsFormatter
https://bugs.webkit.org/show_bug.cgi?id=173858
<rdar://problem/32643171>

Patch by Antoine Quint <graouts@apple.com> on 2017-06-27
Reviewed by Dean Jackson.

Source/WebCore:

We shouldn't be manually trying to create a formatted string for media controls and instead rely
on NSDateComponentsFormatter to perform this task for us. So we remove the ad-hoc code in the JS
media controls code and instead add a new MediaControlsHost method to format durations which calls
into RenderTheme to provide a formatted duration string relevant to the current platform and locale.

* English.lproj/modern-media-controls-localized-strings.js:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::formattedStringForDuration):
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:
* Modules/modern-media-controls/controls/slider.js:
(Slider.prototype.set inputAccessibleLabel):
* Modules/modern-media-controls/controls/time-label.js:
(TimeLabel.prototype.commitProperty):
* Modules/modern-media-controls/main.js:
(createControls):
(formattedStringForDuration):
(formatTimeToString): Deleted.
* rendering/RenderTheme.h:
(WebCore::RenderTheme::mediaControlsFormattedStringForDuration):
* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):

LayoutTests:

* media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt:
* media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsscrubberscrubberhascorrectaxlabelexpectedtxt">trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsscrubberscrubberhascorrectaxlabelhtml">trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreEnglishlprojmodernmediacontrolslocalizedstringsjs">trunk/Source/WebCore/English.lproj/modern-media-controls-localized-strings.js</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolscontrolssliderjs">trunk/Source/WebCore/Modules/modern-media-controls/controls/slider.js</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolscontrolstimelabeljs">trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.js</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolsmainjs">trunk/Source/WebCore/Modules/modern-media-controls/main.js</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeh">trunk/Source/WebCore/rendering/RenderTheme.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeCocoah">trunk/Source/WebCore/rendering/RenderThemeCocoa.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeCocoamm">trunk/Source/WebCore/rendering/RenderThemeCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/LayoutTests/ChangeLog 2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2017-06-27  Antoine Quint  <graouts@apple.com>
</span><span class="cx"> 
</span><ins>+        [Modern Media Controls] Accessibility labels should be formatted using NSDateComponentsFormatter
+        https://bugs.webkit.org/show_bug.cgi?id=173858
+        <rdar://problem/32643171>
+
+        Reviewed by Dean Jackson.
+
+        * media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt:
+        * media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html:
+
+2017-06-27  Antoine Quint  <graouts@apple.com>
+
</ins><span class="cx">         Placard icons act like buttons (can get keyboard focus and shows up in VoiceOver)
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=173891
</span><span class="cx">         <rdar://problem/33011855>
</span></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsscrubberscrubberhascorrectaxlabelexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt        2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt   2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -3,11 +3,10 @@
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS scrubberInput.getAttribute('aria-valuetext') is "0 Minute 0 Second"
</del><ins>+PASS input.getAttribute('aria-valuetext') is "0 seconds"
</ins><span class="cx"> PASS media.currentTime is 2
</span><del>-PASS scrubberInput.getAttribute('aria-valuetext') === '0 Minute 2 Seconds' became true
</del><ins>+PASS input.getAttribute('aria-valuetext') === '2 seconds' became true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span><span class="cx"> 
</span><del>-
</del></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsscrubberscrubberhascorrectaxlabelhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html        2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/LayoutTests/media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html   2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> </style>
</span><del>-<video src="../../content/test.mp4" style="width: 320px; height: 240px;" controls></video>
</del><ins>+<video src="../../content/test.mp4" style="width: 320px; height: 240px;" controls autoplay></video>
</ins><span class="cx"> <div id="host"></div>
</span><span class="cx"> <script type="text/javascript">
</span><span class="cx"> 
</span><span class="lines">@@ -21,22 +21,19 @@
</span><span class="cx"> 
</span><span class="cx"> description("Testing for an accessibility text on the scrubber that correctly reflects the changes in media.currentTime.");
</span><span class="cx"> 
</span><del>-const container = document.querySelector("div#host");
</del><span class="cx"> const media = document.querySelector("video");
</span><del>-const mediaController = createControls(container, media, null);
</del><ins>+let input;
</ins><span class="cx"> 
</span><del>-mediaController.controls.showsStartButton = false;
</del><ins>+media.addEventListener("play", () => {
+    input = internals.shadowRoot(media).querySelector(".time-control > .slider > input");
</ins><span class="cx"> 
</span><del>-const scrubberNodes = mediaController.controls.timeControl.scrubber.children;
-const scrubberInput = scrubberNodes[scrubberNodes.length - 1].element;
</del><ins>+    media.pause();
</ins><span class="cx"> 
</span><del>-media.addEventListener("canplay", () => {
-
-    shouldBeEqualToString("scrubberInput.getAttribute('aria-valuetext')", "0 Minute 0 Second");
</del><ins>+    shouldBeEqualToString("input.getAttribute('aria-valuetext')", "0 seconds");
</ins><span class="cx">     media.currentTime = 2;
</span><span class="cx">     shouldBe("media.currentTime", "2");
</span><del>-    shouldBecomeEqual("scrubberInput.getAttribute('aria-valuetext') === '0 Minute 2 Seconds'", "true", finishJSTest);
-})
</del><ins>+    shouldBecomeEqual("input.getAttribute('aria-valuetext') === '2 seconds'", "true", finishJSTest);
+});
</ins><span class="cx"> 
</span><span class="cx"> </script>
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/ChangeLog      2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2017-06-27  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] Accessibility labels should be formatted using NSDateComponentsFormatter
+        https://bugs.webkit.org/show_bug.cgi?id=173858
+        <rdar://problem/32643171>
+
+        Reviewed by Dean Jackson.
+
+        We shouldn't be manually trying to create a formatted string for media controls and instead rely
+        on NSDateComponentsFormatter to perform this task for us. So we remove the ad-hoc code in the JS
+        media controls code and instead add a new MediaControlsHost method to format durations which calls
+        into RenderTheme to provide a formatted duration string relevant to the current platform and locale.
+
+        * English.lproj/modern-media-controls-localized-strings.js:
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::formattedStringForDuration):
+        * Modules/mediacontrols/MediaControlsHost.h:
+        * Modules/mediacontrols/MediaControlsHost.idl:
+        * Modules/modern-media-controls/controls/slider.js:
+        (Slider.prototype.set inputAccessibleLabel):
+        * Modules/modern-media-controls/controls/time-label.js:
+        (TimeLabel.prototype.commitProperty):
+        * Modules/modern-media-controls/main.js:
+        (createControls):
+        (formattedStringForDuration):
+        (formatTimeToString): Deleted.
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::mediaControlsFormattedStringForDuration):
+        * rendering/RenderThemeCocoa.h:
+        * rendering/RenderThemeCocoa.mm:
+        (WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):
+
</ins><span class="cx"> 2017-06-27  Eric Carlson  <eric.carlson@apple.com>
</span><span class="cx"> 
</span><span class="cx">         r218647 causes getUserMedia to fail on some machines
</span></span></pre></div>
<a id="trunkSourceWebCoreEnglishlprojmodernmediacontrolslocalizedstringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/English.lproj/modern-media-controls-localized-strings.js (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/English.lproj/modern-media-controls-localized-strings.js    2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/English.lproj/modern-media-controls-localized-strings.js       2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -8,12 +8,8 @@
</span><span class="cx">     "Exit Full Screen": "Exit Full Screen",
</span><span class="cx">     "Error": "Error",
</span><span class="cx">     "Forward": "Forward",
</span><del>-    "Hour": "Hour",
-    "Hours": "Hours",
</del><span class="cx">     "Invalid": "Invalid",
</span><span class="cx">     "Live Broadcast": "Live Broadcast",
</span><del>-    "Minute": "Minute",
-    "Minutes": "Minutes",
</del><span class="cx">     "Media Selection": "Media Selection",
</span><span class="cx">     "Mute": "Mute",
</span><span class="cx">     "Pause": "Pause",
</span><span class="lines">@@ -21,8 +17,6 @@
</span><span class="cx">     "Play": "Play",
</span><span class="cx">     "Remaining": "Remaining",
</span><span class="cx">     "Rewind": "Rewind",
</span><del>-    "Second": "Second",
-    "Seconds": "Seconds",
</del><span class="cx">     "Skip Back 15 seconds": "Skip Back 15 seconds",
</span><span class="cx">     "Skip Forward 15 seconds": "Skip Forward 15 seconds",
</span><span class="cx">     "Subtitles": "Subtitles",
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp 2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp    2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -289,6 +289,11 @@
</span><span class="cx">     return RenderTheme::singleton().mediaControlsBase64StringForIconNameAndType(iconName, iconType);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String MediaControlsHost::formattedStringForDuration(const double durationInSeconds) const
+{
+    return RenderTheme::singleton().mediaControlsFormattedStringForDuration(durationInSeconds);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h   2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h      2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx"> 
</span><span class="cx">     String shadowRootCSSText() const;
</span><span class="cx">     String base64StringForIconNameAndType(const String& iconName, const String& iconType) const;
</span><ins>+    String formattedStringForDuration(const double) const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     MediaControlsHost(HTMLMediaElement*);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl 2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl    2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -63,4 +63,5 @@
</span><span class="cx"> 
</span><span class="cx">     [EnabledAtRuntime=ModernMediaControls] readonly attribute DOMString shadowRootCSSText;
</span><span class="cx">     [EnabledAtRuntime=ModernMediaControls] DOMString base64StringForIconNameAndType(DOMString iconName, DOMString iconType);
</span><ins>+    [EnabledAtRuntime=ModernMediaControls] DOMString formattedStringForDuration(unrestricted double durationInSeconds);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolscontrolssliderjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/slider.js (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/controls/slider.js    2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/slider.js       2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx">     set inputAccessibleLabel(timeValue)
</span><span class="cx">     {
</span><del>-        this._input.element.setAttribute("aria-valuetext", formatTimeToString(timeValue));
</del><ins>+        this._input.element.setAttribute("aria-valuetext", formattedStringForDuration(timeValue));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     get disabled()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolscontrolstimelabeljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.js (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.js        2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/time-label.js   2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">     {
</span><span class="cx">         if (propertyName === "value") {
</span><span class="cx">             this.element.textContent = this._formattedTime();
</span><del>-            const timeAsString = formatTimeToString(this.value);
</del><ins>+            const timeAsString = formattedStringForDuration(this.value);
</ins><span class="cx">             const ariaLabel = (this._type === TimeLabel.Types.Remaining) ? UIString("Remaining") : UIString("Elapsed");
</span><span class="cx">             this.element.setAttribute("aria-label", `${ariaLabel}: ${timeAsString}`);
</span><span class="cx">             if (this.parent instanceof TimeControl)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolsmainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/modern-media-controls/main.js (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/main.js       2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/Modules/modern-media-controls/main.js  2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -23,10 +23,13 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+let mediaControlsHost;
+
</ins><span class="cx"> // This is called from HTMLMediaElement::ensureMediaControlsInjectedScript().
</span><span class="cx"> function createControls(shadowRoot, media, host)
</span><span class="cx"> {
</span><span class="cx">     if (host) {
</span><ins>+        mediaControlsHost = host;
</ins><span class="cx">         iconService.mediaControlsHost = host;
</span><span class="cx">         shadowRoot.appendChild(document.createElement("style")).textContent = host.shadowRootCSSText;
</span><span class="cx">     }
</span><span class="lines">@@ -67,12 +70,10 @@
</span><span class="cx">     return `${value} ${returnedUnit}`;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function formatTimeToString(timeInSeconds)
</del><ins>+function formattedStringForDuration(timeInSeconds)
</ins><span class="cx"> {
</span><del>-    const time = formatTimeByUnit(timeInSeconds);
-    const timeStrings = [unitizeTime(time.minutes, "Minute"), unitizeTime(time.seconds, "Second")];
-    if (time.hours > 0)
-        timeStrings.unshift(unitizeTime(time.hours, "Hour"));
-
-    return timeStrings.join(" ");
</del><ins>+    if (mediaControlsHost)
+        return mediaControlsHost.formattedStringForDuration(Math.abs(timeInSeconds));
+    else
+        return "";
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.h (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.h     2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/rendering/RenderTheme.h        2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -94,6 +94,7 @@
</span><span class="cx">     virtual String extraMediaControlsStyleSheet() { return String(); }
</span><span class="cx">     virtual String mediaControlsScript() { return String(); }
</span><span class="cx">     virtual String mediaControlsBase64StringForIconNameAndType(const String&, const String&) { return String(); }
</span><ins>+    virtual String mediaControlsFormattedStringForDuration(const double) { return String(); }
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx">     virtual String extraFullScreenStyleSheet() { return String(); }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeCocoah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.h (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeCocoa.h        2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.h   2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -35,6 +35,10 @@
</span><span class="cx">     void adjustApplePayButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
</span><span class="cx">     bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="cx"> #endif
</span><ins>+protected:
+#if ENABLE(VIDEO)
+    String mediaControlsFormattedStringForDuration(const double) override;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.mm (218852 => 218853)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeCocoa.mm       2017-06-27 23:40:07 UTC (rev 218852)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.mm  2017-06-27 23:48:22 UTC (rev 218853)
</span><span class="lines">@@ -42,8 +42,16 @@
</span><span class="cx"> 
</span><span class="cx"> SOFT_LINK_MAY_FAIL(PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode));
</span><span class="cx"> 
</span><ins>+#endif // ENABLE(APPLE_PAY)
+
+#if ENABLE(VIDEO)
+#include "LocalizedStrings.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLE_PAY)
+
</ins><span class="cx"> static const auto applePayButtonMinimumWidth = 140;
</span><span class="cx"> static const auto applePayButtonPlainMinimumWidth = 100;
</span><span class="cx"> static const auto applePayButtonMinimumHeight = 30;
</span><span class="lines">@@ -99,6 +107,27 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#endif // ENABLE(APPLE_PAY)
+
+#if ENABLE(VIDEO)
+
+String RenderThemeCocoa::mediaControlsFormattedStringForDuration(const double durationInSeconds)
+{
+#if ENABLE(MEDIA_CONTROLS_SCRIPT)
+    if (!std::isfinite(durationInSeconds))
+        return WEB_UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value");
+
+    NSDateComponentsFormatter *durationFormatter = [NSDateComponentsFormatter new];
+    durationFormatter.unitsStyle = NSDateComponentsFormatterUnitsStyleFull;
+    durationFormatter.allowedUnits = NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
+    durationFormatter.formattingContext = NSFormattingContextStandalone;
+    durationFormatter.maximumUnitCount = 2;
+    return [durationFormatter stringFromTimeInterval:durationInSeconds];
+#else
+    return emptyString();
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // ENABLE(VIDEO)
+
+}
</ins></span></pre>
</div>
</div>

</body>
</html>