<!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>[207468] 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/207468">207468</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-10-18 10:13:53 -0700 (Tue, 18 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update TrackEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163580

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Incorporate https://github.com/w3c/web-platform-tests/pull/3999 as the
test was incorrect. Rebaseline now that we are passing the test.

* web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor-expected.txt:
* web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor.html:

Source/WebCore:

Update TrackEvent to stop using legacy [ConstructorTemplate=Event]
and use a regular constructor as in the specification:
- https://html.spec.whatwg.org/#the-trackevent-interface

No new tests, updated existing tests.

* html/track/TrackEvent.cpp:
(WebCore::TrackEvent::TrackEvent):
* html/track/TrackEvent.h:
* html/track/TrackEvent.idl:

LayoutTests:

Update existing test to reflect behavior change. We now correctly throw a TypeError
when passing an unexpected track object type to the TrackEvent constructor.

* fast/events/constructors/track-event-constructor-expected.txt:
* fast/events/constructors/track-event-constructor.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasteventsconstructorstrackeventconstructorexpectedtxt">trunk/LayoutTests/fast/events/constructors/track-event-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsconstructorstrackeventconstructorhtml">trunk/LayoutTests/fast/events/constructors/track-event-constructor.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontentmediaelementsinterfacesTrackEventconstructorexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontentmediaelementsinterfacesTrackEventconstructorhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTrackEventcpp">trunk/Source/WebCore/html/track/TrackEvent.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTrackEventh">trunk/Source/WebCore/html/track/TrackEvent.h</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTrackEventidl">trunk/Source/WebCore/html/track/TrackEvent.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/LayoutTests/ChangeLog        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-10-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Update TrackEvent to stop using legacy [ConstructorTemplate=Event]
+        https://bugs.webkit.org/show_bug.cgi?id=163580
+
+        Reviewed by Sam Weinig.
+
+        Update existing test to reflect behavior change. We now correctly throw a TypeError
+        when passing an unexpected track object type to the TrackEvent constructor.
+
+        * fast/events/constructors/track-event-constructor-expected.txt:
+        * fast/events/constructors/track-event-constructor.html:
+
</ins><span class="cx"> 2016-10-18  Nael Ouedraogo  &lt;nael.ouedraogo@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         Rebase test in fast/mediastream
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsconstructorstrackeventconstructorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/constructors/track-event-constructor-expected.txt (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/constructors/track-event-constructor-expected.txt        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/LayoutTests/fast/events/constructors/track-event-constructor-expected.txt        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -14,20 +14,16 @@
</span><span class="cx"> PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true }).cancelable is true
</span><span class="cx"> PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true }).track is null
</span><span class="cx"> 
</span><del>-*** Bubbles and cancelable true, invalid track ***
-PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).bubbles is true
-PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).cancelable is true
-PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).track is null
</del><ins>+*** Invalid track ***
+PASS new TrackEvent('TrackEvent', { track: HTMLTrackElement }) threw exception TypeError: Type error.
+PASS new TrackEvent('TrackEvent', { track: 10 }) threw exception TypeError: Type error.
+PASS new TrackEvent('TrackEvent', { track: 'string' }) threw exception TypeError: Type error.
+PASS new TrackEvent('TrackEvent', { track: emptyObject }) threw exception TypeError: Type error.
+PASS new TrackEvent('TrackEvent', { track: document }) threw exception TypeError: Type error.
</ins><span class="cx"> 
</span><del>-*** Initialize 'track' with a invalid values ***
-PASS new TrackEvent('TrackEvent', { track: 10 }).track is null
-PASS new TrackEvent('TrackEvent', { track: 'string' }).track is null
-PASS new TrackEvent('TrackEvent', { track: emptyObject }).track is null
-PASS new TrackEvent('TrackEvent', { track: document }).track is null
-
</del><span class="cx"> *** Bubbles and cancelable true, valid track ***
</span><del>-PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).bubbles is true
-PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).cancelable is true
</del><ins>+PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: trackElement.track }).bubbles is true
+PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: trackElement.track }).cancelable is true
</ins><span class="cx"> PASS new TrackEvent('TrackEvent', { track: trackElement.track }).track is trackElement.track
</span><span class="cx"> 
</span><span class="cx"> *** Initialize 'track' with valid track object ***
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsconstructorstrackeventconstructorhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/constructors/track-event-constructor.html (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/constructors/track-event-constructor.html        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/LayoutTests/fast/events/constructors/track-event-constructor.html        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -26,21 +26,17 @@
</span><span class="cx">             shouldBe(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true }).cancelable&quot;, &quot;true&quot;);
</span><span class="cx">             shouldBeNull(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true }).track&quot;);
</span><span class="cx">     
</span><del>-            debug(&quot;&lt;br&gt;*** Bubbles and cancelable true, invalid track ***&quot;);
-            shouldBe(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).bubbles&quot;, &quot;true&quot;);
-            shouldBe(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).cancelable&quot;, &quot;true&quot;);
-            shouldBeNull(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).track&quot;);
-    
-            debug(&quot;&lt;br&gt;*** Initialize 'track' with a invalid values ***&quot;);
-            shouldBeNull(&quot;new TrackEvent('TrackEvent', { track: 10 }).track&quot;);
-            shouldBeNull(&quot;new TrackEvent('TrackEvent', { track: \'string\' }).track&quot;);
</del><ins>+            debug(&quot;&lt;br&gt;*** Invalid track ***&quot;);
+            shouldThrowErrorName(&quot;new TrackEvent('TrackEvent', { track: HTMLTrackElement })&quot;, &quot;TypeError&quot;);
+            shouldThrowErrorName(&quot;new TrackEvent('TrackEvent', { track: 10 })&quot;, &quot;TypeError&quot;);
+            shouldThrowErrorName(&quot;new TrackEvent('TrackEvent', { track: \'string\' })&quot;, &quot;TypeError&quot;);
</ins><span class="cx">             emptyObject = { };
</span><del>-            shouldBeNull(&quot;new TrackEvent('TrackEvent', { track: emptyObject }).track&quot;);
-            shouldBeNull(&quot;new TrackEvent('TrackEvent', { track: document }).track&quot;);
</del><ins>+            shouldThrowErrorName(&quot;new TrackEvent('TrackEvent', { track: emptyObject })&quot;, &quot;TypeError&quot;);
+            shouldThrowErrorName(&quot;new TrackEvent('TrackEvent', { track: document })&quot;, &quot;TypeError&quot;);
</ins><span class="cx"> 
</span><span class="cx">             debug(&quot;&lt;br&gt;*** Bubbles and cancelable true, valid track ***&quot;);
</span><del>-            shouldBe(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).bubbles&quot;, &quot;true&quot;);
-            shouldBe(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).cancelable&quot;, &quot;true&quot;);
</del><ins>+            shouldBe(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: trackElement.track }).bubbles&quot;, &quot;true&quot;);
+            shouldBe(&quot;new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: trackElement.track }).cancelable&quot;, &quot;true&quot;);
</ins><span class="cx">             shouldBe(&quot;new TrackEvent('TrackEvent', { track: trackElement.track }).track&quot;, &quot;trackElement.track&quot;);
</span><span class="cx"> 
</span><span class="cx">             debug(&quot;&lt;br&gt;*** Initialize 'track' with valid track object ***&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-10-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Update TrackEvent to stop using legacy [ConstructorTemplate=Event]
+        https://bugs.webkit.org/show_bug.cgi?id=163580
+
+        Reviewed by Sam Weinig.
+
+        Incorporate https://github.com/w3c/web-platform-tests/pull/3999 as the
+        test was incorrect. Rebaseline now that we are passing the test.
+
+        * web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor-expected.txt:
+        * web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor.html:
+
</ins><span class="cx"> 2016-10-15  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for reportValidity() on form and form control elements
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontentmediaelementsinterfacesTrackEventconstructorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor-expected.txt (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor-expected.txt        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor-expected.txt        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> 
</span><span class="cx"> PASS TrackEvent constructor, one arg 
</span><del>-FAIL TrackEvent constructor, two args assert_equals: ev.track expected object &quot;[object Object]&quot; but got null
</del><ins>+PASS TrackEvent constructor, two args 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontentmediaelementsinterfacesTrackEventconstructorhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor.html (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor.html        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/constructor.html        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -13,12 +13,13 @@
</span><span class="cx">     assert_equals(ev.track, null, 'ev.track after assignment');
</span><span class="cx"> }, document.title+', one arg');
</span><span class="cx"> test(function(){
</span><del>-    var obj = {};
-    var ev = new TrackEvent('foo', {track:obj});
</del><ins>+    var video = document.createElement('video');
+    var testTrack = video.addTextTrack('subtitles', 'foo', 'foo');
+    var ev = new TrackEvent('foo', {track: testTrack});
</ins><span class="cx">     assert_true(ev instanceof TrackEvent, 'ev instanceof TrackEvent');
</span><span class="cx">     assert_true(ev instanceof Event, 'ev instanceof Event');
</span><del>-    assert_equals(ev.track, obj, 'ev.track');
</del><ins>+    assert_equals(ev.track, testTrack, 'ev.track');
</ins><span class="cx">     ev.track = {};
</span><del>-    assert_equals(ev.track, obj, 'ev.track after assignment');
</del><ins>+    assert_equals(ev.track, testTrack, 'ev.track after assignment');
</ins><span class="cx"> }, document.title+', two args');
</span><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/Source/WebCore/ChangeLog        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-10-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Update TrackEvent to stop using legacy [ConstructorTemplate=Event]
+        https://bugs.webkit.org/show_bug.cgi?id=163580
+
+        Reviewed by Sam Weinig.
+
+        Update TrackEvent to stop using legacy [ConstructorTemplate=Event]
+        and use a regular constructor as in the specification:
+        - https://html.spec.whatwg.org/#the-trackevent-interface
+
+        No new tests, updated existing tests.
+
+        * html/track/TrackEvent.cpp:
+        (WebCore::TrackEvent::TrackEvent):
+        * html/track/TrackEvent.h:
+        * html/track/TrackEvent.idl:
+
</ins><span class="cx"> 2016-10-18  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r207409.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTrackEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TrackEvent.cpp (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TrackEvent.cpp        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/Source/WebCore/html/track/TrackEvent.cpp        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -39,10 +39,14 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TrackEvent::TrackEvent(const AtomicString&amp; type, const TrackEventInit&amp; initializer)
-    : Event(type, initializer)
-    , m_track(initializer.track)
</del><ins>+TrackEvent::TrackEvent(const AtomicString&amp; type, const Init&amp; initializer, IsTrusted isTrusted)
+    : Event(type, initializer, isTrusted)
</ins><span class="cx"> {
</span><ins>+    if (initializer.track) {
+        m_track = std::experimental::visit([](const auto&amp; trackbase) -&gt; TrackBase* {
+            return trackbase.get();
+        }, *initializer.track);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TrackEvent::~TrackEvent()
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTrackEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TrackEvent.h (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TrackEvent.h        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/Source/WebCore/html/track/TrackEvent.h        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -28,15 +28,13 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> 
</span><ins>+#include &quot;AudioTrack.h&quot;
</ins><span class="cx"> #include &quot;Event.h&quot;
</span><del>-#include &quot;TrackBase.h&quot;
</del><ins>+#include &quot;TextTrack.h&quot;
+#include &quot;VideoTrack.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-struct TrackEventInit : public EventInit {
-    RefPtr&lt;TrackBase&gt; track;
-};
-
</del><span class="cx"> class TrackEvent final : public Event {
</span><span class="cx"> public:
</span><span class="cx">     virtual ~TrackEvent();
</span><span class="lines">@@ -46,9 +44,15 @@
</span><span class="cx">         return adoptRef(*new TrackEvent(type, canBubble, cancelable, WTFMove(track)));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static Ref&lt;TrackEvent&gt; createForBindings(const AtomicString&amp; type, const TrackEventInit&amp; initializer)
</del><ins>+    using TrackEventTrack = std::experimental::variant&lt;RefPtr&lt;VideoTrack&gt;, RefPtr&lt;AudioTrack&gt;, RefPtr&lt;TextTrack&gt;&gt;;
+
+    struct Init : public EventInit {
+        Optional&lt;TrackEventTrack&gt; track;
+    };
+
+    static Ref&lt;TrackEvent&gt; create(const AtomicString&amp; type, const Init&amp; initializer, IsTrusted isTrusted = IsTrusted::No)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new TrackEvent(type, initializer));
</del><ins>+        return adoptRef(*new TrackEvent(type, initializer, isTrusted));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     EventInterface eventInterface() const override;
</span><span class="lines">@@ -57,7 +61,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     TrackEvent(const AtomicString&amp; type, bool canBubble, bool cancelable, Ref&lt;TrackBase&gt;&amp;&amp;);
</span><del>-    TrackEvent(const AtomicString&amp; type, const TrackEventInit&amp; initializer);
</del><ins>+    TrackEvent(const AtomicString&amp; type, const Init&amp; initializer, IsTrusted);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;TrackBase&gt; m_track;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTrackEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TrackEvent.idl (207467 => 207468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TrackEvent.idl        2016-10-18 17:10:06 UTC (rev 207467)
+++ trunk/Source/WebCore/html/track/TrackEvent.idl        2016-10-18 17:13:53 UTC (rev 207468)
</span><span class="lines">@@ -25,8 +25,11 @@
</span><span class="cx"> 
</span><span class="cx"> [
</span><span class="cx">     Conditional=VIDEO_TRACK,
</span><del>-    LegacyConstructorTemplate=Event
</del><ins>+    Constructor(DOMString type, optional TrackEventInit eventInitDict)
</ins><span class="cx"> ] interface TrackEvent : Event {
</span><del>-    [LegacyInitializedByEventConstructor, CustomGetter] readonly attribute object track;
</del><ins>+    [CustomGetter] readonly attribute (VideoTrack or AudioTrack or TextTrack)? track;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+dictionary TrackEventInit : EventInit {
+    (VideoTrack or AudioTrack or TextTrack)? track = null;
+};
</ins></span></pre>
</div>
</div>

</body>
</html>