HTMLMediaElement::configureTextTracks should configure all text tracks
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2012 23:06:40 +0000 (23:06 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2012 23:06:40 +0000 (23:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102561

Reviewed by Philippe Normand.

Source/WebCore:

No new tests, track-mode-not-changed-by-new-track.html was updated to test the changes.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::textTrackModeChanged): HTMLTrackElement -> TextTrack.
(WebCore::HTMLMediaElement::willRemoveTrack): Ditto.
(WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto.
(WebCore::HTMLMediaElement::configureTextTracks): Ditto.
(WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Ditto.
* html/HTMLMediaElement.h:

* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::HTMLTrackElement): Move hasBeenConfigured down to TextTrack.
(WebCore::HTMLTrackElement::parseAttribute): isDefault is stored on TextTrack.
(WebCore::HTMLTrackElement::ensureTrack): LoadableTextTrack constructor doesn't take
    "default" argument.
* html/HTMLTrackElement.h:

* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::LoadableTextTrack): Initialize m_isDefault to false.
* html/track/LoadableTextTrack.h:
(WebCore::TextTrack::isDefault): Override base class implementation, because a track element
    can be flagged as default.
(WebCore::TextTrack::setIsDefault): Ditto.

* html/track/TextTrack.cpp:
(WebCore::TextTrack::TextTrack): Initialize m_hasBeenConfigured.
* html/track/TextTrack.h:
(WebCore::TextTrack::hasBeenConfigured): New, moved from HTMLTrackElement so other code doesn't
    need know what type of track it is calling.
(WebCore::TextTrack::setHasBeenConfigured): Ditto.
(WebCore::TextTrack::isDefault): Base, do nothing, implementation because only LoadableTextTrack
    can be "default".
(WebCore::TextTrack::setIsDefault): Ditto.

LayoutTests:

Update test and results to check that dynamically added tracks are configured correctly.

* media/track/track-mode-not-changed-by-new-track-expected.txt:
* media/track/track-mode-not-changed-by-new-track.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135202 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/track-mode-not-changed-by-new-track-expected.txt
LayoutTests/media/track/track-mode-not-changed-by-new-track.html
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/HTMLTrackElement.h
Source/WebCore/html/track/LoadableTextTrack.cpp
Source/WebCore/html/track/LoadableTextTrack.h
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.h

index 4ef38c5..3a29c23 100644 (file)
@@ -1,3 +1,15 @@
+2012-11-19  Eric Carlson  <eric.carlson@apple.com>
+
+        HTMLMediaElement::configureTextTracks should configure all text tracks
+        https://bugs.webkit.org/show_bug.cgi?id=102561
+
+        Reviewed by Philippe Normand.
+
+        Update test and results to check that dynamically added tracks are configured correctly.
+
+        * media/track/track-mode-not-changed-by-new-track-expected.txt:
+        * media/track/track-mode-not-changed-by-new-track.html:
+
 2012-11-19  Abhishek Arya  <inferno@chromium.org>
 
         Crash in ApplyStyleCommand::cleanupUnstyledAppleStyleSpans.
index 66a3d66..7873858 100644 (file)
@@ -18,6 +18,7 @@ EXPECTED (track1.readyState == '2') OK
 EXPECTED (track1.track.mode == 'hidden') OK
 EXPECTED (track1.track.cues.length == '12') OK
 EXPECTED (track1.track.cues[11].startTime == '22') OK
+
 **add a caption track, configured to load automatically
 RUN(track2 = document.createElement('track'))
 RUN(track2.setAttribute('kind', 'captions'))
@@ -30,9 +31,26 @@ EVENT(load) -- <track kind='captions' >
 **check that metadata track state has not changed
 EXPECTED (track1.readyState == '2') OK
 EXPECTED (track1.track.mode == 'hidden') OK
-**and that the captions track state is correct
+**and that the caption track state is correct
+EXPECTED (track2.readyState == '2') OK
+EXPECTED (track2.track.mode == 'showing') OK
+
+**add a subtitle track with video.addTextTrack()
+RUN(track3 = video.addTextTrack('subtitles', 'Subtitle Track', 'en'))
+RUN(track3.mode = 'showing')
+
+EVENT(addtrack)
+**check that metadata track state has not changed
+EXPECTED (track1.readyState == '2') OK
+EXPECTED (track1.track.mode == 'hidden') OK
+**and that the caption track state has not changed
 EXPECTED (track2.readyState == '2') OK
 EXPECTED (track2.track.mode == 'showing') OK
+**and that the subtitle track state is correct
+EXPECTED (event.target == '[object TextTrackList]') OK
+EXPECTED (event instanceof window.TrackEvent == 'true') OK
+EXPECTED (event.track == '[object TextTrack]') OK
+EXPECTED (track3.mode == 'showing') OK
 
 END OF TEST
 
index 6b7d8a8..c9fcf60 100644 (file)
@@ -7,17 +7,42 @@
         <script src=../video-test.js></script>
         <script>
 
+            function trackAdded()
+            {
+                consoleWrite("EVENT(" + event.type + ")");
+                consoleWrite("<i>**check that metadata track state has not changed<" + "/i>");
+                testExpected("track1.readyState", HTMLTrackElement.LOADED);
+                testExpected("track1.track.mode", "hidden");
+                consoleWrite("<i>**and that the caption track state has not changed<" + "/i>");
+                testExpected("track2.readyState", HTMLTrackElement.LOADED);
+                testExpected("track2.track.mode", "showing");
+                consoleWrite("<i>**and that the subtitle track state is correct<" + "/i>");
+                testExpected("event.target", video.textTracks);
+                testExpected("event instanceof window.TrackEvent", true);
+                testExpected("event.track", video.textTracks[video.textTracks.length - 1]);
+                testExpected("track3.mode", "showing");
+
+                consoleWrite("");
+                endTest();
+            }
+
             function captionsTrackLoaded()
             {
                 consoleWrite("EVENT(load) -- &lt;track kind='captions' &gt;");
                 consoleWrite("<i>**check that metadata track state has not changed<" + "/i>");
                 testExpected("track1.readyState", HTMLTrackElement.LOADED);
                 testExpected("track1.track.mode", "hidden");
-                consoleWrite("<i>**and that the captions track state is correct<" + "/i>");
+                consoleWrite("<i>**and that the caption track state is correct<" + "/i>");
                 testExpected("track2.readyState", HTMLTrackElement.LOADED);
                 testExpected("track2.track.mode", "showing");
                 consoleWrite("");
-                endTest();
+
+                video.textTracks.addEventListener("addtrack", trackAdded);
+                consoleWrite("<i>**add a subtitle track with video.addTextTrack()<" + "/i>");
+                run("track3 = video.addTextTrack('subtitles', 'Subtitle Track', 'en')");
+                run("track3.mode = 'showing'");
+
+                consoleWrite("");
             }
 
             function metadataTrackLoaded()
@@ -29,7 +54,7 @@
                 testExpected("track1.track.cues.length", 12);
                 testExpected("track1.track.cues[11].startTime", 22);
 
-                consoleWrite("<i>**add a caption track, configured to load automatically<" + "/i>");
+                consoleWrite("<br><i>**add a caption track, configured to load automatically<" + "/i>");
                 run("track2 = document.createElement('track')");
                 run("track2.setAttribute('kind', 'captions')");
                 run("track2.setAttribute('default', 'default')");
index f93d864..95f3321 100644 (file)
@@ -1,3 +1,44 @@
+2012-11-19  Eric Carlson  <eric.carlson@apple.com>
+
+        HTMLMediaElement::configureTextTracks should configure all text tracks
+        https://bugs.webkit.org/show_bug.cgi?id=102561
+
+        Reviewed by Philippe Normand.
+
+        No new tests, track-mode-not-changed-by-new-track.html was updated to test the changes.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::textTrackModeChanged): HTMLTrackElement -> TextTrack.
+        (WebCore::HTMLMediaElement::willRemoveTrack): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto.
+        (WebCore::HTMLMediaElement::configureTextTracks): Ditto.
+        (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Ditto.
+        * html/HTMLMediaElement.h:
+
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::HTMLTrackElement): Move hasBeenConfigured down to TextTrack.
+        (WebCore::HTMLTrackElement::parseAttribute): isDefault is stored on TextTrack.
+        (WebCore::HTMLTrackElement::ensureTrack): LoadableTextTrack constructor doesn't take 
+            "default" argument.
+        * html/HTMLTrackElement.h:
+
+        * html/track/LoadableTextTrack.cpp:
+        (WebCore::LoadableTextTrack::LoadableTextTrack): Initialize m_isDefault to false.
+        * html/track/LoadableTextTrack.h: 
+        (WebCore::TextTrack::isDefault): Override base class implementation, because a track element
+            can be flagged as default.
+        (WebCore::TextTrack::setIsDefault): Ditto.
+
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::TextTrack): Initialize m_hasBeenConfigured.
+        * html/track/TextTrack.h:
+        (WebCore::TextTrack::hasBeenConfigured): New, moved from HTMLTrackElement so other code doesn't
+            need know what type of track it is calling.
+        (WebCore::TextTrack::setHasBeenConfigured): Ditto.
+        (WebCore::TextTrack::isDefault): Base, do nothing, implementation because only LoadableTextTrack
+            can be "default".
+        (WebCore::TextTrack::setIsDefault): Ditto.
+
 2012-11-19  Huang Dongsung  <luxtella@company100.net>
 
         Coordinated Graphics: refactor syncCanvas to handle the lifecycle clearly.
index b0002cf..e42a54b 100644 (file)
@@ -1322,7 +1322,7 @@ void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
                 continue;
             
             // Mark this track as "configured" so configureTextTracks won't change the mode again.
-            trackElement->setHasBeenConfigured(true);
+            track->setHasBeenConfigured(true);
             if (track->mode() != TextTrack::disabledKeyword()) {
                 if (trackElement->readyState() == HTMLTrackElement::LOADED)
                     textTrackAddCues(track, track->cues());
@@ -2764,22 +2764,6 @@ TextTrackList* HTMLMediaElement::textTracks()
     return m_textTracks.get();
 }
 
-HTMLTrackElement* HTMLMediaElement::showingTrackWithSameKind(HTMLTrackElement* trackElement) const
-{
-    for (Node* node = firstChild(); node; node = node->nextSibling()) {
-        if (trackElement == node)
-            continue;
-        if (!node->hasTagName(trackTag))
-            continue;
-
-        HTMLTrackElement* showingTrack = static_cast<HTMLTrackElement*>(node);
-        if (showingTrack->kind() == trackElement->kind() && showingTrack->track()->mode() == TextTrack::showingKeyword())
-            return showingTrack;
-    }
-    
-    return 0;
-}
-
 void HTMLMediaElement::didAddTrack(HTMLTrackElement* trackElement)
 {
     ASSERT(trackElement->hasTagName(trackTag));
@@ -2817,14 +2801,15 @@ void HTMLMediaElement::willRemoveTrack(HTMLTrackElement* trackElement)
     }
 #endif
 
-    trackElement->setHasBeenConfigured(false);
+    RefPtr<TextTrack> textTrack = trackElement->track();
+    if (!textTrack)
+        return;
+    
+    textTrack->setHasBeenConfigured(false);
 
     if (!m_textTracks)
         return;
     
-    RefPtr<TextTrack> textTrack = trackElement->track();
-    if (!textTrack)
-        return;
 
     // 4.8.10.12.3 Sourcing out-of-band text tracks
     // When a track element's parent element changes and the old parent was a media element, 
@@ -2881,7 +2866,7 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) const
         Vector<String> languages;
         languages.reserveInitialCapacity(group.tracks.size());
         for (size_t i = 0; i < group.tracks.size(); ++i) {
-            String srcLanguage = group.tracks[i]->track()->language();
+            String srcLanguage = group.tracks[i]->language();
             if (srcLanguage.length())
                 languages.append(srcLanguage);
         }
@@ -2889,12 +2874,11 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) const
     }
 
     // First, find the track in the group that should be enabled (if any).
-    HTMLTrackElement* trackElementToEnable = 0;
-    HTMLTrackElement* defaultTrack = 0;
-    HTMLTrackElement* fallbackTrack = 0;
-    for (size_t i = 0; !trackElementToEnable && i < group.tracks.size(); ++i) {
-        HTMLTrackElement* trackElement = group.tracks[i];
-        RefPtr<TextTrack> textTrack = trackElement->track();
+    RefPtr<TextTrack> trackToEnable;
+    RefPtr<TextTrack> defaultTrack;
+    RefPtr<TextTrack> fallbackTrack;
+    for (size_t i = 0; !trackToEnable && i < group.tracks.size(); ++i) {
+        RefPtr<TextTrack> textTrack = group.tracks[i];
 
         if (userIsInterestedInThisTrackKind(textTrack->kind())) {
             // * If the text track kind is { [subtitles or captions] [descriptions] } and the user has indicated an interest in having a
@@ -2908,39 +2892,38 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) const
             //    Let the text track mode be showing.
             if (bestMatchingLanguage.length()) {
                 if (textTrack->language() == bestMatchingLanguage)
-                    trackElementToEnable = trackElement;
-            } else if (trackElement->isDefault()) {
+                    trackToEnable = textTrack;
+            } else if (textTrack->isDefault()) {
                 // The user is interested in this type of track, but their language preference doesn't match any track so we will
                 // enable the 'default' track.
-                defaultTrack = trackElement;
+                defaultTrack = textTrack;
             }
 
             // Remember the first track that doesn't match language or have 'default' to potentially use as fallback.
             if (!fallbackTrack)
-                fallbackTrack = trackElement;
-        } else if (!group.visibleTrack && !defaultTrack && trackElement->isDefault()) {
+                fallbackTrack = textTrack;
+        } else if (!group.visibleTrack && !defaultTrack && textTrack->isDefault()) {
             // * If the track element has a default attribute specified, and there is no other text track in the media
             // element's list of text tracks whose text track mode is showing or showing by default
             //    Let the text track mode be showing by default.
-            defaultTrack = trackElement;
+            defaultTrack = textTrack.get();
         }
     }
 
-    if (!trackElementToEnable && defaultTrack)
-        trackElementToEnable = defaultTrack;
+    if (!trackToEnable && defaultTrack)
+        trackToEnable = defaultTrack;
 
     // If no track matches the user's preferred language and non was marked 'default', enable the first track
     // because the user has explicitly stated a preference for this kind of track.
-    if (!trackElementToEnable && fallbackTrack)
-        trackElementToEnable = fallbackTrack;
+    if (!trackToEnable && fallbackTrack)
+        trackToEnable = fallbackTrack;
 
     for (size_t i = 0; i < group.tracks.size(); ++i) {
-        HTMLTrackElement* trackElement = group.tracks[i];
-        RefPtr<TextTrack> textTrack = trackElement->track();
+        RefPtr<TextTrack> textTrack = group.tracks[i];
         
-        if (trackElementToEnable == trackElement) {
+        if (trackToEnable == textTrack) {
             textTrack->setMode(TextTrack::showingKeyword());
-            if (defaultTrack == trackElement)
+            if (defaultTrack == textTrack)
                 textTrack->setShowingByDefault(true);
         } else {
             if (textTrack->showingByDefault()) {
@@ -2954,11 +2937,10 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) const
         }
     }
 
-    if (trackElementToEnable && group.defaultTrack && group.defaultTrack != trackElementToEnable) {
-        RefPtr<TextTrack> textTrack = group.defaultTrack->track();
-        if (textTrack && textTrack->showingByDefault()) {
-            textTrack->setShowingByDefault(false);
-            textTrack->setMode(TextTrack::hiddenKeyword());
+    if (trackToEnable && group.defaultTrack && group.defaultTrack != trackToEnable) {
+        if (group.defaultTrack && group.defaultTrack->showingByDefault()) {
+            group.defaultTrack->setShowingByDefault(false);
+            group.defaultTrack->setMode(TextTrack::hiddenKeyword());
         }
     }
 }
@@ -2971,12 +2953,11 @@ void HTMLMediaElement::configureTextTracks()
     TrackGroup metadataTracks(TrackGroup::Metadata);
     TrackGroup otherTracks(TrackGroup::Other);
 
-    for (Node* node = firstChild(); node; node = node->nextSibling()) {
-        if (!node->hasTagName(trackTag))
-            continue;
+    if (!m_textTracks)
+        return;
 
-        HTMLTrackElement* trackElement = static_cast<HTMLTrackElement*>(node);
-        RefPtr<TextTrack> textTrack = trackElement->track();
+    for (size_t i = 0; i < m_textTracks->length(); ++i) {
+        RefPtr<TextTrack> textTrack = m_textTracks->item(i);
         if (!textTrack)
             continue;
 
@@ -2994,9 +2975,9 @@ void HTMLMediaElement::configureTextTracks()
             currentGroup = &otherTracks;
 
         if (!currentGroup->visibleTrack && textTrack->mode() == TextTrack::showingKeyword())
-            currentGroup->visibleTrack = trackElement;
-        if (!currentGroup->defaultTrack && trackElement->isDefault())
-            currentGroup->defaultTrack = trackElement;
+            currentGroup->visibleTrack = textTrack;
+        if (!currentGroup->defaultTrack && textTrack->isDefault())
+            currentGroup->defaultTrack = textTrack;
 
         // Do not add this track to the group if it has already been automatically configured
         // as we only want to call configureTextTrack once per track so that adding another 
@@ -3004,12 +2985,12 @@ void HTMLMediaElement::configureTextTracks()
         // that should be changed by the new addition. For example all metadata tracks are 
         // disabled by default, and we don't want a track that has been enabled by script 
         // to be disabled automatically when a new metadata track is added later.
-        if (trackElement->hasBeenConfigured())
+        if (textTrack->hasBeenConfigured())
             continue;
         
         if (textTrack->language().length())
             currentGroup->hasSrcLang = true;
-        currentGroup->tracks.append(trackElement);
+        currentGroup->tracks.append(textTrack);
     }
     
     if (captionAndSubtitleTracks.tracks.size())
@@ -4258,7 +4239,7 @@ void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
         String kind = textTrack->kind();
 
         if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captionsKeyword())
-            trackElement->setHasBeenConfigured(false);
+            textTrack->setHasBeenConfigured(false);
     }
     configureTextTracks();
 }
index ea9a4b7..5e2a00a 100644 (file)
@@ -230,9 +230,9 @@ public:
         {
         }
 
-        Vector<HTMLTrackElement*> tracks;
-        HTMLTrackElement* visibleTrack;
-        HTMLTrackElement* defaultTrack;
+        Vector<RefPtr<TextTrack> > tracks;
+        RefPtr<TextTrack> visibleTrack;
+        RefPtr<TextTrack> defaultTrack;
         GroupKind kind;
         bool hasSrcLang;
     };
index 38451ad..377fc65 100644 (file)
@@ -56,7 +56,6 @@ static String urlForLogging(const KURL& url)
     
 inline HTMLTrackElement::HTMLTrackElement(const QualifiedName& tagName, Document* document)
     : HTMLElement(tagName, document)
-    , m_hasBeenConfigured(false)
 {
     LOG(Media, "HTMLTrackElement::HTMLTrackElement - %p", this);
     ASSERT(hasTagName(trackTag));
@@ -109,6 +108,8 @@ void HTMLTrackElement::parseAttribute(const QualifiedName& name, const AtomicStr
             track()->setLabel(value);
         else if (name == srclangAttr)
             track()->setLanguage(value);
+        else if (name == defaultAttr)
+            track()->setIsDefault(!value.isNull());
     }
 
     if (name == onloadAttr)
@@ -176,7 +177,7 @@ LoadableTextTrack* HTMLTrackElement::ensureTrack()
         String kind = getAttribute(kindAttr);
         if (!TextTrack::isValidKindKeyword(kind))
             kind = TextTrack::subtitlesKeyword();
-        m_track = LoadableTextTrack::create(this, kind, label(), srclang(), isDefault());
+        m_track = LoadableTextTrack::create(this, kind, label(), srclang());
     }
     return m_track.get();
 }
index d7ebdfa..1b659ff 100644 (file)
@@ -68,9 +68,6 @@ public:
 
     const AtomicString& mediaElementCrossOriginAttribute() const;
 
-    bool hasBeenConfigured() const { return m_hasBeenConfigured; }
-    void setHasBeenConfigured(bool flag) { m_hasBeenConfigured = flag; }
-
 private:
     HTMLTrackElement(const QualifiedName&, Document*);
     virtual ~HTMLTrackElement();
@@ -101,7 +98,6 @@ private:
     virtual bool canLoadUrl(const KURL&);
 
     RefPtr<LoadableTextTrack> m_track;
-    bool m_hasBeenConfigured;
 };
 
 }
index d95e8cc..542efbc 100644 (file)
 
 namespace WebCore {
 
-LoadableTextTrack::LoadableTextTrack(HTMLTrackElement* track, const String& kind, const String& label, const String& language, bool)
+LoadableTextTrack::LoadableTextTrack(HTMLTrackElement* track, const String& kind, const String& label, const String& language)
     : TextTrack(track->document(), track, kind, label, language, TrackElement)
     , m_trackElement(track)
     , m_loadTimer(this, &LoadableTextTrack::loadTimerFired)
+    , m_isDefault(false)
 {
 }
 
index 33183db..cd2dd1e 100644 (file)
@@ -48,9 +48,9 @@ public:
 
 class LoadableTextTrack : public TextTrack, private TextTrackLoaderClient {
 public:
-    static PassRefPtr<LoadableTextTrack> create(HTMLTrackElement* track, const String& kind, const String& label, const String& language, bool isDefault)
+    static PassRefPtr<LoadableTextTrack> create(HTMLTrackElement* track, const String& kind, const String& label, const String& language)
     {
-        return adoptRef(new LoadableTextTrack(track, kind, label, language, isDefault));
+        return adoptRef(new LoadableTextTrack(track, kind, label, language));
     }
     virtual ~LoadableTextTrack();
 
@@ -61,6 +61,9 @@ public:
     size_t trackElementIndex();
     HTMLTrackElement* trackElement() { return m_trackElement; }
 
+    virtual bool isDefault() const OVERRIDE { return m_isDefault; }
+    virtual void setIsDefault(bool isDefault) OVERRIDE  { m_isDefault = isDefault; }
+
 private:
     // TextTrackLoaderClient
     virtual bool shouldLoadCues(TextTrackLoader*) { return true; }
@@ -68,7 +71,7 @@ private:
     virtual void cueLoadingStarted(TextTrackLoader*);
     virtual void cueLoadingCompleted(TextTrackLoader*, bool loadingFailed);
 
-    LoadableTextTrack(HTMLTrackElement*, const String& kind, const String& label, const String& language, bool isDefault);
+    LoadableTextTrack(HTMLTrackElement*, const String& kind, const String& label, const String& language);
 
     void loadTimerFired(Timer<LoadableTextTrack>*);
 
@@ -76,6 +79,7 @@ private:
     Timer<LoadableTextTrack> m_loadTimer;
     OwnPtr<TextTrackLoader> m_loader;
     KURL m_url;
+    bool m_isDefault;
 };
 } // namespace WebCore
 
index 078ecb1..95ab190 100644 (file)
@@ -107,6 +107,7 @@ TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, c
     , m_trackIndex(invalidTrackIndex)
     , m_renderedTrackIndex(invalidTrackIndex)
     , m_showingByDefault(false)
+    , m_hasBeenConfigured(false)
 {
     setKind(kind);
 }
index faff627..f0c6726 100644 (file)
@@ -116,6 +116,12 @@ public:
     bool isRendered();
     int trackIndexRelativeToRenderedTracks();
 
+    bool hasBeenConfigured() const { return m_hasBeenConfigured; }
+    void setHasBeenConfigured(bool flag) { m_hasBeenConfigured = flag; }
+
+    virtual bool isDefault() const { return false; }
+    virtual void setIsDefault(bool) { }
+
 protected:
     TextTrack(ScriptExecutionContext*, TextTrackClient*, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType);
 
@@ -134,6 +140,7 @@ private:
     int m_trackIndex;
     int m_renderedTrackIndex;
     bool m_showingByDefault;
+    bool m_hasBeenConfigured;
 };
 
 } // namespace WebCore