Title: [200317] trunk/Source/WebCore
Revision
200317
Author
[email protected]
Date
2016-05-01 23:05:57 -0700 (Sun, 01 May 2016)

Log Message

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 "dictionary" 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& 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& 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200316 => 200317)


--- 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)
@@ -1,3 +1,185 @@
+2016-05-01  Darin Adler  <[email protected]>
+
+        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 "dictionary" 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& 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& 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.
+
 2016-05-01  Chris Dumez  <[email protected]>
 
         Pass reference instead of pointer to IDL attribute setters if not nullable

Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (200316 => 200317)


--- 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)
@@ -671,7 +671,7 @@
 
             // 9.3.2 If the mode attribute on the TextTrack object is set to "showing" or "hidden", then
             // set the removed enabled text track flag to true.
-            if (track->mode() == TextTrack::showingKeyword() || track->mode() == TextTrack::hiddenKeyword())
+            if (track->mode() == TextTrackMode::Showing || track->mode() == TextTrackMode::Hidden)
                 removedEnabledTextTrack = true;
 
             // 9.3.3 Remove the TextTrack object from the HTMLMediaElement textTracks list.

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (200316 => 200317)


--- 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)
@@ -1674,7 +1674,7 @@
     // 2.4.5 Changes to selected/enabled track state
     // If a text track mode becomes "disabled" and the SourceBuffer associated with this track is not
     // associated with any other enabled or selected track, then run the following steps:
-    if (track->mode() == TextTrack::disabledKeyword()
+    if (track->mode() == TextTrackMode::Disabled
         && (!m_videoTracks || !m_videoTracks->isAnyTrackEnabled())
         && (!m_audioTracks || !m_audioTracks->isAnyTrackEnabled())
         && (!m_textTracks || !m_textTracks->isAnyTrackEnabled())) {

Modified: trunk/Source/WebCore/bindings/js/JSTextTrackCustom.cpp (200316 => 200317)


--- 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)
@@ -41,19 +41,6 @@
     visitor.addOpaqueRoot(root(&wrapped()));
 }
 
-void JSTextTrack::setKind(ExecState& state, JSValue value)
-{
-#if ENABLE(MEDIA_SOURCE)
-    auto& string = value.toString(&state)->value(&state);
-    if (state.hadException())
-        return;
-    wrapped().setKind(string);
-#else
-    UNUSED_PARAM(state);
-    UNUSED_PARAM(value);
-#endif
-}
-
 void JSTextTrack::setLanguage(ExecState& state, JSValue value)
 {
 #if ENABLE(MEDIA_SOURCE)

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (200316 => 200317)


--- 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)
@@ -129,14 +129,6 @@
     "SVGMatrix" => 1
 );
 
-# 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 = (
-    "TextTrackKind" => 1,
-    "TextTrackMode" => 1,
-);
-
 # Cache of IDL file pathnames.
 my $idlFiles;
 my $cachedInterfaces = {};
@@ -381,16 +373,6 @@
     return $type eq "DOMString";
 }
 
-sub IsStringBasedEnumType
-{
-    my $object = shift;
-    my $type = shift;
-
-    return 0 if !$object->IsEnumType($type);
-    return 1 if exists $stringBasedEnumerationHash{$type};
-    return 0;
-}
-
 sub IsEnumType
 {
     my $object = shift;

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200316 => 200317)


--- 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)
@@ -838,7 +838,6 @@
     my $result = "";
     foreach my $enumeration (@$enumerations) {
         my $name = $enumeration->name;
-        next if $codeGenerator->IsStringBasedEnumType($name);
 
         my $className = GetEnumerationClassName($name);
 
@@ -2845,16 +2844,6 @@
                 push(@implContent, "    if (UNLIKELY(state->hadException()))\n");
                 push(@implContent, "        return false;\n");
 
-                if ($codeGenerator->IsStringBasedEnumType($type)) {
-                    my @enumValues = $codeGenerator->ValidEnumValues($type);
-                    my @enumChecks = ();
-                    foreach my $enumValue (@enumValues) {
-                        push(@enumChecks, "nativeValue != \"$enumValue\"");
-                    }
-                    push (@implContent, "    if (" . join(" && ", @enumChecks) . ")\n");
-                    push (@implContent, "        return false;\n");
-                }
-
                 if ($codeGenerator->IsEnumType($type)) {
                     push (@implContent, "    if (UNLIKELY(!nativeValue))\n");
                     push (@implContent, "        return false;\n");
@@ -2908,7 +2897,7 @@
                     my ($functionName, @arguments) = $codeGenerator->SetterExpression(\%implIncludes, $interfaceName, $attribute);
                     if ($codeGenerator->IsTypedArrayType($type) and not $type eq "ArrayBuffer") {
                         push(@arguments, "nativeValue.get()");
-                    } elsif ($codeGenerator->IsEnumType($type) and not $codeGenerator->IsStringBasedEnumType($type)) {
+                    } elsif ($codeGenerator->IsEnumType($type)) {
                         push(@arguments, "nativeValue.value()");
                     } else {
                         push(@arguments, $shouldPassByReference ? "*nativeValue" : "nativeValue");
@@ -3635,49 +3624,6 @@
                 push(@$outputArray, "    if (UNLIKELY(state->hadException()))\n");
                 push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
             }
-        } elsif ($codeGenerator->IsStringBasedEnumType($argType)) {
-            $implIncludes{"<runtime/Error.h>"} = 1;
-
-            my $exceptionCheck = sub {
-                my $indent = shift;
-                push(@$outputArray, $indent . "    if (UNLIKELY(state->hadException()))\n");
-                push(@$outputArray, $indent . "        return JSValue::encode(jsUndefined());\n");
-            };
-
-            my $enumValueCheck = sub {
-                my $indent = shift;
-                my @enumValues = $codeGenerator->ValidEnumValues($argType);
-                my @enumChecks = ();
-                my $enums = 0;
-                foreach my $enumValue (@enumValues) {
-                    push(@enumChecks, "${name} != \"$enumValue\"");
-                    if (!$enums) {
-                        $enums = "\\\"$enumValue\\\"";
-                    } else {
-                        $enums = $enums . ", \\\"" . $enumValue . "\\\"";
-                    }
-                }
-                push(@$outputArray, $indent . "    if (" . join(" && ", @enumChecks) . ")\n");
-                push(@$outputArray, $indent . "        return throwArgumentMustBeEnumError(*state, $argsIndex, \"$name\", \"$interfaceName\", $quotedFunctionName, \"$enums\");\n");
-            };
-
-            my $argValue = "state->argument($argsIndex)";
-            if ($parameter->isOptional && defined($parameter->default)) {
-                push(@$outputArray, "    String $name;\n");
-                push(@$outputArray, "    if (${argValue}.isUndefined())\n");
-                push(@$outputArray, "        $name = ASCIILiteral(" . $parameter->default . ");\n");
-                push(@$outputArray, "    else {\n");
-                push(@$outputArray, "        $name = state->uncheckedArgument($argsIndex).toWTFString(state);\n");
-                &$exceptionCheck("    ");
-                &$enumValueCheck("    ");
-                push(@$outputArray, "    }\n");
-            } else {
-                push(@$outputArray, "    // Keep pointer to the JSString in a local so we don't need to ref the String.\n");
-                push(@$outputArray, "    auto* ${name}String = ${argValue}.toString(state);\n");
-                push(@$outputArray, "    auto& $name = ${name}String->value(state);\n");
-                &$exceptionCheck("");
-                &$enumValueCheck("");
-            }
         } elsif ($codeGenerator->IsEnumType($argType)) {
             my $className = GetEnumerationClassName($argType);
             $implIncludes{"<runtime/Error.h>"} = 1;
@@ -4272,7 +4218,6 @@
     my $arrayOrSequenceType = $codeGenerator->GetArrayOrSequenceType($type);
 
     return "Vector<" . GetNativeVectorInnerType($arrayOrSequenceType) . ">" if $arrayOrSequenceType;
-    return "String" if $codeGenerator->IsStringBasedEnumType($type);
     return "auto" if $codeGenerator->IsEnumType($type);
 
     # For all other types, the native type is a pointer with same type name as the IDL type.
@@ -4423,7 +4368,6 @@
     return "valueToDate(state, $value)" if $type eq "Date";
 
     return "to$type($value)" if $codeGenerator->IsTypedArrayType($type);
-    return "$value.toWTFString(state)" if $codeGenerator->IsStringBasedEnumType($type);
     return "parse" . GetEnumerationClassName($type) . "(*state, $value)" if $codeGenerator->IsEnumType($type);
 
     AddToImplIncludes("JS$type.h", $conditional);

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (200316 => 200317)


--- 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)
@@ -1174,7 +1174,7 @@
         if (m_textTracks) {
             for (unsigned i = 0; i < m_textTracks->length(); ++i) {
                 TextTrack* track = m_textTracks->item(i);
-                if (track->mode() != TextTrack::disabledKeyword())
+                if (track->mode() != TextTrackMode::Disabled)
                     m_textTracksWhenResourceSelectionBegan.append(track);
             }
         }
@@ -1731,7 +1731,7 @@
     // Mark this track as "configured" so configureTextTracks won't change the mode again.
     track->setHasBeenConfigured(true);
     
-    if (track->mode() != TextTrack::disabledKeyword() && trackIsLoaded)
+    if (track->mode() != TextTrackMode::Disabled && trackIsLoaded)
         textTrackAddCues(track, track->cues());
 
     configureTextTrackDisplay(AssumeTextTrackVisibilityChanged);
@@ -1755,8 +1755,8 @@
 
 void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
 {
-    if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTrack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword())
-        track->setMode(TextTrack::hiddenKeyword());
+    if (track->kind() != TextTrackKind::Captions && track->kind() != TextTrackKind::Subtitles && track->mode() == TextTrackMode::Showing)
+        track->setMode(TextTrackMode::Hidden);
 }
 
 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests()
@@ -1774,7 +1774,7 @@
 
 void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList* cues) 
 {
-    if (track->mode() == TextTrack::disabledKeyword())
+    if (track->mode() == TextTrackMode::Disabled)
         return;
 
     TrackDisplayUpdateScope scope(this);
@@ -1791,7 +1791,7 @@
 
 void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue> prpCue)
 {
-    if (track->mode() == TextTrack::disabledKeyword())
+    if (track->mode() == TextTrackMode::Disabled)
         return;
 
     RefPtr<TextTrackCue> cue = prpCue;
@@ -3664,7 +3664,7 @@
     textTrack->setReadinessState(TextTrack::Loaded);
 
     // ... its text track mode to the text track hidden mode, and its text track list of cues to an empty list ...
-    textTrack->setMode(TextTrack::hiddenKeyword());
+    textTrack->setMode(TextTrackMode::Hidden);
 
     return textTrack.release();
 }
@@ -3792,11 +3792,11 @@
     for (size_t i = 0; i < group.tracks.size(); ++i) {
         RefPtr<TextTrack> textTrack = group.tracks[i];
 
-        if (m_processingPreferenceChange && textTrack->mode() == TextTrack::showingKeyword())
+        if (m_processingPreferenceChange && textTrack->mode() == TextTrackMode::Showing)
             currentlyEnabledTracks.append(textTrack);
 
         int trackScore = captionPreferences ? captionPreferences->textTrackSelectionScore(textTrack.get(), this) : 0;
-        LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%p) -  '%s' track with language '%s' has score %i", this, textTrack->kind().string().utf8().data(), textTrack->language().string().utf8().data(), trackScore);
+        LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%p) -  '%s' track with language '%s' has score %i", this, textTrack->kindKeyword().string().utf8().data(), textTrack->language().string().utf8().data(), trackScore);
 
         if (trackScore) {
 
@@ -3861,12 +3861,12 @@
         for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
             RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
             if (textTrack != trackToEnable)
-                textTrack->setMode(TextTrack::disabledKeyword());
+                textTrack->setMode(TextTrackMode::Disabled);
         }
     }
 
     if (trackToEnable) {
-        trackToEnable->setMode(TextTrack::showingKeyword());
+        trackToEnable->setMode(TextTrackMode::Showing);
 
         // If user preferences indicate we should always display captions, make sure we reflect the
         // proper status via the webkitClosedCaptionsVisible API call:
@@ -3996,13 +3996,13 @@
         for (int i = 0, length = trackList->length(); i < length; ++i) {
             TextTrack* track = trackList->item(i);
             if (!trackToSelect || track != trackToSelect)
-                track->setMode(TextTrack::disabledKeyword());
+                track->setMode(TextTrackMode::Disabled);
             else
-                track->setMode(TextTrack::showingKeyword());
+                track->setMode(TextTrackMode::Showing);
         }
     } else if (trackToSelect == TextTrack::captionMenuOffItem()) {
         for (int i = 0, length = trackList->length(); i < length; ++i)
-            trackList->item(i)->setMode(TextTrack::disabledKeyword());
+            trackList->item(i)->setMode(TextTrackMode::Disabled);
     }
 
     if (!document().page())
@@ -4039,20 +4039,20 @@
         if (!textTrack)
             continue;
 
-        String kind = textTrack->kind();
+        auto kind = textTrack->kind();
         TrackGroup* currentGroup;
-        if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captionsKeyword() || kind == TextTrack::forcedKeyword())
+        if (kind == TextTrackKind::Subtitles || kind == TextTrackKind::Captions || kind == TextTrackKind::Forced)
             currentGroup = &captionAndSubtitleTracks;
-        else if (kind == TextTrack::descriptionsKeyword())
+        else if (kind == TextTrackKind::Descriptions)
             currentGroup = &descriptionTracks;
-        else if (kind == TextTrack::chaptersKeyword())
+        else if (kind == TextTrackKind::Chapters)
             currentGroup = &chapterTracks;
-        else if (kind == TextTrack::metadataKeyword())
+        else if (kind == TextTrackKind::Metadata)
             currentGroup = &metadataTracks;
         else
             currentGroup = &otherTracks;
 
-        if (!currentGroup->visibleTrack && textTrack->mode() == TextTrack::showingKeyword())
+        if (!currentGroup->visibleTrack && textTrack->mode() == TextTrackMode::Showing)
             currentGroup->visibleTrack = textTrack;
         if (!currentGroup->defaultTrack && textTrack->isDefault())
             currentGroup->defaultTrack = textTrack;
@@ -5447,6 +5447,7 @@
 }
 
 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+
 void HTMLMediaElement::setVideoFullscreenLayer(PlatformLayer* platformLayer)
 {
     m_videoFullscreenLayer = platformLayer;
@@ -5474,6 +5475,7 @@
     if (m_player)
         m_player->setVideoFullscreenGravity(gravity);
 }
+
 #endif
 
 bool HTMLMediaElement::hasClosedCaptions() const
@@ -5486,11 +5488,10 @@
         return false;
 
     for (unsigned i = 0; i < m_textTracks->length(); ++i) {
-        if (m_textTracks->item(i)->readinessState() == TextTrack::FailedToLoad)
+        auto& track = *m_textTracks->item(i);
+        if (track.readinessState() == TextTrack::FailedToLoad)
             continue;
-
-        if (m_textTracks->item(i)->kind() == TextTrack::captionsKeyword()
-            || m_textTracks->item(i)->kind() == TextTrack::subtitlesKeyword())
+        if (track.kind() == TextTrackKind::Captions || track.kind() == TextTrackKind::Subtitles)
             return true;
     }
 #endif
@@ -5757,7 +5758,7 @@
 
     bool haveVisibleTextTrack = false;
     for (unsigned i = 0; i < m_textTracks->length(); ++i) {
-        if (m_textTracks->item(i)->mode() == TextTrack::showingKeyword()) {
+        if (m_textTracks->item(i)->mode() == TextTrackMode::Showing) {
             haveVisibleTextTrack = true;
             break;
         }
@@ -5831,12 +5832,10 @@
     // captions and non-default tracks should be displayed based on language
     // preferences if the user has turned captions on).
     for (unsigned i = 0; i < m_textTracks->length(); ++i) {
-        
-        RefPtr<TextTrack> textTrack = m_textTracks->item(i);
-        String kind = textTrack->kind();
-
-        if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captionsKeyword())
-            textTrack->setHasBeenConfigured(false);
+        auto& track = *m_textTracks->item(i);
+        auto kind = track.kind();
+        if (kind == TextTrackKind::Subtitles || kind == TextTrackKind::Captions)
+            track.setHasBeenConfigured(false);
     }
 
     m_processingPreferenceChange = true;
@@ -6080,14 +6079,45 @@
 }
 
 #if ENABLE(AVF_CAPTIONS)
+
+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;
+}
+
 Vector<RefPtr<PlatformTextTrack>> HTMLMediaElement::outOfBandTrackSources()
 {
     Vector<RefPtr<PlatformTextTrack>> outOfBandTrackSources;
     for (auto& trackElement : childrenOfType<HTMLTrackElement>(*this)) {
-        
-        if (!trackElement.fastHasAttribute(srcAttr))
-            continue;
-        
         URL url = ""
         if (url.isEmpty())
             continue;
@@ -6095,33 +6125,28 @@
         if (!document().contentSecurityPolicy()->allowMediaFromSource(url, trackElement.isInUserAgentShadowTree()))
             continue;
 
-        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
+        auto& 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:
             continue;
-        
-        const AtomicString& mode = trackElement.track()->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()->uniqueId(), trackElement.isDefault()));
+        }
+
+        outOfBandTrackSources.append(PlatformTextTrack::createOutOfBand(trackElement.label(), trackElement.srclang(), url.string(), toPlatform(track.mode()), toPlatform(kind), track.uniqueId(), trackElement.isDefault()));
     }
-    
+
     return outOfBandTrackSources;
 }
+
 #endif
 
 bool HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks() const

Modified: trunk/Source/WebCore/html/HTMLTrackElement.cpp (200316 => 200317)


--- 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)
@@ -102,58 +102,43 @@
         // 4.8.10.12.3 Sourcing out-of-band text tracks
         // As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly...
         } else if (name == kindAttr)
-            track()->setKind(value.convertToASCIILowercase());
+            ensureTrack().setKindKeywordIgnoringASCIICase(value.string());
         else if (name == labelAttr)
-            track()->setLabel(value);
+            ensureTrack().setLabel(value);
         else if (name == srclangAttr)
-            track()->setLanguage(value);
+            ensureTrack().setLanguage(value);
         else if (name == defaultAttr)
-            track()->setIsDefault(!value.isNull());
+            ensureTrack().setIsDefault(!value.isNull());
     }
 
     HTMLElement::parseAttribute(name, value);
 }
 
-String HTMLTrackElement::kind()
+const AtomicString& HTMLTrackElement::kind()
 {
-    return track()->kind();
+    return ensureTrack().kindKeyword();
 }
 
-void HTMLTrackElement::setKind(const String& kind)
+void HTMLTrackElement::setKind(const AtomicString& kind)
 {
-    setAttribute(kindAttr, kind);
+    setAttributeWithoutSynchronization(kindAttr, kind);
 }
 
-String HTMLTrackElement::srclang() const
+const AtomicString& HTMLTrackElement::srclang() const
 {
-    return getAttribute(srclangAttr);
+    return fastGetAttribute(srclangAttr);
 }
 
-void HTMLTrackElement::setSrclang(const String& srclang)
+const AtomicString& HTMLTrackElement::label() const
 {
-    setAttribute(srclangAttr, srclang);
+    return fastGetAttribute(labelAttr);
 }
 
-String HTMLTrackElement::label() const
-{
-    return getAttribute(labelAttr);
-}
-
-void HTMLTrackElement::setLabel(const String& label)
-{
-    setAttribute(labelAttr, label);
-}
-
 bool HTMLTrackElement::isDefault() const
 {
     return fastHasAttribute(defaultAttr);
 }
 
-void HTMLTrackElement::setIsDefault(bool isDefault)
-{
-    setBooleanAttribute(defaultAttr, isDefault);
-}
-
 LoadableTextTrack& HTMLTrackElement::ensureTrack()
 {
     if (!m_track) {
@@ -189,7 +174,7 @@
         return;
 
     // 2. If the text track's text track mode is not set to one of hidden or showing, abort these steps.
-    if (ensureTrack().mode() != TextTrack::hiddenKeyword() && ensureTrack().mode() != TextTrack::showingKeyword())
+    if (ensureTrack().mode() != TextTrackMode::Hidden && ensureTrack().mode() != TextTrackMode::Showing)
         return;
 
     // 3. If the text track's track element does not have a media element as a parent, abort these steps.

Modified: trunk/Source/WebCore/html/HTMLTrackElement.h (200316 => 200317)


--- 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)
@@ -23,13 +23,12 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef HTMLTrackElement_h
-#define HTMLTrackElement_h
+#pragma once
 
 #if ENABLE(VIDEO_TRACK)
+
 #include "HTMLElement.h"
 #include "LoadableTextTrack.h"
-#include "TextTrack.h"
 
 namespace WebCore {
 
@@ -39,17 +38,12 @@
 public:
     static Ref<HTMLTrackElement> create(const QualifiedName&, Document&);
 
-    String kind();
-    void setKind(const String&);
+    const AtomicString& kind();
+    void setKind(const AtomicString&);
 
-    String srclang() const;
-    void setSrclang(const String&);
-
-    String label() const;
-    void setLabel(const String&);
-
+    const AtomicString& srclang() const;
+    const AtomicString& label() const;
     bool isDefault() const;
-    void setIsDefault(bool);
 
     enum ReadyState { NONE = 0, LOADING = 1, LOADED = 2, TRACK_ERROR = 3 };
     ReadyState readyState();
@@ -68,24 +62,24 @@
     HTMLTrackElement(const QualifiedName&, Document&);
     virtual ~HTMLTrackElement();
 
-    void parseAttribute(const QualifiedName&, const AtomicString&) override;
+    void parseAttribute(const QualifiedName&, const AtomicString&) final;
 
-    InsertionNotificationRequest insertedInto(ContainerNode&) override;
-    void removedFrom(ContainerNode&) override;
+    InsertionNotificationRequest insertedInto(ContainerNode&) final;
+    void removedFrom(ContainerNode&) final;
 
-    bool isURLAttribute(const Attribute&) const override;
+    bool isURLAttribute(const Attribute&) const final;
 
     void loadTimerFired();
 
     HTMLMediaElement* mediaElement() const;
 
     // TextTrackClient
-    void textTrackModeChanged(TextTrack*) override;
-    void textTrackKindChanged(TextTrack*) override;
-    void textTrackAddCues(TextTrack*, const TextTrackCueList*) override;
-    void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) override;
-    void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) override;
-    void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) override;
+    void textTrackModeChanged(TextTrack*) final;
+    void textTrackKindChanged(TextTrack*) final;
+    void textTrackAddCues(TextTrack*, const TextTrackCueList*) final;
+    void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) final;
+    void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) final;
+    void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) final;
 
     LoadableTextTrack& ensureTrack();
     bool canLoadURL(const URL&);
@@ -97,4 +91,3 @@
 }
 
 #endif
-#endif

Modified: trunk/Source/WebCore/html/HTMLTrackElement.idl (200316 => 200317)


--- 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)
@@ -28,8 +28,8 @@
 ] interface HTMLTrackElement : HTMLElement {
     attribute DOMString kind;
     [Reflect, URL] attribute DOMString src;
-    attribute DOMString srclang;
-    attribute DOMString label;
+    [Reflect] attribute DOMString srclang;
+    [Reflect] attribute DOMString label;
     [Reflect] attribute boolean default;
 
     const unsigned short NONE = 0;

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (200316 => 200317)


--- 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)
@@ -765,7 +765,7 @@
             continue;
         }
 
-        if (displayMode != CaptionUserPreferences::Automatic && textTrack->mode() == TextTrack::showingKeyword()) {
+        if (displayMode != CaptionUserPreferences::Automatic && textTrack->mode() == TextTrackMode::Showing) {
             trackMenuItemSelected = true;
             trackItem->classList().add(selectedClassValue, ASSERT_NO_EXCEPTION);
         } else
@@ -1173,7 +1173,7 @@
         LOG(Media, "MediaControlTextTrackContainerElement::updateDisplay(%p) - adding and positioning cue #%zu: \"%s\", start=%.2f, end=%.2f, line=%.2f", this, i, cue->text().utf8().data(), cue->startTime(), cue->endTime(), cue->line());
 
         RefPtr<VTTCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size(), m_fontSize);
-        if (cue->track()->mode() == TextTrack::disabledKeyword())
+        if (cue->track()->mode() == TextTrackMode::Disabled)
             continue;
 
         VTTRegion* region = cue->track()->regions()->getRegionById(cue->regionId());

Modified: trunk/Source/WebCore/html/track/AudioTrack.cpp (200316 => 200317)


--- 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)
@@ -79,7 +79,7 @@
 }
 
 AudioTrack::AudioTrack(AudioTrackClient* client, PassRefPtr<AudioTrackPrivate> trackPrivate)
-    : TrackBase(TrackBase::AudioTrack, trackPrivate->id(), trackPrivate->label(), trackPrivate->language())
+    : MediaTrackBase(MediaTrackBase::AudioTrack, trackPrivate->id(), trackPrivate->label(), trackPrivate->language())
     , m_enabled(trackPrivate->enabled())
     , m_client(client)
     , m_private(trackPrivate)

Modified: trunk/Source/WebCore/html/track/AudioTrack.h (200316 => 200317)


--- 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)
@@ -24,17 +24,14 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef AudioTrack_h
-#define AudioTrack_h
+#pragma once
 
-#include "PlatformExportMacros.h"
-
 #if ENABLE(VIDEO_TRACK)
 
 #include "AudioTrackPrivate.h"
 #include "ExceptionCode.h"
+#include "PlatformExportMacros.h"
 #include "TrackBase.h"
-#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -47,7 +44,7 @@
     virtual void audioTrackEnabledChanged(AudioTrack*) = 0;
 };
 
-class AudioTrack final : public TrackBase, public AudioTrackPrivateClient {
+class AudioTrack final : public MediaTrackBase, public AudioTrackPrivateClient {
 public:
     static Ref<AudioTrack> create(AudioTrackClient* client, PassRefPtr<AudioTrackPrivate> trackPrivate)
     {
@@ -105,4 +102,3 @@
 } // namespace WebCore
 
 #endif
-#endif

Modified: trunk/Source/WebCore/html/track/InbandTextTrack.cpp (200316 => 200317)


--- 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)
@@ -70,7 +70,7 @@
 
 InbandTextTrack::~InbandTextTrack()
 {
-    m_private->setClient(0);
+    m_private->setClient(nullptr);
 }
 
 void InbandTextTrack::setPrivate(PassRefPtr<InbandTextTrackPrivate> trackPrivate)
@@ -81,7 +81,7 @@
     if (m_private == trackPrivate)
         return;
 
-    m_private->setClient(0);
+    m_private->setClient(nullptr);
     m_private = trackPrivate;
     m_private->setClient(this);
 
@@ -89,24 +89,31 @@
     updateKindFromPrivate();
 }
 
-void InbandTextTrack::setMode(const AtomicString& mode)
+void InbandTextTrack::setMode(TextTrackMode mode)
 {
     TextTrack::setMode(mode);
     setModeInternal(mode);
 }
 
-void InbandTextTrack::setModeInternal(const AtomicString& mode)
+static inline InbandTextTrackPrivate::Mode toPrivate(TextTrackMode mode)
 {
-    if (mode == TextTrack::disabledKeyword())
-        m_private->setMode(InbandTextTrackPrivate::Disabled);
-    else if (mode == TextTrack::hiddenKeyword())
-        m_private->setMode(InbandTextTrackPrivate::Hidden);
-    else if (mode == TextTrack::showingKeyword())
-        m_private->setMode(InbandTextTrackPrivate::Showing);
-    else
-        ASSERT_NOT_REACHED();
+    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;
 }
 
+void InbandTextTrack::setModeInternal(TextTrackMode mode)
+{
+    m_private->setMode(toPrivate(mode));
+}
+
 bool InbandTextTrack::isClosedCaptions() const
 {
     if (!m_private)
@@ -189,22 +196,22 @@
 {
     switch (m_private->kind()) {
     case InbandTextTrackPrivate::Subtitles:
-        setKind(TextTrack::subtitlesKeyword());
+        setKind(TextTrackKind::Subtitles);
         break;
     case InbandTextTrackPrivate::Captions:
-        setKind(TextTrack::captionsKeyword());
+        setKind(TextTrackKind::Captions);
         break;
     case InbandTextTrackPrivate::Descriptions:
-        setKind(TextTrack::descriptionsKeyword());
+        setKind(TextTrackKind::Descriptions);
         break;
     case InbandTextTrackPrivate::Chapters:
-        setKind(TextTrack::chaptersKeyword());
+        setKind(TextTrackKind::Chapters);
         break;
     case InbandTextTrackPrivate::Metadata:
-        setKind(TextTrack::metadataKeyword());
+        setKind(TextTrackKind::Metadata);
         break;
     case InbandTextTrackPrivate::Forced:
-        setKind(TextTrack::forcedKeyword());
+        setKind(TextTrackKind::Forced);
         break;
     case InbandTextTrackPrivate::None:
     default:

Modified: trunk/Source/WebCore/html/track/InbandTextTrack.h (200316 => 200317)


--- 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)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef InbandTextTrack_h
-#define InbandTextTrack_h
+#pragma once
 
 #if ENABLE(VIDEO_TRACK)
 
@@ -46,7 +45,7 @@
     bool containsOnlyForcedSubtitles() const override;
     bool isMainProgramContent() const override;
     bool isEasyToRead() const override;
-    void setMode(const AtomicString&) override;
+    void setMode(TextTrackMode) override;
     size_t inbandTrackIndex();
 
     AtomicString inBandMetadataTrackDispatchType() const override;
@@ -56,7 +55,7 @@
 protected:
     InbandTextTrack(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
 
-    void setModeInternal(const AtomicString&);
+    void setModeInternal(TextTrackMode);
     void updateKindFromPrivate();
 
     RefPtr<InbandTextTrackPrivate> m_private;
@@ -94,5 +93,3 @@
 SPECIALIZE_TYPE_TRAITS_END()
 
 #endif // ENABLE(VIDEO_TRACK)
-
-#endif // InbandTextTrack_h

Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (200316 => 200317)


--- 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)
@@ -53,54 +53,36 @@
     return subtitles;
 }
 
-const AtomicString& TextTrack::captionsKeyword()
+static const AtomicString& captionsKeyword()
 {
     static NeverDestroyed<const AtomicString> captions("captions", AtomicString::ConstructFromLiteral);
     return captions;
 }
 
-const AtomicString& TextTrack::descriptionsKeyword()
+static const AtomicString& descriptionsKeyword()
 {
     static NeverDestroyed<const AtomicString> descriptions("descriptions", AtomicString::ConstructFromLiteral);
     return descriptions;
 }
 
-const AtomicString& TextTrack::chaptersKeyword()
+static const AtomicString& chaptersKeyword()
 {
     static NeverDestroyed<const AtomicString> chapters("chapters", AtomicString::ConstructFromLiteral);
     return chapters;
 }
 
-const AtomicString& TextTrack::metadataKeyword()
+static const AtomicString& metadataKeyword()
 {
     static NeverDestroyed<const AtomicString> metadata("metadata", AtomicString::ConstructFromLiteral);
     return metadata;
 }
     
-const AtomicString& TextTrack::forcedKeyword()
+static const AtomicString& forcedKeyword()
 {
     static NeverDestroyed<const AtomicString> forced("forced", AtomicString::ConstructFromLiteral);
     return forced;
 }
 
-const AtomicString& TextTrack::disabledKeyword()
-{
-    static NeverDestroyed<const AtomicString> open("disabled", AtomicString::ConstructFromLiteral);
-    return open;
-}
-
-const AtomicString& TextTrack::hiddenKeyword()
-{
-    static NeverDestroyed<const AtomicString> closed("hidden", AtomicString::ConstructFromLiteral);
-    return closed;
-}
-
-const AtomicString& TextTrack::showingKeyword()
-{
-    static NeverDestroyed<const AtomicString> ended("showing", AtomicString::ConstructFromLiteral);
-    return ended;
-}
-
 TextTrack* TextTrack::captionMenuOffItem()
 {
     static TextTrack& off = TextTrack::create(0, 0, "off menu item", "", "", "").leakRef();
@@ -115,18 +97,22 @@
 
 TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& id, const AtomicString& label, const AtomicString& language, TextTrackType type)
     : TrackBase(TrackBase::TextTrack, id, label, language)
-    , m_cues(0)
-    , m_regions(0)
     , m_scriptExecutionContext(context)
-    , m_mode(disabledKeyword().string())
     , m_client(client)
     , m_trackType(type)
-    , m_readinessState(NotLoaded)
     , m_trackIndex(invalidTrackIndex)
     , m_renderedTrackIndex(invalidTrackIndex)
-    , m_hasBeenConfigured(false)
 {
-    setKindInternal(kind);
+    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;
 }
 
 TextTrack::~TextTrack()
@@ -142,17 +128,11 @@
         for (size_t i = 0; i < m_regions->length(); ++i)
             m_regions->item(i)->setTrack(nullptr);
     }
-    clearClient();
 }
 
-bool TextTrack::isValidKind(const AtomicString& value) const
-{
-    return TextTrack::isValidKindKeyword(value);
-}
-
 bool TextTrack::enabled() const
 {
-    return m_mode != disabledKeyword();
+    return m_mode != TextTrackMode::Disabled;
 }
 
 bool TextTrack::isValidKindKeyword(const AtomicString& value)
@@ -173,20 +153,38 @@
     return false;
 }
 
-void TextTrack::setKind(const AtomicString& newKind)
+const AtomicString& TextTrack::kindKeyword() const
 {
-    String oldKind = kind();
+    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();
+}
 
-#if ENABLE(MEDIA_SOURCE)
+void TextTrack::setKind(TextTrackKind newKind)
+{
+    auto oldKind = m_kind;
+
     // 10.1 kind, on setting:
     // 1. If the value being assigned to this attribute does not match one of the text track kinds,
     // then abort these steps.
-    if (!isValidKindKeyword(newKind))
-        return;
 
     // 2. Update this attribute to the new value.
-    setKindInternal(newKind);
+    m_kind = newKind;
 
+#if ENABLE(MEDIA_SOURCE)
     // 3. If the sourceBuffer attribute on this track is not null, then queue a task to fire a simple
     // event named change at sourceBuffer.textTracks.
     if (m_sourceBuffer)
@@ -196,18 +194,38 @@
     // the textTracks attribute on the HTMLMediaElement.
     if (mediaElement())
         mediaElement()->textTracks()->scheduleChangeEvent();
-#else
-    TrackBase::setKind(newKind);
 #endif
 
-    if (m_client && oldKind != kind())
+    if (m_client && oldKind != m_kind)
         m_client->textTrackKindChanged(this);
 }
 
-void TextTrack::setMode(const AtomicString& mode)
+void TextTrack::setKindKeywordIgnoringASCIICase(StringView keyword)
 {
-    ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showingKeyword());
+    if (equalLettersIgnoringASCIICase(keyword, "captions"))
+        setKind(TextTrackKind::Captions);
+    else if (equalLettersIgnoringASCIICase(keyword, "chapters"))
+        setKind(TextTrackKind::Chapters);
+    else if (equalLettersIgnoringASCIICase(keyword, "descriptions"))
+        setKind(TextTrackKind::Descriptions);
+    else if (equalLettersIgnoringASCIICase(keyword, "forced"))
+        setKind(TextTrackKind::Forced);
+    else if (equalLettersIgnoringASCIICase(keyword, "metadata"))
+        setKind(TextTrackKind::Metadata);
+    else if (equalLettersIgnoringASCIICase(keyword, "subtitles"))
+        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
+}
 
+void TextTrack::setMode(TextTrackMode mode)
+{
     // On setting, if the new value isn't equal to what the attribute would currently
     // return, the new value must be processed as follows ...
     if (m_mode == mode)
@@ -215,10 +233,10 @@
 
     // If mode changes to disabled, remove this track's cues from the client
     // because they will no longer be accessible from the cues() function.
-    if (mode == disabledKeyword() && m_client && m_cues)
+    if (mode == TextTrackMode::Disabled && m_client && m_cues)
         m_client->textTrackRemoveCues(this, m_cues.get());
-         
-    if (mode != showingKeyword() && m_cues) {
+
+    if (mode != TextTrackMode::Showing && m_cues) {
         for (size_t i = 0; i < m_cues->length(); ++i) {
             TextTrackCue* cue = m_cues->item(i);
             if (cue->isRenderable())
@@ -239,9 +257,9 @@
     // Otherwise, it must return null. When an object is returned, the
     // same object must be returned each time.
     // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-cues
-    if (m_mode != disabledKeyword())
-        return ensureTextTrackCueList();
-    return nullptr;
+    if (m_mode == TextTrackMode::Disabled)
+        return nullptr;
+    return &ensureTextTrackCueList();
 }
 
 void TextTrack::removeAllCues()
@@ -266,9 +284,9 @@
     // order. Otherwise, it must return null. When an object is returned, the
     // same object must be returned each time.
     // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecues
-    if (m_cues && m_mode != disabledKeyword())
-        return m_cues->activeCues();
-    return nullptr;
+    if (!m_cues || m_mode == TextTrackMode::Disabled)
+        return nullptr;
+    return m_cues->activeCues();
 }
 
 void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue, ExceptionCode& ec)
@@ -284,7 +302,7 @@
     // If a DataCue is added to a TextTrack via the addCue() method but the text track does not have its text
     // track kind set to metadata, throw a InvalidNodeTypeError exception and don't add the cue to the TextTrackList
     // of the TextTrack.
-    if (cue->cueType() == TextTrackCue::Data && kind() != metadataKeyword()) {
+    if (cue->cueType() == TextTrackCue::Data && m_kind != TextTrackKind::Metadata) {
         ec = INVALID_NODE_TYPE_ERR;
         return;
     }
@@ -305,7 +323,7 @@
 
     // 2. Add cue to the method's TextTrack object's text track's text track list of cues.
     cue->setTrack(this);
-    ensureTextTrackCueList()->add(cue);
+    ensureTextTrackCueList().add(cue);
     
     if (m_client)
         m_client->textTrackAddCue(this, cue.get());
@@ -338,12 +356,12 @@
         m_client->textTrackRemoveCue(this, cue);
 }
 
-VTTRegionList* TextTrack::ensureVTTRegionList()
+VTTRegionList& TextTrack::ensureVTTRegionList()
 {
     if (!m_regions)
         m_regions = VTTRegionList::create();
 
-    return m_regions.get();
+    return *m_regions;
 }
 
 VTTRegionList* TextTrack::regions()
@@ -354,10 +372,9 @@
     // the text track list of regions of the text track. Otherwise, it must
     // return null. When an object is returned, the same object must be returned
     // each time.
-    if (m_mode != disabledKeyword())
-        return ensureVTTRegionList();
-
-    return 0;
+    if (m_mode == TextTrackMode::Disabled)
+        return nullptr;
+    return &ensureVTTRegionList();
 }
 
 void TextTrack::addRegion(PassRefPtr<VTTRegion> prpRegion)
@@ -366,7 +383,7 @@
         return;
 
     RefPtr<VTTRegion> region = prpRegion;
-    VTTRegionList* regionList = ensureVTTRegionList();
+    VTTRegionList& regionList = ensureVTTRegionList();
 
     // 1. If the given region is in a text track list of regions, then remove
     // region from that text track list of regions.
@@ -378,7 +395,7 @@
     // a region with the same identifier as region replace the values of that
     // region's width, height, anchor point, viewport anchor point and scroll
     // attributes with those of region.
-    VTTRegion* existingRegion = regionList->getRegionById(region->id());
+    VTTRegion* existingRegion = regionList.getRegionById(region->id());
     if (existingRegion) {
         existingRegion->updateParametersFromRegion(region.get());
         return;
@@ -387,7 +404,7 @@
     // Otherwise: add region to the method's TextTrack object's text track
     // list of regions.
     region->setTrack(this);
-    regionList->add(region);
+    regionList.add(region);
 }
 
 void TextTrack::removeRegion(VTTRegion* region, ExceptionCode &ec)
@@ -426,7 +443,7 @@
         return;
 
     // Make sure the TextTrackCueList order is up-to-date.
-    ensureTextTrackCueList()->updateCueIndex(cue);
+    ensureTextTrackCueList().updateCueIndex(cue);
 
     // ... and add it back again.
     m_client->textTrackAddCue(this, cue);
@@ -450,21 +467,15 @@
 
 bool TextTrack::isRendered()
 {
-    if (kind() != captionsKeyword() && kind() != subtitlesKeyword() && kind() != forcedKeyword())
-        return false;
-
-    if (m_mode != showingKeyword())
-        return false;
-
-    return true;
+    return (m_kind == TextTrackKind::Captions || m_kind == TextTrackKind::Subtitles || m_kind == TextTrackKind::Forced)
+        && m_mode == TextTrackMode::Showing;
 }
 
-TextTrackCueList* TextTrack::ensureTextTrackCueList()
+TextTrackCueList& TextTrack::ensureTextTrackCueList()
 {
     if (!m_cues)
         m_cues = TextTrackCueList::create();
-
-    return m_cues.get();
+    return *m_cues;
 }
 
 int TextTrack::trackIndexRelativeToRenderedTracks()
@@ -542,15 +553,16 @@
     // directors commentary is not "main program" because it is not essential for the presentation. HTML5 doesn't have
     // a way to express this in a machine-reable form, it is typically done with the track label, so we assume that caption
     // tracks are main content and all other track types are not.
-    return kind() == captionsKeyword();
+    return m_kind == TextTrackKind::Captions;
 }
 
 bool TextTrack::containsOnlyForcedSubtitles() const
 {
-    return kind() == forcedKeyword();
+    return m_kind == TextTrackKind::Forced;
 }
 
 #if ENABLE(MEDIA_SOURCE)
+
 void TextTrack::setLanguage(const AtomicString& language)
 {
     // 11.1 language, on setting:
@@ -571,6 +583,7 @@
     if (mediaElement())
         mediaElement()->textTracks()->scheduleChangeEvent();
 }
+
 #endif
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/track/TextTrack.h (200316 => 200317)


--- 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)
@@ -24,8 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef TextTrack_h
-#define TextTrack_h
+#pragma once
 
 #if ENABLE(VIDEO_TRACK)
 
@@ -33,7 +32,6 @@
 #include "TextTrackCue.h"
 #include "TrackBase.h"
 #include "VTTCue.h"
-#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -44,6 +42,9 @@
 class VTTRegion;
 class VTTRegionList;
 
+enum class TextTrackKind { Subtitles, Captions, Descriptions, Chapters, Metadata, Forced };
+enum class TextTrackMode { Disabled, Hidden, Showing };
+
 class TextTrackClient {
 public:
     virtual ~TextTrackClient() { }
@@ -70,24 +71,25 @@
     static TextTrack* captionMenuAutomaticItem();
 
     static const AtomicString& subtitlesKeyword();
-    static const AtomicString& captionsKeyword();
-    static const AtomicString& descriptionsKeyword();
-    static const AtomicString& chaptersKeyword();
-    static const AtomicString& metadataKeyword();
-    static const AtomicString& forcedKeyword();
-    const AtomicString& defaultKindKeyword() const override { return subtitlesKeyword(); }
     static bool isValidKindKeyword(const AtomicString&);
 
     static const AtomicString& disabledKeyword();
     static const AtomicString& hiddenKeyword();
     static const AtomicString& showingKeyword();
 
-    void setKind(const AtomicString&) override;
+    TextTrackKind kind() const;
+    void setKind(TextTrackKind);
 
+    TextTrackKind kindForBindings() const;
+    void setKindForBindings(TextTrackKind);
+
+    const AtomicString& kindKeyword() const;
+    void setKindKeywordIgnoringASCIICase(StringView);
+
     virtual AtomicString inBandMetadataTrackDispatchType() const { return emptyString(); }
 
-    AtomicString mode() const { return m_mode; }
-    virtual void setMode(const AtomicString&);
+    TextTrackMode mode() const;
+    virtual void setMode(TextTrackMode);
 
     enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad = 3 };
     ReadinessState readinessState() const { return m_readinessState; }
@@ -96,7 +98,7 @@
     TextTrackCueList* cues();
     TextTrackCueList* activeCues() const;
 
-    void clearClient() override { m_client = 0; }
+    void clearClient() override { m_client = nullptr; }
     TextTrackClient* client() { return m_client; }
 
     void addCue(PassRefPtr<TextTrackCue>, ExceptionCode&);
@@ -151,26 +153,25 @@
     RefPtr<TextTrackCueList> m_cues;
 
 private:
-    bool isValidKind(const AtomicString&) const override;
-
     bool enabled() const override;
 
     void refEventTarget() final { ref(); }
     void derefEventTarget() final { deref(); }
 
-    VTTRegionList* ensureVTTRegionList();
+    VTTRegionList& ensureVTTRegionList();
     RefPtr<VTTRegionList> m_regions;
 
-    TextTrackCueList* ensureTextTrackCueList();
+    TextTrackCueList& ensureTextTrackCueList();
 
     ScriptExecutionContext* m_scriptExecutionContext;
-    AtomicString m_mode;
+    TextTrackMode m_mode { TextTrackMode::Disabled };
+    TextTrackKind m_kind { TextTrackKind::Subtitles };
     TextTrackClient* m_client;
     TextTrackType m_trackType;
-    ReadinessState m_readinessState;
+    ReadinessState m_readinessState { NotLoaded };
     int m_trackIndex;
     int m_renderedTrackIndex;
-    bool m_hasBeenConfigured;
+    bool m_hasBeenConfigured { false };
 };
 
 inline TextTrack* toTextTrack(TrackBase* track)
@@ -179,7 +180,40 @@
     return static_cast<TextTrack*>(track);
 }
 
+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
+
+
 } // namespace WebCore
 
 #endif
-#endif

Modified: trunk/Source/WebCore/html/track/TextTrack.idl (200316 => 200317)


--- 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)
@@ -23,8 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-enum TextTrackMode { "disabled",  "hidden",  "showing" };
-enum TextTrackKind { "subtitles",  "captions",  "descriptions",  "chapters", "metadata" };
+enum TextTrackMode { "disabled", "hidden", "showing" };
+enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata", "forced" };
 
 [
     Conditional=VIDEO_TRACK,
@@ -33,7 +33,7 @@
     SkipVTableValidation,
 ] interface TextTrack : EventTarget {
     readonly attribute DOMString id;
-    [CustomSetter] attribute TextTrackKind kind;
+    [ImplementedAs=kindForBindings] attribute TextTrackKind kind;
     readonly attribute DOMString label;
     [CustomSetter] attribute DOMString language;
     readonly attribute DOMString inBandMetadataTrackDispatchType;

Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (200316 => 200317)


--- 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)
@@ -193,7 +193,7 @@
 bool TextTrackCue::dispatchEvent(Event& event)
 {
     // When a TextTrack's mode is disabled: no cues are active, no events fired.
-    if (!track() || track()->mode() == TextTrack::disabledKeyword())
+    if (!track() || track()->mode() == TextTrackMode::Disabled)
         return false;
 
     return EventTarget::dispatchEvent(event);
@@ -201,7 +201,7 @@
 
 bool TextTrackCue::isActive()
 {
-    return m_isActive && track() && track()->mode() != TextTrack::disabledKeyword();
+    return m_isActive && track() && track()->mode() != TextTrackMode::Disabled;
 }
 
 void TextTrackCue::setIsActive(bool active)

Modified: trunk/Source/WebCore/html/track/TrackBase.cpp (200316 => 200317)


--- 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)
@@ -26,20 +26,16 @@
 #include "config.h"
 #include "TrackBase.h"
 
-#include "HTMLMediaElement.h"
-
 #if ENABLE(VIDEO_TRACK)
 
+#include "HTMLMediaElement.h"
+
 namespace WebCore {
 
 static int s_uniqueId = 0;
 
 TrackBase::TrackBase(Type type, const AtomicString& id, const AtomicString& label, const AtomicString& language)
-    : m_mediaElement(0)
-#if ENABLE(MEDIA_SOURCE)
-    , m_sourceBuffer(0)
-#endif
-    , m_uniqueId(++s_uniqueId)
+    : m_uniqueId(++s_uniqueId)
     , m_id(id)
     , m_label(label)
     , m_language(language)
@@ -57,15 +53,18 @@
     return m_mediaElement;
 }
 
-void TrackBase::setKind(const AtomicString& kind)
+MediaTrackBase::MediaTrackBase(Type type, const AtomicString& id, const AtomicString& label, const AtomicString& language)
+    : TrackBase(type, id, label, language)
 {
-    setKindInternal(kind);
 }
 
-void TrackBase::setKindInternal(const AtomicString& kind)
+void MediaTrackBase::setKind(const AtomicString& kind)
 {
-    String oldKind = m_kind;
+    setKindInternal(kind);
+}
 
+void MediaTrackBase::setKindInternal(const AtomicString& kind)
+{
     if (isValidKind(kind))
         m_kind = kind;
     else

Modified: trunk/Source/WebCore/html/track/TrackBase.h (200316 => 200317)


--- 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)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef TrackBase_h
-#define TrackBase_h
+#pragma once
 
 #if ENABLE(VIDEO_TRACK)
 
@@ -51,9 +50,6 @@
     virtual AtomicString id() const { return m_id; }
     virtual void setId(const AtomicString& id) { m_id = id; }
 
-    AtomicString kind() const { return m_kind; }
-    virtual void setKind(const AtomicString&);
-
     AtomicString label() const { return m_label; }
     void setLabel(const AtomicString& label) { m_label = label; }
 
@@ -74,27 +70,37 @@
 protected:
     TrackBase(Type, const AtomicString& id, const AtomicString& label, const AtomicString& language);
 
-    virtual bool isValidKind(const AtomicString&) const = 0;
-    virtual const AtomicString& defaultKindKeyword() const = 0;
+    HTMLMediaElement* m_mediaElement { nullptr };
 
-    void setKindInternal(const AtomicString&);
-
-    HTMLMediaElement* m_mediaElement;
-
 #if ENABLE(MEDIA_SOURCE)
-    SourceBuffer* m_sourceBuffer;
+    SourceBuffer* m_sourceBuffer { nullptr };
 #endif
 
 private:
     Type m_type;
     int m_uniqueId;
     AtomicString m_id;
-    AtomicString m_kind;
     AtomicString m_label;
     AtomicString m_language;
 };
 
+class MediaTrackBase : public TrackBase {
+public:
+    const AtomicString& kind() const { return m_kind; }
+    virtual void setKind(const AtomicString&);
+
+protected:
+    MediaTrackBase(Type, const AtomicString& id, const AtomicString& label, const AtomicString& language);
+
+    void setKindInternal(const AtomicString&);
+
+private:
+    virtual bool isValidKind(const AtomicString&) const = 0;
+    virtual const AtomicString& defaultKindKeyword() const = 0;
+
+    AtomicString m_kind;
+};
+
 } // namespace WebCore
 
 #endif
-#endif // TrackBase_h

Modified: trunk/Source/WebCore/html/track/VideoTrack.cpp (200316 => 200317)


--- 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)
@@ -82,7 +82,7 @@
 }
 
 VideoTrack::VideoTrack(VideoTrackClient* client, PassRefPtr<VideoTrackPrivate> trackPrivate)
-    : TrackBase(TrackBase::VideoTrack, trackPrivate->id(), trackPrivate->label(), trackPrivate->language())
+    : MediaTrackBase(MediaTrackBase::VideoTrack, trackPrivate->id(), trackPrivate->label(), trackPrivate->language())
     , m_selected(trackPrivate->selected())
     , m_client(client)
     , m_private(trackPrivate)
@@ -208,7 +208,7 @@
     // FIXME(123926): Validate the BCP47-ness of langague.
 
     // 2. Update this attribute to the new value.
-    TrackBase::setLanguage(language);
+    MediaTrackBase::setLanguage(language);
 
     // 3. If the sourceBuffer attribute on this track is not null, then queue a task to fire a simple
     // event named change at sourceBuffer.videoTracks.

Modified: trunk/Source/WebCore/html/track/VideoTrack.h (200316 => 200317)


--- 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)
@@ -24,15 +24,13 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef VideoTrack_h
-#define VideoTrack_h
+#pragma once
 
 #if ENABLE(VIDEO_TRACK)
 
 #include "ExceptionCode.h"
 #include "TrackBase.h"
 #include "VideoTrackPrivate.h"
-#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -46,7 +44,7 @@
     virtual void videoTrackSelectedChanged(VideoTrack*) = 0;
 };
 
-class VideoTrack final : public TrackBase, public VideoTrackPrivateClient {
+class VideoTrack final : public MediaTrackBase, public VideoTrackPrivateClient {
 public:
     static Ref<VideoTrack> create(VideoTrackClient* client, PassRefPtr<VideoTrackPrivate> trackPrivate)
     {
@@ -113,4 +111,3 @@
 } // namespace WebCore
 
 #endif
-#endif

Modified: trunk/Source/WebCore/page/CaptionUserPreferences.cpp (200316 => 200317)


--- 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)
@@ -216,8 +216,8 @@
 
     for (unsigned i = 0, length = trackList->length(); i < length; ++i) {
         TextTrack* track = trackList->item(i);
-        const AtomicString& kind = track->kind();
-        if (kind == TextTrack::captionsKeyword() || kind == TextTrack::descriptionsKeyword() || kind == TextTrack::subtitlesKeyword())
+        auto kind = track->kind();
+        if (kind == TextTrackKind::Captions || kind == TextTrackKind::Descriptions || kind == TextTrackKind::Subtitles)
             tracksForMenu.append(track);
     }
 
@@ -265,7 +265,7 @@
 
 int CaptionUserPreferences::textTrackSelectionScore(TextTrack* track, HTMLMediaElement*) const
 {
-    if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTrack::subtitlesKeyword())
+    if (track->kind() != TextTrackKind::Captions && track->kind() != TextTrackKind::Subtitles)
         return 0;
     
     if (!userPrefersSubtitles() && !userPrefersCaptions())

Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (200316 => 200317)


--- 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)
@@ -710,7 +710,7 @@
     bool legacyOverride = mediaElement->webkitClosedCaptionsVisible();
     if (displayMode == AlwaysOn && (!userPrefersSubtitles() && !userPrefersCaptions() && !legacyOverride))
         return 0;
-    if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTrack::subtitlesKeyword() && track->kind() != TextTrack::forcedKeyword())
+    if (track->kind() != TextTrackKind::Captions && track->kind() != TextTrackKind::Subtitles && track->kind() != TextTrackKind::Forced)
         return 0;
     if (!track->isMainProgramContent())
         return 0;
@@ -771,7 +771,7 @@
 
     if (userPrefersCaptions()) {
         // When the user prefers accessibility tracks, rank is SDH, then CC, then subtitles.
-        if (track->kind() == track->subtitlesKeyword())
+        if (track->kind() == TextTrackKind::Subtitles)
             trackScore = 1;
         else if (track->isClosedCaptions())
             trackScore = 2;
@@ -779,7 +779,7 @@
             trackScore = 3;
     } else {
         // When the user prefers translation tracks, rank is subtitles, then SDH, then CC tracks.
-        if (track->kind() == track->subtitlesKeyword())
+        if (track->kind() == TextTrackKind::Subtitles)
             trackScore = 3;
         else if (!track->isClosedCaptions())
             trackScore = 2;
@@ -859,30 +859,30 @@
         String language = displayNameForLanguageLocale(track->language());
 
         if (displayMode == Manual) {
-            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because selection mode is 'manual'", track->kind().string().utf8().data(), language.utf8().data());
+            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because selection mode is 'manual'", track->kindKeyword().string().utf8().data(), language.utf8().data());
             tracksForMenu.append(track);
             continue;
         }
 
-        const AtomicString& kind = track->kind();
-        if (kind != TextTrack::captionsKeyword() && kind != TextTrack::descriptionsKeyword() && kind != TextTrack::subtitlesKeyword())
+        auto kind = track->kind();
+        if (kind != TextTrackKind::Captions && kind != TextTrackKind::Descriptions && kind != TextTrackKind::Subtitles)
             continue;
 
         if (track->containsOnlyForcedSubtitles()) {
-            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it contains only forced subtitles", track->kind().string().utf8().data(), language.utf8().data());
+            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it contains only forced subtitles", track->kindKeyword().string().utf8().data(), language.utf8().data());
             continue;
         }
         
         if (track->isEasyToRead()) {
-            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is 'easy to read'", track->kind().string().utf8().data(), language.utf8().data());
+            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is 'easy to read'", track->kindKeyword().string().utf8().data(), language.utf8().data());
             if (!language.isEmpty())
                 languagesIncluded.add(language);
             tracksForMenu.append(track);
             continue;
         }
 
-        if (track->mode() == TextTrack::showingKeyword()) {
-            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is already visible", track->kind().string().utf8().data(), language.utf8().data());
+        if (track->mode() == TextTrackMode::Showing) {
+            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is already visible", track->kindKeyword().string().utf8().data(), language.utf8().data());
             if (!language.isEmpty())
                 languagesIncluded.add(language);
             tracksForMenu.append(track);
@@ -890,21 +890,21 @@
         }
 
         if (!language.isEmpty() && track->isMainProgramContent()) {
-            bool isAccessibilityTrack = track->kind() == track->captionsKeyword();
+            bool isAccessibilityTrack = track->kind() == TextTrackKind::Captions;
             if (prefersAccessibilityTracks) {
                 // In the first pass, include only caption tracks if the user prefers accessibility tracks.
                 if (!isAccessibilityTrack && filterTrackList) {
-                    LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is NOT an accessibility track", track->kind().string().utf8().data(), language.utf8().data());
+                    LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is NOT an accessibility track", track->kindKeyword().string().utf8().data(), language.utf8().data());
                     continue;
                 }
             } else {
                 // In the first pass, only include the first non-CC or SDH track with each language if the user prefers translation tracks.
                 if (isAccessibilityTrack && filterTrackList) {
-                    LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is an accessibility track", track->kind().string().utf8().data(), language.utf8().data());
+                    LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is an accessibility track", track->kindKeyword().string().utf8().data(), language.utf8().data());
                     continue;
                 }
-                if (languagesIncluded.contains(language)  && filterTrackList) {
-                    LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is not the first with this language", track->kind().string().utf8().data(), language.utf8().data());
+                if (languagesIncluded.contains(language) && filterTrackList) {
+                    LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - skipping '%s' track with language '%s' because it is not the first with this language", track->kindKeyword().string().utf8().data(), language.utf8().data());
                     continue;
                 }
             }
@@ -914,7 +914,7 @@
             languagesIncluded.add(language);
         tracksForMenu.append(track);
 
-        LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s', is%s main program content", track->kind().string().utf8().data(), language.utf8().data(), track->isMainProgramContent() ? "" : " NOT");
+        LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s', is%s main program content", track->kindKeyword().string().utf8().data(), language.utf8().data(), track->isMainProgramContent() ? "" : " NOT");
     }
 
     // Now that we have filtered for the user's accessibility/translation preference, add  all tracks with a unique language without regard to track type.
@@ -925,8 +925,8 @@
         if (tracksForMenu.contains(track))
             continue;
 
-        const AtomicString& kind = track->kind();
-        if (kind != TextTrack::captionsKeyword() && kind != TextTrack::descriptionsKeyword() && kind != TextTrack::subtitlesKeyword())
+        auto kind = track->kind();
+        if (kind != TextTrackKind::Captions && kind != TextTrackKind::Descriptions && kind != TextTrackKind::Subtitles)
             continue;
 
         // All candidates with no languge were added the first time through.
@@ -939,7 +939,7 @@
         if (!languagesIncluded.contains(language) && track->isMainProgramContent()) {
             languagesIncluded.add(language);
             tracksForMenu.append(track);
-            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is the only track with this language", track->kind().string().utf8().data(), language.utf8().data());
+            LOG(Media, "CaptionUserPreferencesMediaAF::sortedTrackListForMenu - adding '%s' track with language '%s' because it is the only track with this language", track->kindKeyword().string().utf8().data(), language.utf8().data());
         }
     }
 

Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm (200316 => 200317)


--- 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)
@@ -303,7 +303,7 @@
             trackMenuItemSelected = true;
         }
 
-        if (displayMode != MediaControlsHost::automaticKeyword() && track->mode() == TextTrack::showingKeyword()) {
+        if (displayMode != MediaControlsHost::automaticKeyword() && track->mode() == TextTrackMode::Showing) {
             selectedIndex = index;
             trackMenuItemSelected = true;
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to