<!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>[186020] 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/186020">186020</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-06-26 18:43:17 -0700 (Fri, 26 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Supporting getStartDate and added tests
https://bugs.webkit.org/show_bug.cgi?id=145676
&lt;rdar://problem/20876076&gt;

Patch by Matt Daiter &lt;mdaiter@apple.com&gt; on 2015-06-26
Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/media/hls/video-controller-getStartDate.html

* bindings/js/JSDOMBinding.cpp:
(WebCore::jsDateOrNaN):
* bindings/js/JSDOMBinding.h:
* bindings/scripts/CodeGeneratorJS.pm: Added features to return
NaN for Date
* bindings/scripts/CodeGeneratorGObject.pm: Needed to add
type checking code for GObject (no date)
(NativeToJSValue):
* bindings/scripts/IDLAttributes.txt:
* html/HTMLMediaElement.cpp: Added getStartDate function
(WebCore::HTMLMediaElement::getStartDate):
* html/HTMLMediaElement.h: Needed to add declarations
* html/HTMLMediaElement.idl: Needed to modify for returning NaN
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::getStartDate):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h: Added in Mac-specific platform
(WebCore::MediaPlayerPrivateInterface::getStartDate):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate):

LayoutTests:

* http/tests/media/hls/video-controller-getStartDate-expected.txt: Added.
* http/tests/media/hls/video-controller-getStartDate.html: Added.
* http/tests/media/resources/hls/test-vod-date-time.m3u8: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingcpp">trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorGObjectpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLAttributestxt">trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementidl">trunk/Source/WebCore/html/HTMLMediaElement.idl</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayercpp">trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayerh">trunk/Source/WebCore/platform/graphics/MediaPlayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayerPrivateh">trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsmediahlsvideocontrollergetStartDateexpectedtxt">trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmediahlsvideocontrollergetStartDatehtml">trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate.html</a></li>
<li><a href="#trunkLayoutTestshttptestsmediaresourceshlstestvoddatetimem3u8">trunk/LayoutTests/http/tests/media/resources/hls/test-vod-date-time.m3u8</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/LayoutTests/ChangeLog        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-06-26  Matt Daiter  &lt;mdaiter@apple.com&gt;
+
+        Supporting getStartDate and added tests
+        https://bugs.webkit.org/show_bug.cgi?id=145676
+        &lt;rdar://problem/20876076&gt;
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/media/hls/video-controller-getStartDate-expected.txt: Added.
+        * http/tests/media/hls/video-controller-getStartDate.html: Added.
+        * http/tests/media/resources/hls/test-vod-date-time.m3u8: Added.
+
</ins><span class="cx"> 2015-06-26  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         No audio on animated page with the attached fixed layout epub
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsmediahlsvideocontrollergetStartDateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate-expected.txt (0 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate-expected.txt        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+ 
+Test that getStartDate() returns appropriate NaN or date.
+
+EVENT(canplaythrough)
+EVENT(canplaythrough)
+EXPECTED (isNaN(video.getStartDate()) == 'true') OK
+EXPECTED (video.getStartDate() == 'Wed Nov 03 2010 01:00:00 GMT-0700 (PDT)') OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediahlsvideocontrollergetStartDatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate.html (0 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/video-controller-getStartDate.html        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=../../media-resources/media-file.js&gt;&lt;/script&gt;
+        &lt;script src=../../media-resources/video-test.js&gt;&lt;/script&gt;
+        &lt;script&gt;
+            var canPlayThroughCount = 0;
+
+            function canPlayThrough()
+            {
+                consoleWrite(&quot;EVENT(canplaythrough)&quot;);
+                if (++canPlayThroughCount == 2)
+                    testGetStartDate()
+            }
+
+            function start()
+            {
+                findMediaElement();

+                video = document.getElementById(&quot;source_without_start_date&quot;);
+                video.src = &quot;../resources/hls/test-vod.m3u8&quot;;
+                video.addEventListener('canplaythrough', canPlayThrough, true);
+
+                video = document.getElementById('source_with_start_date');
+                video.src = &quot;../resources/hls/test-vod-date-time.m3u8&quot;;
+                video.addEventListener('canplaythrough', canPlayThrough, true);
+            }
+    
+            function testGetStartDate()
+            {
+                video = document.getElementById(&quot;source_without_start_date&quot;);
+                testExpected(&quot;isNaN(video.getStartDate())&quot;, true );
+                video = document.getElementById('source_with_start_date');
+                testExpected(&quot;video.getStartDate()&quot;, &quot;Wed Nov 03 2010 01:00:00 GMT-0700 (PDT)&quot;);
+
+                endTest();
+            }
+        &lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body onload=&quot;start()&quot;&gt;
+        &lt;video id=&quot;source_with_start_date&quot; autoplay=&quot;autoplay&quot; width=&quot;640&quot; height=&quot;480&quot;&gt;&lt;/video&gt;
+        &lt;video id=&quot;source_without_start_date&quot; autoplay=&quot;autoplay&quot; width=&quot;640&quot; height=&quot;480&quot;&gt;&lt;/video&gt;
+        &lt;p&gt;Test that getStartDate() returns appropriate NaN or date.&lt;/p&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediaresourceshlstestvoddatetimem3u8"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/resources/hls/test-vod-date-time.m3u8 (0 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/resources/hls/test-vod-date-time.m3u8                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/hls/test-vod-date-time.m3u8        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+#EXTM3U
+#EXT-X-TARGETDURATION:6
+#EXT-X-PROGRAM-DATE-TIME:2010-11-03T00:00:00-08:00
+#EXT-X-VERSION:4
+#EXT-X-MEDIA-SEQUENCE:0
+#EXT-X-PLAYLIST-TYPE:VOD
+#EXTINF:6.0272,
+test.ts
+#EXT-X-ENDLIST
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/ChangeLog        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2015-06-26  Matt Daiter  &lt;mdaiter@apple.com&gt;
+
+        Supporting getStartDate and added tests
+        https://bugs.webkit.org/show_bug.cgi?id=145676
+        &lt;rdar://problem/20876076&gt;
+
+        Reviewed by Brent Fulgham.
+
+        Test: http/tests/media/hls/video-controller-getStartDate.html
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::jsDateOrNaN):
+        * bindings/js/JSDOMBinding.h:
+        * bindings/scripts/CodeGeneratorJS.pm: Added features to return 
+        NaN for Date
+        * bindings/scripts/CodeGeneratorGObject.pm: Needed to add
+        type checking code for GObject (no date)
+        (NativeToJSValue):
+        * bindings/scripts/IDLAttributes.txt: 
+        * html/HTMLMediaElement.cpp: Added getStartDate function
+        (WebCore::HTMLMediaElement::getStartDate):
+        * html/HTMLMediaElement.h: Needed to add declarations
+        * html/HTMLMediaElement.idl: Needed to modify for returning NaN
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::getStartDate):
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/MediaPlayerPrivate.h: Added in Mac-specific platform
+        (WebCore::MediaPlayerPrivateInterface::getStartDate):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate):
+
</ins><span class="cx"> 2015-06-26  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebPage::getPositionInformation() should not copy an image that is larger than the  
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -113,6 +113,13 @@
</span><span class="cx">     return value.toString(exec)-&gt;value(exec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSValue jsDateOrNaN(ExecState* exec, double value)
+{
+    if (std::isnan(value))
+        return jsDoubleNumber(value);
+    return jsDateOrNull(exec, value);
+}
+
</ins><span class="cx"> JSValue jsDateOrNull(ExecState* exec, double value)
</span><span class="cx"> {
</span><span class="cx">     if (!std::isfinite(value))
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -314,6 +314,8 @@
</span><span class="cx"> WEBCORE_EXPORT int64_t toInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
</span><span class="cx"> WEBCORE_EXPORT uint64_t toUInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
</span><span class="cx"> 
</span><ins>+// Returns a Date instnace for the specified value, or NaN if the date is not a number.
+JSC::JSValue jsDateOrNaN(JSC::ExecState*, double);
</ins><span class="cx"> // Returns a Date instance for the specified value, or null if the value is NaN or infinity.
</span><span class="cx"> JSC::JSValue jsDateOrNull(JSC::ExecState*, double);
</span><span class="cx"> // NaN if the value can't be converted to a date.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorGObjectpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -366,6 +366,10 @@
</span><span class="cx">         return 1;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if ($function-&gt;signature-&gt;type eq &quot;Date&quot;) {
+        return 1;
+    }
+
</ins><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -3934,6 +3934,13 @@
</span><span class="cx"> 
</span><span class="cx">     # Need to check Date type before IsPrimitiveType().
</span><span class="cx">     if ($type eq &quot;Date&quot;) {
</span><ins>+        my $conv = $signature-&gt;extendedAttributes-&gt;{&quot;TreatReturnedNaNDateAs&quot;};
+        if (defined $conv) {
+            return &quot;jsDateOrNull(exec, $value)&quot; if $conv eq &quot;Null&quot;;
+            return &quot;jsDateOrNaN(exec, $value)&quot; if $conv eq &quot;NaN&quot;;
+            
+            die &quot;Unknown value for TreatReturnedNaNDateAs extended attribute&quot;;
+        }
</ins><span class="cx">         return &quot;jsDateOrNull(exec, $value)&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLAttributestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -111,6 +111,7 @@
</span><span class="cx"> StrictTypeChecking
</span><span class="cx"> SuppressToJSObject
</span><span class="cx"> TreatNullAs=NullString
</span><ins>+TreatReturnedNaNDateAs=Null|NaN
</ins><span class="cx"> TreatReturnedNullStringAs=Null|Undefined
</span><span class="cx"> TreatUndefinedAs=NullString
</span><span class="cx"> TypedArray=*
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -882,6 +882,11 @@
</span><span class="cx">     return canPlay;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+double HTMLMediaElement::getStartDate() const
+{
+    return m_player-&gt;getStartDate().toDouble();
+}
+
</ins><span class="cx"> void HTMLMediaElement::load()
</span><span class="cx"> {
</span><span class="cx">     Ref&lt;HTMLMediaElement&gt; protect(*this); // loadInternal may result in a 'beforeload' event, which can make arbitrary DOM mutations.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -178,6 +178,7 @@
</span><span class="cx">     WEBCORE_EXPORT virtual double currentTime() const override;
</span><span class="cx">     virtual void setCurrentTime(double) override;
</span><span class="cx">     virtual void setCurrentTime(double, ExceptionCode&amp;);
</span><ins>+    virtual double getStartDate() const;
</ins><span class="cx">     WEBCORE_EXPORT virtual double duration() const override;
</span><span class="cx">     WEBCORE_EXPORT virtual bool paused() const override;
</span><span class="cx">     virtual double defaultPlaybackRate() const override;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.idl (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.idl        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/html/HTMLMediaElement.idl        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx">     // playback state
</span><span class="cx">     [SetterRaisesException] attribute unrestricted double currentTime;
</span><span class="cx">     readonly attribute unrestricted double duration;
</span><ins>+    [TreatReturnedNaNDateAs=NaN] Date getStartDate();
</ins><span class="cx">     readonly attribute boolean paused;
</span><span class="cx">     attribute unrestricted double defaultPlaybackRate;
</span><span class="cx">     attribute unrestricted double playbackRate;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -534,6 +534,11 @@
</span><span class="cx">     return m_private-&gt;currentMediaTime();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+MediaTime MediaPlayer::getStartDate() const
+{
+    return m_private-&gt;getStartDate();
+}
+
</ins><span class="cx"> void MediaPlayer::seekWithTolerance(const MediaTime&amp; time, const MediaTime&amp; negativeTolerance, const MediaTime&amp; positiveTolerance)
</span><span class="cx"> {
</span><span class="cx">     m_private-&gt;seekWithTolerance(time, negativeTolerance, positiveTolerance);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -380,6 +380,8 @@
</span><span class="cx">     MediaTime startTime() const;
</span><span class="cx">     MediaTime initialTime() const;
</span><span class="cx"> 
</span><ins>+    MediaTime getStartDate() const;
+
</ins><span class="cx">     double rate() const;
</span><span class="cx">     void setRate(double);
</span><span class="cx">     double requestedRate() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayerPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -94,6 +94,8 @@
</span><span class="cx">     virtual double currentTimeDouble() const { return currentTime(); }
</span><span class="cx">     virtual MediaTime currentMediaTime() const { return MediaTime::createWithDouble(currentTimeDouble()); }
</span><span class="cx"> 
</span><ins>+    virtual MediaTime getStartDate() const { return MediaTime::createWithDouble(std::numeric_limits&lt;double&gt;::quiet_NaN()); }
+
</ins><span class="cx">     virtual void seek(float) { }
</span><span class="cx">     virtual void seekDouble(double time) { seek(time); }
</span><span class="cx">     virtual void seek(const MediaTime&amp; time) { seekDouble(time.toDouble()); }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -207,6 +207,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool hasSingleSecurityOrigin() const override;
</span><span class="cx"> 
</span><ins>+    MediaTime getStartDate() const override;
+
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">     virtual bool requiresTextTrackRepresentation() const override;
</span><span class="cx">     virtual void setTextTrackRepresentation(TextTrackRepresentation*) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (186019 => 186020)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2015-06-26 23:50:25 UTC (rev 186019)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2015-06-27 01:43:17 UTC (rev 186020)
</span><span class="lines">@@ -719,6 +719,21 @@
</span><span class="cx">     m_videoLayer = nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+MediaTime MediaPlayerPrivateAVFoundationObjC::getStartDate() const
+{
+    // Date changes as the track's playback position changes. Must subtract currentTime (offset in seconds) from date offset to get date beginning
+    double date = [[m_avPlayerItem currentDate] timeIntervalSince1970] * 1000;
+
+    // No live streams were made during the epoch (1970). AVFoundation returns 0 if the media file doesn't have a start date
+    if (!date)
+        return MediaTime::invalidTime();
+
+    double currentTime = CMTimeGetSeconds([m_avPlayerItem currentTime]) * 1000;
+
+    // Rounding due to second offset error when subtracting.
+    return MediaTime::createWithDouble(round(date - currentTime));
+}
+
</ins><span class="cx"> bool MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame() const
</span><span class="cx"> {
</span><span class="cx">     if (currentRenderingMode() == MediaRenderingToLayer)
</span></span></pre>
</div>
</div>

</body>
</html>