<!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>[200317] trunk/Source/WebCore</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/200317">200317</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-05-01 23:05:57 -0700 (Sun, 01 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Stop using string-based enumerations in TextTrack, and eliminate support for string-based enumerations
https://bugs.webkit.org/show_bug.cgi?id=157253

Reviewed by Chris Dumez.

This was the most difficult case to convert from the old style of enumeration to enum class.
Afterward there is a bit of messy duplication, but it still seems like an improvement overall.

After this patch, I plan to change the rule for the name of the enumeration; instead of
living at the top level of the WebCore namespace, we will look for them inside the class for the
first interface defined in the same file along with the enumeration, and remove the name prefix,
if the interfaces's name is a prefix of the enumerations's name.

Once that's done, next step is to do something in the bindings for dictionaries. And adopt both the
enumeration and dictionary mechanisms more widely, and remove the old use of &quot;dictionary&quot; as a type name.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::removeSourceBuffer): Use enum values instead of keywords.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::textTrackModeChanged): Ditto.

* bindings/js/JSTextTrackCustom.cpp:
(WebCore::JSTextTrack::setKind): Deleted.

* bindings/scripts/CodeGenerator.pm:
(IsStringBasedEnumType): Deleted.

* bindings/scripts/CodeGeneratorJS.pm:
(GetEnumerationImplementationContent): Removed IsStringBasedEnumType check.
(GenerateParametersCheck): Ditto.
(GenerateImplementation): Ditto.
(GetNativeType): Ditto.
(JSValueToNative): Ditto.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadInternal): Use enum values instead of keywords.
(WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
(WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
(WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
(WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
(WebCore::HTMLMediaElement::addTextTrack): Ditto.
(WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto.
(WebCore::HTMLMediaElement::setSelectedTextTrack): Ditto.
(WebCore::HTMLMediaElement::configureTextTracks): Ditto.
(WebCore::HTMLMediaElement::hasClosedCaptions): Ditto.
(WebCore::HTMLMediaElement::configureTextTrackDisplay): Ditto.
(WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Ditto.
(WebCore::toPlatform): Added helpers for the outOfBandTrackSources function.
(WebCore::HTMLMediaElement::outOfBandTrackSources): Removed unneeded fastHasAttribute
check since getNonEmptyURLAttribute already returns an empty URL when the attribute is
not present. Changed to use enum values instead of keywords.

* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::parseAttribute): Use new setKindKeywordIgnoringASCIICase
function rather than calling setKind and convertToASCIILowercase. Also use ensureTrack
instead of track since the latter is a cover that calls it and dumbs down the return type.
(WebCore::HTMLTrackElement::kind): Changed return type to const AtomicString&amp; since
that's what we will have for kind keywords and because it matches what we normally have
for attribute getting fuctions. Also use ensureTrack.
(WebCore::HTMLTrackElement::setKind): Changed argument to AtomicString so we don't waste
time making a string and then destroying it before turning it into an AtomicString so it
can be an attribute value.
(WebCore::HTMLTrackElement::srclang): Changed return type to const AtomicString&amp; as is
customary and efficient for attribute value convenience functions. Also use fastGetAttribute.
(WebCore::HTMLTrackElement::setSrclang): Deleted.
(WebCore::HTMLTrackElement::label): Ditto.
(WebCore::HTMLTrackElement::setLabel): Deleted.
(WebCore::HTMLTrackElement::setIsDefault): Deleted.
(WebCore::HTMLTrackElement::scheduleLoad): Use enum values instead of keywords.

* html/HTMLTrackElement.h: Use pragma once. Update for changes mentioned above.
Also mark things final instead of override as per our recent style discussion.

* html/HTMLTrackElement.idl: Use [Reflect] for srclang and label.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Use enum value
instead of keyword.
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.

* html/track/AudioTrack.cpp:
(WebCore::AudioTrack::AudioTrack): Use new base class MediaTrackBase.

* html/track/AudioTrack.h: Use pragma once. Make base class be MediaTrackBase instead
of TrackBase.

* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::setMode): Change argument type to enum instead of string.
(WebCore::toPrivate): Added. Helper for setModeInternal.
(WebCore::InbandTextTrack::setModeInternal): Change argument type to enum instead of string.
(WebCore::InbandTextTrack::updateKindFromPrivate): Use enum instead of string to call setKind.

* html/track/InbandTextTrack.h: Use pragma once. Use TextTrackMode for argument types.

* html/track/TextTrack.cpp:
(WebCore::captionsKeyword): Converted this to a non-member function since it is now
private to this file.
(WebCore::descriptionsKeyword): Ditto.
(WebCore::chaptersKeyword): Ditto.
(WebCore::metadataKeyword): Ditto.
(WebCore::forcedKeyword): Ditto.
(WebCore::TextTrack::disabledKeyword): Deleted.
(WebCore::TextTrack::hiddenKeyword): Deleted.
(WebCore::TextTrack::showingKeyword): Deleted.
(WebCore::TextTrack::TextTrack): Moved some initialization to be done in the header where
the data members are defined. Put the code that is the equivalent to setKindInternal here,
because it turns out it's not needed anywhere else. Over time we might change the types
involved and there's no need to have that be across multiple functions.
(WebCore::TextTrack::~TextTrack): Removed unneeded call to clearClient, right when the
object is about to be destroyed. Perhaps there was an illusion that the old call might
be a virtual function call that invokes the clearClient from a derived class, but that
doesn't work in a destructor, so this code was only clearing out the data member and
that does not need to be done.
(WebCore::TextTrack::isValidKind): Deleted.
(WebCore::TextTrack::enabled): Use enum value instead of keyword.
(WebCore::TextTrack::kindKeyword): Added. Function for callers who need a string, not the
enum value.
(WebCore::TextTrack::setKind): Take enum value instead of keyword. Also changed since
we store the kind in a data member in this class, not inherited.
(WebCore::TextTrack::setKindKeywordIgnoringASCIICase): Added. For HTMLTrackElement to use
when setting the kind attribute.
(WebCore::TextTrack::setMode): Take enum value instread of keyword. Also removed assertion
since the enum already makes it intrinsically clear what values are valid, unlike a string.
(WebCore::TextTrack::cues): Use enum value instead of keyword.
(WebCore::TextTrack::activeCues): Ditto.
(WebCore::TextTrack::addCue): Ditto.
(WebCore::TextTrack::ensureVTTRegionList): Changed return type to reference.
(WebCore::TextTrack::regions): Use enum value instead of keyword.
(WebCore::TextTrack::addRegion): Use reference.
(WebCore::TextTrack::cueDidChange): Ditto.
(WebCore::TextTrack::isRendered): Use enum values instead of keywords. Also write to be
a boolean expression instead of a couple different if statements.
(WebCore::TextTrack::ensureTextTrackCueList): Changed return type to reference.
(WebCore::TextTrack::isMainProgramContent): Use enum value instead of keyword.
(WebCore::TextTrack::containsOnlyForcedSubtitles): Ditto.

* html/track/TextTrack.h: Use pragma once. Removed unneeded include. Added enums for
TextTrackKind and TextTrackMode. Updated for changes to functions listed above.
Added m_mode and m_kind and initialized those data members and some others.

* html/track/TextTrack.idl: Tweaked formatting. Used ImplementedAs for the kind
attribute rather than using a CustomSetter. This preserves the strange behavior
where setting kind does nothing when !ENABLE(MEDIA_SOURCE). If we discover we don't
need that, then we won't need ImplementedAs any more either.

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::dispatchEvent): Use enum instad of keyword.
(WebCore::TextTrackCue::isActive): Ditto.

* html/track/TrackBase.cpp:
(WebCore::TrackBase::TrackBase): Removed unneeded initialization that is handled in
the data member definition in the header now.
(WebCore::MediaTrackBase::MediaTrackBase): Added. Calls through to TrackBase.
(WebCore::MediaTrackBase::setKind): Moved to MediaTrackBase from TrackBase, because
this isn't needed for text tracks.
(WebCore::MediaTrackBase::setKindInternal): Ditto.

* html/track/TrackBase.h: Use pragma once. Move kind, setKind, isValidKind, defaultKindKeyword,
setKindInternal, and m_kind all to a derived class, MediaTrackBase, since TextTrack doesn't need
any of those any more. Later we might adopt enumerations more and it's possible the need for
MediaTrackBase will go away.

* html/track/VideoTrack.cpp:
(WebCore::VideoTrack::VideoTrack): Updated to use MediaTrackBase.
(WebCore::VideoTrack::setLanguage): Ditto.

* html/track/VideoTrack.h: Use pragma once. Removed unneeded header include.
Derive from MediaTrackBase instead of TrackBase.

* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::sortedTrackListForMenu): Use enum values instead
of keywords.
(WebCore::CaptionUserPreferences::textTrackSelectionScore): Ditto.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Ditto.
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Ditto. Also used
kindKeyword since we want a string for logging.
* platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
(WebPlaybackSessionModelMediaElement::updateLegibleOptions): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceMediaSourcecpp">trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceSourceBuffercpp">trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSTextTrackCustomcpp">trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTrackElementcpp">trunk/Source/WebCore/html/HTMLTrackElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTrackElementh">trunk/Source/WebCore/html/HTMLTrackElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTrackElementidl">trunk/Source/WebCore/html/HTMLTrackElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowMediaControlElementscpp">trunk/Source/WebCore/html/shadow/MediaControlElements.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackAudioTrackcpp">trunk/Source/WebCore/html/track/AudioTrack.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackAudioTrackh">trunk/Source/WebCore/html/track/AudioTrack.h</a></li>
<li><a href="#trunkSourceWebCorehtmltrackInbandTextTrackcpp">trunk/Source/WebCore/html/track/InbandTextTrack.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackInbandTextTrackh">trunk/Source/WebCore/html/track/InbandTextTrack.h</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTextTrackcpp">trunk/Source/WebCore/html/track/TextTrack.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTextTrackh">trunk/Source/WebCore/html/track/TextTrack.h</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTextTrackidl">trunk/Source/WebCore/html/track/TextTrack.idl</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTextTrackCuecpp">trunk/Source/WebCore/html/track/TextTrackCue.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTrackBasecpp">trunk/Source/WebCore/html/track/TrackBase.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTrackBaseh">trunk/Source/WebCore/html/track/TrackBase.h</a></li>
<li><a href="#trunkSourceWebCorehtmltrackVideoTrackcpp">trunk/Source/WebCore/html/track/VideoTrack.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackVideoTrackh">trunk/Source/WebCore/html/track/VideoTrack.h</a></li>
<li><a href="#trunkSourceWebCorepageCaptionUserPreferencescpp">trunk/Source/WebCore/page/CaptionUserPreferences.cpp</a></li>
<li><a href="#trunkSourceWebCorepageCaptionUserPreferencesMediaAFcpp">trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaWebPlaybackSessionModelMediaElementmm">trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/ChangeLog        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -1,3 +1,185 @@
</span><ins>+2016-05-01  Darin Adler  &lt;darin@apple.com&gt;
+
+        Stop using string-based enumerations in TextTrack, and eliminate support for string-based enumerations
+        https://bugs.webkit.org/show_bug.cgi?id=157253
+
+        Reviewed by Chris Dumez.
+
+        This was the most difficult case to convert from the old style of enumeration to enum class.
+        Afterward there is a bit of messy duplication, but it still seems like an improvement overall.
+
+        After this patch, I plan to change the rule for the name of the enumeration; instead of
+        living at the top level of the WebCore namespace, we will look for them inside the class for the
+        first interface defined in the same file along with the enumeration, and remove the name prefix,
+        if the interfaces's name is a prefix of the enumerations's name.
+
+        Once that's done, next step is to do something in the bindings for dictionaries. And adopt both the
+        enumeration and dictionary mechanisms more widely, and remove the old use of &quot;dictionary&quot; as a type name.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::removeSourceBuffer): Use enum values instead of keywords.
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::textTrackModeChanged): Ditto.
+
+        * bindings/js/JSTextTrackCustom.cpp:
+        (WebCore::JSTextTrack::setKind): Deleted.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (IsStringBasedEnumType): Deleted.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetEnumerationImplementationContent): Removed IsStringBasedEnumType check.
+        (GenerateParametersCheck): Ditto.
+        (GenerateImplementation): Ditto.
+        (GetNativeType): Ditto.
+        (JSValueToNative): Ditto.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::loadInternal): Use enum values instead of keywords.
+        (WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
+        (WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
+        (WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
+        (WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
+        (WebCore::HTMLMediaElement::addTextTrack): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto.
+        (WebCore::HTMLMediaElement::setSelectedTextTrack): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTracks): Ditto.
+        (WebCore::HTMLMediaElement::hasClosedCaptions): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTrackDisplay): Ditto.
+        (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Ditto.
+        (WebCore::toPlatform): Added helpers for the outOfBandTrackSources function.
+        (WebCore::HTMLMediaElement::outOfBandTrackSources): Removed unneeded fastHasAttribute
+        check since getNonEmptyURLAttribute already returns an empty URL when the attribute is
+        not present. Changed to use enum values instead of keywords.
+
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::parseAttribute): Use new setKindKeywordIgnoringASCIICase
+        function rather than calling setKind and convertToASCIILowercase. Also use ensureTrack
+        instead of track since the latter is a cover that calls it and dumbs down the return type.
+        (WebCore::HTMLTrackElement::kind): Changed return type to const AtomicString&amp; since
+        that's what we will have for kind keywords and because it matches what we normally have
+        for attribute getting fuctions. Also use ensureTrack.
+        (WebCore::HTMLTrackElement::setKind): Changed argument to AtomicString so we don't waste
+        time making a string and then destroying it before turning it into an AtomicString so it
+        can be an attribute value.
+        (WebCore::HTMLTrackElement::srclang): Changed return type to const AtomicString&amp; as is
+        customary and efficient for attribute value convenience functions. Also use fastGetAttribute.
+        (WebCore::HTMLTrackElement::setSrclang): Deleted.
+        (WebCore::HTMLTrackElement::label): Ditto.
+        (WebCore::HTMLTrackElement::setLabel): Deleted.
+        (WebCore::HTMLTrackElement::setIsDefault): Deleted.
+        (WebCore::HTMLTrackElement::scheduleLoad): Use enum values instead of keywords.
+
+        * html/HTMLTrackElement.h: Use pragma once. Update for changes mentioned above.
+        Also mark things final instead of override as per our recent style discussion.
+
+        * html/HTMLTrackElement.idl: Use [Reflect] for srclang and label.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): Use enum value
+        instead of keyword.
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.
+
+        * html/track/AudioTrack.cpp:
+        (WebCore::AudioTrack::AudioTrack): Use new base class MediaTrackBase.
+
+        * html/track/AudioTrack.h: Use pragma once. Make base class be MediaTrackBase instead
+        of TrackBase.
+
+        * html/track/InbandTextTrack.cpp:
+        (WebCore::InbandTextTrack::setMode): Change argument type to enum instead of string.
+        (WebCore::toPrivate): Added. Helper for setModeInternal.
+        (WebCore::InbandTextTrack::setModeInternal): Change argument type to enum instead of string.
+        (WebCore::InbandTextTrack::updateKindFromPrivate): Use enum instead of string to call setKind.
+
+        * html/track/InbandTextTrack.h: Use pragma once. Use TextTrackMode for argument types.
+
+        * html/track/TextTrack.cpp:
+        (WebCore::captionsKeyword): Converted this to a non-member function since it is now
+        private to this file.
+        (WebCore::descriptionsKeyword): Ditto.
+        (WebCore::chaptersKeyword): Ditto.
+        (WebCore::metadataKeyword): Ditto.
+        (WebCore::forcedKeyword): Ditto.
+        (WebCore::TextTrack::disabledKeyword): Deleted.
+        (WebCore::TextTrack::hiddenKeyword): Deleted.
+        (WebCore::TextTrack::showingKeyword): Deleted.
+        (WebCore::TextTrack::TextTrack): Moved some initialization to be done in the header where
+        the data members are defined. Put the code that is the equivalent to setKindInternal here,
+        because it turns out it's not needed anywhere else. Over time we might change the types
+        involved and there's no need to have that be across multiple functions.
+        (WebCore::TextTrack::~TextTrack): Removed unneeded call to clearClient, right when the
+        object is about to be destroyed. Perhaps there was an illusion that the old call might
+        be a virtual function call that invokes the clearClient from a derived class, but that
+        doesn't work in a destructor, so this code was only clearing out the data member and
+        that does not need to be done.
+        (WebCore::TextTrack::isValidKind): Deleted.
+        (WebCore::TextTrack::enabled): Use enum value instead of keyword.
+        (WebCore::TextTrack::kindKeyword): Added. Function for callers who need a string, not the
+        enum value.
+        (WebCore::TextTrack::setKind): Take enum value instead of keyword. Also changed since
+        we store the kind in a data member in this class, not inherited.
+        (WebCore::TextTrack::setKindKeywordIgnoringASCIICase): Added. For HTMLTrackElement to use
+        when setting the kind attribute.
+        (WebCore::TextTrack::setMode): Take enum value instread of keyword. Also removed assertion
+        since the enum already makes it intrinsically clear what values are valid, unlike a string.
+        (WebCore::TextTrack::cues): Use enum value instead of keyword.
+        (WebCore::TextTrack::activeCues): Ditto.
+        (WebCore::TextTrack::addCue): Ditto.
+        (WebCore::TextTrack::ensureVTTRegionList): Changed return type to reference.
+        (WebCore::TextTrack::regions): Use enum value instead of keyword.
+        (WebCore::TextTrack::addRegion): Use reference.
+        (WebCore::TextTrack::cueDidChange): Ditto.
+        (WebCore::TextTrack::isRendered): Use enum values instead of keywords. Also write to be
+        a boolean expression instead of a couple different if statements.
+        (WebCore::TextTrack::ensureTextTrackCueList): Changed return type to reference.
+        (WebCore::TextTrack::isMainProgramContent): Use enum value instead of keyword.
+        (WebCore::TextTrack::containsOnlyForcedSubtitles): Ditto.
+
+        * html/track/TextTrack.h: Use pragma once. Removed unneeded include. Added enums for
+        TextTrackKind and TextTrackMode. Updated for changes to functions listed above.
+        Added m_mode and m_kind and initialized those data members and some others.
+
+        * html/track/TextTrack.idl: Tweaked formatting. Used ImplementedAs for the kind
+        attribute rather than using a CustomSetter. This preserves the strange behavior
+        where setting kind does nothing when !ENABLE(MEDIA_SOURCE). If we discover we don't
+        need that, then we won't need ImplementedAs any more either.
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCue::dispatchEvent): Use enum instad of keyword.
+        (WebCore::TextTrackCue::isActive): Ditto.
+
+        * html/track/TrackBase.cpp:
+        (WebCore::TrackBase::TrackBase): Removed unneeded initialization that is handled in
+        the data member definition in the header now.
+        (WebCore::MediaTrackBase::MediaTrackBase): Added. Calls through to TrackBase.
+        (WebCore::MediaTrackBase::setKind): Moved to MediaTrackBase from TrackBase, because
+        this isn't needed for text tracks.
+        (WebCore::MediaTrackBase::setKindInternal): Ditto.
+
+        * html/track/TrackBase.h: Use pragma once. Move kind, setKind, isValidKind, defaultKindKeyword,
+        setKindInternal, and m_kind all to a derived class, MediaTrackBase, since TextTrack doesn't need
+        any of those any more. Later we might adopt enumerations more and it's possible the need for
+        MediaTrackBase will go away.
+
+        * html/track/VideoTrack.cpp:
+        (WebCore::VideoTrack::VideoTrack): Updated to use MediaTrackBase.
+        (WebCore::VideoTrack::setLanguage): Ditto.
+
+        * html/track/VideoTrack.h: Use pragma once. Removed unneeded header include.
+        Derive from MediaTrackBase instead of TrackBase.
+
+        * page/CaptionUserPreferences.cpp:
+        (WebCore::CaptionUserPreferences::sortedTrackListForMenu): Use enum values instead
+        of keywords.
+        (WebCore::CaptionUserPreferences::textTrackSelectionScore): Ditto.
+        * page/CaptionUserPreferencesMediaAF.cpp:
+        (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Ditto.
+        (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Ditto. Also used
+        kindKeyword since we want a string for logging.
+        * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
+        (WebPlaybackSessionModelMediaElement::updateLegibleOptions): Ditto.
+
</ins><span class="cx"> 2016-05-01  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Pass reference instead of pointer to IDL attribute setters if not nullable
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceMediaSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -671,7 +671,7 @@
</span><span class="cx"> 
</span><span class="cx">             // 9.3.2 If the mode attribute on the TextTrack object is set to &quot;showing&quot; or &quot;hidden&quot;, then
</span><span class="cx">             // set the removed enabled text track flag to true.
</span><del>-            if (track-&gt;mode() == TextTrack::showingKeyword() || track-&gt;mode() == TextTrack::hiddenKeyword())
</del><ins>+            if (track-&gt;mode() == TextTrackMode::Showing || track-&gt;mode() == TextTrackMode::Hidden)
</ins><span class="cx">                 removedEnabledTextTrack = true;
</span><span class="cx"> 
</span><span class="cx">             // 9.3.3 Remove the TextTrack object from the HTMLMediaElement textTracks list.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceSourceBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -1674,7 +1674,7 @@
</span><span class="cx">     // 2.4.5 Changes to selected/enabled track state
</span><span class="cx">     // If a text track mode becomes &quot;disabled&quot; and the SourceBuffer associated with this track is not
</span><span class="cx">     // associated with any other enabled or selected track, then run the following steps:
</span><del>-    if (track-&gt;mode() == TextTrack::disabledKeyword()
</del><ins>+    if (track-&gt;mode() == TextTrackMode::Disabled
</ins><span class="cx">         &amp;&amp; (!m_videoTracks || !m_videoTracks-&gt;isAnyTrackEnabled())
</span><span class="cx">         &amp;&amp; (!m_audioTracks || !m_audioTracks-&gt;isAnyTrackEnabled())
</span><span class="cx">         &amp;&amp; (!m_textTracks || !m_textTracks-&gt;isAnyTrackEnabled())) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSTextTrackCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -41,19 +41,6 @@
</span><span class="cx">     visitor.addOpaqueRoot(root(&amp;wrapped()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JSTextTrack::setKind(ExecState&amp; state, JSValue value)
-{
-#if ENABLE(MEDIA_SOURCE)
-    auto&amp; string = value.toString(&amp;state)-&gt;value(&amp;state);
-    if (state.hadException())
-        return;
-    wrapped().setKind(string);
-#else
-    UNUSED_PARAM(state);
-    UNUSED_PARAM(value);
-#endif
-}
-
</del><span class="cx"> void JSTextTrack::setLanguage(ExecState&amp; state, JSValue value)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -129,14 +129,6 @@
</span><span class="cx">     &quot;SVGMatrix&quot; =&gt; 1
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-# FIXME: Remove each enum from this hash as we convert it from the string-based
-# enumeration to using an actual enum class in the C++. Once that is done, we should
-# remove this hash and the function that calls it.
-my %stringBasedEnumerationHash = (
-    &quot;TextTrackKind&quot; =&gt; 1,
-    &quot;TextTrackMode&quot; =&gt; 1,
-);
-
</del><span class="cx"> # Cache of IDL file pathnames.
</span><span class="cx"> my $idlFiles;
</span><span class="cx"> my $cachedInterfaces = {};
</span><span class="lines">@@ -381,16 +373,6 @@
</span><span class="cx">     return $type eq &quot;DOMString&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub IsStringBasedEnumType
-{
-    my $object = shift;
-    my $type = shift;
-
-    return 0 if !$object-&gt;IsEnumType($type);
-    return 1 if exists $stringBasedEnumerationHash{$type};
-    return 0;
-}
-
</del><span class="cx"> sub IsEnumType
</span><span class="cx"> {
</span><span class="cx">     my $object = shift;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -838,7 +838,6 @@
</span><span class="cx">     my $result = &quot;&quot;;
</span><span class="cx">     foreach my $enumeration (@$enumerations) {
</span><span class="cx">         my $name = $enumeration-&gt;name;
</span><del>-        next if $codeGenerator-&gt;IsStringBasedEnumType($name);
</del><span class="cx"> 
</span><span class="cx">         my $className = GetEnumerationClassName($name);
</span><span class="cx"> 
</span><span class="lines">@@ -2845,16 +2844,6 @@
</span><span class="cx">                 push(@implContent, &quot;    if (UNLIKELY(state-&gt;hadException()))\n&quot;);
</span><span class="cx">                 push(@implContent, &quot;        return false;\n&quot;);
</span><span class="cx"> 
</span><del>-                if ($codeGenerator-&gt;IsStringBasedEnumType($type)) {
-                    my @enumValues = $codeGenerator-&gt;ValidEnumValues($type);
-                    my @enumChecks = ();
-                    foreach my $enumValue (@enumValues) {
-                        push(@enumChecks, &quot;nativeValue != \&quot;$enumValue\&quot;&quot;);
-                    }
-                    push (@implContent, &quot;    if (&quot; . join(&quot; &amp;&amp; &quot;, @enumChecks) . &quot;)\n&quot;);
-                    push (@implContent, &quot;        return false;\n&quot;);
-                }
-
</del><span class="cx">                 if ($codeGenerator-&gt;IsEnumType($type)) {
</span><span class="cx">                     push (@implContent, &quot;    if (UNLIKELY(!nativeValue))\n&quot;);
</span><span class="cx">                     push (@implContent, &quot;        return false;\n&quot;);
</span><span class="lines">@@ -2908,7 +2897,7 @@
</span><span class="cx">                     my ($functionName, @arguments) = $codeGenerator-&gt;SetterExpression(\%implIncludes, $interfaceName, $attribute);
</span><span class="cx">                     if ($codeGenerator-&gt;IsTypedArrayType($type) and not $type eq &quot;ArrayBuffer&quot;) {
</span><span class="cx">                         push(@arguments, &quot;nativeValue.get()&quot;);
</span><del>-                    } elsif ($codeGenerator-&gt;IsEnumType($type) and not $codeGenerator-&gt;IsStringBasedEnumType($type)) {
</del><ins>+                    } elsif ($codeGenerator-&gt;IsEnumType($type)) {
</ins><span class="cx">                         push(@arguments, &quot;nativeValue.value()&quot;);
</span><span class="cx">                     } else {
</span><span class="cx">                         push(@arguments, $shouldPassByReference ? &quot;*nativeValue&quot; : &quot;nativeValue&quot;);
</span><span class="lines">@@ -3635,49 +3624,6 @@
</span><span class="cx">                 push(@$outputArray, &quot;    if (UNLIKELY(state-&gt;hadException()))\n&quot;);
</span><span class="cx">                 push(@$outputArray, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
</span><span class="cx">             }
</span><del>-        } elsif ($codeGenerator-&gt;IsStringBasedEnumType($argType)) {
-            $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
-
-            my $exceptionCheck = sub {
-                my $indent = shift;
-                push(@$outputArray, $indent . &quot;    if (UNLIKELY(state-&gt;hadException()))\n&quot;);
-                push(@$outputArray, $indent . &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-            };
-
-            my $enumValueCheck = sub {
-                my $indent = shift;
-                my @enumValues = $codeGenerator-&gt;ValidEnumValues($argType);
-                my @enumChecks = ();
-                my $enums = 0;
-                foreach my $enumValue (@enumValues) {
-                    push(@enumChecks, &quot;${name} != \&quot;$enumValue\&quot;&quot;);
-                    if (!$enums) {
-                        $enums = &quot;\\\&quot;$enumValue\\\&quot;&quot;;
-                    } else {
-                        $enums = $enums . &quot;, \\\&quot;&quot; . $enumValue . &quot;\\\&quot;&quot;;
-                    }
-                }
-                push(@$outputArray, $indent . &quot;    if (&quot; . join(&quot; &amp;&amp; &quot;, @enumChecks) . &quot;)\n&quot;);
-                push(@$outputArray, $indent . &quot;        return throwArgumentMustBeEnumError(*state, $argsIndex, \&quot;$name\&quot;, \&quot;$interfaceName\&quot;, $quotedFunctionName, \&quot;$enums\&quot;);\n&quot;);
-            };
-
-            my $argValue = &quot;state-&gt;argument($argsIndex)&quot;;
-            if ($parameter-&gt;isOptional &amp;&amp; defined($parameter-&gt;default)) {
-                push(@$outputArray, &quot;    String $name;\n&quot;);
-                push(@$outputArray, &quot;    if (${argValue}.isUndefined())\n&quot;);
-                push(@$outputArray, &quot;        $name = ASCIILiteral(&quot; . $parameter-&gt;default . &quot;);\n&quot;);
-                push(@$outputArray, &quot;    else {\n&quot;);
-                push(@$outputArray, &quot;        $name = state-&gt;uncheckedArgument($argsIndex).toWTFString(state);\n&quot;);
-                &amp;$exceptionCheck(&quot;    &quot;);
-                &amp;$enumValueCheck(&quot;    &quot;);
-                push(@$outputArray, &quot;    }\n&quot;);
-            } else {
-                push(@$outputArray, &quot;    // Keep pointer to the JSString in a local so we don't need to ref the String.\n&quot;);
-                push(@$outputArray, &quot;    auto* ${name}String = ${argValue}.toString(state);\n&quot;);
-                push(@$outputArray, &quot;    auto&amp; $name = ${name}String-&gt;value(state);\n&quot;);
-                &amp;$exceptionCheck(&quot;&quot;);
-                &amp;$enumValueCheck(&quot;&quot;);
-            }
</del><span class="cx">         } elsif ($codeGenerator-&gt;IsEnumType($argType)) {
</span><span class="cx">             my $className = GetEnumerationClassName($argType);
</span><span class="cx">             $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
</span><span class="lines">@@ -4272,7 +4218,6 @@
</span><span class="cx">     my $arrayOrSequenceType = $codeGenerator-&gt;GetArrayOrSequenceType($type);
</span><span class="cx"> 
</span><span class="cx">     return &quot;Vector&lt;&quot; . GetNativeVectorInnerType($arrayOrSequenceType) . &quot;&gt;&quot; if $arrayOrSequenceType;
</span><del>-    return &quot;String&quot; if $codeGenerator-&gt;IsStringBasedEnumType($type);
</del><span class="cx">     return &quot;auto&quot; if $codeGenerator-&gt;IsEnumType($type);
</span><span class="cx"> 
</span><span class="cx">     # For all other types, the native type is a pointer with same type name as the IDL type.
</span><span class="lines">@@ -4423,7 +4368,6 @@
</span><span class="cx">     return &quot;valueToDate(state, $value)&quot; if $type eq &quot;Date&quot;;
</span><span class="cx"> 
</span><span class="cx">     return &quot;to$type($value)&quot; if $codeGenerator-&gt;IsTypedArrayType($type);
</span><del>-    return &quot;$value.toWTFString(state)&quot; if $codeGenerator-&gt;IsStringBasedEnumType($type);
</del><span class="cx">     return &quot;parse&quot; . GetEnumerationClassName($type) . &quot;(*state, $value)&quot; if $codeGenerator-&gt;IsEnumType($type);
</span><span class="cx"> 
</span><span class="cx">     AddToImplIncludes(&quot;JS$type.h&quot;, $conditional);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -1174,7 +1174,7 @@
</span><span class="cx">         if (m_textTracks) {
</span><span class="cx">             for (unsigned i = 0; i &lt; m_textTracks-&gt;length(); ++i) {
</span><span class="cx">                 TextTrack* track = m_textTracks-&gt;item(i);
</span><del>-                if (track-&gt;mode() != TextTrack::disabledKeyword())
</del><ins>+                if (track-&gt;mode() != TextTrackMode::Disabled)
</ins><span class="cx">                     m_textTracksWhenResourceSelectionBegan.append(track);
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -1731,7 +1731,7 @@
</span><span class="cx">     // Mark this track as &quot;configured&quot; so configureTextTracks won't change the mode again.
</span><span class="cx">     track-&gt;setHasBeenConfigured(true);
</span><span class="cx">     
</span><del>-    if (track-&gt;mode() != TextTrack::disabledKeyword() &amp;&amp; trackIsLoaded)
</del><ins>+    if (track-&gt;mode() != TextTrackMode::Disabled &amp;&amp; trackIsLoaded)
</ins><span class="cx">         textTrackAddCues(track, track-&gt;cues());
</span><span class="cx"> 
</span><span class="cx">     configureTextTrackDisplay(AssumeTextTrackVisibilityChanged);
</span><span class="lines">@@ -1755,8 +1755,8 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
</span><span class="cx"> {
</span><del>-    if (track-&gt;kind() != TextTrack::captionsKeyword() &amp;&amp; track-&gt;kind() != TextTrack::subtitlesKeyword() &amp;&amp; track-&gt;mode() == TextTrack::showingKeyword())
-        track-&gt;setMode(TextTrack::hiddenKeyword());
</del><ins>+    if (track-&gt;kind() != TextTrackKind::Captions &amp;&amp; track-&gt;kind() != TextTrackKind::Subtitles &amp;&amp; track-&gt;mode() == TextTrackMode::Showing)
+        track-&gt;setMode(TextTrackMode::Hidden);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests()
</span><span class="lines">@@ -1774,7 +1774,7 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList* cues) 
</span><span class="cx"> {
</span><del>-    if (track-&gt;mode() == TextTrack::disabledKeyword())
</del><ins>+    if (track-&gt;mode() == TextTrackMode::Disabled)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     TrackDisplayUpdateScope scope(this);
</span><span class="lines">@@ -1791,7 +1791,7 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr&lt;TextTrackCue&gt; prpCue)
</span><span class="cx"> {
</span><del>-    if (track-&gt;mode() == TextTrack::disabledKeyword())
</del><ins>+    if (track-&gt;mode() == TextTrackMode::Disabled)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;TextTrackCue&gt; cue = prpCue;
</span><span class="lines">@@ -3664,7 +3664,7 @@
</span><span class="cx">     textTrack-&gt;setReadinessState(TextTrack::Loaded);
</span><span class="cx"> 
</span><span class="cx">     // ... its text track mode to the text track hidden mode, and its text track list of cues to an empty list ...
</span><del>-    textTrack-&gt;setMode(TextTrack::hiddenKeyword());
</del><ins>+    textTrack-&gt;setMode(TextTrackMode::Hidden);
</ins><span class="cx"> 
</span><span class="cx">     return textTrack.release();
</span><span class="cx"> }
</span><span class="lines">@@ -3792,11 +3792,11 @@
</span><span class="cx">     for (size_t i = 0; i &lt; group.tracks.size(); ++i) {
</span><span class="cx">         RefPtr&lt;TextTrack&gt; textTrack = group.tracks[i];
</span><span class="cx"> 
</span><del>-        if (m_processingPreferenceChange &amp;&amp; textTrack-&gt;mode() == TextTrack::showingKeyword())
</del><ins>+        if (m_processingPreferenceChange &amp;&amp; textTrack-&gt;mode() == TextTrackMode::Showing)
</ins><span class="cx">             currentlyEnabledTracks.append(textTrack);
</span><span class="cx"> 
</span><span class="cx">         int trackScore = captionPreferences ? captionPreferences-&gt;textTrackSelectionScore(textTrack.get(), this) : 0;
</span><del>-        LOG(Media, &quot;HTMLMediaElement::configureTextTrackGroup(%p) -  '%s' track with language '%s' has score %i&quot;, this, textTrack-&gt;kind().string().utf8().data(), textTrack-&gt;language().string().utf8().data(), trackScore);
</del><ins>+        LOG(Media, &quot;HTMLMediaElement::configureTextTrackGroup(%p) -  '%s' track with language '%s' has score %i&quot;, this, textTrack-&gt;kindKeyword().string().utf8().data(), textTrack-&gt;language().string().utf8().data(), trackScore);
</ins><span class="cx"> 
</span><span class="cx">         if (trackScore) {
</span><span class="cx"> 
</span><span class="lines">@@ -3861,12 +3861,12 @@
</span><span class="cx">         for (size_t i = 0; i &lt; currentlyEnabledTracks.size(); ++i) {
</span><span class="cx">             RefPtr&lt;TextTrack&gt; textTrack = currentlyEnabledTracks[i];
</span><span class="cx">             if (textTrack != trackToEnable)
</span><del>-                textTrack-&gt;setMode(TextTrack::disabledKeyword());
</del><ins>+                textTrack-&gt;setMode(TextTrackMode::Disabled);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (trackToEnable) {
</span><del>-        trackToEnable-&gt;setMode(TextTrack::showingKeyword());
</del><ins>+        trackToEnable-&gt;setMode(TextTrackMode::Showing);
</ins><span class="cx"> 
</span><span class="cx">         // If user preferences indicate we should always display captions, make sure we reflect the
</span><span class="cx">         // proper status via the webkitClosedCaptionsVisible API call:
</span><span class="lines">@@ -3996,13 +3996,13 @@
</span><span class="cx">         for (int i = 0, length = trackList-&gt;length(); i &lt; length; ++i) {
</span><span class="cx">             TextTrack* track = trackList-&gt;item(i);
</span><span class="cx">             if (!trackToSelect || track != trackToSelect)
</span><del>-                track-&gt;setMode(TextTrack::disabledKeyword());
</del><ins>+                track-&gt;setMode(TextTrackMode::Disabled);
</ins><span class="cx">             else
</span><del>-                track-&gt;setMode(TextTrack::showingKeyword());
</del><ins>+                track-&gt;setMode(TextTrackMode::Showing);
</ins><span class="cx">         }
</span><span class="cx">     } else if (trackToSelect == TextTrack::captionMenuOffItem()) {
</span><span class="cx">         for (int i = 0, length = trackList-&gt;length(); i &lt; length; ++i)
</span><del>-            trackList-&gt;item(i)-&gt;setMode(TextTrack::disabledKeyword());
</del><ins>+            trackList-&gt;item(i)-&gt;setMode(TextTrackMode::Disabled);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!document().page())
</span><span class="lines">@@ -4039,20 +4039,20 @@
</span><span class="cx">         if (!textTrack)
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        String kind = textTrack-&gt;kind();
</del><ins>+        auto kind = textTrack-&gt;kind();
</ins><span class="cx">         TrackGroup* currentGroup;
</span><del>-        if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captionsKeyword() || kind == TextTrack::forcedKeyword())
</del><ins>+        if (kind == TextTrackKind::Subtitles || kind == TextTrackKind::Captions || kind == TextTrackKind::Forced)
</ins><span class="cx">             currentGroup = &amp;captionAndSubtitleTracks;
</span><del>-        else if (kind == TextTrack::descriptionsKeyword())
</del><ins>+        else if (kind == TextTrackKind::Descriptions)
</ins><span class="cx">             currentGroup = &amp;descriptionTracks;
</span><del>-        else if (kind == TextTrack::chaptersKeyword())
</del><ins>+        else if (kind == TextTrackKind::Chapters)
</ins><span class="cx">             currentGroup = &amp;chapterTracks;
</span><del>-        else if (kind == TextTrack::metadataKeyword())
</del><ins>+        else if (kind == TextTrackKind::Metadata)
</ins><span class="cx">             currentGroup = &amp;metadataTracks;
</span><span class="cx">         else
</span><span class="cx">             currentGroup = &amp;otherTracks;
</span><span class="cx"> 
</span><del>-        if (!currentGroup-&gt;visibleTrack &amp;&amp; textTrack-&gt;mode() == TextTrack::showingKeyword())
</del><ins>+        if (!currentGroup-&gt;visibleTrack &amp;&amp; textTrack-&gt;mode() == TextTrackMode::Showing)
</ins><span class="cx">             currentGroup-&gt;visibleTrack = textTrack;
</span><span class="cx">         if (!currentGroup-&gt;defaultTrack &amp;&amp; textTrack-&gt;isDefault())
</span><span class="cx">             currentGroup-&gt;defaultTrack = textTrack;
</span><span class="lines">@@ -5447,6 +5447,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; ENABLE(VIDEO_PRESENTATION_MODE))
</span><ins>+
</ins><span class="cx"> void HTMLMediaElement::setVideoFullscreenLayer(PlatformLayer* platformLayer)
</span><span class="cx"> {
</span><span class="cx">     m_videoFullscreenLayer = platformLayer;
</span><span class="lines">@@ -5474,6 +5475,7 @@
</span><span class="cx">     if (m_player)
</span><span class="cx">         m_player-&gt;setVideoFullscreenGravity(gravity);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> bool HTMLMediaElement::hasClosedCaptions() const
</span><span class="lines">@@ -5486,11 +5488,10 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0; i &lt; m_textTracks-&gt;length(); ++i) {
</span><del>-        if (m_textTracks-&gt;item(i)-&gt;readinessState() == TextTrack::FailedToLoad)
</del><ins>+        auto&amp; track = *m_textTracks-&gt;item(i);
+        if (track.readinessState() == TextTrack::FailedToLoad)
</ins><span class="cx">             continue;
</span><del>-
-        if (m_textTracks-&gt;item(i)-&gt;kind() == TextTrack::captionsKeyword()
-            || m_textTracks-&gt;item(i)-&gt;kind() == TextTrack::subtitlesKeyword())
</del><ins>+        if (track.kind() == TextTrackKind::Captions || track.kind() == TextTrackKind::Subtitles)
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -5757,7 +5758,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool haveVisibleTextTrack = false;
</span><span class="cx">     for (unsigned i = 0; i &lt; m_textTracks-&gt;length(); ++i) {
</span><del>-        if (m_textTracks-&gt;item(i)-&gt;mode() == TextTrack::showingKeyword()) {
</del><ins>+        if (m_textTracks-&gt;item(i)-&gt;mode() == TextTrackMode::Showing) {
</ins><span class="cx">             haveVisibleTextTrack = true;
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="lines">@@ -5831,12 +5832,10 @@
</span><span class="cx">     // captions and non-default tracks should be displayed based on language
</span><span class="cx">     // preferences if the user has turned captions on).
</span><span class="cx">     for (unsigned i = 0; i &lt; m_textTracks-&gt;length(); ++i) {
</span><del>-        
-        RefPtr&lt;TextTrack&gt; textTrack = m_textTracks-&gt;item(i);
-        String kind = textTrack-&gt;kind();
-
-        if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captionsKeyword())
-            textTrack-&gt;setHasBeenConfigured(false);
</del><ins>+        auto&amp; track = *m_textTracks-&gt;item(i);
+        auto kind = track.kind();
+        if (kind == TextTrackKind::Subtitles || kind == TextTrackKind::Captions)
+            track.setHasBeenConfigured(false);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_processingPreferenceChange = true;
</span><span class="lines">@@ -6080,14 +6079,45 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(AVF_CAPTIONS)
</span><ins>+
+static inline PlatformTextTrack::TrackKind toPlatform(TextTrackKind kind)
+{
+    switch (kind) {
+    case TextTrackKind::Captions:
+        return PlatformTextTrack::Caption;
+    case TextTrackKind::Chapters:
+        return PlatformTextTrack::Chapter;
+    case TextTrackKind::Descriptions:
+        return PlatformTextTrack::Description;
+    case TextTrackKind::Forced:
+        return PlatformTextTrack::Forced;
+    case TextTrackKind::Metadata:
+        return PlatformTextTrack::MetaData;
+    case TextTrackKind::Subtitles:
+        return PlatformTextTrack::Subtitle;
+    }
+    ASSERT_NOT_REACHED();
+    return PlatformTextTrack::Caption;
+}
+
+static inline PlatformTextTrack::TrackMode toPlatform(TextTrackMode mode)
+{
+    switch (mode) {
+    case TextTrackMode::Disabled:
+        return PlatformTextTrack::Disabled;
+    case TextTrackMode::Hidden:
+        return PlatformTextTrack::Hidden;
+    case TextTrackMode::Showing:
+        return PlatformTextTrack::Showing;
+    }
+    ASSERT_NOT_REACHED();
+    return PlatformTextTrack::Disabled;
+}
+
</ins><span class="cx"> Vector&lt;RefPtr&lt;PlatformTextTrack&gt;&gt; HTMLMediaElement::outOfBandTrackSources()
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;RefPtr&lt;PlatformTextTrack&gt;&gt; outOfBandTrackSources;
</span><span class="cx">     for (auto&amp; trackElement : childrenOfType&lt;HTMLTrackElement&gt;(*this)) {
</span><del>-        
-        if (!trackElement.fastHasAttribute(srcAttr))
-            continue;
-        
</del><span class="cx">         URL url = trackElement.getNonEmptyURLAttribute(srcAttr);
</span><span class="cx">         if (url.isEmpty())
</span><span class="cx">             continue;
</span><span class="lines">@@ -6095,33 +6125,28 @@
</span><span class="cx">         if (!document().contentSecurityPolicy()-&gt;allowMediaFromSource(url, trackElement.isInUserAgentShadowTree()))
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        PlatformTextTrack::TrackKind platformKind = PlatformTextTrack::Caption;
-        if (trackElement.kind() == TextTrack::captionsKeyword())
-            platformKind = PlatformTextTrack::Caption;
-        else if (trackElement.kind() == TextTrack::subtitlesKeyword())
-            platformKind = PlatformTextTrack::Subtitle;
-        else if (trackElement.kind() == TextTrack::descriptionsKeyword())
-            platformKind = PlatformTextTrack::Description;
-        else if (trackElement.kind() == TextTrack::forcedKeyword())
-            platformKind = PlatformTextTrack::Forced;
-        else
</del><ins>+        auto&amp; track = *trackElement.track();
+        auto kind = track.kind();
+
+        // FIXME: The switch statement below preserves existing behavior where we ignore chapters and metadata tracks.
+        // If we confirm this behavior is valuable, we should remove this comment. Otherwise, remove both comment and switch.
+        switch (kind) {
+        case TextTrackKind::Captions:
+        case TextTrackKind::Descriptions:
+        case TextTrackKind::Forced:
+        case TextTrackKind::Subtitles:
+            break;
+        case TextTrackKind::Chapters:
+        case TextTrackKind::Metadata:
</ins><span class="cx">             continue;
</span><del>-        
-        const AtomicString&amp; mode = trackElement.track()-&gt;mode();
-        
-        PlatformTextTrack::TrackMode platformMode = PlatformTextTrack::Disabled;
-        if (TextTrack::hiddenKeyword() == mode)
-            platformMode = PlatformTextTrack::Hidden;
-        else if (TextTrack::disabledKeyword() == mode)
-            platformMode = PlatformTextTrack::Disabled;
-        else if (TextTrack::showingKeyword() == mode)
-            platformMode = PlatformTextTrack::Showing;
-        
-        outOfBandTrackSources.append(PlatformTextTrack::createOutOfBand(trackElement.label(), trackElement.srclang(), url.string(), platformMode, platformKind, trackElement.track()-&gt;uniqueId(), trackElement.isDefault()));
</del><ins>+        }
+
+        outOfBandTrackSources.append(PlatformTextTrack::createOutOfBand(trackElement.label(), trackElement.srclang(), url.string(), toPlatform(track.mode()), toPlatform(kind), track.uniqueId(), trackElement.isDefault()));
</ins><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     return outOfBandTrackSources;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> bool HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks() const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTrackElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTrackElement.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTrackElement.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/HTMLTrackElement.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -102,58 +102,43 @@
</span><span class="cx">         // 4.8.10.12.3 Sourcing out-of-band text tracks
</span><span class="cx">         // As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly...
</span><span class="cx">         } else if (name == kindAttr)
</span><del>-            track()-&gt;setKind(value.convertToASCIILowercase());
</del><ins>+            ensureTrack().setKindKeywordIgnoringASCIICase(value.string());
</ins><span class="cx">         else if (name == labelAttr)
</span><del>-            track()-&gt;setLabel(value);
</del><ins>+            ensureTrack().setLabel(value);
</ins><span class="cx">         else if (name == srclangAttr)
</span><del>-            track()-&gt;setLanguage(value);
</del><ins>+            ensureTrack().setLanguage(value);
</ins><span class="cx">         else if (name == defaultAttr)
</span><del>-            track()-&gt;setIsDefault(!value.isNull());
</del><ins>+            ensureTrack().setIsDefault(!value.isNull());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     HTMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String HTMLTrackElement::kind()
</del><ins>+const AtomicString&amp; HTMLTrackElement::kind()
</ins><span class="cx"> {
</span><del>-    return track()-&gt;kind();
</del><ins>+    return ensureTrack().kindKeyword();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTrackElement::setKind(const String&amp; kind)
</del><ins>+void HTMLTrackElement::setKind(const AtomicString&amp; kind)
</ins><span class="cx"> {
</span><del>-    setAttribute(kindAttr, kind);
</del><ins>+    setAttributeWithoutSynchronization(kindAttr, kind);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String HTMLTrackElement::srclang() const
</del><ins>+const AtomicString&amp; HTMLTrackElement::srclang() const
</ins><span class="cx"> {
</span><del>-    return getAttribute(srclangAttr);
</del><ins>+    return fastGetAttribute(srclangAttr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTrackElement::setSrclang(const String&amp; srclang)
</del><ins>+const AtomicString&amp; HTMLTrackElement::label() const
</ins><span class="cx"> {
</span><del>-    setAttribute(srclangAttr, srclang);
</del><ins>+    return fastGetAttribute(labelAttr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String HTMLTrackElement::label() const
-{
-    return getAttribute(labelAttr);
-}
-
-void HTMLTrackElement::setLabel(const String&amp; label)
-{
-    setAttribute(labelAttr, label);
-}
-
</del><span class="cx"> bool HTMLTrackElement::isDefault() const
</span><span class="cx"> {
</span><span class="cx">     return fastHasAttribute(defaultAttr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTrackElement::setIsDefault(bool isDefault)
-{
-    setBooleanAttribute(defaultAttr, isDefault);
-}
-
</del><span class="cx"> LoadableTextTrack&amp; HTMLTrackElement::ensureTrack()
</span><span class="cx"> {
</span><span class="cx">     if (!m_track) {
</span><span class="lines">@@ -189,7 +174,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // 2. If the text track's text track mode is not set to one of hidden or showing, abort these steps.
</span><del>-    if (ensureTrack().mode() != TextTrack::hiddenKeyword() &amp;&amp; ensureTrack().mode() != TextTrack::showingKeyword())
</del><ins>+    if (ensureTrack().mode() != TextTrackMode::Hidden &amp;&amp; ensureTrack().mode() != TextTrackMode::Showing)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // 3. If the text track's track element does not have a media element as a parent, abort these steps.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTrackElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTrackElement.h (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTrackElement.h        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/HTMLTrackElement.h        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -23,13 +23,12 @@
</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><del>-#ifndef HTMLTrackElement_h
-#define HTMLTrackElement_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><ins>+
</ins><span class="cx"> #include &quot;HTMLElement.h&quot;
</span><span class="cx"> #include &quot;LoadableTextTrack.h&quot;
</span><del>-#include &quot;TextTrack.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -39,17 +38,12 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;HTMLTrackElement&gt; create(const QualifiedName&amp;, Document&amp;);
</span><span class="cx"> 
</span><del>-    String kind();
-    void setKind(const String&amp;);
</del><ins>+    const AtomicString&amp; kind();
+    void setKind(const AtomicString&amp;);
</ins><span class="cx"> 
</span><del>-    String srclang() const;
-    void setSrclang(const String&amp;);
-
-    String label() const;
-    void setLabel(const String&amp;);
-
</del><ins>+    const AtomicString&amp; srclang() const;
+    const AtomicString&amp; label() const;
</ins><span class="cx">     bool isDefault() const;
</span><del>-    void setIsDefault(bool);
</del><span class="cx"> 
</span><span class="cx">     enum ReadyState { NONE = 0, LOADING = 1, LOADED = 2, TRACK_ERROR = 3 };
</span><span class="cx">     ReadyState readyState();
</span><span class="lines">@@ -68,24 +62,24 @@
</span><span class="cx">     HTMLTrackElement(const QualifiedName&amp;, Document&amp;);
</span><span class="cx">     virtual ~HTMLTrackElement();
</span><span class="cx"> 
</span><del>-    void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) override;
</del><ins>+    void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) final;
</ins><span class="cx"> 
</span><del>-    InsertionNotificationRequest insertedInto(ContainerNode&amp;) override;
-    void removedFrom(ContainerNode&amp;) override;
</del><ins>+    InsertionNotificationRequest insertedInto(ContainerNode&amp;) final;
+    void removedFrom(ContainerNode&amp;) final;
</ins><span class="cx"> 
</span><del>-    bool isURLAttribute(const Attribute&amp;) const override;
</del><ins>+    bool isURLAttribute(const Attribute&amp;) const final;
</ins><span class="cx"> 
</span><span class="cx">     void loadTimerFired();
</span><span class="cx"> 
</span><span class="cx">     HTMLMediaElement* mediaElement() const;
</span><span class="cx"> 
</span><span class="cx">     // TextTrackClient
</span><del>-    void textTrackModeChanged(TextTrack*) override;
-    void textTrackKindChanged(TextTrack*) override;
-    void textTrackAddCues(TextTrack*, const TextTrackCueList*) override;
-    void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) override;
-    void textTrackAddCue(TextTrack*, PassRefPtr&lt;TextTrackCue&gt;) override;
-    void textTrackRemoveCue(TextTrack*, PassRefPtr&lt;TextTrackCue&gt;) override;
</del><ins>+    void textTrackModeChanged(TextTrack*) final;
+    void textTrackKindChanged(TextTrack*) final;
+    void textTrackAddCues(TextTrack*, const TextTrackCueList*) final;
+    void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) final;
+    void textTrackAddCue(TextTrack*, PassRefPtr&lt;TextTrackCue&gt;) final;
+    void textTrackRemoveCue(TextTrack*, PassRefPtr&lt;TextTrackCue&gt;) final;
</ins><span class="cx"> 
</span><span class="cx">     LoadableTextTrack&amp; ensureTrack();
</span><span class="cx">     bool canLoadURL(const URL&amp;);
</span><span class="lines">@@ -97,4 +91,3 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><del>-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTrackElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTrackElement.idl (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTrackElement.idl        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/HTMLTrackElement.idl        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx"> ] interface HTMLTrackElement : HTMLElement {
</span><span class="cx">     attribute DOMString kind;
</span><span class="cx">     [Reflect, URL] attribute DOMString src;
</span><del>-    attribute DOMString srclang;
-    attribute DOMString label;
</del><ins>+    [Reflect] attribute DOMString srclang;
+    [Reflect] attribute DOMString label;
</ins><span class="cx">     [Reflect] attribute boolean default;
</span><span class="cx"> 
</span><span class="cx">     const unsigned short NONE = 0;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowMediaControlElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -765,7 +765,7 @@
</span><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (displayMode != CaptionUserPreferences::Automatic &amp;&amp; textTrack-&gt;mode() == TextTrack::showingKeyword()) {
</del><ins>+        if (displayMode != CaptionUserPreferences::Automatic &amp;&amp; textTrack-&gt;mode() == TextTrackMode::Showing) {
</ins><span class="cx">             trackMenuItemSelected = true;
</span><span class="cx">             trackItem-&gt;classList().add(selectedClassValue, ASSERT_NO_EXCEPTION);
</span><span class="cx">         } else
</span><span class="lines">@@ -1173,7 +1173,7 @@
</span><span class="cx">         LOG(Media, &quot;MediaControlTextTrackContainerElement::updateDisplay(%p) - adding and positioning cue #%zu: \&quot;%s\&quot;, start=%.2f, end=%.2f, line=%.2f&quot;, this, i, cue-&gt;text().utf8().data(), cue-&gt;startTime(), cue-&gt;endTime(), cue-&gt;line());
</span><span class="cx"> 
</span><span class="cx">         RefPtr&lt;VTTCueBox&gt; displayBox = cue-&gt;getDisplayTree(m_videoDisplaySize.size(), m_fontSize);
</span><del>-        if (cue-&gt;track()-&gt;mode() == TextTrack::disabledKeyword())
</del><ins>+        if (cue-&gt;track()-&gt;mode() == TextTrackMode::Disabled)
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><span class="cx">         VTTRegion* region = cue-&gt;track()-&gt;regions()-&gt;getRegionById(cue-&gt;regionId());
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackAudioTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/AudioTrack.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/AudioTrack.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/AudioTrack.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> AudioTrack::AudioTrack(AudioTrackClient* client, PassRefPtr&lt;AudioTrackPrivate&gt; trackPrivate)
</span><del>-    : TrackBase(TrackBase::AudioTrack, trackPrivate-&gt;id(), trackPrivate-&gt;label(), trackPrivate-&gt;language())
</del><ins>+    : MediaTrackBase(MediaTrackBase::AudioTrack, trackPrivate-&gt;id(), trackPrivate-&gt;label(), trackPrivate-&gt;language())
</ins><span class="cx">     , m_enabled(trackPrivate-&gt;enabled())
</span><span class="cx">     , m_client(client)
</span><span class="cx">     , m_private(trackPrivate)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackAudioTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/AudioTrack.h (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/AudioTrack.h        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/AudioTrack.h        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -24,17 +24,14 @@
</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><del>-#ifndef AudioTrack_h
-#define AudioTrack_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &quot;PlatformExportMacros.h&quot;
-
</del><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AudioTrackPrivate.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><ins>+#include &quot;PlatformExportMacros.h&quot;
</ins><span class="cx"> #include &quot;TrackBase.h&quot;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -47,7 +44,7 @@
</span><span class="cx">     virtual void audioTrackEnabledChanged(AudioTrack*) = 0;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class AudioTrack final : public TrackBase, public AudioTrackPrivateClient {
</del><ins>+class AudioTrack final : public MediaTrackBase, public AudioTrackPrivateClient {
</ins><span class="cx"> public:
</span><span class="cx">     static Ref&lt;AudioTrack&gt; create(AudioTrackClient* client, PassRefPtr&lt;AudioTrackPrivate&gt; trackPrivate)
</span><span class="cx">     {
</span><span class="lines">@@ -105,4 +102,3 @@
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><del>-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorehtmltrackInbandTextTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/InbandTextTrack.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/InbandTextTrack.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/InbandTextTrack.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx"> 
</span><span class="cx"> InbandTextTrack::~InbandTextTrack()
</span><span class="cx"> {
</span><del>-    m_private-&gt;setClient(0);
</del><ins>+    m_private-&gt;setClient(nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InbandTextTrack::setPrivate(PassRefPtr&lt;InbandTextTrackPrivate&gt; trackPrivate)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     if (m_private == trackPrivate)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_private-&gt;setClient(0);
</del><ins>+    m_private-&gt;setClient(nullptr);
</ins><span class="cx">     m_private = trackPrivate;
</span><span class="cx">     m_private-&gt;setClient(this);
</span><span class="cx"> 
</span><span class="lines">@@ -89,24 +89,31 @@
</span><span class="cx">     updateKindFromPrivate();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InbandTextTrack::setMode(const AtomicString&amp; mode)
</del><ins>+void InbandTextTrack::setMode(TextTrackMode mode)
</ins><span class="cx"> {
</span><span class="cx">     TextTrack::setMode(mode);
</span><span class="cx">     setModeInternal(mode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InbandTextTrack::setModeInternal(const AtomicString&amp; mode)
</del><ins>+static inline InbandTextTrackPrivate::Mode toPrivate(TextTrackMode mode)
</ins><span class="cx"> {
</span><del>-    if (mode == TextTrack::disabledKeyword())
-        m_private-&gt;setMode(InbandTextTrackPrivate::Disabled);
-    else if (mode == TextTrack::hiddenKeyword())
-        m_private-&gt;setMode(InbandTextTrackPrivate::Hidden);
-    else if (mode == TextTrack::showingKeyword())
-        m_private-&gt;setMode(InbandTextTrackPrivate::Showing);
-    else
-        ASSERT_NOT_REACHED();
</del><ins>+    switch (mode) {
+    case TextTrackMode::Disabled:
+        return InbandTextTrackPrivate::Disabled;
+    case TextTrackMode::Hidden:
+        return InbandTextTrackPrivate::Hidden;
+    case TextTrackMode::Showing:
+        return InbandTextTrackPrivate::Showing;
+    }
+    ASSERT_NOT_REACHED();
+    return InbandTextTrackPrivate::Disabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InbandTextTrack::setModeInternal(TextTrackMode mode)
+{
+    m_private-&gt;setMode(toPrivate(mode));
+}
+
</ins><span class="cx"> bool InbandTextTrack::isClosedCaptions() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_private)
</span><span class="lines">@@ -189,22 +196,22 @@
</span><span class="cx"> {
</span><span class="cx">     switch (m_private-&gt;kind()) {
</span><span class="cx">     case InbandTextTrackPrivate::Subtitles:
</span><del>-        setKind(TextTrack::subtitlesKeyword());
</del><ins>+        setKind(TextTrackKind::Subtitles);
</ins><span class="cx">         break;
</span><span class="cx">     case InbandTextTrackPrivate::Captions:
</span><del>-        setKind(TextTrack::captionsKeyword());
</del><ins>+        setKind(TextTrackKind::Captions);
</ins><span class="cx">         break;
</span><span class="cx">     case InbandTextTrackPrivate::Descriptions:
</span><del>-        setKind(TextTrack::descriptionsKeyword());
</del><ins>+        setKind(TextTrackKind::Descriptions);
</ins><span class="cx">         break;
</span><span class="cx">     case InbandTextTrackPrivate::Chapters:
</span><del>-        setKind(TextTrack::chaptersKeyword());
</del><ins>+        setKind(TextTrackKind::Chapters);
</ins><span class="cx">         break;
</span><span class="cx">     case InbandTextTrackPrivate::Metadata:
</span><del>-        setKind(TextTrack::metadataKeyword());
</del><ins>+        setKind(TextTrackKind::Metadata);
</ins><span class="cx">         break;
</span><span class="cx">     case InbandTextTrackPrivate::Forced:
</span><del>-        setKind(TextTrack::forcedKeyword());
</del><ins>+        setKind(TextTrackKind::Forced);
</ins><span class="cx">         break;
</span><span class="cx">     case InbandTextTrackPrivate::None:
</span><span class="cx">     default:
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackInbandTextTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/InbandTextTrack.h (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/InbandTextTrack.h        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/InbandTextTrack.h        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -23,8 +23,7 @@
</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><del>-#ifndef InbandTextTrack_h
-#define InbandTextTrack_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> 
</span><span class="lines">@@ -46,7 +45,7 @@
</span><span class="cx">     bool containsOnlyForcedSubtitles() const override;
</span><span class="cx">     bool isMainProgramContent() const override;
</span><span class="cx">     bool isEasyToRead() const override;
</span><del>-    void setMode(const AtomicString&amp;) override;
</del><ins>+    void setMode(TextTrackMode) override;
</ins><span class="cx">     size_t inbandTrackIndex();
</span><span class="cx"> 
</span><span class="cx">     AtomicString inBandMetadataTrackDispatchType() const override;
</span><span class="lines">@@ -56,7 +55,7 @@
</span><span class="cx"> protected:
</span><span class="cx">     InbandTextTrack(ScriptExecutionContext*, TextTrackClient*, PassRefPtr&lt;InbandTextTrackPrivate&gt;);
</span><span class="cx"> 
</span><del>-    void setModeInternal(const AtomicString&amp;);
</del><ins>+    void setModeInternal(TextTrackMode);
</ins><span class="cx">     void updateKindFromPrivate();
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;InbandTextTrackPrivate&gt; m_private;
</span><span class="lines">@@ -94,5 +93,3 @@
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_END()
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(VIDEO_TRACK)
</span><del>-
-#endif // InbandTextTrack_h
</del></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTextTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TextTrack.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -53,54 +53,36 @@
</span><span class="cx">     return subtitles;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const AtomicString&amp; TextTrack::captionsKeyword()
</del><ins>+static const AtomicString&amp; captionsKeyword()
</ins><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;const AtomicString&gt; captions(&quot;captions&quot;, AtomicString::ConstructFromLiteral);
</span><span class="cx">     return captions;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const AtomicString&amp; TextTrack::descriptionsKeyword()
</del><ins>+static const AtomicString&amp; descriptionsKeyword()
</ins><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;const AtomicString&gt; descriptions(&quot;descriptions&quot;, AtomicString::ConstructFromLiteral);
</span><span class="cx">     return descriptions;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const AtomicString&amp; TextTrack::chaptersKeyword()
</del><ins>+static const AtomicString&amp; chaptersKeyword()
</ins><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;const AtomicString&gt; chapters(&quot;chapters&quot;, AtomicString::ConstructFromLiteral);
</span><span class="cx">     return chapters;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const AtomicString&amp; TextTrack::metadataKeyword()
</del><ins>+static const AtomicString&amp; metadataKeyword()
</ins><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;const AtomicString&gt; metadata(&quot;metadata&quot;, AtomicString::ConstructFromLiteral);
</span><span class="cx">     return metadata;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-const AtomicString&amp; TextTrack::forcedKeyword()
</del><ins>+static const AtomicString&amp; forcedKeyword()
</ins><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;const AtomicString&gt; forced(&quot;forced&quot;, AtomicString::ConstructFromLiteral);
</span><span class="cx">     return forced;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const AtomicString&amp; TextTrack::disabledKeyword()
-{
-    static NeverDestroyed&lt;const AtomicString&gt; open(&quot;disabled&quot;, AtomicString::ConstructFromLiteral);
-    return open;
-}
-
-const AtomicString&amp; TextTrack::hiddenKeyword()
-{
-    static NeverDestroyed&lt;const AtomicString&gt; closed(&quot;hidden&quot;, AtomicString::ConstructFromLiteral);
-    return closed;
-}
-
-const AtomicString&amp; TextTrack::showingKeyword()
-{
-    static NeverDestroyed&lt;const AtomicString&gt; ended(&quot;showing&quot;, AtomicString::ConstructFromLiteral);
-    return ended;
-}
-
</del><span class="cx"> TextTrack* TextTrack::captionMenuOffItem()
</span><span class="cx"> {
</span><span class="cx">     static TextTrack&amp; off = TextTrack::create(0, 0, &quot;off menu item&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;).leakRef();
</span><span class="lines">@@ -115,18 +97,22 @@
</span><span class="cx"> 
</span><span class="cx"> TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString&amp; kind, const AtomicString&amp; id, const AtomicString&amp; label, const AtomicString&amp; language, TextTrackType type)
</span><span class="cx">     : TrackBase(TrackBase::TextTrack, id, label, language)
</span><del>-    , m_cues(0)
-    , m_regions(0)
</del><span class="cx">     , m_scriptExecutionContext(context)
</span><del>-    , m_mode(disabledKeyword().string())
</del><span class="cx">     , m_client(client)
</span><span class="cx">     , m_trackType(type)
</span><del>-    , m_readinessState(NotLoaded)
</del><span class="cx">     , m_trackIndex(invalidTrackIndex)
</span><span class="cx">     , m_renderedTrackIndex(invalidTrackIndex)
</span><del>-    , m_hasBeenConfigured(false)
</del><span class="cx"> {
</span><del>-    setKindInternal(kind);
</del><ins>+    if (kind == captionsKeyword())
+        m_kind = TextTrackKind::Captions;
+    else if (kind == chaptersKeyword())
+        m_kind = TextTrackKind::Chapters;
+    else if (kind == descriptionsKeyword())
+        m_kind = TextTrackKind::Descriptions;
+    else if (kind == forcedKeyword())
+        m_kind = TextTrackKind::Forced;
+    else if (kind == metadataKeyword())
+        m_kind = TextTrackKind::Metadata;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TextTrack::~TextTrack()
</span><span class="lines">@@ -142,17 +128,11 @@
</span><span class="cx">         for (size_t i = 0; i &lt; m_regions-&gt;length(); ++i)
</span><span class="cx">             m_regions-&gt;item(i)-&gt;setTrack(nullptr);
</span><span class="cx">     }
</span><del>-    clearClient();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TextTrack::isValidKind(const AtomicString&amp; value) const
-{
-    return TextTrack::isValidKindKeyword(value);
-}
-
</del><span class="cx"> bool TextTrack::enabled() const
</span><span class="cx"> {
</span><del>-    return m_mode != disabledKeyword();
</del><ins>+    return m_mode != TextTrackMode::Disabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool TextTrack::isValidKindKeyword(const AtomicString&amp; value)
</span><span class="lines">@@ -173,20 +153,38 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextTrack::setKind(const AtomicString&amp; newKind)
</del><ins>+const AtomicString&amp; TextTrack::kindKeyword() const
</ins><span class="cx"> {
</span><del>-    String oldKind = kind();
</del><ins>+    switch (m_kind) {
+    case TextTrackKind::Captions:
+        return captionsKeyword();
+    case TextTrackKind::Chapters:
+        return chaptersKeyword();
+    case TextTrackKind::Descriptions:
+        return descriptionsKeyword();
+    case TextTrackKind::Forced:
+        return forcedKeyword();
+    case TextTrackKind::Metadata:
+        return metadataKeyword();
+    case TextTrackKind::Subtitles:
+        return subtitlesKeyword();
+    }
+    ASSERT_NOT_REACHED();
+    return subtitlesKeyword();
+}
</ins><span class="cx"> 
</span><del>-#if ENABLE(MEDIA_SOURCE)
</del><ins>+void TextTrack::setKind(TextTrackKind newKind)
+{
+    auto oldKind = m_kind;
+
</ins><span class="cx">     // 10.1 kind, on setting:
</span><span class="cx">     // 1. If the value being assigned to this attribute does not match one of the text track kinds,
</span><span class="cx">     // then abort these steps.
</span><del>-    if (!isValidKindKeyword(newKind))
-        return;
</del><span class="cx"> 
</span><span class="cx">     // 2. Update this attribute to the new value.
</span><del>-    setKindInternal(newKind);
</del><ins>+    m_kind = newKind;
</ins><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SOURCE)
</ins><span class="cx">     // 3. If the sourceBuffer attribute on this track is not null, then queue a task to fire a simple
</span><span class="cx">     // event named change at sourceBuffer.textTracks.
</span><span class="cx">     if (m_sourceBuffer)
</span><span class="lines">@@ -196,18 +194,38 @@
</span><span class="cx">     // the textTracks attribute on the HTMLMediaElement.
</span><span class="cx">     if (mediaElement())
</span><span class="cx">         mediaElement()-&gt;textTracks()-&gt;scheduleChangeEvent();
</span><del>-#else
-    TrackBase::setKind(newKind);
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if (m_client &amp;&amp; oldKind != kind())
</del><ins>+    if (m_client &amp;&amp; oldKind != m_kind)
</ins><span class="cx">         m_client-&gt;textTrackKindChanged(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextTrack::setMode(const AtomicString&amp; mode)
</del><ins>+void TextTrack::setKindKeywordIgnoringASCIICase(StringView keyword)
</ins><span class="cx"> {
</span><del>-    ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showingKeyword());
</del><ins>+    if (equalLettersIgnoringASCIICase(keyword, &quot;captions&quot;))
+        setKind(TextTrackKind::Captions);
+    else if (equalLettersIgnoringASCIICase(keyword, &quot;chapters&quot;))
+        setKind(TextTrackKind::Chapters);
+    else if (equalLettersIgnoringASCIICase(keyword, &quot;descriptions&quot;))
+        setKind(TextTrackKind::Descriptions);
+    else if (equalLettersIgnoringASCIICase(keyword, &quot;forced&quot;))
+        setKind(TextTrackKind::Forced);
+    else if (equalLettersIgnoringASCIICase(keyword, &quot;metadata&quot;))
+        setKind(TextTrackKind::Metadata);
+    else if (equalLettersIgnoringASCIICase(keyword, &quot;subtitles&quot;))
+        setKind(TextTrackKind::Subtitles);
+#if !ENABLE(MEDIA_SOURCE)
+    // FIXME: This preserves the behavior of an older version of this code before refactoring.
+    // !ENABLE(MEDIA_SOURCE): unknown keywords all get turned into Subtitles.
+    // ENABLE(MEDIA_SOURCE): unknown keywords leave the old value for kind untouched.
+    // I am not sure that either of those is the correct behavior; should test and fix.
+    else
+        setKind(TextTrackKind::Subtitles);
+#endif
+}
</ins><span class="cx"> 
</span><ins>+void TextTrack::setMode(TextTrackMode mode)
+{
</ins><span class="cx">     // On setting, if the new value isn't equal to what the attribute would currently
</span><span class="cx">     // return, the new value must be processed as follows ...
</span><span class="cx">     if (m_mode == mode)
</span><span class="lines">@@ -215,10 +233,10 @@
</span><span class="cx"> 
</span><span class="cx">     // If mode changes to disabled, remove this track's cues from the client
</span><span class="cx">     // because they will no longer be accessible from the cues() function.
</span><del>-    if (mode == disabledKeyword() &amp;&amp; m_client &amp;&amp; m_cues)
</del><ins>+    if (mode == TextTrackMode::Disabled &amp;&amp; m_client &amp;&amp; m_cues)
</ins><span class="cx">         m_client-&gt;textTrackRemoveCues(this, m_cues.get());
</span><del>-         
-    if (mode != showingKeyword() &amp;&amp; m_cues) {
</del><ins>+
+    if (mode != TextTrackMode::Showing &amp;&amp; m_cues) {
</ins><span class="cx">         for (size_t i = 0; i &lt; m_cues-&gt;length(); ++i) {
</span><span class="cx">             TextTrackCue* cue = m_cues-&gt;item(i);
</span><span class="cx">             if (cue-&gt;isRenderable())
</span><span class="lines">@@ -239,9 +257,9 @@
</span><span class="cx">     // Otherwise, it must return null. When an object is returned, the
</span><span class="cx">     // same object must be returned each time.
</span><span class="cx">     // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-cues
</span><del>-    if (m_mode != disabledKeyword())
-        return ensureTextTrackCueList();
-    return nullptr;
</del><ins>+    if (m_mode == TextTrackMode::Disabled)
+        return nullptr;
+    return &amp;ensureTextTrackCueList();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextTrack::removeAllCues()
</span><span class="lines">@@ -266,9 +284,9 @@
</span><span class="cx">     // order. Otherwise, it must return null. When an object is returned, the
</span><span class="cx">     // same object must be returned each time.
</span><span class="cx">     // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecues
</span><del>-    if (m_cues &amp;&amp; m_mode != disabledKeyword())
-        return m_cues-&gt;activeCues();
-    return nullptr;
</del><ins>+    if (!m_cues || m_mode == TextTrackMode::Disabled)
+        return nullptr;
+    return m_cues-&gt;activeCues();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextTrack::addCue(PassRefPtr&lt;TextTrackCue&gt; prpCue, ExceptionCode&amp; ec)
</span><span class="lines">@@ -284,7 +302,7 @@
</span><span class="cx">     // If a DataCue is added to a TextTrack via the addCue() method but the text track does not have its text
</span><span class="cx">     // track kind set to metadata, throw a InvalidNodeTypeError exception and don't add the cue to the TextTrackList
</span><span class="cx">     // of the TextTrack.
</span><del>-    if (cue-&gt;cueType() == TextTrackCue::Data &amp;&amp; kind() != metadataKeyword()) {
</del><ins>+    if (cue-&gt;cueType() == TextTrackCue::Data &amp;&amp; m_kind != TextTrackKind::Metadata) {
</ins><span class="cx">         ec = INVALID_NODE_TYPE_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -305,7 +323,7 @@
</span><span class="cx"> 
</span><span class="cx">     // 2. Add cue to the method's TextTrack object's text track's text track list of cues.
</span><span class="cx">     cue-&gt;setTrack(this);
</span><del>-    ensureTextTrackCueList()-&gt;add(cue);
</del><ins>+    ensureTextTrackCueList().add(cue);
</ins><span class="cx">     
</span><span class="cx">     if (m_client)
</span><span class="cx">         m_client-&gt;textTrackAddCue(this, cue.get());
</span><span class="lines">@@ -338,12 +356,12 @@
</span><span class="cx">         m_client-&gt;textTrackRemoveCue(this, cue);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VTTRegionList* TextTrack::ensureVTTRegionList()
</del><ins>+VTTRegionList&amp; TextTrack::ensureVTTRegionList()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_regions)
</span><span class="cx">         m_regions = VTTRegionList::create();
</span><span class="cx"> 
</span><del>-    return m_regions.get();
</del><ins>+    return *m_regions;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VTTRegionList* TextTrack::regions()
</span><span class="lines">@@ -354,10 +372,9 @@
</span><span class="cx">     // the text track list of regions of the text track. Otherwise, it must
</span><span class="cx">     // return null. When an object is returned, the same object must be returned
</span><span class="cx">     // each time.
</span><del>-    if (m_mode != disabledKeyword())
-        return ensureVTTRegionList();
-
-    return 0;
</del><ins>+    if (m_mode == TextTrackMode::Disabled)
+        return nullptr;
+    return &amp;ensureVTTRegionList();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextTrack::addRegion(PassRefPtr&lt;VTTRegion&gt; prpRegion)
</span><span class="lines">@@ -366,7 +383,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;VTTRegion&gt; region = prpRegion;
</span><del>-    VTTRegionList* regionList = ensureVTTRegionList();
</del><ins>+    VTTRegionList&amp; regionList = ensureVTTRegionList();
</ins><span class="cx"> 
</span><span class="cx">     // 1. If the given region is in a text track list of regions, then remove
</span><span class="cx">     // region from that text track list of regions.
</span><span class="lines">@@ -378,7 +395,7 @@
</span><span class="cx">     // a region with the same identifier as region replace the values of that
</span><span class="cx">     // region's width, height, anchor point, viewport anchor point and scroll
</span><span class="cx">     // attributes with those of region.
</span><del>-    VTTRegion* existingRegion = regionList-&gt;getRegionById(region-&gt;id());
</del><ins>+    VTTRegion* existingRegion = regionList.getRegionById(region-&gt;id());
</ins><span class="cx">     if (existingRegion) {
</span><span class="cx">         existingRegion-&gt;updateParametersFromRegion(region.get());
</span><span class="cx">         return;
</span><span class="lines">@@ -387,7 +404,7 @@
</span><span class="cx">     // Otherwise: add region to the method's TextTrack object's text track
</span><span class="cx">     // list of regions.
</span><span class="cx">     region-&gt;setTrack(this);
</span><del>-    regionList-&gt;add(region);
</del><ins>+    regionList.add(region);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextTrack::removeRegion(VTTRegion* region, ExceptionCode &amp;ec)
</span><span class="lines">@@ -426,7 +443,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Make sure the TextTrackCueList order is up-to-date.
</span><del>-    ensureTextTrackCueList()-&gt;updateCueIndex(cue);
</del><ins>+    ensureTextTrackCueList().updateCueIndex(cue);
</ins><span class="cx"> 
</span><span class="cx">     // ... and add it back again.
</span><span class="cx">     m_client-&gt;textTrackAddCue(this, cue);
</span><span class="lines">@@ -450,21 +467,15 @@
</span><span class="cx"> 
</span><span class="cx"> bool TextTrack::isRendered()
</span><span class="cx"> {
</span><del>-    if (kind() != captionsKeyword() &amp;&amp; kind() != subtitlesKeyword() &amp;&amp; kind() != forcedKeyword())
-        return false;
-
-    if (m_mode != showingKeyword())
-        return false;
-
-    return true;
</del><ins>+    return (m_kind == TextTrackKind::Captions || m_kind == TextTrackKind::Subtitles || m_kind == TextTrackKind::Forced)
+        &amp;&amp; m_mode == TextTrackMode::Showing;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TextTrackCueList* TextTrack::ensureTextTrackCueList()
</del><ins>+TextTrackCueList&amp; TextTrack::ensureTextTrackCueList()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_cues)
</span><span class="cx">         m_cues = TextTrackCueList::create();
</span><del>-
-    return m_cues.get();
</del><ins>+    return *m_cues;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int TextTrack::trackIndexRelativeToRenderedTracks()
</span><span class="lines">@@ -542,15 +553,16 @@
</span><span class="cx">     // directors commentary is not &quot;main program&quot; because it is not essential for the presentation. HTML5 doesn't have
</span><span class="cx">     // a way to express this in a machine-reable form, it is typically done with the track label, so we assume that caption
</span><span class="cx">     // tracks are main content and all other track types are not.
</span><del>-    return kind() == captionsKeyword();
</del><ins>+    return m_kind == TextTrackKind::Captions;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool TextTrack::containsOnlyForcedSubtitles() const
</span><span class="cx"> {
</span><del>-    return kind() == forcedKeyword();
</del><ins>+    return m_kind == TextTrackKind::Forced;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><ins>+
</ins><span class="cx"> void TextTrack::setLanguage(const AtomicString&amp; language)
</span><span class="cx"> {
</span><span class="cx">     // 11.1 language, on setting:
</span><span class="lines">@@ -571,6 +583,7 @@
</span><span class="cx">     if (mediaElement())
</span><span class="cx">         mediaElement()-&gt;textTracks()-&gt;scheduleChangeEvent();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTextTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TextTrack.h (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TextTrack.h        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/TextTrack.h        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -24,8 +24,7 @@
</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><del>-#ifndef TextTrack_h
-#define TextTrack_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> 
</span><span class="lines">@@ -33,7 +32,6 @@
</span><span class="cx"> #include &quot;TextTrackCue.h&quot;
</span><span class="cx"> #include &quot;TrackBase.h&quot;
</span><span class="cx"> #include &quot;VTTCue.h&quot;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -44,6 +42,9 @@
</span><span class="cx"> class VTTRegion;
</span><span class="cx"> class VTTRegionList;
</span><span class="cx"> 
</span><ins>+enum class TextTrackKind { Subtitles, Captions, Descriptions, Chapters, Metadata, Forced };
+enum class TextTrackMode { Disabled, Hidden, Showing };
+
</ins><span class="cx"> class TextTrackClient {
</span><span class="cx"> public:
</span><span class="cx">     virtual ~TextTrackClient() { }
</span><span class="lines">@@ -70,24 +71,25 @@
</span><span class="cx">     static TextTrack* captionMenuAutomaticItem();
</span><span class="cx"> 
</span><span class="cx">     static const AtomicString&amp; subtitlesKeyword();
</span><del>-    static const AtomicString&amp; captionsKeyword();
-    static const AtomicString&amp; descriptionsKeyword();
-    static const AtomicString&amp; chaptersKeyword();
-    static const AtomicString&amp; metadataKeyword();
-    static const AtomicString&amp; forcedKeyword();
-    const AtomicString&amp; defaultKindKeyword() const override { return subtitlesKeyword(); }
</del><span class="cx">     static bool isValidKindKeyword(const AtomicString&amp;);
</span><span class="cx"> 
</span><span class="cx">     static const AtomicString&amp; disabledKeyword();
</span><span class="cx">     static const AtomicString&amp; hiddenKeyword();
</span><span class="cx">     static const AtomicString&amp; showingKeyword();
</span><span class="cx"> 
</span><del>-    void setKind(const AtomicString&amp;) override;
</del><ins>+    TextTrackKind kind() const;
+    void setKind(TextTrackKind);
</ins><span class="cx"> 
</span><ins>+    TextTrackKind kindForBindings() const;
+    void setKindForBindings(TextTrackKind);
+
+    const AtomicString&amp; kindKeyword() const;
+    void setKindKeywordIgnoringASCIICase(StringView);
+
</ins><span class="cx">     virtual AtomicString inBandMetadataTrackDispatchType() const { return emptyString(); }
</span><span class="cx"> 
</span><del>-    AtomicString mode() const { return m_mode; }
-    virtual void setMode(const AtomicString&amp;);
</del><ins>+    TextTrackMode mode() const;
+    virtual void setMode(TextTrackMode);
</ins><span class="cx"> 
</span><span class="cx">     enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad = 3 };
</span><span class="cx">     ReadinessState readinessState() const { return m_readinessState; }
</span><span class="lines">@@ -96,7 +98,7 @@
</span><span class="cx">     TextTrackCueList* cues();
</span><span class="cx">     TextTrackCueList* activeCues() const;
</span><span class="cx"> 
</span><del>-    void clearClient() override { m_client = 0; }
</del><ins>+    void clearClient() override { m_client = nullptr; }
</ins><span class="cx">     TextTrackClient* client() { return m_client; }
</span><span class="cx"> 
</span><span class="cx">     void addCue(PassRefPtr&lt;TextTrackCue&gt;, ExceptionCode&amp;);
</span><span class="lines">@@ -151,26 +153,25 @@
</span><span class="cx">     RefPtr&lt;TextTrackCueList&gt; m_cues;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    bool isValidKind(const AtomicString&amp;) const override;
-
</del><span class="cx">     bool enabled() const override;
</span><span class="cx"> 
</span><span class="cx">     void refEventTarget() final { ref(); }
</span><span class="cx">     void derefEventTarget() final { deref(); }
</span><span class="cx"> 
</span><del>-    VTTRegionList* ensureVTTRegionList();
</del><ins>+    VTTRegionList&amp; ensureVTTRegionList();
</ins><span class="cx">     RefPtr&lt;VTTRegionList&gt; m_regions;
</span><span class="cx"> 
</span><del>-    TextTrackCueList* ensureTextTrackCueList();
</del><ins>+    TextTrackCueList&amp; ensureTextTrackCueList();
</ins><span class="cx"> 
</span><span class="cx">     ScriptExecutionContext* m_scriptExecutionContext;
</span><del>-    AtomicString m_mode;
</del><ins>+    TextTrackMode m_mode { TextTrackMode::Disabled };
+    TextTrackKind m_kind { TextTrackKind::Subtitles };
</ins><span class="cx">     TextTrackClient* m_client;
</span><span class="cx">     TextTrackType m_trackType;
</span><del>-    ReadinessState m_readinessState;
</del><ins>+    ReadinessState m_readinessState { NotLoaded };
</ins><span class="cx">     int m_trackIndex;
</span><span class="cx">     int m_renderedTrackIndex;
</span><del>-    bool m_hasBeenConfigured;
</del><ins>+    bool m_hasBeenConfigured { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline TextTrack* toTextTrack(TrackBase* track)
</span><span class="lines">@@ -179,7 +180,40 @@
</span><span class="cx">     return static_cast&lt;TextTrack*&gt;(track);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline TextTrackMode TextTrack::mode() const
+{
+    return m_mode;
+}
+
+inline TextTrackKind TextTrack::kind() const
+{
+    return m_kind;
+}
+
+inline TextTrackKind TextTrack::kindForBindings() const
+{
+    return kind();
+}
+
+#if !ENABLE(MEDIA_SOURCE)
+
+inline void TextTrack::setKindForBindings(TextTrackKind)
+{
+    // FIXME: We are using kindForBindings only to implement this empty function, preserving the
+    // behavior of doing nothing when trying to set the kind, originally implemented in a custom setter.
+    // Once we no longer need this special case, we should remove kindForBindings and setKindForBindings.
+}
+
+#else
+
+inline void TextTrack::setKindForBindings(TextTrackKind kind)
+{
+    setKind(kind);
+}
+
+#endif
+
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><del>-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTextTrackidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TextTrack.idl (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TextTrack.idl        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/TextTrack.idl        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -23,8 +23,8 @@
</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><del>-enum TextTrackMode { &quot;disabled&quot;,  &quot;hidden&quot;,  &quot;showing&quot; };
-enum TextTrackKind { &quot;subtitles&quot;,  &quot;captions&quot;,  &quot;descriptions&quot;,  &quot;chapters&quot;, &quot;metadata&quot; };
</del><ins>+enum TextTrackMode { &quot;disabled&quot;, &quot;hidden&quot;, &quot;showing&quot; };
+enum TextTrackKind { &quot;subtitles&quot;, &quot;captions&quot;, &quot;descriptions&quot;, &quot;chapters&quot;, &quot;metadata&quot;, &quot;forced&quot; };
</ins><span class="cx"> 
</span><span class="cx"> [
</span><span class="cx">     Conditional=VIDEO_TRACK,
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx">     SkipVTableValidation,
</span><span class="cx"> ] interface TextTrack : EventTarget {
</span><span class="cx">     readonly attribute DOMString id;
</span><del>-    [CustomSetter] attribute TextTrackKind kind;
</del><ins>+    [ImplementedAs=kindForBindings] attribute TextTrackKind kind;
</ins><span class="cx">     readonly attribute DOMString label;
</span><span class="cx">     [CustomSetter] attribute DOMString language;
</span><span class="cx">     readonly attribute DOMString inBandMetadataTrackDispatchType;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTextTrackCuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TextTrackCue.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/TextTrackCue.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx"> bool TextTrackCue::dispatchEvent(Event&amp; event)
</span><span class="cx"> {
</span><span class="cx">     // When a TextTrack's mode is disabled: no cues are active, no events fired.
</span><del>-    if (!track() || track()-&gt;mode() == TextTrack::disabledKeyword())
</del><ins>+    if (!track() || track()-&gt;mode() == TextTrackMode::Disabled)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return EventTarget::dispatchEvent(event);
</span><span class="lines">@@ -201,7 +201,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool TextTrackCue::isActive()
</span><span class="cx"> {
</span><del>-    return m_isActive &amp;&amp; track() &amp;&amp; track()-&gt;mode() != TextTrack::disabledKeyword();
</del><ins>+    return m_isActive &amp;&amp; track() &amp;&amp; track()-&gt;mode() != TextTrackMode::Disabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextTrackCue::setIsActive(bool active)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTrackBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TrackBase.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TrackBase.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/TrackBase.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -26,20 +26,16 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;TrackBase.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;HTMLMediaElement.h&quot;
-
</del><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> 
</span><ins>+#include &quot;HTMLMediaElement.h&quot;
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static int s_uniqueId = 0;
</span><span class="cx"> 
</span><span class="cx"> TrackBase::TrackBase(Type type, const AtomicString&amp; id, const AtomicString&amp; label, const AtomicString&amp; language)
</span><del>-    : m_mediaElement(0)
-#if ENABLE(MEDIA_SOURCE)
-    , m_sourceBuffer(0)
-#endif
-    , m_uniqueId(++s_uniqueId)
</del><ins>+    : m_uniqueId(++s_uniqueId)
</ins><span class="cx">     , m_id(id)
</span><span class="cx">     , m_label(label)
</span><span class="cx">     , m_language(language)
</span><span class="lines">@@ -57,15 +53,18 @@
</span><span class="cx">     return m_mediaElement;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TrackBase::setKind(const AtomicString&amp; kind)
</del><ins>+MediaTrackBase::MediaTrackBase(Type type, const AtomicString&amp; id, const AtomicString&amp; label, const AtomicString&amp; language)
+    : TrackBase(type, id, label, language)
</ins><span class="cx"> {
</span><del>-    setKindInternal(kind);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TrackBase::setKindInternal(const AtomicString&amp; kind)
</del><ins>+void MediaTrackBase::setKind(const AtomicString&amp; kind)
</ins><span class="cx"> {
</span><del>-    String oldKind = m_kind;
</del><ins>+    setKindInternal(kind);
+}
</ins><span class="cx"> 
</span><ins>+void MediaTrackBase::setKindInternal(const AtomicString&amp; kind)
+{
</ins><span class="cx">     if (isValidKind(kind))
</span><span class="cx">         m_kind = kind;
</span><span class="cx">     else
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTrackBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TrackBase.h (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TrackBase.h        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/TrackBase.h        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -23,8 +23,7 @@
</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><del>-#ifndef TrackBase_h
-#define TrackBase_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> 
</span><span class="lines">@@ -51,9 +50,6 @@
</span><span class="cx">     virtual AtomicString id() const { return m_id; }
</span><span class="cx">     virtual void setId(const AtomicString&amp; id) { m_id = id; }
</span><span class="cx"> 
</span><del>-    AtomicString kind() const { return m_kind; }
-    virtual void setKind(const AtomicString&amp;);
-
</del><span class="cx">     AtomicString label() const { return m_label; }
</span><span class="cx">     void setLabel(const AtomicString&amp; label) { m_label = label; }
</span><span class="cx"> 
</span><span class="lines">@@ -74,27 +70,37 @@
</span><span class="cx"> protected:
</span><span class="cx">     TrackBase(Type, const AtomicString&amp; id, const AtomicString&amp; label, const AtomicString&amp; language);
</span><span class="cx"> 
</span><del>-    virtual bool isValidKind(const AtomicString&amp;) const = 0;
-    virtual const AtomicString&amp; defaultKindKeyword() const = 0;
</del><ins>+    HTMLMediaElement* m_mediaElement { nullptr };
</ins><span class="cx"> 
</span><del>-    void setKindInternal(const AtomicString&amp;);
-
-    HTMLMediaElement* m_mediaElement;
-
</del><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><del>-    SourceBuffer* m_sourceBuffer;
</del><ins>+    SourceBuffer* m_sourceBuffer { nullptr };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     Type m_type;
</span><span class="cx">     int m_uniqueId;
</span><span class="cx">     AtomicString m_id;
</span><del>-    AtomicString m_kind;
</del><span class="cx">     AtomicString m_label;
</span><span class="cx">     AtomicString m_language;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+class MediaTrackBase : public TrackBase {
+public:
+    const AtomicString&amp; kind() const { return m_kind; }
+    virtual void setKind(const AtomicString&amp;);
+
+protected:
+    MediaTrackBase(Type, const AtomicString&amp; id, const AtomicString&amp; label, const AtomicString&amp; language);
+
+    void setKindInternal(const AtomicString&amp;);
+
+private:
+    virtual bool isValidKind(const AtomicString&amp;) const = 0;
+    virtual const AtomicString&amp; defaultKindKeyword() const = 0;
+
+    AtomicString m_kind;
+};
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><del>-#endif // TrackBase_h
</del></span></pre></div>
<a id="trunkSourceWebCorehtmltrackVideoTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/VideoTrack.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/VideoTrack.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/VideoTrack.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VideoTrack::VideoTrack(VideoTrackClient* client, PassRefPtr&lt;VideoTrackPrivate&gt; trackPrivate)
</span><del>-    : TrackBase(TrackBase::VideoTrack, trackPrivate-&gt;id(), trackPrivate-&gt;label(), trackPrivate-&gt;language())
</del><ins>+    : MediaTrackBase(MediaTrackBase::VideoTrack, trackPrivate-&gt;id(), trackPrivate-&gt;label(), trackPrivate-&gt;language())
</ins><span class="cx">     , m_selected(trackPrivate-&gt;selected())
</span><span class="cx">     , m_client(client)
</span><span class="cx">     , m_private(trackPrivate)
</span><span class="lines">@@ -208,7 +208,7 @@
</span><span class="cx">     // FIXME(123926): Validate the BCP47-ness of langague.
</span><span class="cx"> 
</span><span class="cx">     // 2. Update this attribute to the new value.
</span><del>-    TrackBase::setLanguage(language);
</del><ins>+    MediaTrackBase::setLanguage(language);
</ins><span class="cx"> 
</span><span class="cx">     // 3. If the sourceBuffer attribute on this track is not null, then queue a task to fire a simple
</span><span class="cx">     // event named change at sourceBuffer.videoTracks.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackVideoTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/VideoTrack.h (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/VideoTrack.h        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/html/track/VideoTrack.h        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -24,15 +24,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><del>-#ifndef VideoTrack_h
-#define VideoTrack_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;TrackBase.h&quot;
</span><span class="cx"> #include &quot;VideoTrackPrivate.h&quot;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -46,7 +44,7 @@
</span><span class="cx">     virtual void videoTrackSelectedChanged(VideoTrack*) = 0;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class VideoTrack final : public TrackBase, public VideoTrackPrivateClient {
</del><ins>+class VideoTrack final : public MediaTrackBase, public VideoTrackPrivateClient {
</ins><span class="cx"> public:
</span><span class="cx">     static Ref&lt;VideoTrack&gt; create(VideoTrackClient* client, PassRefPtr&lt;VideoTrackPrivate&gt; trackPrivate)
</span><span class="cx">     {
</span><span class="lines">@@ -113,4 +111,3 @@
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><del>-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorepageCaptionUserPreferencescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/CaptionUserPreferences.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/CaptionUserPreferences.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/page/CaptionUserPreferences.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -216,8 +216,8 @@
</span><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0, length = trackList-&gt;length(); i &lt; length; ++i) {
</span><span class="cx">         TextTrack* track = trackList-&gt;item(i);
</span><del>-        const AtomicString&amp; kind = track-&gt;kind();
-        if (kind == TextTrack::captionsKeyword() || kind == TextTrack::descriptionsKeyword() || kind == TextTrack::subtitlesKeyword())
</del><ins>+        auto kind = track-&gt;kind();
+        if (kind == TextTrackKind::Captions || kind == TextTrackKind::Descriptions || kind == TextTrackKind::Subtitles)
</ins><span class="cx">             tracksForMenu.append(track);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -265,7 +265,7 @@
</span><span class="cx"> 
</span><span class="cx"> int CaptionUserPreferences::textTrackSelectionScore(TextTrack* track, HTMLMediaElement*) const
</span><span class="cx"> {
</span><del>-    if (track-&gt;kind() != TextTrack::captionsKeyword() &amp;&amp; track-&gt;kind() != TextTrack::subtitlesKeyword())
</del><ins>+    if (track-&gt;kind() != TextTrackKind::Captions &amp;&amp; track-&gt;kind() != TextTrackKind::Subtitles)
</ins><span class="cx">         return 0;
</span><span class="cx">     
</span><span class="cx">     if (!userPrefersSubtitles() &amp;&amp; !userPrefersCaptions())
</span></span></pre></div>
<a id="trunkSourceWebCorepageCaptionUserPreferencesMediaAFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -710,7 +710,7 @@
</span><span class="cx">     bool legacyOverride = mediaElement-&gt;webkitClosedCaptionsVisible();
</span><span class="cx">     if (displayMode == AlwaysOn &amp;&amp; (!userPrefersSubtitles() &amp;&amp; !userPrefersCaptions() &amp;&amp; !legacyOverride))
</span><span class="cx">         return 0;
</span><del>-    if (track-&gt;kind() != TextTrack::captionsKeyword() &amp;&amp; track-&gt;kind() != TextTrack::subtitlesKeyword() &amp;&amp; track-&gt;kind() != TextTrack::forcedKeyword())
</del><ins>+    if (track-&gt;kind() != TextTrackKind::Captions &amp;&amp; track-&gt;kind() != TextTrackKind::Subtitles &amp;&amp; track-&gt;kind() != TextTrackKind::Forced)
</ins><span class="cx">         return 0;
</span><span class="cx">     if (!track-&gt;isMainProgramContent())
</span><span class="cx">         return 0;
</span><span class="lines">@@ -771,7 +771,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (userPrefersCaptions()) {
</span><span class="cx">         // When the user prefers accessibility tracks, rank is SDH, then CC, then subtitles.
</span><del>-        if (track-&gt;kind() == track-&gt;subtitlesKeyword())
</del><ins>+        if (track-&gt;kind() == TextTrackKind::Subtitles)
</ins><span class="cx">             trackScore = 1;
</span><span class="cx">         else if (track-&gt;isClosedCaptions())
</span><span class="cx">             trackScore = 2;
</span><span class="lines">@@ -779,7 +779,7 @@
</span><span class="cx">             trackScore = 3;
</span><span class="cx">     } else {
</span><span class="cx">         // When the user prefers translation tracks, rank is subtitles, then SDH, then CC tracks.
</span><del>-        if (track-&gt;kind() == track-&gt;subtitlesKeyword())
</del><ins>+        if (track-&gt;kind() == TextTrackKind::Subtitles)
</ins><span class="cx">             trackScore = 3;
</span><span class="cx">         else if (!track-&gt;isClosedCaptions())
</span><span class="cx">             trackScore = 2;
</span><span class="lines">@@ -859,30 +859,30 @@
</span><span class="cx">         String language = displayNameForLanguageLocale(track-&gt;language());
</span><span class="cx"> 
</span><span class="cx">         if (displayMode == Manual) {
</span><del>-            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because selection mode is 'manual'&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because selection mode is 'manual'&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">             tracksForMenu.append(track);
</span><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        const AtomicString&amp; kind = track-&gt;kind();
-        if (kind != TextTrack::captionsKeyword() &amp;&amp; kind != TextTrack::descriptionsKeyword() &amp;&amp; kind != TextTrack::subtitlesKeyword())
</del><ins>+        auto kind = track-&gt;kind();
+        if (kind != TextTrackKind::Captions &amp;&amp; kind != TextTrackKind::Descriptions &amp;&amp; kind != TextTrackKind::Subtitles)
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><span class="cx">         if (track-&gt;containsOnlyForcedSubtitles()) {
</span><del>-            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it contains only forced subtitles&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it contains only forced subtitles&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         if (track-&gt;isEasyToRead()) {
</span><del>-            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is 'easy to read'&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is 'easy to read'&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">             if (!language.isEmpty())
</span><span class="cx">                 languagesIncluded.add(language);
</span><span class="cx">             tracksForMenu.append(track);
</span><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (track-&gt;mode() == TextTrack::showingKeyword()) {
-            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is already visible&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+        if (track-&gt;mode() == TextTrackMode::Showing) {
+            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is already visible&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">             if (!language.isEmpty())
</span><span class="cx">                 languagesIncluded.add(language);
</span><span class="cx">             tracksForMenu.append(track);
</span><span class="lines">@@ -890,21 +890,21 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (!language.isEmpty() &amp;&amp; track-&gt;isMainProgramContent()) {
</span><del>-            bool isAccessibilityTrack = track-&gt;kind() == track-&gt;captionsKeyword();
</del><ins>+            bool isAccessibilityTrack = track-&gt;kind() == TextTrackKind::Captions;
</ins><span class="cx">             if (prefersAccessibilityTracks) {
</span><span class="cx">                 // In the first pass, include only caption tracks if the user prefers accessibility tracks.
</span><span class="cx">                 if (!isAccessibilityTrack &amp;&amp; filterTrackList) {
</span><del>-                    LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is NOT an accessibility track&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+                    LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is NOT an accessibility track&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">                     continue;
</span><span class="cx">                 }
</span><span class="cx">             } else {
</span><span class="cx">                 // In the first pass, only include the first non-CC or SDH track with each language if the user prefers translation tracks.
</span><span class="cx">                 if (isAccessibilityTrack &amp;&amp; filterTrackList) {
</span><del>-                    LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is an accessibility track&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+                    LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is an accessibility track&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">                     continue;
</span><span class="cx">                 }
</span><del>-                if (languagesIncluded.contains(language)  &amp;&amp; filterTrackList) {
-                    LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is not the first with this language&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+                if (languagesIncluded.contains(language) &amp;&amp; filterTrackList) {
+                    LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is not the first with this language&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">                     continue;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -914,7 +914,7 @@
</span><span class="cx">             languagesIncluded.add(language);
</span><span class="cx">         tracksForMenu.append(track);
</span><span class="cx"> 
</span><del>-        LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s', is%s main program content&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data(), track-&gt;isMainProgramContent() ? &quot;&quot; : &quot; NOT&quot;);
</del><ins>+        LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s', is%s main program content&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data(), track-&gt;isMainProgramContent() ? &quot;&quot; : &quot; NOT&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Now that we have filtered for the user's accessibility/translation preference, add  all tracks with a unique language without regard to track type.
</span><span class="lines">@@ -925,8 +925,8 @@
</span><span class="cx">         if (tracksForMenu.contains(track))
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        const AtomicString&amp; kind = track-&gt;kind();
-        if (kind != TextTrack::captionsKeyword() &amp;&amp; kind != TextTrack::descriptionsKeyword() &amp;&amp; kind != TextTrack::subtitlesKeyword())
</del><ins>+        auto kind = track-&gt;kind();
+        if (kind != TextTrackKind::Captions &amp;&amp; kind != TextTrackKind::Descriptions &amp;&amp; kind != TextTrackKind::Subtitles)
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><span class="cx">         // All candidates with no languge were added the first time through.
</span><span class="lines">@@ -939,7 +939,7 @@
</span><span class="cx">         if (!languagesIncluded.contains(language) &amp;&amp; track-&gt;isMainProgramContent()) {
</span><span class="cx">             languagesIncluded.add(language);
</span><span class="cx">             tracksForMenu.append(track);
</span><del>-            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is the only track with this language&quot;, track-&gt;kind().string().utf8().data(), language.utf8().data());
</del><ins>+            LOG(Media, &quot;CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is the only track with this language&quot;, track-&gt;kindKeyword().string().utf8().data(), language.utf8().data());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaWebPlaybackSessionModelMediaElementmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm (200316 => 200317)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm        2016-05-02 04:21:19 UTC (rev 200316)
+++ trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm        2016-05-02 06:05:57 UTC (rev 200317)
</span><span class="lines">@@ -303,7 +303,7 @@
</span><span class="cx">             trackMenuItemSelected = true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (displayMode != MediaControlsHost::automaticKeyword() &amp;&amp; track-&gt;mode() == TextTrack::showingKeyword()) {
</del><ins>+        if (displayMode != MediaControlsHost::automaticKeyword() &amp;&amp; track-&gt;mode() == TextTrackMode::Showing) {
</ins><span class="cx">             selectedIndex = index;
</span><span class="cx">             trackMenuItemSelected = true;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>