Add interfaces and stubs for audio and video tracks
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Apr 2013 01:03:14 +0000 (01:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Apr 2013 01:03:14 +0000 (01:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113965

Patch by Brendan Long <b.long@cablelabs.com> on 2013-04-19
Reviewed by Jer Noble.

No new tests because there's no implementations, so there's nothing
interesting to test.

* CMakeLists.txt: Add AudioTrack, VideoTrack, AudioTrackList and VideoTrackList.
* DerivedSources.cpp: Same.
* DerivedSources.make: Same.
* DerivedSources.pri: Same.
* GNUmakefile.list.am: Same.
* Target.pri: Same.
* UseJSC.cmake: Same.
* WebCore.vcproj/WebCore.vcproj: Same.
* WebCore.xcodeproj/project.pbxproj: Same.
* bindings/gobject/GNUmakefile.am: Same.
* bindings/js/JSAudioTrackCustom.cpp: Added, based on JSTestTrackCustom
* bindings/js/JSAudioTrackListCustom.cpp: Same.
* bindings/js/JSBindingsAllInOne.cpp: Add AudioTrack, VideoTrack, AudioTrackList and VideoTrackList.
* bindings/js/JSVideoTrackCustom.cpp: Added, based on JSTestTrackCustom
* bindings/js/JSVideoTrackListCustom.cpp: Same.
* dom/EventTarget.h: Make AudioTrackList and VideoTrackList event targets.
* dom/EventTargetFactory.in: Same.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Add m_audioTracks and m_videoTracks
(WebCore::HTMLMediaElement::~HTMLMediaElement): Clear clients for audio and video tracks
(WebCore::HTMLMediaElement::audioTrackEnabledChanged): Added.
(WebCore::HTMLMediaElement::videoTrackSelectedChanged): Added.
(WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Added, based on mediaPlayerDidAddTextTrack
(WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Same.
(WebCore::HTMLMediaElement::mediaPlayerDidRemoveAudioTrack): Added, based on mediaPlayerDidRemoveTextTrack
(WebCore::HTMLMediaElement::mediaPlayerDidRemoveVideoTrack): Same.
(WebCore::HTMLMediaElement::addAudioTrack): Added, based on addTextTrack
(WebCore::HTMLMediaElement::addVideoTrack): Same.
(WebCore::HTMLMediaElement::removeAudioTrack): Added, based on removeTextTrack
(WebCore::HTMLMediaElement::removeVideoTrack): Added, based on removeTextTrack
(WebCore::HTMLMediaElement::removeAllInbandTracks): Remove audio and video tracks too
(WebCore::HTMLMediaElement::audioTracks): Added, based on textTracks
(WebCore::HTMLMediaElement::videoTracks): Added, based on textTracks
(WebCore::HTMLMediaElement::reportMemoryUsage): Add audio and video tracks
* html/HTMLMediaElement.h: Add audioTracks and videoTracks and related functions
* html/HTMLMediaElement.idl: Add audioTracks and videoTracks
* html/track/AudioTrack.cpp: Added, based on TextTrack and InbandTextTrack.
* html/track/AudioTrack.h: Same.
* html/track/AudioTrack.idl: Added.
* html/track/AudioTrackList.cpp: Added, based on TextTrackList
* html/track/AudioTrackList.h: Same.
* html/track/AudioTrackList.idl: Added.
* html/track/TextTrackList.h: Add missing OVERRIDE on interfaceName()
* html/track/VideoTrack.cpp: Added, based on TextTrack and InbandTextTrack.
* html/track/VideoTrack.h: Same.
* html/track/VideoTrack.idl: Added.
* html/track/VideoTrackList.cpp: Added, based on TextTrackList
* html/track/VideoTrackList.h: Same.
* html/track/VideoTrackList.idl: Added.
* platform/graphics/AudioTrackPrivate.h: Added, based on InbandTextTrackPrivate.h
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::addAudioTrack): Added, based on addTextTrack
(WebCore::MediaPlayer::removeAudioTrack): Added, based on removeTextTrack
(WebCore::MediaPlayer::addVideoTrack): Added, based on addTextTrack
(WebCore::MediaPlayer::removeVideoTrack): Added, based on removeTextTrack
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerDidAddAudioTrack): Added, based on mediaPlayerDidAddTextTrack
(WebCore::MediaPlayerClient::mediaPlayerDidAddVideoTrack): Same
(WebCore::MediaPlayerClient::mediaPlayerDidRemoveAudioTrack): Added, based on mediaPlayerDidRemoveTextTrack
(WebCore::MediaPlayerClient::mediaPlayerDidRemoveVideoTrack): Same
* platform/graphics/VideoTrackPrivate.h: Added, based on InbandTextTrackPrivate.h

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

56 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/DerivedSources.pri
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/UseJSC.cmake
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/gobject/GNUmakefile.am
Source/WebCore/bindings/js/JSAudioTrackCustom.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/JSAudioTrackListCustom.cpp [moved from Source/WebCore/bindings/js/JSTextTrackCustom.h with 63% similarity]
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp
Source/WebCore/bindings/js/JSTextTrackCustom.cpp
Source/WebCore/bindings/js/JSTextTrackListCustom.cpp
Source/WebCore/bindings/js/JSTrackCustom.cpp
Source/WebCore/bindings/js/JSTrackCustom.h
Source/WebCore/bindings/js/JSVideoTrackCustom.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/JSVideoTrackListCustom.cpp [new file with mode: 0644]
Source/WebCore/dom/EventTarget.h
Source/WebCore/dom/EventTargetFactory.in
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMediaElement.idl
Source/WebCore/html/track/AudioTrack.cpp [new file with mode: 0644]
Source/WebCore/html/track/AudioTrack.h [new file with mode: 0644]
Source/WebCore/html/track/AudioTrack.idl [new file with mode: 0644]
Source/WebCore/html/track/AudioTrackList.cpp [new file with mode: 0644]
Source/WebCore/html/track/AudioTrackList.h [new file with mode: 0644]
Source/WebCore/html/track/AudioTrackList.idl [new file with mode: 0644]
Source/WebCore/html/track/InbandTextTrack.cpp
Source/WebCore/html/track/InbandTextTrack.h
Source/WebCore/html/track/LoadableTextTrack.cpp
Source/WebCore/html/track/LoadableTextTrack.h
Source/WebCore/html/track/TextTrack.idl
Source/WebCore/html/track/TextTrackList.cpp
Source/WebCore/html/track/TextTrackList.h
Source/WebCore/html/track/TextTrackList.idl
Source/WebCore/html/track/TrackBase.cpp
Source/WebCore/html/track/TrackBase.h
Source/WebCore/html/track/TrackListBase.cpp
Source/WebCore/html/track/TrackListBase.h
Source/WebCore/html/track/VideoTrack.cpp [new file with mode: 0644]
Source/WebCore/html/track/VideoTrack.h [new file with mode: 0644]
Source/WebCore/html/track/VideoTrack.idl [new file with mode: 0644]
Source/WebCore/html/track/VideoTrackList.cpp [new file with mode: 0644]
Source/WebCore/html/track/VideoTrackList.h [new file with mode: 0644]
Source/WebCore/html/track/VideoTrackList.idl [new file with mode: 0644]
Source/WebCore/platform/graphics/AudioTrackPrivate.h [new file with mode: 0644]
Source/WebCore/platform/graphics/InbandTextTrackPrivate.h
Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/VideoTrackPrivate.h [new file with mode: 0644]

index e7cf652..7b389f8 100644 (file)
@@ -2686,14 +2686,20 @@ endif ()
 
 if (ENABLE_VIDEO_TRACK)
     list(APPEND WebCore_IDL_FILES
+        html/track/AudioTrack.idl
+        html/track/AudioTrackList.idl
         html/track/TextTrack.idl
         html/track/TextTrackCue.idl
         html/track/TextTrackCueList.idl
         html/track/TextTrackList.idl
         html/track/TrackEvent.idl
+        html/track/VideoTrack.idl
+        html/track/VideoTrackList.idl
     )
 
     list(APPEND WebCore_SOURCES
+        html/track/AudioTrack.cpp
+        html/track/AudioTrackList.cpp
         html/track/InbandTextTrack.cpp
         html/track/LoadableTextTrack.cpp
         html/track/TextTrack.cpp
@@ -2707,6 +2713,8 @@ if (ENABLE_VIDEO_TRACK)
         html/track/WebVTTElement.cpp
         html/track/WebVTTParser.cpp
         html/track/WebVTTTokenizer.cpp
+        html/track/VideoTrack.cpp
+        html/track/VideoTrackList.cpp
 
         loader/cache/CachedTextTrack.cpp
 
index fd5f9b0..8e9ab3e 100644 (file)
@@ -1,3 +1,75 @@
+2013-04-19  Brendan Long  <b.long@cablelabs.com>
+
+        Add interfaces and stubs for audio and video tracks
+        https://bugs.webkit.org/show_bug.cgi?id=113965
+
+        Reviewed by Jer Noble.
+
+        No new tests because there's no implementations, so there's nothing
+        interesting to test.
+
+        * CMakeLists.txt: Add AudioTrack, VideoTrack, AudioTrackList and VideoTrackList.
+        * DerivedSources.cpp: Same.
+        * DerivedSources.make: Same.
+        * DerivedSources.pri: Same.
+        * GNUmakefile.list.am: Same.
+        * Target.pri: Same.
+        * UseJSC.cmake: Same.
+        * WebCore.vcproj/WebCore.vcproj: Same.
+        * WebCore.xcodeproj/project.pbxproj: Same.
+        * bindings/gobject/GNUmakefile.am: Same.
+        * bindings/js/JSAudioTrackCustom.cpp: Added, based on JSTestTrackCustom
+        * bindings/js/JSAudioTrackListCustom.cpp: Same.
+        * bindings/js/JSBindingsAllInOne.cpp: Add AudioTrack, VideoTrack, AudioTrackList and VideoTrackList.
+        * bindings/js/JSVideoTrackCustom.cpp: Added, based on JSTestTrackCustom
+        * bindings/js/JSVideoTrackListCustom.cpp: Same.
+        * dom/EventTarget.h: Make AudioTrackList and VideoTrackList event targets.
+        * dom/EventTargetFactory.in: Same.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement): Add m_audioTracks and m_videoTracks
+        (WebCore::HTMLMediaElement::~HTMLMediaElement): Clear clients for audio and video tracks
+        (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Added.
+        (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Added.
+        (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Added, based on mediaPlayerDidAddTextTrack
+        (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Same.
+        (WebCore::HTMLMediaElement::mediaPlayerDidRemoveAudioTrack): Added, based on mediaPlayerDidRemoveTextTrack
+        (WebCore::HTMLMediaElement::mediaPlayerDidRemoveVideoTrack): Same.
+        (WebCore::HTMLMediaElement::addAudioTrack): Added, based on addTextTrack
+        (WebCore::HTMLMediaElement::addVideoTrack): Same.
+        (WebCore::HTMLMediaElement::removeAudioTrack): Added, based on removeTextTrack
+        (WebCore::HTMLMediaElement::removeVideoTrack): Added, based on removeTextTrack
+        (WebCore::HTMLMediaElement::removeAllInbandTracks): Remove audio and video tracks too
+        (WebCore::HTMLMediaElement::audioTracks): Added, based on textTracks
+        (WebCore::HTMLMediaElement::videoTracks): Added, based on textTracks
+        (WebCore::HTMLMediaElement::reportMemoryUsage): Add audio and video tracks
+        * html/HTMLMediaElement.h: Add audioTracks and videoTracks and related functions
+        * html/HTMLMediaElement.idl: Add audioTracks and videoTracks
+        * html/track/AudioTrack.cpp: Added, based on TextTrack and InbandTextTrack.
+        * html/track/AudioTrack.h: Same.
+        * html/track/AudioTrack.idl: Added.
+        * html/track/AudioTrackList.cpp: Added, based on TextTrackList
+        * html/track/AudioTrackList.h: Same.
+        * html/track/AudioTrackList.idl: Added.
+        * html/track/TextTrackList.h: Add missing OVERRIDE on interfaceName()
+        * html/track/VideoTrack.cpp: Added, based on TextTrack and InbandTextTrack.
+        * html/track/VideoTrack.h: Same.
+        * html/track/VideoTrack.idl: Added.
+        * html/track/VideoTrackList.cpp: Added, based on TextTrackList
+        * html/track/VideoTrackList.h: Same.
+        * html/track/VideoTrackList.idl: Added.
+        * platform/graphics/AudioTrackPrivate.h: Added, based on InbandTextTrackPrivate.h
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::addAudioTrack): Added, based on addTextTrack
+        (WebCore::MediaPlayer::removeAudioTrack): Added, based on removeTextTrack
+        (WebCore::MediaPlayer::addVideoTrack): Added, based on addTextTrack
+        (WebCore::MediaPlayer::removeVideoTrack): Added, based on removeTextTrack
+        * platform/graphics/MediaPlayer.h:
+        (WebCore::MediaPlayerClient::mediaPlayerDidAddAudioTrack): Added, based on mediaPlayerDidAddTextTrack
+        (WebCore::MediaPlayerClient::mediaPlayerDidAddVideoTrack): Same
+        (WebCore::MediaPlayerClient::mediaPlayerDidRemoveAudioTrack): Added, based on mediaPlayerDidRemoveTextTrack
+        (WebCore::MediaPlayerClient::mediaPlayerDidRemoveVideoTrack): Same
+        * platform/graphics/VideoTrackPrivate.h: Added, based on InbandTextTrackPrivate.h
+
 2013-04-19  Bear Travis  <betravis@adobe.com>
 
         [CSS Exclusions] Implement empty segments for multiple-segment shape-insides
index 6b7cd07..4a4bada 100644 (file)
 #include "JSTextEvent.cpp"
 #include "JSTextMetrics.cpp"
 #if ENABLE(VIDEO_TRACK)
+#include "JSAudioTrack.cpp"
+#include "JSAudioTrackList.cpp"
 #include "JSHTMLTrackElement.cpp"
 #include "JSTextTrack.cpp"
 #include "JSTextTrackCue.cpp"
 #include "JSTextTrackCueList.cpp"
 #include "JSTextTrackList.cpp"
 #include "JSTrackEvent.cpp"
+#include "JSVideoTrack.cpp"
+#include "JSVideoTrackList.cpp"
 #endif
 #include "JSTimeRanges.cpp"
 #include "JSTouch.cpp"
index 0d7a65d..10ded62 100644 (file)
@@ -431,11 +431,15 @@ BINDING_IDLS = \
     $(WebCore)/html/canvas/WebGLVertexArrayObjectOES.idl \
     $(WebCore)/html/shadow/HTMLContentElement.idl \
     $(WebCore)/html/shadow/HTMLShadowElement.idl \
+    $(WebCore)/html/track/AudioTrack.idl \
+    $(WebCore)/html/track/AudioTrackList.idl \
     $(WebCore)/html/track/TextTrack.idl \
     $(WebCore)/html/track/TextTrackCue.idl \
     $(WebCore)/html/track/TextTrackCueList.idl \
     $(WebCore)/html/track/TextTrackList.idl \
     $(WebCore)/html/track/TrackEvent.idl \
+    $(WebCore)/html/track/VideoTrack.idl \
+    $(WebCore)/html/track/VideoTrackList.idl \
     $(WebCore)/inspector/InjectedScriptHost.idl \
     $(WebCore)/inspector/InspectorFrontendHost.idl \
     $(WebCore)/inspector/ScriptProfile.idl \
index dbeca47..7909e1a 100644 (file)
@@ -652,11 +652,15 @@ enable?(GAMEPAD) {
 
 enable?(VIDEO_TRACK) {
   IDL_BINDINGS += \
+    $$PWD/html/track/AudioTrack.idl \
+    $$PWD/html/track/AudioTrackList.idl \
     $$PWD/html/track/TextTrack.idl \
     $$PWD/html/track/TextTrackCue.idl \
     $$PWD/html/track/TextTrackCueList.idl \
     $$PWD/html/track/TextTrackList.idl \
     $$PWD/html/track/TrackEvent.idl \
+    $$PWD/html/track/VideoTrack.idl \
+    $$PWD/html/track/VideoTrackList.idl
 }
 
 enable?(MEDIA_SOURCE) {
index e99cec3..0e74ac3 100644 (file)
@@ -65,6 +65,10 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSAudioProcessingEvent.h \
        DerivedSources/WebCore/JSAudioSourceNode.cpp \
        DerivedSources/WebCore/JSAudioSourceNode.h \
+       DerivedSources/WebCore/JSAudioTrack.cpp \
+       DerivedSources/WebCore/JSAudioTrack.h \
+       DerivedSources/WebCore/JSAudioTrackList.cpp \
+       DerivedSources/WebCore/JSAudioTrackList.h \
        DerivedSources/WebCore/JSBarInfo.cpp \
        DerivedSources/WebCore/JSBarInfo.h \
        DerivedSources/WebCore/JSBeforeLoadEvent.cpp \
@@ -777,6 +781,10 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSValidityState.h \
        DerivedSources/WebCore/JSVoidCallback.cpp \
        DerivedSources/WebCore/JSVoidCallback.h \
+       DerivedSources/WebCore/JSVideoTrack.cpp \
+       DerivedSources/WebCore/JSVideoTrack.h \
+       DerivedSources/WebCore/JSVideoTrackList.cpp \
+       DerivedSources/WebCore/JSVideoTrackList.h \
        DerivedSources/WebCore/JSWaveShaperNode.cpp \
        DerivedSources/WebCore/JSWaveShaperNode.h \
        DerivedSources/WebCore/JSWaveTable.cpp \
@@ -1586,11 +1594,15 @@ dom_binding_idls += \
        $(WebCore)/html/canvas/WebGLVertexArrayObjectOES.idl \
        $(WebCore)/html/shadow/HTMLContentElement.idl \
        $(WebCore)/html/shadow/HTMLShadowElement.idl \
+       $(WebCore)/html/track/AudioTrack.idl \
+       $(WebCore)/html/track/AudioTrackList.idl \
        $(WebCore)/html/track/TextTrack.idl \
        $(WebCore)/html/track/TextTrackCue.idl \
        $(WebCore)/html/track/TextTrackCueList.idl \
        $(WebCore)/html/track/TextTrackList.idl \
        $(WebCore)/html/track/TrackEvent.idl \
+       $(WebCore)/html/track/VideoTrack.idl \
+       $(WebCore)/html/track/VideoTrackList.idl \
        $(WebCore)/inspector/InjectedScriptHost.idl \
        $(WebCore)/inspector/InspectorFrontendHost.idl \
        $(WebCore)/inspector/JavaScriptCallFrame.idl \
@@ -2321,6 +2333,8 @@ webcore_sources += \
        Source/WebCore/bindings/js/JSAttrCustom.cpp \
        Source/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp \
        Source/WebCore/bindings/js/JSAudioContextCustom.cpp \
+       Source/WebCore/bindings/js/JSAudioTrackCustom.cpp \
+       Source/WebCore/bindings/js/JSAudioTrackListCustom.cpp \
        Source/WebCore/bindings/js/JSBiquadFilterNodeCustom.cpp \
        Source/WebCore/bindings/js/JSBlobCustom.cpp \
        Source/WebCore/bindings/js/JSCDATASectionCustom.cpp \
@@ -2467,7 +2481,6 @@ webcore_sources += \
        Source/WebCore/bindings/js/JSTextCustom.cpp \
        Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp \
        Source/WebCore/bindings/js/JSTextTrackCustom.cpp \
-       Source/WebCore/bindings/js/JSTextTrackCustom.h \
        Source/WebCore/bindings/js/JSTextTrackListCustom.cpp \
        Source/WebCore/bindings/js/JSTouchCustom.cpp \
        Source/WebCore/bindings/js/JSTouchListCustom.cpp \
@@ -2475,6 +2488,8 @@ webcore_sources += \
        Source/WebCore/bindings/js/JSTrackCustom.h \
        Source/WebCore/bindings/js/JSTrackEventCustom.cpp \
        Source/WebCore/bindings/js/JSTreeWalkerCustom.cpp \
+       Source/WebCore/bindings/js/JSVideoTrackCustom.cpp \
+       Source/WebCore/bindings/js/JSVideoTrackListCustom.cpp \
        Source/WebCore/bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp \
        Source/WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp \
        Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp \
@@ -3769,6 +3784,10 @@ webcore_sources += \
        Source/WebCore/html/TimeInputType.h \
        Source/WebCore/html/TimeRanges.cpp \
        Source/WebCore/html/TimeRanges.h \
+       Source/WebCore/html/track/AudioTrack.cpp \
+       Source/WebCore/html/track/AudioTrack.h \
+       Source/WebCore/html/track/AudioTrackList.cpp \
+       Source/WebCore/html/track/AudioTrackList.h \
        Source/WebCore/html/track/InbandTextTrack.cpp \
        Source/WebCore/html/track/InbandTextTrack.h \
        Source/WebCore/html/track/LoadableTextTrack.cpp \
@@ -3789,6 +3808,10 @@ webcore_sources += \
        Source/WebCore/html/track/TrackEvent.h \
        Source/WebCore/html/track/TrackListBase.cpp \
        Source/WebCore/html/track/TrackListBase.h \
+       Source/WebCore/html/track/VideoTrack.cpp \
+       Source/WebCore/html/track/VideoTrack.h \
+       Source/WebCore/html/track/VideoTrackList.cpp \
+       Source/WebCore/html/track/VideoTrackList.h \
        Source/WebCore/html/track/WebVTTElement.cpp \
        Source/WebCore/html/track/WebVTTElement.h \
        Source/WebCore/html/track/WebVTTParser.cpp \
@@ -5499,6 +5522,7 @@ webcore_platform_sources += \
        Source/WebCore/platform/InitializeLogging.h \
        Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp \
        Source/WebCore/platform/graphics/ANGLEWebKitBridge.h \
+       Source/WebCore/platform/graphics/AudioTrackPrivate.h \
        Source/WebCore/platform/graphics/cpu/arm/GraphicsContext3DNEON.h \
        Source/WebCore/platform/graphics/cpu/arm/filters/NEONHelpers.h \
        Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h \
@@ -5779,6 +5803,7 @@ webcore_platform_sources += \
        Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h \
        Source/WebCore/platform/graphics/TypesettingFeatures.h \
        Source/WebCore/platform/graphics/UnitBezier.h \
+       Source/WebCore/platform/graphics/VideoTrackPrivate.h \
        Source/WebCore/platform/graphics/WidthCache.h \
        Source/WebCore/platform/graphics/WidthIterator.cpp \
        Source/WebCore/platform/graphics/WidthIterator.h \
index 6af110f..9c875f4 100644 (file)
@@ -3969,9 +3969,10 @@ enable?(JAVASCRIPT_DEBUGGER) {
 
 enable?(VIDEO_TRACK) {
     HEADERS += \
-        bindings/js/JSTextTrackCustom.h \
         bindings/js/JSTrackCustom.h \
         html/HTMLTrackElement.h \
+        html/track/AudioTrack.h \
+        html/track/AudioTrackList.h \
         html/track/InbandTextTrack.h \
         html/track/LoadableTextTrack.h \
         html/track/TextTrack.h \
@@ -3982,20 +3983,30 @@ enable?(VIDEO_TRACK) {
         html/track/TrackBase.h \
         html/track/TrackEvent.h \
         html/track/TrackListBase.h \
+        html/track/VideoTrack.h \
+        html/track/VideoTrackList.h \
         html/track/WebVTTParser.h \
         html/track/WebVTTToken.h \
         html/track/WebVTTTokenizer.h \
         loader/TextTrackLoader.h \
+        platform/graphics/AudioTrackPrivate.h \
         platform/graphics/InbandTextTrackPrivate.h \
         platform/graphics/InbandTextTrackPrivateClient.h
+        platform/graphics/VideoTrackPrivate.h \
 
     SOURCES += \
+        bindings/js/JSAudioTrackCustom.cpp \
+        bindings/js/JSAudioTrackListCustom.cpp \
         bindings/js/JSTextTrackCueCustom.cpp \
         bindings/js/JSTextTrackCustom.cpp \
         bindings/js/JSTrackCustom.cpp \
         bindings/js/JSTrackEventCustom.cpp \
         bindings/js/JSTextTrackListCustom.cpp \
+        bindings/js/JSVideoTrackCustom.cpp \
+        bindings/js/JSVideoTrackListCustom.cpp \
         html/HTMLTrackElement.cpp \
+        html/track/AudioTrack.cpp \
+        html/track/AudioTrackList.cpp \
         html/track/InbandTextTrack.cpp \
         html/track/LoadableTextTrack.cpp \
         html/track/TextTrack.cpp \
@@ -4006,6 +4017,8 @@ enable?(VIDEO_TRACK) {
         html/track/TrackBase.cpp \
         html/track/TrackEvent.cpp \
         html/track/TrackListBase.cpp \
+        html/track/VideoTrack.cpp \
+        html/track/VideoTrackList.cpp \
         html/track/WebVTTElement.cpp \
         html/track/WebVTTParser.cpp \
         html/track/WebVTTTokenizer.cpp \
index d45162b..e8d4333 100644 (file)
@@ -219,11 +219,15 @@ endif ()
 
 if (ENABLE_VIDEO_TRACK)
     list(APPEND WebCore_SOURCES
+        bindings/js/JSAudioTrackCustom.cpp
+        bindings/js/JSAudioTrackListCustom.cpp
         bindings/js/JSTextTrackCueCustom.cpp
         bindings/js/JSTextTrackCustom.cpp
         bindings/js/JSTextTrackListCustom.cpp
         bindings/js/JSTrackCustom.cpp
         bindings/js/JSTrackEventCustom.cpp
+        bindings/js/JSVideoTrackCustom.cpp
+        bindings/js/JSVideoTrackListCustom.cpp
     )
 endif ()
 
index 2a94fe5..4803929 100755 (executable)
                                Name="graphics"
                                >
                                <File
+                                       RelativePath="..\platform\graphics\AudioTrackPrivate.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\platform\graphics\BitmapImage.cpp"
                                        >
                                </File>
                                        >
                                </File>
                                <File
+                                       RelativePath="..\platform\graphics\VideoTrackPrivate.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\platform\graphics\WindRule.h"
                                        >
                                </File>
                                Name="track"
                                >
                                <File
+                                       RelativePath="..\html\track\AudioTrack.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\html\track\AudioTrack.h"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\html\track\AudioTrackList.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\html\track\AudioTrackList.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\html\track\InbandTextTrack.cpp"
                                        >
                                </File>
                                        >
                                </File>
                                <File
+                                       RelativePath="..\html\track\VideoTrack.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\html\track\VideoTrack.h"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\html\track\VideoTrackList.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\html\track\VideoTrackList.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\html\track\WebVTTElement.cpp"
                                        >
                                </File>
index 49f77b5..04d9b40 100644 (file)
                07B5A2DC1464320A00A81ECE /* JSTextTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B5A2DA1464320A00A81ECE /* JSTextTrackList.h */; };
                07B5A30D14687D7100A81ECE /* JSTextTrackListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B5A30C14687D7100A81ECE /* JSTextTrackListCustom.cpp */; };
                07BDD6EC1469B4C2009C9F85 /* JSTrackEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B5A30A14687B8400A81ECE /* JSTrackEventCustom.cpp */; };
-               07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; };
+               07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07E116B11489C9A100EC5ACE /* JSTextTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */; };
                07E117071489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */; };
                0806E57A12893045007CED32 /* SVGMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 0806E57912893045007CED32 /* SVGMatrix.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCFE2F120C1B58380020235F /* JSRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFE2F100C1B58370020235F /* JSRect.h */; };
                BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF64900EAD15C200C1D6F7 /* LengthSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               BE6DF70B171CA2C500DD52B8 /* JSVideoTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */; };
+               BE6DF70D171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */; };
+               BE6DF711171CA2DA00DD52B8 /* JSAudioTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6DF70E171CA2DA00DD52B8 /* JSAudioTrackCustom.cpp */; };
+               BE6DF713171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6DF710171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp */; };
                BE88E0C11715CE2600658D98 /* TrackListBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE88E0BF1715CE2600658D98 /* TrackListBase.cpp */; };
                BE88E0C21715CE2600658D98 /* TrackListBase.h in Headers */ = {isa = PBXBuildFile; fileRef = BE88E0C01715CE2600658D98 /* TrackListBase.h */; };
+               BE88E0D81715D2A200658D98 /* AudioTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE88E0CC1715D2A200658D98 /* AudioTrack.cpp */; };
+               BE88E0D91715D2A200658D98 /* AudioTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = BE88E0CD1715D2A200658D98 /* AudioTrack.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               BE88E0DB1715D2A200658D98 /* AudioTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE88E0CF1715D2A200658D98 /* AudioTrackList.cpp */; };
+               BE88E0DC1715D2A200658D98 /* AudioTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = BE88E0D01715D2A200658D98 /* AudioTrackList.h */; };
+               BE88E0DE1715D2A200658D98 /* VideoTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE88E0D21715D2A200658D98 /* VideoTrack.cpp */; };
+               BE88E0DF1715D2A200658D98 /* VideoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = BE88E0D31715D2A200658D98 /* VideoTrack.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               BE88E0E11715D2A200658D98 /* VideoTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE88E0D51715D2A200658D98 /* VideoTrackList.cpp */; };
+               BE88E0E21715D2A200658D98 /* VideoTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = BE88E0D61715D2A200658D98 /* VideoTrackList.h */; };
+               BE8EF042171C8FF9009B48C3 /* JSAudioTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8EF03E171C8FF9009B48C3 /* JSAudioTrack.cpp */; };
+               BE8EF043171C8FF9009B48C3 /* JSAudioTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8EF03F171C8FF9009B48C3 /* JSAudioTrack.h */; };
+               BE8EF044171C8FF9009B48C3 /* JSAudioTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8EF040171C8FF9009B48C3 /* JSAudioTrackList.cpp */; };
+               BE8EF045171C8FF9009B48C3 /* JSAudioTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8EF041171C8FF9009B48C3 /* JSAudioTrackList.h */; };
+               BE8EF04A171C9014009B48C3 /* JSVideoTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8EF046171C9014009B48C3 /* JSVideoTrack.cpp */; };
+               BE8EF04B171C9014009B48C3 /* JSVideoTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8EF047171C9014009B48C3 /* JSVideoTrack.h */; };
+               BE8EF04C171C9014009B48C3 /* JSVideoTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8EF048171C9014009B48C3 /* JSVideoTrackList.cpp */; };
+               BE8EF04D171C9014009B48C3 /* JSVideoTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8EF049171C9014009B48C3 /* JSVideoTrackList.h */; };
+               BEF29EEB1715DD0900C4B4C9 /* AudioTrackPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BEF29EE91715DD0900C4B4C9 /* AudioTrackPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               BEF29EEC1715DD0900C4B4C9 /* VideoTrackPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                C046E1AC1208A9FE00BA2CF7 /* LocalizedStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C046E1AB1208A9FE00BA2CF7 /* LocalizedStrings.cpp */; };
                C0C054CB1118C8E400CE2636 /* CodeGenerator.pm in Headers */ = {isa = PBXBuildFile; fileRef = 93F8B3050A300FE100F61AB8 /* CodeGenerator.pm */; settings = {ATTRIBUTES = (Private, ); }; };
                C0C054CC1118C8E400CE2636 /* generate-bindings.pl in Headers */ = {isa = PBXBuildFile; fileRef = 93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */; settings = {ATTRIBUTES = (Private, ); }; };
                07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; };
                07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCustom.cpp; sourceTree = "<group>"; };
                07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCueCustom.cpp; sourceTree = "<group>"; };
-               07E38A0B148FCF0C006E1ECC /* JSTextTrackCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextTrackCustom.h; sourceTree = "<group>"; };
                0806E57912893045007CED32 /* SVGMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMatrix.h; sourceTree = "<group>"; };
                080E49211255F3BD00EFCA27 /* SVGTextLayoutEngineBaseline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutEngineBaseline.cpp; sourceTree = "<group>"; };
                080E49221255F3BD00EFCA27 /* SVGTextLayoutEngineBaseline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutEngineBaseline.h; sourceTree = "<group>"; };
                BCFE2F100C1B58370020235F /* JSRect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSRect.h; sourceTree = "<group>"; };
                BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthBox.h; sourceTree = "<group>"; };
                BCFF64900EAD15C200C1D6F7 /* LengthSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthSize.h; sourceTree = "<group>"; };
+               BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVideoTrackCustom.cpp; sourceTree = "<group>"; };
+               BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVideoTrackListCustom.cpp; sourceTree = "<group>"; };
+               BE6DF70E171CA2DA00DD52B8 /* JSAudioTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioTrackCustom.cpp; sourceTree = "<group>"; };
+               BE6DF710171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioTrackListCustom.cpp; sourceTree = "<group>"; };
                BE855F7F0701E83500239769 /* WebCoreView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BE8560510701F91100239769 /* WebCoreView.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BE88E0BF1715CE2600658D98 /* TrackListBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackListBase.cpp; sourceTree = "<group>"; };
                BE88E0C01715CE2600658D98 /* TrackListBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackListBase.h; sourceTree = "<group>"; };
+               BE88E0CC1715D2A200658D98 /* AudioTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioTrack.cpp; sourceTree = "<group>"; };
+               BE88E0CD1715D2A200658D98 /* AudioTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioTrack.h; sourceTree = "<group>"; };
+               BE88E0CE1715D2A200658D98 /* AudioTrack.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AudioTrack.idl; sourceTree = "<group>"; };
+               BE88E0CF1715D2A200658D98 /* AudioTrackList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioTrackList.cpp; sourceTree = "<group>"; };
+               BE88E0D01715D2A200658D98 /* AudioTrackList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioTrackList.h; sourceTree = "<group>"; };
+               BE88E0D11715D2A200658D98 /* AudioTrackList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AudioTrackList.idl; sourceTree = "<group>"; };
+               BE88E0D21715D2A200658D98 /* VideoTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoTrack.cpp; sourceTree = "<group>"; };
+               BE88E0D31715D2A200658D98 /* VideoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrack.h; sourceTree = "<group>"; };
+               BE88E0D41715D2A200658D98 /* VideoTrack.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VideoTrack.idl; sourceTree = "<group>"; };
+               BE88E0D51715D2A200658D98 /* VideoTrackList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoTrackList.cpp; sourceTree = "<group>"; };
+               BE88E0D61715D2A200658D98 /* VideoTrackList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackList.h; sourceTree = "<group>"; };
+               BE88E0D71715D2A200658D98 /* VideoTrackList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VideoTrackList.idl; sourceTree = "<group>"; };
+               BE8EF03E171C8FF9009B48C3 /* JSAudioTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioTrack.cpp; sourceTree = "<group>"; };
+               BE8EF03F171C8FF9009B48C3 /* JSAudioTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAudioTrack.h; sourceTree = "<group>"; };
+               BE8EF040171C8FF9009B48C3 /* JSAudioTrackList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioTrackList.cpp; sourceTree = "<group>"; };
+               BE8EF041171C8FF9009B48C3 /* JSAudioTrackList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAudioTrackList.h; sourceTree = "<group>"; };
+               BE8EF046171C9014009B48C3 /* JSVideoTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVideoTrack.cpp; sourceTree = "<group>"; };
+               BE8EF047171C9014009B48C3 /* JSVideoTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVideoTrack.h; sourceTree = "<group>"; };
+               BE8EF048171C9014009B48C3 /* JSVideoTrackList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVideoTrackList.cpp; sourceTree = "<group>"; };
+               BE8EF049171C9014009B48C3 /* JSVideoTrackList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVideoTrackList.h; sourceTree = "<group>"; };
                BE91FC8B06133666005E3790 /* Position.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Position.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BE91FC8C06133666005E3790 /* Position.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Position.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreKeyboardUIMode.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               BEF29EE91715DD0900C4B4C9 /* AudioTrackPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioTrackPrivate.h; sourceTree = "<group>"; };
+               BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackPrivate.h; sourceTree = "<group>"; };
                C046E1AB1208A9FE00BA2CF7 /* LocalizedStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalizedStrings.cpp; sourceTree = "<group>"; };
                C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsoleCustom.cpp; sourceTree = "<group>"; };
                C0F2A43F13869A280066C534 /* preprocessor.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = preprocessor.pm; path = scripts/preprocessor.pm; sourceTree = "<group>"; };
                                49EECEF3105070C400099FAB /* JSArrayBuffer.h */,
                                49EECF19105072F300099FAB /* JSArrayBufferView.cpp */,
                                49EECF1A105072F300099FAB /* JSArrayBufferView.h */,
+                               BE8EF03E171C8FF9009B48C3 /* JSAudioTrack.cpp */,
+                               BE8EF03F171C8FF9009B48C3 /* JSAudioTrack.h */,
+                               BE8EF040171C8FF9009B48C3 /* JSAudioTrackList.cpp */,
+                               BE8EF041171C8FF9009B48C3 /* JSAudioTrackList.h */,
                                65DF323309D1DE65000BE325 /* JSCanvasGradient.cpp */,
                                65DF323409D1DE65000BE325 /* JSCanvasGradient.h */,
                                65DF323509D1DE65000BE325 /* JSCanvasPattern.cpp */,
                                91089D3014C335CD005AFC49 /* JSUint8ClampedArray.h */,
                                15C77092100D3CA8005BA267 /* JSValidityState.cpp */,
                                15C77091100D3CA8005BA267 /* JSValidityState.h */,
+                               BE8EF046171C9014009B48C3 /* JSVideoTrack.cpp */,
+                               BE8EF047171C9014009B48C3 /* JSVideoTrack.h */,
+                               BE8EF048171C9014009B48C3 /* JSVideoTrackList.cpp */,
+                               BE8EF049171C9014009B48C3 /* JSVideoTrackList.h */,
                                97E9EC8B15DC492F004F2E71 /* JSVoidCallback.cpp */,
                                97E9EC8C15DC492F004F2E71 /* JSVoidCallback.h */,
                                A7D20F60107F406900A80392 /* JSWebGLActiveInfo.cpp */,
                B1AD4E7713A12A7200846B27 /* track */ = {
                        isa = PBXGroup;
                        children = (
-                               BE88E0BF1715CE2600658D98 /* TrackListBase.cpp */,
-                               BE88E0C01715CE2600658D98 /* TrackListBase.h */,
+                               BE88E0CC1715D2A200658D98 /* AudioTrack.cpp */,
+                               BE88E0CD1715D2A200658D98 /* AudioTrack.h */,
+                               BE88E0CE1715D2A200658D98 /* AudioTrack.idl */,
+                               BE88E0CF1715D2A200658D98 /* AudioTrackList.cpp */,
+                               BE88E0D01715D2A200658D98 /* AudioTrackList.h */,
+                               BE88E0D11715D2A200658D98 /* AudioTrackList.idl */,
                                0794178F166E855F009416C2 /* InbandTextTrack.cpp */,
                                07941790166E855F009416C2 /* InbandTextTrack.h */,
                                9759E93414EF1CF80026A2DD /* LoadableTextTrack.cpp */,
                                070334D01459FFAC008D8D45 /* TrackEvent.cpp */,
                                070334D11459FFAC008D8D45 /* TrackEvent.h */,
                                070334D21459FFAC008D8D45 /* TrackEvent.idl */,
+                               BE88E0BF1715CE2600658D98 /* TrackListBase.cpp */,
+                               BE88E0C01715CE2600658D98 /* TrackListBase.h */,
+                               BE88E0D21715D2A200658D98 /* VideoTrack.cpp */,
+                               BE88E0D31715D2A200658D98 /* VideoTrack.h */,
+                               BE88E0D41715D2A200658D98 /* VideoTrack.idl */,
+                               BE88E0D51715D2A200658D98 /* VideoTrackList.cpp */,
+                               BE88E0D61715D2A200658D98 /* VideoTrackList.h */,
+                               BE88E0D71715D2A200658D98 /* VideoTrackList.idl */,
                                F12171F316A8BC63000053CA /* WebVTTElement.cpp */,
                                F12171F416A8BC63000053CA /* WebVTTElement.h */,
                                5D21A80013ECE5DF00BB7064 /* WebVTTParser.cpp */,
                                49E911B20EF86D27009D0CAF /* transforms */,
                                490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */,
                                490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */,
+                               BEF29EE91715DD0900C4B4C9 /* AudioTrackPrivate.h */,
+                               BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */,
                                A89943270B42338700D7C802 /* BitmapImage.cpp */,
                                A89943260B42338700D7C802 /* BitmapImage.h */,
                                B27535380B053814002CE64F /* Color.cpp */,
                                FDEAAAEF12B02EE400DCF33B /* JSAudioBufferSourceNodeCustom.cpp */,
                                CDDE691D171DF89100A44D89 /* JSAudioBufferCustom.cpp */,
                                FDEAAAF012B02EE400DCF33B /* JSAudioContextCustom.cpp */,
+                               BE6DF70E171CA2DA00DD52B8 /* JSAudioTrackCustom.cpp */,
+                               BE6DF710171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp */,
                                FD8AA63B1695148E00D2EA68 /* JSBiquadFilterNodeCustom.cpp */,
                                8931DE5A14C44C44000DC9D2 /* JSBlobCustom.cpp */,
                                49EED14B1051971900099FAB /* JSCanvasRenderingContext2DCustom.cpp */,
                                1A2C40AA0DEB55AA005AF19E /* JSTextCustom.cpp */,
                                07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */,
                                07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */,
-                               07E38A0B148FCF0C006E1ECC /* JSTextTrackCustom.h */,
                                07B5A30C14687D7100A81ECE /* JSTextTrackListCustom.cpp */,
                                070334E8145A1F35008D8D45 /* JSTrackCustom.cpp */,
                                07846384145B1B8E00A58DF1 /* JSTrackCustom.h */,
                                07B5A30A14687B8400A81ECE /* JSTrackEventCustom.cpp */,
                                516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
+                               BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */,
+                               BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */,
                                49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */,
                                E1AD14C41297354900ACA989 /* JSWebKitCSSKeyframeRuleCustom.cpp */,
                                E1AD14B4129734CA00ACA989 /* JSWebKitCSSKeyframesRuleCustom.cpp */,
                                FD31608912B026F700C1A359 /* AudioSourceProvider.h in Headers */,
                                FD62F52E145898D80094B0ED /* AudioSourceProviderClient.h in Headers */,
                                FDB052E01561A42C00B500D6 /* AudioSummingJunction.h in Headers */,
+                               BEF29EEB1715DD0900C4B4C9 /* AudioTrackPrivate.h in Headers */,
                                FD31608B12B026F700C1A359 /* AudioUtilities.h in Headers */,
                                7EE6846012D26E3800E79415 /* AuthenticationCF.h in Headers */,
                                7EE6846112D26E3800E79415 /* AuthenticationChallenge.h in Headers */,
                                15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */,
                                FD3160AF12B026F700C1A359 /* VectorMath.h in Headers */,
                                BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */,
+                               BEF29EEC1715DD0900C4B4C9 /* VideoTrackPrivate.h in Headers */,
                                CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */,
                                3FFFF9AE159D9B060020BBD5 /* ViewportStyleResolver.h in Headers */,
                                93309E20099E64920056E581 /* VisiblePosition.h in Headers */,
                                E1B533491717DEE300F205F9 /* CachedRawResourceClient.h in Headers */,
                                BE88E0C21715CE2600658D98 /* TrackListBase.h in Headers */,
                                FB484F4D171F821E00040755 /* TransformFunctions.h in Headers */,
+                               BE88E0D91715D2A200658D98 /* AudioTrack.h in Headers */,
+                               BE88E0DC1715D2A200658D98 /* AudioTrackList.h in Headers */,
+                               BE88E0DF1715D2A200658D98 /* VideoTrack.h in Headers */,
+                               BE88E0E21715D2A200658D98 /* VideoTrackList.h in Headers */,
+                               BE8EF043171C8FF9009B48C3 /* JSAudioTrack.h in Headers */,
+                               BE8EF045171C8FF9009B48C3 /* JSAudioTrackList.h in Headers */,
+                               BE8EF04B171C9014009B48C3 /* JSVideoTrack.h in Headers */,
+                               BE8EF04D171C9014009B48C3 /* JSVideoTrackList.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                E1B533471717D0A100F205F9 /* CachedSVGDocumentReference.cpp in Sources */,
                                BE88E0C11715CE2600658D98 /* TrackListBase.cpp in Sources */,
                                FB484F4C171F821E00040755 /* TransformFunctions.cpp in Sources */,
+                               BE88E0D81715D2A200658D98 /* AudioTrack.cpp in Sources */,
+                               BE88E0DB1715D2A200658D98 /* AudioTrackList.cpp in Sources */,
+                               BE88E0DE1715D2A200658D98 /* VideoTrack.cpp in Sources */,
+                               BE88E0E11715D2A200658D98 /* VideoTrackList.cpp in Sources */,
+                               BE8EF042171C8FF9009B48C3 /* JSAudioTrack.cpp in Sources */,
+                               BE8EF044171C8FF9009B48C3 /* JSAudioTrackList.cpp in Sources */,
+                               BE8EF04A171C9014009B48C3 /* JSVideoTrack.cpp in Sources */,
+                               BE8EF04C171C9014009B48C3 /* JSVideoTrackList.cpp in Sources */,
+                               BE6DF70B171CA2C500DD52B8 /* JSVideoTrackCustom.cpp in Sources */,
+                               BE6DF70D171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp in Sources */,
+                               BE6DF711171CA2DA00DD52B8 /* JSAudioTrackCustom.cpp in Sources */,
+                               BE6DF713171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index f322d64..eeeeeba 100644 (file)
@@ -433,18 +433,24 @@ webkitgtk_gdom_built_h_api += \
 
 if ENABLE_VIDEO
 webkitgtk_gdom_built_h_api += \
+       $(top_builddir)/DerivedSources/webkitdom/WebKitDOMAudioTrack.h \
+       $(top_builddir)/DerivedSources/webkitdom/WebKitDOMAudioTrackList.h \
        $(top_builddir)/DerivedSources/webkitdom/WebKitDOMHTMLAudioElement.h \
        $(top_builddir)/DerivedSources/webkitdom/WebKitDOMHTMLVideoElement.h \
        $(top_builddir)/DerivedSources/webkitdom/WebKitDOMTextTrack.h \
        $(top_builddir)/DerivedSources/webkitdom/WebKitDOMTextTrackList.h \
        $(top_builddir)/DerivedSources/webkitdom/WebKitDOMTextTrackCue.h \
        $(top_builddir)/DerivedSources/webkitdom/WebKitDOMTextTrackCueList.h \
-       $(top_builddir)/DerivedSources/webkitdom/WebKitDOMTrackEvent.h
+       $(top_builddir)/DerivedSources/webkitdom/WebKitDOMTrackEvent.h \
+       $(top_builddir)/DerivedSources/webkitdom/WebKitDOMVideoTrack.h \
+       $(top_builddir)/DerivedSources/webkitdom/WebKitDOMVideoTrackList.h
 webkitgtk_gdom_built_sources += \
        DerivedSources/webkitdom/WebKitDOMHTMLAudioElement.cpp \
        DerivedSources/webkitdom/WebKitDOMHTMLAudioElementPrivate.h \
        DerivedSources/webkitdom/WebKitDOMHTMLVideoElement.cpp \
        DerivedSources/webkitdom/WebKitDOMHTMLVideoElementPrivate.h \
+       DerivedSources/webkitdom/WebKitDOMAudioTrack.cpp \
+       DerivedSources/webkitdom/WebKitDOMAudioTrackList.cpp \
        DerivedSources/webkitdom/WebKitDOMTextTrack.cpp \
        DerivedSources/webkitdom/WebKitDOMTextTrackPrivate.h \
        DerivedSources/webkitdom/WebKitDOMTextTrackList.cpp \
@@ -453,6 +459,8 @@ webkitgtk_gdom_built_sources += \
        DerivedSources/webkitdom/WebKitDOMTextTrackCuePrivate.h \
        DerivedSources/webkitdom/WebKitDOMTextTrackCueList.cpp \
        DerivedSources/webkitdom/WebKitDOMTextTrackCueListPrivate.h \
+       DerivedSources/webkitdom/WebKitDOMVideoTrack.cpp \
+       DerivedSources/webkitdom/WebKitDOMVideoTrackList.cpp \
        DerivedSources/webkitdom/WebKitDOMTrackEvent.cpp \
        DerivedSources/webkitdom/WebKitDOMTrackEventPrivate.h
 endif
diff --git a/Source/WebCore/bindings/js/JSAudioTrackCustom.cpp b/Source/WebCore/bindings/js/JSAudioTrackCustom.cpp
new file mode 100644 (file)
index 0000000..ab62f1b
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "JSAudioTrack.h"
+
+#include "JSTrackCustom.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSAudioTrack::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+    JSAudioTrack* jsAudioTrack = jsCast<JSAudioTrack*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(jsAudioTrack, &s_info);
+    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+    ASSERT(jsAudioTrack->structure()->typeInfo().overridesVisitChildren());
+    Base::visitChildren(jsAudioTrack, visitor);
+
+    AudioTrack* audioTrack = static_cast<AudioTrack*>(jsAudioTrack->impl());
+    visitor.addOpaqueRoot(root(audioTrack));
+}
+
+} // namespace WebCore
+
+#endif
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc.  All rights reserved.
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef JSTextTrackCustom_h
-#define JSTextTrackCustom_h
+#include "config.h"
 
 #if ENABLE(VIDEO_TRACK)
-#include "JSTextTrack.h"
+#include "JSAudioTrackList.h"
 
-#include "HTMLMediaElement.h"
-#include "HTMLTrackElement.h"
+#include "Element.h"
 #include "JSNodeCustom.h"
-#include "LoadableTextTrack.h"
 
 using namespace JSC;
 
 namespace WebCore {
 
-inline void* root(TextTrack* track)
+void JSAudioTrackList::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
-    // If this track corresponds to a <track> element, return that element's root.
-    if (track->trackType() == TextTrack::TrackElement) {
-        if (HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(track)->trackElement())
-            return root(trackElement);
-    }
-
-    // No, return the media element's root if it has one.
-    if (track->mediaElement())
-        return root(track->mediaElement());
-
-    // No track element and no media element, return the text track.
-    return track;
+    JSAudioTrackList* jsAudioTrackList = jsCast<JSAudioTrackList*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(jsAudioTrackList, &s_info);
+    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+    ASSERT(jsAudioTrackList->structure()->typeInfo().overridesVisitChildren());
+    Base::visitChildren(jsAudioTrackList, visitor);
+
+    AudioTrackList* audioTrackList = static_cast<AudioTrackList*>(jsAudioTrackList->impl());
+    visitor.addOpaqueRoot(root(audioTrackList->element()));
+    audioTrackList->visitJSEventListeners(visitor);
 }
 
-}
+} // namespace WebCore
 
 #endif
-#endif
index 2ba10f5..51adf35 100644 (file)
@@ -34,6 +34,8 @@
 #include "GCController.cpp"
 #include "JSArrayBufferCustom.cpp"
 #include "JSAttrCustom.cpp"
+#include "JSAudioTrackCustom.cpp"
+#include "JSAudioTrackListCustom.cpp"
 #include "JSBlobCustom.cpp"
 #include "JSCDATASectionCustom.cpp"
 #include "JSCSSFontFaceRuleCustom.cpp"
 #include "JSTrackCustom.cpp"
 #include "JSTrackEventCustom.cpp"
 #include "JSTreeWalkerCustom.cpp"
+#include "JSVideoTrackCustom.cpp"
+#include "JSVideoTrackListCustom.cpp"
 #include "JSWebKitCSSKeyframeRuleCustom.cpp"
 #include "JSWebKitCSSKeyframesRuleCustom.cpp"
 #include "JSWebKitPointCustom.cpp"
index 5dd9dca..ee997aa 100644 (file)
@@ -28,7 +28,8 @@
 #if ENABLE(VIDEO_TRACK)
 
 #include "JSTextTrackCue.h"
-#include "JSTextTrackCustom.h"
+#include "JSTrackCustom.h"
+#include "TextTrack.h"
 
 using namespace JSC;
 
index 5d64124..93f347b 100644 (file)
 #include "config.h"
 
 #if ENABLE(VIDEO_TRACK)
-#include "JSTextTrackCustom.h"
-
 #include "JSTextTrack.h"
 #include "JSTextTrackCueList.h"
+#include "JSTrackCustom.h"
 
 using namespace JSC;
 
 namespace WebCore {
 
-bool JSTextTrackOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
-{
-    JSTextTrack* jsTextTrack = jsCast<JSTextTrack*>(handle.get().asCell());
-    TextTrack* textTrack = static_cast<TextTrack*>(jsTextTrack->impl());
-
-    // If the cue is firing event listeners, its wrapper is reachable because
-    // the wrapper is responsible for marking those event listeners.
-    if (textTrack->isFiringEventListeners())
-        return true;
-
-    // If the cue has no event listeners and has no custom properties, it is not reachable.
-    if (!textTrack->hasEventListeners() && !jsTextTrack->hasCustomProperties())
-        return false;
-
-    return visitor.containsOpaqueRoot(root(textTrack));
-}
-
 void JSTextTrack::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSTextTrack* jsTextTrack = jsCast<JSTextTrack*>(cell);
index 23a83e8..af0ec11 100644 (file)
 #if ENABLE(VIDEO_TRACK)
 #include "JSTextTrackList.h"
 
-#include "HTMLMediaElement.h"
+#include "Element.h"
 #include "JSNodeCustom.h"
 
 using namespace JSC;
 
 namespace WebCore {
 
-bool JSTextTrackListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
-{
-    JSTextTrackList* jsTextTrackList = jsCast<JSTextTrackList*>(handle.get().asCell());
-    TextTrackList* textTrackList = static_cast<TextTrackList*>(jsTextTrackList->impl());
-
-    // If the list is firing event listeners, its wrapper is reachable because
-    // the wrapper is responsible for marking those event listeners.
-    if (textTrackList->isFiringEventListeners())
-        return true;
-
-    // If the list has no event listeners and has no custom properties, it is not reachable.
-    if (!textTrackList->hasEventListeners() && !jsTextTrackList->hasCustomProperties())
-        return false;
-
-    // It is reachable if the media element parent is reachable.
-    return visitor.containsOpaqueRoot(root(textTrackList->element()));
-}
-
 void JSTextTrackList::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSTextTrackList* jsTextTrackList = jsCast<JSTextTrackList*>(cell);
index 7b97945..79d7b93 100644 (file)
@@ -29,7 +29,9 @@
 
 #include "JSTrackCustom.h"
 
+#include "JSAudioTrack.h"
 #include "JSTextTrack.h"
+#include "JSVideoTrack.h"
 
 using namespace JSC;
 
@@ -66,9 +68,11 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TrackBa
         break;
         
     case TrackBase::AudioTrack:
+        return CREATE_DOM_WRAPPER(exec, globalObject, AudioTrack, track);
+        break;
+
     case TrackBase::VideoTrack:
-        // This should not happen until VideoTrack and AudioTrack are implemented.
-        ASSERT_NOT_REACHED();
+        return CREATE_DOM_WRAPPER(exec, globalObject, VideoTrack, track);
         break;
 
     case TrackBase::TextTrack:
index 165340d..6e24a09 100644 (file)
@@ -28,7 +28,9 @@
 
 #if ENABLE(VIDEO_TRACK)
 
+#include "Element.h"
 #include "JSDOMBinding.h"
+#include "JSNodeCustom.h"
 #include "TrackBase.h"
 
 namespace WebCore {
@@ -36,6 +38,13 @@ namespace WebCore {
 TrackBase* toTrack(JSC::JSValue);
 JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TrackBase*);
 
+inline void* root(TrackBase* track)
+{
+    if (track->element())
+        return root(track->element());
+    return track;
+}
+
 }
 
 #endif
diff --git a/Source/WebCore/bindings/js/JSVideoTrackCustom.cpp b/Source/WebCore/bindings/js/JSVideoTrackCustom.cpp
new file mode 100644 (file)
index 0000000..6818493
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "JSVideoTrack.h"
+
+#include "JSTrackCustom.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSVideoTrack::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+    JSVideoTrack* jsVideoTrack = jsCast<JSVideoTrack*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(jsVideoTrack, &s_info);
+    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+    ASSERT(jsVideoTrack->structure()->typeInfo().overridesVisitChildren());
+    Base::visitChildren(jsVideoTrack, visitor);
+
+    VideoTrack* videoTrack = static_cast<VideoTrack*>(jsVideoTrack->impl());
+    visitor.addOpaqueRoot(root(videoTrack));
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/bindings/js/JSVideoTrackListCustom.cpp b/Source/WebCore/bindings/js/JSVideoTrackListCustom.cpp
new file mode 100644 (file)
index 0000000..b1b493a
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+#include "JSVideoTrackList.h"
+
+#include "Element.h"
+#include "JSNodeCustom.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSVideoTrackList::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+    JSVideoTrackList* jsVideoTrackList = jsCast<JSVideoTrackList*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(jsVideoTrackList, &s_info);
+    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+    ASSERT(jsVideoTrackList->structure()->typeInfo().overridesVisitChildren());
+    Base::visitChildren(jsVideoTrackList, visitor);
+
+    VideoTrackList* videoTrackList = static_cast<VideoTrackList*>(jsVideoTrackList->impl());
+    visitor.addOpaqueRoot(root(videoTrackList->element()));
+    videoTrackList->visitJSEventListeners(visitor);
+}
+
+} // namespace WebCore
+
+#endif
index 82777a8..ea0799b 100644 (file)
@@ -41,6 +41,7 @@
 namespace WebCore {
 
     class AudioContext;
+    class AudioTrackList;
     class DedicatedWorkerContext;
     class DOMApplicationCache;
     class DOMWindow;
@@ -67,6 +68,7 @@ namespace WebCore {
     class SourceBufferList;
     class TextTrack;
     class TextTrackCue;
+    class VideoTrackList;
     class WebSocket;
     class WebKitNamedFlow;
     class Worker;
index 476d1b5..8ea5b7b 100644 (file)
@@ -1,6 +1,7 @@
 namespace="EventTarget"
 
 AudioContext conditional=WEB_AUDIO
+AudioTrackList conditional=VIDEO_TRACK
 BatteryManager conditional=BATTERY_STATUS
 DedicatedWorkerContext conditional=WORKERS
 DOMApplicationCache
@@ -37,6 +38,7 @@ SVGElementInstance conditional=SVG
 TextTrack conditional=VIDEO_TRACK
 TextTrackCue conditional=VIDEO_TRACK
 TextTrackList conditional=VIDEO_TRACK
+VideoTrackList conditional=VIDEO_TRACK
 WebKitNamedFlow
 WebSocket conditional=WEB_SOCKETS
 Worker conditional=WORKERS
index 6fb9977..5054af1 100644 (file)
@@ -98,6 +98,8 @@
 #endif
 
 #if ENABLE(VIDEO_TRACK)
+#include "AudioTrackList.h"
+#include "AudioTrackPrivate.h"
 #include "CaptionUserPreferences.h"
 #include "HTMLTrackElement.h"
 #include "InbandTextTrack.h"
 #include "RuntimeEnabledFeatures.h"
 #include "TextTrackCueList.h"
 #include "TextTrackList.h"
+#include "VideoTrackList.h"
+#include "VideoTrackPrivate.h"
 #endif
 
 #if ENABLE(WEB_AUDIO)
@@ -296,7 +300,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
     , m_processingPreferenceChange(false)
     , m_lastTextTrackUpdateTime(-1)
     , m_captionDisplayMode(CaptionUserPreferences::Automatic)
+    , m_audioTracks(0)
     , m_textTracks(0)
+    , m_videoTracks(0)
     , m_ignoreTrackDisplayUpdate(0)
 #endif
 #if ENABLE(WEB_AUDIO)
@@ -330,12 +336,22 @@ HTMLMediaElement::~HTMLMediaElement()
     document()->unregisterForPrivateBrowsingStateChangedCallbacks(this);
 #if ENABLE(VIDEO_TRACK)
     document()->unregisterForCaptionPreferencesChangedCallbacks(this);
+    if (m_audioTracks) {
+        m_audioTracks->clearElement();
+        for (unsigned i = 0; i < m_audioTracks->length(); ++i)
+            m_audioTracks->item(i)->clearClient();
+    }
     if (m_textTracks)
         m_textTracks->clearElement();
     if (m_textTracks) {
         for (unsigned i = 0; i < m_textTracks->length(); ++i)
             m_textTracks->item(i)->clearClient();
     }
+    if (m_videoTracks) {
+        m_videoTracks->clearElement();
+        for (unsigned i = 0; i < m_videoTracks->length(); ++i)
+            m_videoTracks->item(i)->clearClient();
+    }
 #endif
 
     if (m_mediaController)
@@ -1353,6 +1369,11 @@ void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track)
     }
 }
 
+void HTMLMediaElement::audioTrackEnabledChanged(AudioTrack*)
+{
+    // We will want to change the media controls here once they exist
+}
+
 void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
 {
     if (track->trackType() == TextTrack::TrackElement) {
@@ -1392,6 +1413,11 @@ void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
     updateActiveTextTrackCues(currentTime());
 }
 
+void HTMLMediaElement::videoTrackSelectedChanged(VideoTrack*)
+{
+    // We will want to change the media controls here once they exist
+}
+
 void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
 {
     if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTrack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword())
@@ -2796,6 +2822,14 @@ double HTMLMediaElement::percentLoaded() const
 
 #if ENABLE(VIDEO_TRACK)
 
+void HTMLMediaElement::mediaPlayerDidAddAudioTrack(PassRefPtr<AudioTrackPrivate> prpTrack)
+{
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return;
+
+    addAudioTrack(AudioTrack::create(this, prpTrack));
+}
+
 void HTMLMediaElement::mediaPlayerDidAddTextTrack(PassRefPtr<InbandTextTrackPrivate> prpTrack)
 {
     if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
@@ -2828,24 +2862,30 @@ void HTMLMediaElement::mediaPlayerDidAddTextTrack(PassRefPtr<InbandTextTrackPriv
     // 9. Fire an event with the name addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent
     // interface, with the track attribute initialized to the text track's TextTrack object, at the media element's
     // textTracks attribute's TextTrackList object.
-    addTextTrack(textTrack.get());
+    addTextTrack(textTrack.release());
 }
 
-void HTMLMediaElement::mediaPlayerDidRemoveTextTrack(PassRefPtr<InbandTextTrackPrivate> prpTrack)
+void HTMLMediaElement::mediaPlayerDidAddVideoTrack(PassRefPtr<VideoTrackPrivate> prpTrack)
 {
     if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
         return;
-    
-    if (!m_textTracks)
-        return;
 
-    // This cast is safe because we created the InbandTextTrack with the InbandTextTrackPrivate
-    // passed to mediaPlayerDidAddTextTrack.
-    RefPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*>(prpTrack->client());
-    if (!textTrack)
-        return;
+    addVideoTrack(VideoTrack::create(this, prpTrack));
+}
 
-    removeTextTrack(textTrack.get());
+void HTMLMediaElement::mediaPlayerDidRemoveAudioTrack(PassRefPtr<AudioTrackPrivate> prpTrack)
+{
+    prpTrack->willBeRemoved();
+}
+
+void HTMLMediaElement::mediaPlayerDidRemoveTextTrack(PassRefPtr<InbandTextTrackPrivate> prpTrack)
+{
+    prpTrack->willBeRemoved();
+}
+
+void HTMLMediaElement::mediaPlayerDidRemoveVideoTrack(PassRefPtr<VideoTrackPrivate> prpTrack)
+{
+    prpTrack->willBeRemoved();
 }
 
 #if USE(PLATFORM_TEXT_TRACK_MENU)
@@ -2924,15 +2964,45 @@ void HTMLMediaElement::closeCaptionTracksChanged()
 #endif
 }
 
-void HTMLMediaElement::addTextTrack(TextTrack* track)
+void HTMLMediaElement::addAudioTrack(PassRefPtr<AudioTrack> track)
+{
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return;
+
+    audioTracks()->append(track);
+}
+
+void HTMLMediaElement::addTextTrack(PassRefPtr<TextTrack> track)
 {
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return;
+
     textTracks()->append(track);
-    
+
     closeCaptionTracksChanged();
 }
 
+void HTMLMediaElement::addVideoTrack(PassRefPtr<VideoTrack> track)
+{
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return;
+
+    videoTracks()->append(track);
+}
+
+void HTMLMediaElement::removeAudioTrack(AudioTrack* track)
+{
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return;
+
+    m_audioTracks->remove(track);
+}
+
 void HTMLMediaElement::removeTextTrack(TextTrack* track)
 {
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return;
+
     TrackDisplayUpdateScope scope(this);
     TextTrackCueList* cues = track->cues();
     if (cues)
@@ -2943,18 +3013,31 @@ void HTMLMediaElement::removeTextTrack(TextTrack* track)
     closeCaptionTracksChanged();
 }
 
-void HTMLMediaElement::removeAllInbandTracks()
+void HTMLMediaElement::removeVideoTrack(VideoTrack* track)
 {
-    if (!m_textTracks)
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
         return;
 
-    TrackDisplayUpdateScope scope(this);
-    for (int i = m_textTracks->length() - 1; i >= 0; --i) {
-        TextTrack* track = m_textTracks->item(i);
+    m_videoTracks->remove(track);
+}
 
-        if (track->trackType() == TextTrack::InBand)
-            removeTextTrack(track);
+void HTMLMediaElement::removeAllInbandTracks()
+{
+    while (m_audioTracks &&  m_audioTracks->length())
+        removeAudioTrack(m_audioTracks->lastItem());
+
+    if (m_textTracks) {
+        TrackDisplayUpdateScope scope(this);
+        for (int i = m_textTracks->length() - 1; i >= 0; --i) {
+            TextTrack* track = m_textTracks->item(i);
+
+            if (track->trackType() == TextTrack::InBand)
+                removeTextTrack(track);
+        }
     }
+
+    while (m_videoTracks &&  m_videoTracks->length())
+        removeVideoTrack(m_videoTracks->lastItem());
 }
 
 PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const String& label, const String& language, ExceptionCode& ec)
@@ -2983,7 +3066,7 @@ PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const S
     // first append the track to the text track list.
 
     // 6. Add the new text track to the media element's list of text tracks.
-    addTextTrack(textTrack.get());
+    addTextTrack(textTrack);
 
     // ... its text track readiness state to the text track loaded state ...
     textTrack->setReadinessState(TextTrack::Loaded);
@@ -2994,6 +3077,17 @@ PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const S
     return textTrack.release();
 }
 
+AudioTrackList* HTMLMediaElement::audioTracks()
+{
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return 0;
+
+    if (!m_audioTracks)
+        m_audioTracks = AudioTrackList::create(this, ActiveDOMObject::scriptExecutionContext());
+
+    return m_audioTracks.get();
+}
+
 TextTrackList* HTMLMediaElement::textTracks() 
 {
     if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
@@ -3005,6 +3099,17 @@ TextTrackList* HTMLMediaElement::textTracks()
     return m_textTracks.get();
 }
 
+VideoTrackList* HTMLMediaElement::videoTracks()
+{
+    if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
+        return 0;
+
+    if (!m_videoTracks)
+        m_videoTracks = VideoTrackList::create(this, ActiveDOMObject::scriptExecutionContext());
+
+    return m_videoTracks.get();
+}
+
 void HTMLMediaElement::didAddTextTrack(HTMLTrackElement* trackElement)
 {
     ASSERT(trackElement->hasTagName(trackTag));
@@ -3020,7 +3125,7 @@ void HTMLMediaElement::didAddTextTrack(HTMLTrackElement* trackElement)
     if (!textTrack)
         return;
     
-    addTextTrack(textTrack.get());
+    addTextTrack(textTrack.release());
     
     // Do not schedule the track loading until parsing finishes so we don't start before all tracks
     // in the markup have been added.
@@ -4922,7 +5027,9 @@ void HTMLMediaElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
     info.addMember(m_mediaSource, "mediaSource");
 #endif
 #if ENABLE(VIDEO_TRACK)
+    info.addMember(m_audioTracks, "audioTracks");
     info.addMember(m_textTracks, "textTracks");
+    info.addMember(m_videoTracks, "videoTracks");
     info.addMember(m_textTracksWhenResourceSelectionBegan, "textTracksWhenResourceSelectionBegan");
     info.addMember(m_cueTree, "cueTree");
     info.addMember(m_currentlyActiveCues, "currentlyActiveCues");
index d085e9d..c769aa0 100644 (file)
 #endif
 
 #if ENABLE(VIDEO_TRACK)
+#include "AudioTrack.h"
 #include "CaptionUserPreferences.h"
 #include "PODIntervalTree.h"
 #include "TextTrack.h"
 #include "TextTrackCue.h"
+#include "VideoTrack.h"
 #endif
 
 namespace WebCore {
@@ -70,8 +72,12 @@ class MediaKeys;
 #endif
 
 #if ENABLE(VIDEO_TRACK)
+class AudioTrackList;
+class AudioTrackPrivate;
 class InbandTextTrackPrivate;
 class TextTrackList;
+class VideoTrackList;
+class VideoTrackPrivate;
 
 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree;
 typedef CueIntervalTree::IntervalType CueInterval;
@@ -84,7 +90,9 @@ typedef Vector<CueInterval> CueList;
 
 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, public MediaPlayerSupportsTypeClient, private MediaCanStartListener, public ActiveDOMObject, public MediaControllerInterface
 #if ENABLE(VIDEO_TRACK)
+    , private AudioTrackClient
     , private TextTrackClient
+    , private VideoTrackClient
 #endif
 #if USE(PLATFORM_TEXT_TRACK_MENU)
     , public PlatformTextTrackMenuClient
@@ -226,11 +234,18 @@ public:
     PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, ExceptionCode& ec) { return addTextTrack(kind, label, emptyString(), ec); }
     PassRefPtr<TextTrack> addTextTrack(const String& kind, ExceptionCode& ec) { return addTextTrack(kind, emptyString(), emptyString(), ec); }
 
+    AudioTrackList* audioTracks();
     TextTrackList* textTracks();
+    VideoTrackList* videoTracks();
+
     CueList currentlyActiveCues() const { return m_currentlyActiveCues; }
 
-    void addTextTrack(TextTrack*);
+    void addAudioTrack(PassRefPtr<AudioTrack>);
+    void addTextTrack(PassRefPtr<TextTrack>);
+    void addVideoTrack(PassRefPtr<VideoTrack>);
+    void removeAudioTrack(AudioTrack*);
     void removeTextTrack(TextTrack*);
+    void removeVideoTrack(VideoTrack*);
     void removeAllInbandTracks();
     void closeCaptionTracksChanged();
     void notifyMediaPlayerOfTextTrackChanges();
@@ -238,8 +253,12 @@ public:
     virtual void didAddTextTrack(HTMLTrackElement*);
     virtual void didRemoveTextTrack(HTMLTrackElement*);
 
+    virtual void mediaPlayerDidAddAudioTrack(PassRefPtr<AudioTrackPrivate>) OVERRIDE;
     virtual void mediaPlayerDidAddTextTrack(PassRefPtr<InbandTextTrackPrivate>) OVERRIDE;
+    virtual void mediaPlayerDidAddVideoTrack(PassRefPtr<VideoTrackPrivate>) OVERRIDE;
+    virtual void mediaPlayerDidRemoveAudioTrack(PassRefPtr<AudioTrackPrivate>) OVERRIDE;
     virtual void mediaPlayerDidRemoveTextTrack(PassRefPtr<InbandTextTrackPrivate>) OVERRIDE;
+    virtual void mediaPlayerDidRemoveVideoTrack(PassRefPtr<VideoTrackPrivate>) OVERRIDE;
 
 #if USE(PLATFORM_TEXT_TRACK_MENU)
     virtual void setSelectedTextTrack(PassRefPtr<PlatformTextTrack>) OVERRIDE;
@@ -275,6 +294,9 @@ public:
     void configureTextTrackDisplay();
     void updateTextTrackDisplay();
 
+    // AudioTrackClient
+    virtual void audioTrackEnabledChanged(AudioTrack*);
+
     // TextTrackClient
     virtual void textTrackReadyStateChanged(TextTrack*);
     virtual void textTrackKindChanged(TextTrack*);
@@ -284,6 +306,9 @@ public:
     virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>);
     virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>);
 
+    // VideoTrackClient
+    virtual void videoTrackSelectedChanged(VideoTrack*);
+
     bool requiresTextTrackRepresentation() const;
     void setTextTrackRepresentation(TextTrackRepresentation*);
 #endif
@@ -699,7 +724,9 @@ private:
 
     CaptionUserPreferences::CaptionDisplayMode m_captionDisplayMode;
 
+    RefPtr<AudioTrackList> m_audioTracks;
     RefPtr<TextTrackList> m_textTracks;
+    RefPtr<VideoTrackList> m_videoTracks;
     Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan;
 
     CueIntervalTree m_cueTree;
index ced4174..05bc2dd 100644 (file)
@@ -116,7 +116,9 @@ void webkitCancelKeyRequest(in [TreatNullAs=NullString, TreatUndefinedAs=NullStr
 #if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK
 TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language)
     raises (DOMException);
+readonly attribute AudioTrackList audioTracks;
 readonly attribute TextTrackList textTracks;
+readonly attribute VideoTrackList videoTracks;
 #endif
 
 [Reflect, TreatNullAs=NullString] attribute DOMString mediaGroup;
diff --git a/Source/WebCore/html/track/AudioTrack.cpp b/Source/WebCore/html/track/AudioTrack.cpp
new file mode 100644 (file)
index 0000000..db51dd8
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2011 Google Inc.  All rights reserved.
+ * Copyright (C) 2011, 2012, 2013 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "AudioTrack.h"
+
+#include "AudioTrackList.h"
+#include "Event.h"
+#include "ExceptionCode.h"
+#include "HTMLMediaElement.h"
+#include "TrackBase.h"
+
+namespace WebCore {
+
+const AtomicString& AudioTrack::alternativeKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, alternative, ("alternative", AtomicString::ConstructFromLiteral));
+    return alternative;
+}
+
+const AtomicString& AudioTrack::descriptionKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, description, ("description", AtomicString::ConstructFromLiteral));
+    return description;
+}
+
+const AtomicString& AudioTrack::mainKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, main, ("main", AtomicString::ConstructFromLiteral));
+    return main;
+}
+
+const AtomicString& AudioTrack::mainDescKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, mainDesc, ("main-desc", AtomicString::ConstructFromLiteral));
+    return mainDesc;
+}
+
+const AtomicString& AudioTrack::translationKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, translation, ("translation", AtomicString::ConstructFromLiteral));
+    return translation;
+}
+
+const AtomicString& AudioTrack::commentaryKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, commentary, ("commentary", AtomicString::ConstructFromLiteral));
+    return commentary;
+}
+
+AudioTrack::AudioTrack(AudioTrackClient* client, PassRefPtr<AudioTrackPrivate> trackPrivate)
+    : TrackBase(TrackBase::AudioTrack, trackPrivate->label(), trackPrivate->language())
+    , m_id(trackPrivate->id())
+    , m_enabled(trackPrivate->enabled())
+    , m_client(client)
+    , m_private(trackPrivate)
+{
+    m_private->setClient(this);
+
+    switch (m_private->kind()) {
+    case AudioTrackPrivate::Alternative:
+        setKind(AudioTrack::alternativeKeyword());
+        break;
+    case AudioTrackPrivate::Description:
+        setKind(AudioTrack::descriptionKeyword());
+        break;
+    case AudioTrackPrivate::Main:
+        setKind(AudioTrack::mainKeyword());
+        break;
+    case AudioTrackPrivate::MainDesc:
+        setKind(AudioTrack::mainDescKeyword());
+        break;
+    case AudioTrackPrivate::Translation:
+        setKind(AudioTrack::translationKeyword());
+        break;
+    case AudioTrackPrivate::Commentary:
+        setKind(AudioTrack::commentaryKeyword());
+        break;
+    case AudioTrackPrivate::None:
+        setKind(emptyString());
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+}
+
+AudioTrack::~AudioTrack()
+{
+    m_private->setClient(0);
+}
+
+bool AudioTrack::isValidKind(const AtomicString& value) const
+{
+    if (value == alternativeKeyword())
+        return true;
+    if (value == descriptionKeyword())
+        return true;
+    if (value == mainKeyword())
+        return true;
+    if (value == mainDescKeyword())
+        return true;
+    if (value == translationKeyword())
+        return true;
+    if (value == commentaryKeyword())
+        return true;
+
+    return false;
+}
+
+void AudioTrack::setEnabled(const bool enabled)
+{
+    if (m_enabled == enabled)
+        return;
+
+    m_enabled = enabled;
+
+    if (m_client)
+        m_client->audioTrackEnabledChanged(this);
+}
+
+size_t AudioTrack::inbandTrackIndex()
+{
+    ASSERT(m_private);
+    return m_private->audioTrackIndex();
+}
+
+void AudioTrack::willRemoveAudioTrackPrivate(AudioTrackPrivate* trackPrivate)
+{
+    UNUSED_PARAM(trackPrivate);
+    ASSERT(trackPrivate == m_private);
+    mediaElement()->removeAudioTrack(this);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/html/track/AudioTrack.h b/Source/WebCore/html/track/AudioTrack.h
new file mode 100644 (file)
index 0000000..053ecb6
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012, 2013 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AudioTrack_h
+#define AudioTrack_h
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "AudioTrackPrivate.h"
+#include "ExceptionCode.h"
+#include "TrackBase.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class AudioTrack;
+
+class AudioTrackClient {
+public:
+    virtual ~AudioTrackClient() { }
+    virtual void audioTrackEnabledChanged(AudioTrack*) = 0;
+};
+
+class AudioTrack : public TrackBase, public AudioTrackPrivateClient {
+public:
+    static PassRefPtr<AudioTrack> create(AudioTrackClient* client, PassRefPtr<AudioTrackPrivate> trackPrivate)
+    {
+        return adoptRef(new AudioTrack(client, trackPrivate));
+    }
+    virtual ~AudioTrack();
+
+    AtomicString id() const { return m_id; }
+    void setId(const AtomicString& id) { m_id = id; }
+
+    static const AtomicString& alternativeKeyword();
+    static const AtomicString& descriptionKeyword();
+    static const AtomicString& mainKeyword();
+    static const AtomicString& mainDescKeyword();
+    static const AtomicString& translationKeyword();
+    static const AtomicString& commentaryKeyword();
+    virtual const AtomicString& defaultKindKeyword() const OVERRIDE { return emptyAtom; }
+
+    bool enabled() const { return m_enabled; }
+    virtual void setEnabled(const bool);
+
+    virtual void clearClient() OVERRIDE { m_client = 0; }
+    AudioTrackClient* client() const { return m_client; }
+
+    size_t inbandTrackIndex();
+
+protected:
+    AudioTrack(AudioTrackClient*, PassRefPtr<AudioTrackPrivate>);
+
+private:
+    virtual bool isValidKind(const AtomicString&) const OVERRIDE;
+    virtual void willRemoveAudioTrackPrivate(AudioTrackPrivate*) OVERRIDE;
+
+    AtomicString m_id;
+    bool m_enabled;
+    AudioTrackClient* m_client;
+
+    RefPtr<AudioTrackPrivate> m_private;
+};
+
+inline AudioTrack* toAudioTrack(TrackBase* track)
+{
+    ASSERT(track->type() == TrackBase::AudioTrack);
+    return static_cast<AudioTrack*>(track);
+}
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/Source/WebCore/html/track/AudioTrack.idl b/Source/WebCore/html/track/AudioTrack.idl
new file mode 100644 (file)
index 0000000..a68f967
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2011 Google Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+[
+    Conditional=VIDEO_TRACK,
+    GenerateIsReachable=ImplElementRoot,
+    JSCustomMarkFunction
+] interface AudioTrack {
+    readonly attribute DOMString id;
+    readonly attribute DOMString kind;
+    readonly attribute DOMString label;
+    readonly attribute DOMString language;
+
+    attribute boolean enabled;
+};
diff --git a/Source/WebCore/html/track/AudioTrackList.cpp b/Source/WebCore/html/track/AudioTrackList.cpp
new file mode 100644 (file)
index 0000000..682ff8e
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2011, 2012 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "AudioTrackList.h"
+
+#include "AudioTrack.h"
+#include "EventNames.h"
+
+using namespace WebCore;
+
+AudioTrackList::AudioTrackList(HTMLMediaElement* element, ScriptExecutionContext* context)
+    : TrackListBase(element, context)
+{
+}
+
+AudioTrackList::~AudioTrackList()
+{
+}
+
+void AudioTrackList::append(PassRefPtr<AudioTrack> prpTrack)
+{
+    RefPtr<AudioTrack> track = prpTrack;
+
+    // Insert tracks in the media file order.
+    size_t index = track->inbandTrackIndex();
+    m_inbandTracks.insert(index, track);
+
+    ASSERT(!track->mediaElement() || track->mediaElement() == mediaElement());
+    track->setMediaElement(mediaElement());
+
+    scheduleAddTrackEvent(track.release());
+}
+
+AudioTrack* AudioTrackList::item(unsigned index) const
+{
+    if (index < m_inbandTracks.size())
+        return toAudioTrack(m_inbandTracks[index].get());
+
+    return 0;
+}
+
+AudioTrack* AudioTrackList::getTrackById(const AtomicString& id) const
+{
+    for (size_t i = 0; i < m_inbandTracks.size(); ++i) {
+        AudioTrack* track = toAudioTrack(m_inbandTracks[i].get());
+        if (track->id() == id)
+            return track;
+    }
+    return 0;
+}
+
+const AtomicString& AudioTrackList::interfaceName() const
+{
+    return eventNames().interfaceForAudioTrackList;
+}
+
+#endif
diff --git a/Source/WebCore/html/track/AudioTrackList.h b/Source/WebCore/html/track/AudioTrackList.h
new file mode 100644 (file)
index 0000000..28593c3
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011, 2012 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef AudioTrackList_h
+#define AudioTrackList_h
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "TrackListBase.h"
+
+namespace WebCore {
+
+class AudioTrack;
+
+class AudioTrackList : public TrackListBase {
+public:
+    static PassRefPtr<AudioTrackList> create(HTMLMediaElement* owner, ScriptExecutionContext* context)
+    {
+        return adoptRef(new AudioTrackList(owner, context));
+    }
+    ~AudioTrackList();
+
+    AudioTrack* getTrackById(const AtomicString&) const;
+
+    AudioTrack* item(unsigned index) const;
+    AudioTrack* lastItem() const { return item(length() - 1); }
+    void append(PassRefPtr<AudioTrack>);
+
+    // EventTarget
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+
+private:
+    AudioTrackList(HTMLMediaElement*, ScriptExecutionContext*);
+};
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/Source/WebCore/html/track/AudioTrackList.idl b/Source/WebCore/html/track/AudioTrackList.idl
new file mode 100644 (file)
index 0000000..157b8f3
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2011 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+[
+    Conditional=VIDEO_TRACK,
+    GenerateIsReachable=ImplElementRoot,
+    IndexedGetter,
+    EventTarget,
+    JSCustomMarkFunction
+] interface AudioTrackList {
+    readonly attribute unsigned long length;
+    AudioTrack item(in unsigned long index);
+    AudioTrack getTrackById(in DOMString id);
+
+    attribute EventListener onchange;
+    attribute EventListener onaddtrack;
+    attribute EventListener onremovetrack;
+
+    void addEventListener(in DOMString type,
+                          in EventListener listener,
+                          in [Optional] boolean useCapture);
+    void removeEventListener(in DOMString type,
+                             in EventListener listener,
+                             in [Optional] boolean useCapture);
+    boolean dispatchEvent(in Event evt)
+        raises(EventException);
+};
+
index 6d7e379..c79c382 100644 (file)
@@ -263,7 +263,14 @@ void InbandTextTrack::removeCue(TextTrackCue* cue, ExceptionCode& ec)
     m_cueMap.remove(static_cast<TextTrackCueGeneric*>(cue));
     TextTrack::removeCue(cue, ec);
 }
-    
+
+void InbandTextTrack::willRemoveTextTrackPrivate(InbandTextTrackPrivate* trackPrivate)
+{
+    UNUSED_PARAM(trackPrivate);
+    ASSERT(trackPrivate == m_private);
+    mediaElement()->removeTextTrack(this);
+}
+
 } // namespace WebCore
 
 #endif
index 369a857..f029237 100644 (file)
@@ -80,6 +80,7 @@ private:
     virtual void updateGenericCue(InbandTextTrackPrivate*, GenericCueData*) OVERRIDE;
     virtual void removeGenericCue(InbandTextTrackPrivate*, GenericCueData*) OVERRIDE;
     virtual void removeCue(TextTrackCue*, ExceptionCode&) OVERRIDE;
+    virtual void willRemoveTextTrackPrivate(InbandTextTrackPrivate*) OVERRIDE;
 
     PassRefPtr<TextTrackCueGeneric> createCue(PassRefPtr<GenericCueData>);
     void updateCueFromCueData(TextTrackCueGeneric*, GenericCueData*);
index 3dfb977..2419bb6 100644 (file)
@@ -72,6 +72,11 @@ void LoadableTextTrack::scheduleLoad(const KURL& url)
         m_loadTimer.startOneShot(0);
 }
 
+Element* LoadableTextTrack::element()
+{
+    return m_trackElement;
+}
+
 void LoadableTextTrack::loadTimerFired(Timer<LoadableTextTrack>*)
 {
     if (m_loader)
index 324eb32..7d978df 100644 (file)
@@ -60,6 +60,7 @@ public:
 
     size_t trackElementIndex();
     HTMLTrackElement* trackElement() { return m_trackElement; }
+    virtual Element* element() OVERRIDE;
 
     virtual bool isDefault() const OVERRIDE { return m_isDefault; }
     virtual void setIsDefault(bool isDefault) OVERRIDE  { m_isDefault = isDefault; }
index 6717fe6..90d0268 100644 (file)
@@ -26,8 +26,8 @@
 [
     Conditional=VIDEO_TRACK,
     EventTarget,
+    GenerateIsReachable=ImplElementRoot,
     JSCustomMarkFunction,
-    CustomIsReachable,
     SkipVTableValidation
 ] interface TextTrack {
     readonly attribute DOMString kind;
index 5c35dda..2e9d909 100644 (file)
@@ -30,6 +30,7 @@
 #include "TextTrackList.h"
 
 #include "EventNames.h"
+#include "HTMLMediaElement.h"
 #include "InbandTextTrack.h"
 #include "InbandTextTrackPrivate.h"
 #include "LoadableTextTrack.h"
@@ -37,8 +38,8 @@
 
 using namespace WebCore;
 
-TextTrackList::TextTrackList(HTMLMediaElement* owner, ScriptExecutionContext* context)
-    : TrackListBase(owner, context)
+TextTrackList::TextTrackList(HTMLMediaElement* element, ScriptExecutionContext* context)
+    : TrackListBase(element, context)
 {
 }
 
@@ -173,8 +174,8 @@ void TextTrackList::append(PassRefPtr<TextTrack> prpTrack)
 
     invalidateTrackIndexesAfterTrack(track.get());
 
-    ASSERT(!track->mediaElement() || track->mediaElement() == element());
-    track->setMediaElement(element());
+    ASSERT(!track->mediaElement() || track->mediaElement() == mediaElement());
+    track->setMediaElement(mediaElement());
 
     scheduleAddTrackEvent(track.release());
 }
index e36df66..3c01d26 100644 (file)
@@ -52,7 +52,7 @@ public:
     virtual void remove(TrackBase*) OVERRIDE;
 
     // EventTarget
-    virtual const AtomicString& interfaceName() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
 
 private:
     TextTrackList(HTMLMediaElement*, ScriptExecutionContext*);
index d74d949..9038454 100644 (file)
 
 [
     Conditional=VIDEO_TRACK,
+    GenerateIsReachable=ImplElementRoot,
     IndexedGetter,
     EventTarget,
-    JSCustomMarkFunction,
-    CustomIsReachable
+    JSCustomMarkFunction
 ] interface TextTrackList {
     readonly attribute unsigned long length;
     TextTrack item(in unsigned long index);
index de4e385..b928a73 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "TrackBase.h"
 
+#include "HTMLMediaElement.h"
+
 #if ENABLE(VIDEO_TRACK)
 
 namespace WebCore {
@@ -43,6 +45,11 @@ TrackBase::~TrackBase()
 {
 }
 
+Element* TrackBase::element()
+{
+    return m_mediaElement;
+}
+
 void TrackBase::setKind(const AtomicString& kind)
 {
     String oldKind = m_kind;
index 5462898..a81ce31 100644 (file)
@@ -33,6 +33,7 @@
 
 namespace WebCore {
 
+class Element;
 class HTMLMediaElement;
 
 class TrackBase : public RefCounted<TrackBase> {
@@ -44,6 +45,7 @@ public:
 
     void setMediaElement(HTMLMediaElement* element) { m_mediaElement = element; }
     HTMLMediaElement* mediaElement() { return m_mediaElement; }
+    virtual Element* element();
 
     AtomicString kind() const { return m_kind; }
     virtual void setKind(const AtomicString&);
index 2a7104e..229097f 100644 (file)
@@ -50,6 +50,11 @@ TrackListBase::~TrackListBase()
 {
 }
 
+Element* TrackListBase::element() const
+{
+    return m_element;
+}
+
 unsigned TrackListBase::length() const
 {
     return m_inbandTracks.size();
index a46de01..9b51b65 100644 (file)
@@ -38,6 +38,7 @@
 namespace WebCore {
 
 class HTMLMediaElement;
+class Element;
 class TrackBase;
 
 class TrackListBase : public RefCounted<TrackListBase>, public EventTarget {
@@ -59,7 +60,8 @@ public:
     DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack);
 
     void clearElement() { m_element = 0; }
-    HTMLMediaElement* element() const { return m_element; }
+    Element* element() const;
+    HTMLMediaElement* mediaElement() const { return m_element; }
 
     bool isFiringEventListeners() { return m_dispatchingEvents; }
 
diff --git a/Source/WebCore/html/track/VideoTrack.cpp b/Source/WebCore/html/track/VideoTrack.cpp
new file mode 100644 (file)
index 0000000..cfa0826
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2011 Google Inc.  All rights reserved.
+ * Copyright (C) 2011, 2012, 2013 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "VideoTrack.h"
+
+#include "Event.h"
+#include "ExceptionCode.h"
+#include "HTMLMediaElement.h"
+#include "TrackBase.h"
+#include "VideoTrackList.h"
+
+namespace WebCore {
+
+const AtomicString& VideoTrack::alternativeKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, alternative, ("alternative", AtomicString::ConstructFromLiteral));
+    return alternative;
+}
+
+const AtomicString& VideoTrack::captionsKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, captions, ("captions", AtomicString::ConstructFromLiteral));
+    return captions;
+}
+
+const AtomicString& VideoTrack::mainKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, captions, ("main", AtomicString::ConstructFromLiteral));
+    return captions;
+}
+
+const AtomicString& VideoTrack::signKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, sign, ("sign", AtomicString::ConstructFromLiteral));
+    return sign;
+}
+
+const AtomicString& VideoTrack::subtitlesKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, subtitles, ("subtitles", AtomicString::ConstructFromLiteral));
+    return subtitles;
+}
+
+const AtomicString& VideoTrack::commentaryKeyword()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, commentary, ("commentary", AtomicString::ConstructFromLiteral));
+    return commentary;
+}
+
+VideoTrack::VideoTrack(VideoTrackClient* client, PassRefPtr<VideoTrackPrivate> trackPrivate)
+    : TrackBase(TrackBase::VideoTrack, trackPrivate->label(), trackPrivate->language())
+    , m_id(trackPrivate->id())
+    , m_selected(trackPrivate->selected())
+    , m_client(client)
+    , m_private(trackPrivate)
+{
+    m_private->setClient(this);
+
+    switch (m_private->kind()) {
+    case VideoTrackPrivate::Alternative:
+        setKind(VideoTrack::alternativeKeyword());
+        break;
+    case VideoTrackPrivate::Captions:
+        setKind(VideoTrack::captionsKeyword());
+        break;
+    case VideoTrackPrivate::Main:
+        setKind(VideoTrack::mainKeyword());
+        break;
+    case VideoTrackPrivate::Sign:
+        setKind(VideoTrack::signKeyword());
+        break;
+    case VideoTrackPrivate::Subtitles:
+        setKind(VideoTrack::subtitlesKeyword());
+        break;
+    case VideoTrackPrivate::Commentary:
+        setKind(VideoTrack::commentaryKeyword());
+        break;
+    case VideoTrackPrivate::None:
+        setKind(emptyString());
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+}
+
+VideoTrack::~VideoTrack()
+{
+    m_private->setClient(0);
+}
+
+bool VideoTrack::isValidKind(const AtomicString& value) const
+{
+    if (value == alternativeKeyword())
+        return true;
+    if (value == captionsKeyword())
+        return true;
+    if (value == mainKeyword())
+        return true;
+    if (value == signKeyword())
+        return true;
+    if (value == subtitlesKeyword())
+        return true;
+    if (value == commentaryKeyword())
+        return true;
+
+    return false;
+}
+
+void VideoTrack::setSelected(const bool selected)
+{
+    if (m_selected == selected)
+        return;
+
+    m_selected = selected;
+
+    if (m_client)
+        m_client->videoTrackSelectedChanged(this);
+}
+
+size_t VideoTrack::inbandTrackIndex()
+{
+    ASSERT(m_private);
+    return m_private->videoTrackIndex();
+}
+
+void VideoTrack::willRemoveVideoTrackPrivate(VideoTrackPrivate* trackPrivate)
+{
+    UNUSED_PARAM(trackPrivate);
+    ASSERT(trackPrivate == m_private);
+    mediaElement()->removeVideoTrack(this);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/html/track/VideoTrack.h b/Source/WebCore/html/track/VideoTrack.h
new file mode 100644 (file)
index 0000000..f091e3b
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012, 2013 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VideoTrack_h
+#define VideoTrack_h
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "ExceptionCode.h"
+#include "TrackBase.h"
+#include "VideoTrackPrivate.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class VideoTrack;
+
+class VideoTrackClient {
+public:
+    virtual ~VideoTrackClient() { }
+    virtual void videoTrackSelectedChanged(VideoTrack*) = 0;
+};
+
+class VideoTrack : public TrackBase, public VideoTrackPrivateClient {
+public:
+    static PassRefPtr<VideoTrack> create(VideoTrackClient* client, PassRefPtr<VideoTrackPrivate> trackPrivate)
+    {
+        return adoptRef(new VideoTrack(client, trackPrivate));
+    }
+    virtual ~VideoTrack();
+
+    AtomicString id() const { return m_id; }
+    void setId(const AtomicString& id) { m_id = id; }
+
+    static const AtomicString& alternativeKeyword();
+    static const AtomicString& captionsKeyword();
+    static const AtomicString& mainKeyword();
+    static const AtomicString& signKeyword();
+    static const AtomicString& subtitlesKeyword();
+    static const AtomicString& commentaryKeyword();
+    virtual const AtomicString& defaultKindKeyword() const OVERRIDE { return emptyAtom; }
+
+    bool selected() const { return m_selected; }
+    virtual void setSelected(const bool);
+
+    virtual void clearClient() OVERRIDE { m_client = 0; }
+    VideoTrackClient* client() const { return m_client; }
+
+    size_t inbandTrackIndex();
+
+protected:
+    VideoTrack(VideoTrackClient*, PassRefPtr<VideoTrackPrivate> privateTrack);
+
+private:
+    virtual bool isValidKind(const AtomicString&) const OVERRIDE;
+    virtual void willRemoveVideoTrackPrivate(VideoTrackPrivate*) OVERRIDE;
+
+    AtomicString m_id;
+    bool m_selected;
+    VideoTrackClient* m_client;
+
+    RefPtr<VideoTrackPrivate> m_private;
+};
+
+inline VideoTrack* toVideoTrack(TrackBase* track)
+{
+    ASSERT(track->type() == TrackBase::VideoTrack);
+    return static_cast<VideoTrack*>(track);
+}
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/Source/WebCore/html/track/VideoTrack.idl b/Source/WebCore/html/track/VideoTrack.idl
new file mode 100644 (file)
index 0000000..8e37681
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2011 Google Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+[
+    Conditional=VIDEO_TRACK,
+    GenerateIsReachable=ImplElementRoot,
+    JSCustomMarkFunction
+] interface VideoTrack {
+    readonly attribute DOMString id;
+    readonly attribute DOMString kind;
+    readonly attribute DOMString label;
+    readonly attribute DOMString language;
+
+    attribute boolean selected;
+};
diff --git a/Source/WebCore/html/track/VideoTrackList.cpp b/Source/WebCore/html/track/VideoTrackList.cpp
new file mode 100644 (file)
index 0000000..b3b43b5
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2011, 2012 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "VideoTrackList.h"
+
+#include "EventNames.h"
+#include "VideoTrack.h"
+
+using namespace WebCore;
+
+VideoTrackList::VideoTrackList(HTMLMediaElement* element, ScriptExecutionContext* context)
+    : TrackListBase(element, context)
+{
+}
+
+VideoTrackList::~VideoTrackList()
+{
+}
+
+void VideoTrackList::append(PassRefPtr<VideoTrack> prpTrack)
+{
+    RefPtr<VideoTrack> track = prpTrack;
+
+    // Insert tracks in the media file order.
+    size_t index = track->inbandTrackIndex();
+    m_inbandTracks.insert(index, track);
+
+    ASSERT(!track->mediaElement() || track->mediaElement() == mediaElement());
+    track->setMediaElement(mediaElement());
+
+    scheduleAddTrackEvent(track.release());
+}
+
+VideoTrack* VideoTrackList::item(unsigned index) const
+{
+    if (index < m_inbandTracks.size())
+        return toVideoTrack(m_inbandTracks[index].get());
+
+    return 0;
+}
+
+VideoTrack* VideoTrackList::getTrackById(const AtomicString& id) const
+{
+    for (size_t i = 0; i < length(); ++i) {
+        VideoTrack* track = toVideoTrack(m_inbandTracks[i].get());
+        if (track->id() == id)
+            return track;
+    }
+    return 0;
+}
+
+long VideoTrackList::selectedIndex() const
+{
+    // 4.8.10.10.1 AudioTrackList and VideoTrackList objects
+    // The VideoTrackList.selectedIndex attribute must return the index of the
+    // currently selected track, if any. If the VideoTrackList object does not
+    // currently represent any tracks, or if none of the tracks are selected,
+    // it must instead return −1.
+    for (size_t i = 0; i < length(); ++i) {
+        VideoTrack* track = toVideoTrack(m_inbandTracks[i].get());
+        if (track->selected())
+            return i;
+    }
+    return -1;
+}
+
+const AtomicString& VideoTrackList::interfaceName() const
+{
+    return eventNames().interfaceForVideoTrackList;
+}
+
+#endif
diff --git a/Source/WebCore/html/track/VideoTrackList.h b/Source/WebCore/html/track/VideoTrackList.h
new file mode 100644 (file)
index 0000000..19729f6
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011, 2012 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef VideoTrackList_h
+#define VideoTrackList_h
+
+#if ENABLE(VIDEO_TRACK)
+
+#include "TrackListBase.h"
+
+namespace WebCore {
+
+class VideoTrack;
+
+class VideoTrackList : public TrackListBase {
+public:
+    static PassRefPtr<VideoTrackList> create(HTMLMediaElement* owner, ScriptExecutionContext* context)
+    {
+        return adoptRef(new VideoTrackList(owner, context));
+    }
+    ~VideoTrackList();
+
+    VideoTrack* getTrackById(const AtomicString&) const;
+    long selectedIndex() const;
+
+    VideoTrack* item(unsigned) const;
+    VideoTrack* lastItem() const { return item(length() - 1); }
+    void append(PassRefPtr<VideoTrack>);
+
+    // EventTarget
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+
+private:
+    VideoTrackList(HTMLMediaElement*, ScriptExecutionContext*);
+
+};
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/Source/WebCore/html/track/VideoTrackList.idl b/Source/WebCore/html/track/VideoTrackList.idl
new file mode 100644 (file)
index 0000000..defb95e
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2011 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+[
+    Conditional=VIDEO_TRACK,
+    GenerateIsReachable=ImplElementRoot,
+    IndexedGetter,
+    EventTarget,
+    JSCustomMarkFunction
+] interface VideoTrackList {
+    readonly attribute unsigned long length;
+    VideoTrack item(in unsigned long index);
+    VideoTrack getTrackById(in DOMString id);
+
+    attribute EventListener onchange;
+    attribute EventListener onaddtrack;
+    attribute EventListener onremovetrack;
+
+    void addEventListener(in DOMString type,
+                          in EventListener listener,
+                          in [Optional] boolean useCapture);
+    void removeEventListener(in DOMString type,
+                             in EventListener listener,
+                             in [Optional] boolean useCapture);
+    boolean dispatchEvent(in Event evt)
+        raises(EventException);
+};
+
diff --git a/Source/WebCore/platform/graphics/AudioTrackPrivate.h b/Source/WebCore/platform/graphics/AudioTrackPrivate.h
new file mode 100644 (file)
index 0000000..afd917a
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AudioTrackPrivate_h
+#define AudioTrackPrivate_h
+
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/AtomicString.h>
+
+#if ENABLE(VIDEO_TRACK)
+
+namespace WebCore {
+
+class AudioTrackPrivate;
+
+class AudioTrackPrivateClient {
+public:
+    virtual ~AudioTrackPrivateClient() { }
+    virtual void willRemoveAudioTrackPrivate(AudioTrackPrivate*) = 0;
+};
+
+class AudioTrackPrivate : public RefCounted<AudioTrackPrivate> {
+    WTF_MAKE_NONCOPYABLE(AudioTrackPrivate); WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PassRefPtr<AudioTrackPrivate> create()
+    {
+        return adoptRef(new AudioTrackPrivate());
+    }
+    virtual ~AudioTrackPrivate() { }
+
+    void setClient(AudioTrackPrivateClient* client) { m_client = client; }
+    AudioTrackPrivateClient* client() { return m_client; }
+
+    virtual void setEnabled(bool enabled) { m_enabled = enabled; };
+    virtual bool enabled() const { return m_enabled; }
+
+    enum Kind { Alternative, Description, Main, MainDesc, Translation, Commentary, None };
+    virtual Kind kind() const { return None; }
+
+    virtual AtomicString id() const { return emptyAtom; }
+    virtual AtomicString label() const { return emptyAtom; }
+    virtual AtomicString language() const { return emptyAtom; }
+
+    virtual int audioTrackIndex() const { return 0; }
+
+    void willBeRemoved()
+    {
+        if (m_client)
+            m_client->willRemoveAudioTrackPrivate(this);
+    }
+
+protected:
+    AudioTrackPrivate()
+        : m_enabled(false)
+    {
+    }
+
+private:
+    AudioTrackPrivateClient* m_client;
+    bool m_enabled;
+};
+
+} // namespace WebCore
+
+#endif
+#endif
index 3eeccfa..4d41629 100644 (file)
 #ifndef InbandTextTrackPrivate_h
 #define InbandTextTrackPrivate_h
 
+#if ENABLE(VIDEO_TRACK)
+
+#include "InbandTextTrackPrivateClient.h"
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/AtomicString.h>
 
-#if ENABLE(VIDEO_TRACK)
-
 namespace WebCore {
 
-class InbandTextTrackPrivateClient;
-
 class InbandTextTrackPrivate : public RefCounted<InbandTextTrackPrivate> {
     WTF_MAKE_NONCOPYABLE(InbandTextTrackPrivate); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -78,6 +77,12 @@ public:
 
     virtual int textTrackIndex() const { return 0; }
 
+    void willBeRemoved()
+    {
+        if (m_client)
+            m_client->willRemoveTextTrackPrivate(this);
+    }
+
 protected:
     InbandTextTrackPrivate()
         : m_client(0)
index 4c84aac..0d40ad3 100644 (file)
@@ -128,10 +128,12 @@ private:
 class InbandTextTrackPrivateClient {
 public:
     virtual ~InbandTextTrackPrivateClient() { }
-    
+
     virtual void addGenericCue(InbandTextTrackPrivate*, PassRefPtr<GenericCueData>) = 0;
     virtual void updateGenericCue(InbandTextTrackPrivate*, GenericCueData*) = 0;
     virtual void removeGenericCue(InbandTextTrackPrivate*, GenericCueData*) = 0;
+
+    virtual void willRemoveTextTrackPrivate(InbandTextTrackPrivate*) = 0;
 };
 
 } // namespace WebCore
index 87e9425..c523858 100644 (file)
@@ -1103,6 +1103,22 @@ CachedResourceLoader* MediaPlayer::cachedResourceLoader()
 }
 
 #if ENABLE(VIDEO_TRACK)
+void MediaPlayer::addAudioTrack(PassRefPtr<AudioTrackPrivate> track)
+{
+    if (!m_mediaPlayerClient)
+        return;
+
+    m_mediaPlayerClient->mediaPlayerDidAddAudioTrack(track);
+}
+
+void MediaPlayer::removeAudioTrack(PassRefPtr<AudioTrackPrivate> track)
+{
+    if (!m_mediaPlayerClient)
+        return;
+
+    m_mediaPlayerClient->mediaPlayerDidRemoveAudioTrack(track);
+}
+
 void MediaPlayer::addTextTrack(PassRefPtr<InbandTextTrackPrivate> track)
 {
     if (!m_mediaPlayerClient)
@@ -1119,6 +1135,22 @@ void MediaPlayer::removeTextTrack(PassRefPtr<InbandTextTrackPrivate> track)
     m_mediaPlayerClient->mediaPlayerDidRemoveTextTrack(track);
 }
 
+void MediaPlayer::addVideoTrack(PassRefPtr<VideoTrackPrivate> track)
+{
+    if (!m_mediaPlayerClient)
+        return;
+
+    m_mediaPlayerClient->mediaPlayerDidAddVideoTrack(track);
+}
+
+void MediaPlayer::removeVideoTrack(PassRefPtr<VideoTrackPrivate> track)
+{
+    if (!m_mediaPlayerClient)
+        return;
+
+    m_mediaPlayerClient->mediaPlayerDidRemoveVideoTrack(track);
+}
+
 bool MediaPlayer::requiresTextTrackRepresentation() const
 {
     return m_private->requiresTextTrackRepresentation();
index e0067a5..715aa11 100644 (file)
 #include "MediaPlayerProxy.h"
 #endif
 
+#include "AudioTrackPrivate.h"
 #include "InbandTextTrackPrivate.h"
 #include "IntRect.h"
 #include "KURL.h"
 #include "LayoutRect.h"
 #include "Timer.h"
+#include "VideoTrackPrivate.h"
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
 #include <wtf/OwnPtr.h>
@@ -218,8 +220,12 @@ public:
     virtual CachedResourceLoader* mediaPlayerCachedResourceLoader() { return 0; }
 
 #if ENABLE(VIDEO_TRACK)
+    virtual void mediaPlayerDidAddAudioTrack(PassRefPtr<AudioTrackPrivate>) { }
     virtual void mediaPlayerDidAddTextTrack(PassRefPtr<InbandTextTrackPrivate>) { }
+    virtual void mediaPlayerDidAddVideoTrack(PassRefPtr<VideoTrackPrivate>) { }
+    virtual void mediaPlayerDidRemoveAudioTrack(PassRefPtr<AudioTrackPrivate>) { }
     virtual void mediaPlayerDidRemoveTextTrack(PassRefPtr<InbandTextTrackPrivate>) { }
+    virtual void mediaPlayerDidRemoveVideoTrack(PassRefPtr<VideoTrackPrivate>) { }
 
     virtual void textTrackRepresentationBoundsChanged(const IntRect&) { }
     virtual void paintTextTrackRepresentation(GraphicsContext*, const IntRect&) { }
@@ -450,8 +456,12 @@ public:
     CachedResourceLoader* cachedResourceLoader();
 
 #if ENABLE(VIDEO_TRACK)
+    void addAudioTrack(PassRefPtr<AudioTrackPrivate>);
     void addTextTrack(PassRefPtr<InbandTextTrackPrivate>);
+    void addVideoTrack(PassRefPtr<VideoTrackPrivate>);
+    void removeAudioTrack(PassRefPtr<AudioTrackPrivate>);
     void removeTextTrack(PassRefPtr<InbandTextTrackPrivate>);
+    void removeVideoTrack(PassRefPtr<VideoTrackPrivate>);
 
     bool requiresTextTrackRepresentation() const;
     void setTextTrackRepresentation(TextTrackRepresentation*);
diff --git a/Source/WebCore/platform/graphics/VideoTrackPrivate.h b/Source/WebCore/platform/graphics/VideoTrackPrivate.h
new file mode 100644 (file)
index 0000000..b151684
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VideoTrackPrivate_h
+#define VideoTrackPrivate_h
+
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/AtomicString.h>
+
+#if ENABLE(VIDEO_TRACK)
+
+namespace WebCore {
+
+class VideoTrackPrivate;
+
+class VideoTrackPrivateClient {
+public:
+    virtual ~VideoTrackPrivateClient() { }
+    virtual void willRemoveVideoTrackPrivate(VideoTrackPrivate*) = 0;
+};
+
+class VideoTrackPrivate : public RefCounted<VideoTrackPrivate> {
+    WTF_MAKE_NONCOPYABLE(VideoTrackPrivate); WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PassRefPtr<VideoTrackPrivate> create()
+    {
+        return adoptRef(new VideoTrackPrivate());
+    }
+    virtual ~VideoTrackPrivate() { }
+
+    void setClient(VideoTrackPrivateClient* client) { m_client = client; }
+    VideoTrackPrivateClient* client() { return m_client; }
+
+    virtual void setSelected(bool selected) { m_selected = selected; };
+    virtual bool selected() const { return m_selected; }
+
+    enum Kind { Alternative, Captions, Main, Sign, Subtitles, Commentary, None };
+    virtual Kind kind() const { return None; }
+
+    virtual AtomicString id() const { return emptyAtom; }
+    virtual AtomicString label() const { return emptyAtom; }
+    virtual AtomicString language() const { return emptyAtom; }
+
+    virtual int videoTrackIndex() const { return 0; }
+
+    void willBeRemoved()
+    {
+        if (m_client)
+            m_client->willRemoveVideoTrackPrivate(this);
+    }
+
+protected:
+    VideoTrackPrivate()
+        : m_selected(false)
+    {
+    }
+
+private:
+    VideoTrackPrivateClient* m_client;
+    bool m_selected;
+};
+
+} // namespace WebCore
+
+#endif
+#endif