Changeset 151853 in webkit
- Timestamp:
- Jun 21, 2013, 1:37:31 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151852 r151853 1 2013-06-21 Eric Carlson <eric.carlson@apple.com> 2 3 Update platform text track menu 4 https://bugs.webkit.org/show_bug.cgi?id=117884 5 6 Reviewed by Jer Noble. 7 8 * html/HTMLMediaElement.cpp: 9 (WebCore::HTMLMediaElement::setSelectedTextTrack): 10 * html/track/TextTrack.cpp: 11 (WebCore::TextTrack::platformTextTrack): 12 * platform/graphics/PlatformTextTrack.h: 13 (WebCore::PlatformTextTrack::create): 14 (WebCore::PlatformTextTrack::uniqueId): 15 (WebCore::PlatformTextTrack::captionMenuOffItem): 16 (WebCore::PlatformTextTrack::captionMenuAutomaticItem): 17 (WebCore::PlatformTextTrack::PlatformTextTrack): 18 1 19 2013-06-21 James Craig <james@cookiecrook.com> 2 20 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r151684 r151853 2949 2949 2950 2950 if (!platformTrack) { 2951 setSelectedTextTrack( 0);2951 setSelectedTextTrack(TextTrack::captionMenuOffItem()); 2952 2952 return; 2953 2953 } 2954 2954 2955 2955 TextTrack* textTrack; 2956 size_t i; 2957 for (i = 0; i < m_textTracks->length(); ++i) { 2958 textTrack = m_textTracks->item(i); 2959 2960 if (textTrack->platformTextTrack() == platformTrack) 2961 break; 2962 } 2963 2964 if (i == m_textTracks->length()) 2965 return; 2956 if (platformTrack == PlatformTextTrack::captionMenuOffItem()) 2957 textTrack = TextTrack::captionMenuOffItem(); 2958 else if (platformTrack == PlatformTextTrack::captionMenuAutomaticItem()) 2959 textTrack = TextTrack::captionMenuAutomaticItem(); 2960 else { 2961 size_t i; 2962 for (i = 0; i < m_textTracks->length(); ++i) { 2963 textTrack = m_textTracks->item(i); 2964 2965 if (textTrack->platformTextTrack() == platformTrack) 2966 break; 2967 } 2968 if (i == m_textTracks->length()) 2969 return; 2970 } 2971 2966 2972 setSelectedTextTrack(textTrack); 2967 2973 } -
trunk/Source/WebCore/html/track/TextTrack.cpp
r148688 r151853 528 528 PassRefPtr<PlatformTextTrack> TextTrack::platformTextTrack() 529 529 { 530 static int uniqueId = 0; 531 530 532 if (m_platformTextTrack) 531 533 return m_platformTextTrack; … … 553 555 type = PlatformTextTrack::InBand; 554 556 555 m_platformTextTrack = PlatformTextTrack::create(this, label(), language(), platformKind, type );557 m_platformTextTrack = PlatformTextTrack::create(this, label(), language(), platformKind, type, ++uniqueId); 556 558 557 559 return m_platformTextTrack; -
trunk/Source/WebCore/platform/graphics/PlatformTextTrack.h
r148285 r151853 61 61 }; 62 62 63 static PassRefPtr<PlatformTextTrack> create(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type )63 static PassRefPtr<PlatformTextTrack> create(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type, int uniqueId) 64 64 { 65 return adoptRef(new PlatformTextTrack(client, label, language, kind, type ));65 return adoptRef(new PlatformTextTrack(client, label, language, kind, type, uniqueId)); 66 66 } 67 67 … … 73 73 String language() const { return m_language; } 74 74 PlatformTextTrackClient* client() const { return m_client; } 75 75 int uniqueId() const { return m_uniqueId; } 76 77 static PlatformTextTrack* captionMenuOffItem() 78 { 79 DEFINE_STATIC_LOCAL(RefPtr<PlatformTextTrack>, off, (PlatformTextTrack::create(0, "off menu item", "", Subtitle, InBand, 0))); 80 return off.get(); 81 } 82 83 static PlatformTextTrack* captionMenuAutomaticItem() 84 { 85 DEFINE_STATIC_LOCAL(RefPtr<PlatformTextTrack>, automatic, (PlatformTextTrack::create(0, "automatic menu item", "", Subtitle, InBand, 0))); 86 return automatic.get(); 87 } 88 76 89 protected: 77 PlatformTextTrack(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type )90 PlatformTextTrack(PlatformTextTrackClient* client, const String& label, const String& language, TrackKind kind, TrackType type, int uniqueId) 78 91 : m_label(label) 79 92 , m_language(language) … … 81 94 , m_type(type) 82 95 , m_client(client) 96 , m_uniqueId(uniqueId) 83 97 { 84 98 } … … 89 103 TrackType m_type; 90 104 PlatformTextTrackClient* m_client; 105 int m_uniqueId; 91 106 }; 92 107
Note:
See TracChangeset
for help on using the changeset viewer.