Log Message
Update platform text track menu https://bugs.webkit.org/show_bug.cgi?id=117884
Reviewed by Jer Noble. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setSelectedTextTrack): * html/track/TextTrack.cpp: (WebCore::TextTrack::platformTextTrack): * platform/graphics/PlatformTextTrack.h: (WebCore::PlatformTextTrack::create): (WebCore::PlatformTextTrack::uniqueId): (WebCore::PlatformTextTrack::captionMenuOffItem): (WebCore::PlatformTextTrack::captionMenuAutomaticItem): (WebCore::PlatformTextTrack::PlatformTextTrack):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (151852 => 151853)
--- trunk/Source/WebCore/ChangeLog 2013-06-21 20:21:07 UTC (rev 151852)
+++ trunk/Source/WebCore/ChangeLog 2013-06-21 20:37:31 UTC (rev 151853)
@@ -1,3 +1,21 @@
+2013-06-21 Eric Carlson <[email protected]>
+
+ Update platform text track menu
+ https://bugs.webkit.org/show_bug.cgi?id=117884
+
+ Reviewed by Jer Noble.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setSelectedTextTrack):
+ * html/track/TextTrack.cpp:
+ (WebCore::TextTrack::platformTextTrack):
+ * platform/graphics/PlatformTextTrack.h:
+ (WebCore::PlatformTextTrack::create):
+ (WebCore::PlatformTextTrack::uniqueId):
+ (WebCore::PlatformTextTrack::captionMenuOffItem):
+ (WebCore::PlatformTextTrack::captionMenuAutomaticItem):
+ (WebCore::PlatformTextTrack::PlatformTextTrack):
+
2013-06-21 James Craig <[email protected]>
AX: audio/video playback control timers (elapsed and remaining) should be exposed as ApplicationTimerRole
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (151852 => 151853)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-06-21 20:21:07 UTC (rev 151852)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-06-21 20:37:31 UTC (rev 151853)
@@ -2948,21 +2948,27 @@
TrackDisplayUpdateScope scope(this);
if (!platformTrack) {
- setSelectedTextTrack(0);
+ setSelectedTextTrack(TextTrack::captionMenuOffItem());
return;
}
TextTrack* textTrack;
- size_t i;
- for (i = 0; i < m_textTracks->length(); ++i) {
- textTrack = m_textTracks->item(i);
-
- if (textTrack->platformTextTrack() == platformTrack)
- break;
+ if (platformTrack == PlatformTextTrack::captionMenuOffItem())
+ textTrack = TextTrack::captionMenuOffItem();
+ else if (platformTrack == PlatformTextTrack::captionMenuAutomaticItem())
+ textTrack = TextTrack::captionMenuAutomaticItem();
+ else {
+ size_t i;
+ for (i = 0; i < m_textTracks->length(); ++i) {
+ textTrack = m_textTracks->item(i);
+
+ if (textTrack->platformTextTrack() == platformTrack)
+ break;
+ }
+ if (i == m_textTracks->length())
+ return;
}
- if (i == m_textTracks->length())
- return;
setSelectedTextTrack(textTrack);
}
Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (151852 => 151853)
--- trunk/Source/WebCore/html/track/TextTrack.cpp 2013-06-21 20:21:07 UTC (rev 151852)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp 2013-06-21 20:37:31 UTC (rev 151853)
@@ -527,6 +527,8 @@
#if USE(PLATFORM_TEXT_TRACK_MENU)
PassRefPtr<PlatformTextTrack> TextTrack::platformTextTrack()
{
+ static int uniqueId = 0;
+
if (m_platformTextTrack)
return m_platformTextTrack;
@@ -552,7 +554,7 @@
else if (m_trackType == InBand)
type = PlatformTextTrack::InBand;
- m_platformTextTrack = PlatformTextTrack::create(this, label(), language(), platformKind, type);
+ m_platformTextTrack = PlatformTextTrack::create(this, label(), language(), platformKind, type, ++uniqueId);
return m_platformTextTrack;
}
Modified: trunk/Source/WebCore/platform/graphics/PlatformTextTrack.h (151852 => 151853)
--- trunk/Source/WebCore/platform/graphics/PlatformTextTrack.h 2013-06-21 20:21:07 UTC (rev 151852)
+++ trunk/Source/WebCore/platform/graphics/PlatformTextTrack.h 2013-06-21 20:37:31 UTC (rev 151853)
@@ -60,9 +60,9 @@
Script = 2
};
- static PassRefPtr<PlatformTextTrack> create(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type)
+ static PassRefPtr<PlatformTextTrack> create(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type, int uniqueId)
{
- return adoptRef(new PlatformTextTrack(client, label, language, kind, type));
+ return adoptRef(new PlatformTextTrack(client, label, language, kind, type, uniqueId));
}
virtual ~PlatformTextTrack() { }
@@ -72,14 +72,28 @@
String label() const { return m_label; }
String language() const { return m_language; }
PlatformTextTrackClient* client() const { return m_client; }
-
+ int uniqueId() const { return m_uniqueId; }
+
+ static PlatformTextTrack* captionMenuOffItem()
+ {
+ DEFINE_STATIC_LOCAL(RefPtr<PlatformTextTrack>, off, (PlatformTextTrack::create(0, "off menu item", "", Subtitle, InBand, 0)));
+ return off.get();
+ }
+
+ static PlatformTextTrack* captionMenuAutomaticItem()
+ {
+ DEFINE_STATIC_LOCAL(RefPtr<PlatformTextTrack>, automatic, (PlatformTextTrack::create(0, "automatic menu item", "", Subtitle, InBand, 0)));
+ return automatic.get();
+ }
+
protected:
- PlatformTextTrack(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type)
+ PlatformTextTrack(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type, int uniqueId)
: m_label(label)
, m_language(language)
, m_kind(kind)
, m_type(type)
, m_client(client)
+ , m_uniqueId(uniqueId)
{
}
@@ -88,6 +102,7 @@
TrackKind m_kind;
TrackType m_type;
PlatformTextTrackClient* m_client;
+ int m_uniqueId;
};
}
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
