Changeset 100159 in webkit
- Timestamp:
- Nov 14, 2011 9:55:16 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 32 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r100158 r100159 1 2011-11-11 Jer Noble <jer.noble@apple.com> 2 3 Implement MediaController. 4 https://bugs.webkit.org/show_bug.cgi?id=71408 5 6 Reviewed by Eric Carlson. 7 8 * media/media-controller-expected.txt: Added. 9 * media/media-controller-playback-expected.txt: Added. 10 * media/media-controller-playback.html: Added. 11 * media/media-controller.html: Added. 12 * platform/mac/fast/dom/Window/window-properties-expected.txt: 13 * platform/mac/fast/js/global-constructors-expected.txt: 14 1 15 2011-11-14 Andrew Scherkus <scherkus@chromium.org> 2 16 -
trunk/LayoutTests/platform/mac/fast/dom/Window/window-properties-expected.txt
r99859 r100159 1277 1277 window.Math.sqrt [function] 1278 1278 window.Math.tan [function] 1279 window.MediaController [object MediaControllerConstructor] 1280 window.MediaController.prototype [object MediaControllerPrototype] 1281 window.MediaController.prototype.addEventListener [function] 1282 window.MediaController.prototype.dispatchEvent [function] 1283 window.MediaController.prototype.pause [function] 1284 window.MediaController.prototype.play [function] 1285 window.MediaController.prototype.removeEventListener [function] 1279 1286 window.MediaError [object MediaErrorConstructor] 1280 1287 window.MediaError.MEDIA_ERR_ABORTED [number] -
trunk/LayoutTests/platform/mac/fast/js/global-constructors-expected.txt
r97148 r100159 128 128 PASS ImageData.toString() is '[object ImageDataConstructor]' 129 129 PASS KeyboardEvent.toString() is '[object KeyboardEventConstructor]' 130 PASS MediaController.toString() is '[object MediaControllerConstructor]' 130 131 PASS MediaError.toString() is '[object MediaErrorConstructor]' 131 132 PASS MediaList.toString() is '[object MediaListConstructor]' -
trunk/Source/JavaScriptCore/ChangeLog
r100152 r100159 1 2011-11-11 Jer Noble <jer.noble@apple.com> 2 3 Implement MediaController. 4 https://bugs.webkit.org/show_bug.cgi?id=71408 5 6 Reviewed by Eric Carlson. 7 8 Change the definition of WTF_USE_COREAUDIO to exclude Windows completely, as 9 CoreAudioClock.h is not available there. 10 11 * wtf/Platform.h: 12 1 13 2011-11-14 Patrick Gansterer <paroga@webkit.org> 2 14 -
trunk/Source/JavaScriptCore/wtf/Platform.h
r100037 r100159 1128 1128 #endif 1129 1129 1130 #if PLATFORM(MAC) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO))1130 #if PLATFORM(MAC) 1131 1131 #define WTF_USE_COREAUDIO 1 1132 1132 #endif -
trunk/Source/WebCore/CMakeLists.txt
r99984 r100159 277 277 html/HTMLVideoElement.idl 278 278 html/ImageData.idl 279 html/MediaController.idl 279 280 html/MediaError.idl 280 281 html/TextMetrics.idl -
trunk/Source/WebCore/ChangeLog
r100157 r100159 1 2011-11-08 Jer Noble <jer.noble@apple.com> 2 3 Implement MediaController. 4 https://bugs.webkit.org/show_bug.cgi?id=71408 5 6 Reviewed by Eric Carlson. 7 8 Tests: media/media-controller-playback.html 9 media/media-controller.html 10 11 Adds support for the MediaController DOM object, and the mediagroup and mediacontroller 12 HTMLMediaElement attributes. 13 14 MediaController is an DOM object which synchronizes playback of multiple HTMLMediaElements. It can 15 either be created by a page script and assigned to a HTMLMediaElement using the controller property, 16 or all HTMLMediaElements with identical mediagroup attributes will have a MediaController assigned 17 automatically. 18 19 Add an abstract interface implemented by both MediaController and HTMLMediaElement. 20 * html/MediaControllerInterface.h: Added. 21 (WebCore::MediaControllerInterface::~MediaControllerInterface): 22 23 Add the MediaController object and IDL. 24 * html/MediaController.cpp: Added. 25 (mediaGroupToMediaControllerMap): 26 (MediaController::mediaControllerForMediaGroup): 27 (MediaController::create): 28 (MediaController::MediaController): 29 (MediaController::~MediaController): 30 (MediaController::addMediaElement): 31 (MediaController::removeMediaElement): 32 (MediaController::containsMediaElement): 33 (MediaController::buffered): 34 (MediaController::seekable): 35 (MediaController::played): 36 (MediaController::duration): 37 (MediaController::currentTime): 38 (MediaController::setCurrentTime): 39 (MediaController::play): 40 (MediaController::pause): 41 (MediaController::setDefaultPlaybackRate): 42 (MediaController::setPlaybackRate): 43 (MediaController::setVolume): 44 (MediaController::setMuted): 45 (MediaController::reportControllerState): 46 (MediaController::updateReadyState): 47 (MediaController::updatePlaybackState): 48 (MediaController::updateMediaElements): 49 (MediaController::scheduleEvent): 50 (MediaController::asyncEventTimerFired): 51 (MediaController::scriptExecutionContext): 52 (MediaController::hasAudio): 53 (MediaController::hasVideo): 54 (MediaController::hasClosedCaptions): 55 (MediaController::setClosedCaptionsVisible): 56 (MediaController::supportsScanning): 57 (MediaController::beginScrubbing): 58 (MediaController::endScrubbing): 59 (MediaController::canPlay): 60 (MediaController::isLiveStream): 61 (MediaController::hasSource): 62 (MediaController::returnToRealtime): 63 (MediaController::isBlocked): 64 (MediaController::hasEnded): 65 * html/MediaController.h: Added. 66 (WebCore::MediaController::mediaGroup): 67 (WebCore::MediaController::paused): 68 (WebCore::MediaController::defaultPlaybackRate): 69 (WebCore::MediaController::playbackRate): 70 (WebCore::MediaController::volume): 71 (WebCore::MediaController::muted): 72 (WebCore::MediaController::readyState): 73 (WebCore::MediaController::playbackState): 74 (WebCore::MediaController::supportsFullscreen): 75 (WebCore::MediaController::isFullscreen): 76 (WebCore::MediaController::enterFullscreen): 77 (WebCore::MediaController::closedCaptionsVisible): 78 (WebCore::MediaController::refEventTarget): 79 (WebCore::MediaController::derefEventTarget): 80 (WebCore::MediaController::toMediaController): 81 (WebCore::MediaController::eventTargetData): 82 (WebCore::MediaController::ensureEventTargetData): 83 * html/MediaController.idl: Added. 84 85 Add convenience functions to TimeRanges which can calculate intersections and 86 unions between TimeRanges objects. 87 * html/TimeRanges.cpp: 88 (TimeRanges::copy): 89 (TimeRanges::invert): 90 (TimeRanges::intersectWith): 91 (TimeRanges::unionWith): 92 * html/TimeRanges.h: 93 94 Add MediaControllerConstructor to the Window object. 95 * page/DOMWindow.idl: 96 97 Add the two new attribute names, mediagroup and controller. 98 * html/HTMLAttributeNames.in: 99 100 Add support for the new attributes, and add overridden behavior when a media element 101 has a current media controller: 102 * html/HTMLMediaElement.cpp: 103 (WebCore::HTMLMediaElement::~HTMLMediaElement): 104 (WebCore::HTMLMediaElement::parseMappedAttribute): 105 (WebCore::HTMLMediaElement::prepareForLoad): 106 (WebCore::HTMLMediaElement::setReadyState): 107 (WebCore::HTMLMediaElement::setCurrentTime): 108 (WebCore::HTMLMediaElement::setPlaybackRate): 109 (WebCore::HTMLMediaElement::playInternal): 110 (WebCore::HTMLMediaElement::togglePlayState): 111 (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): 112 (WebCore::HTMLMediaElement::seekable): 113 (WebCore::HTMLMediaElement::potentiallyPlaying): 114 (WebCore::HTMLMediaElement::endedPlayback): 115 (WebCore::HTMLMediaElement::updateVolume): 116 (WebCore::HTMLMediaElement::updatePlayState): 117 (WebCore::HTMLMediaElement::userCancelledLoad): 118 (WebCore::HTMLMediaElement::mediaGroup): 119 (WebCore::HTMLMediaElement::setMediaGroup): 120 (WebCore::HTMLMediaElement::controller): 121 (WebCore::HTMLMediaElement::setController): 122 (WebCore::HTMLMediaElement::updateMediaController): 123 (WebCore::HTMLMediaElement::isBlockedOnMediaController): 124 * html/HTMLMediaElement.h: 125 (WebCore::HTMLMediaElement::hasSource): 126 (WebCore::HTMLMediaElement::isLiveStream): 127 * html/HTMLMediaElement.idl: 128 * bindings/js/JSHTMLMediaElementCustom.cpp: Added. 129 (WebCore::JSHTMLMediaElement::setMediaController): 130 131 Add convenience functions to store a mapping of media-elements-per-document to allow 132 a quick lookup of media elements with the same media group within a given document: 133 * html/HTMLMediaElement.cpp: 134 (WebCore::documentToElementSetMap): 135 (WebCore::addElementToDocumentMap): 136 (WebCore::removeElementFromDocumentMap): 137 138 Add a function "seekable" which returns a TimeRanges containing the seekable time ranges 139 in a media element. By default this is a single range of [0, maxTimeSeekable]. 140 * platform/graphics/MediaPlayer.cpp: 141 (WebCore::MediaPlayer::seekable): 142 * platform/graphics/MediaPlayer.h: 143 * platform/graphics/MediaPlayerPrivate.h: 144 (WebCore::MediaPlayerPrivateInterface::seekable): 145 146 Support functions to cast between MediaController and EventTarget. 147 * bindings/js/JSEventTarget.cpp: 148 (WebCore::toJS): 149 * dom/EventTarget.cpp: 150 (WebCore::EventTarget::toMediaController): 151 * dom/EventTarget.h: 152 153 Fixed an infinite-recursion bug due to a collision between WTF::currentTime and 154 ClockGeneric::currentTime: 155 * platform/ClockGeneric.cpp: 156 (ClockGeneric::ClockGeneric): 157 (ClockGeneric::setCurrentTime): 158 (ClockGeneric::currentTime): 159 (ClockGeneric::setPlayRate): 160 (ClockGeneric::start): 161 (ClockGeneric::stop): 162 (ClockGeneric::now): 163 * platform/ClockGeneric.h: 164 165 Boilerplate to support creating the derived sources for MediaController and adding new sources 166 to the project: 167 * CMakeLists.txt: 168 * DerivedSources.cpp: 169 * DerivedSources.make: 170 * GNUmakefile.list.am: 171 * WebCore.gypi: 172 * WebCore.xcodeproj/project.pbxproj: 173 1 174 2011-11-14 Florin Malita <fmalita@google.com> 2 175 -
trunk/Source/WebCore/DerivedSources.cpp
r99984 r100159 229 229 #include "JSKeyboardEvent.cpp" 230 230 #include "JSLocation.cpp" 231 #include "JSMediaController.cpp" 231 232 #include "JSMediaError.cpp" 232 233 #include "JSMediaList.cpp" -
trunk/Source/WebCore/DerivedSources.make
r99984 r100159 278 278 Location \ 279 279 LowPass2FilterNode \ 280 MediaController \ 280 281 MediaElementAudioSourceNode \ 281 282 MediaError \ -
trunk/Source/WebCore/DerivedSources.pri
r99984 r100159 315 315 html/HTMLVideoElement.idl \ 316 316 html/ImageData.idl \ 317 html/MediaController.idl \ 317 318 html/MediaError.idl \ 318 319 html/TextMetrics.idl \ -
trunk/Source/WebCore/GNUmakefile.list.am
r100115 r100159 360 360 DerivedSources/WebCore/JSLocation.cpp \ 361 361 DerivedSources/WebCore/JSLocation.h \ 362 DerivedSources/WebCore/JSMediaController.cpp \ 363 DerivedSources/WebCore/JSMediaController.h \ 362 364 DerivedSources/WebCore/JSMediaError.cpp \ 363 365 DerivedSources/WebCore/JSMediaError.h \ … … 792 794 Source/WebCore/bindings/js/JSHTMLInputElementCustom.h \ 793 795 Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp \ 796 Source/WebCore/bindings/js/JSHTMLMediaElementCustom.cpp \ 794 797 Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp \ 795 798 Source/WebCore/bindings/js/JSHTMLObjectElementCustom.h \ … … 1879 1882 Source/WebCore/html/LoadableTextTrack.cpp \ 1880 1883 Source/WebCore/html/LoadableTextTrack.h \ 1884 Source/WebCore/html/MediaController.cpp \ 1885 Source/WebCore/html/MediaController.h \ 1881 1886 Source/WebCore/html/MediaDocument.cpp \ 1882 1887 Source/WebCore/html/MediaDocument.h \ … … 2462 2467 Source/WebCore/platform/AsyncFileSystem.h \ 2463 2468 Source/WebCore/platform/AutodrainedPool.h \ 2469 Source/WebCore/platform/Clock.cpp \ 2470 Source/WebCore/platform/Clock.h \ 2471 Source/WebCore/platform/ClockGeneric.cpp \ 2472 Source/WebCore/platform/ClockGeneric.h \ 2464 2473 Source/WebCore/platform/ColorChooser.cpp \ 2465 2474 Source/WebCore/platform/ColorChooser.h \ -
trunk/Source/WebCore/Target.pri
r100123 r100159 189 189 bindings/v8/custom/V8HTMLInputElementCustom.cpp \ 190 190 bindings/v8/custom/V8HTMLLinkElementCustom.cpp \ 191 bindings/v8/custom/V8HTMLMediaElementCustom.cpp \ 191 192 bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp \ 192 193 bindings/v8/custom/V8HTMLOutputElementCustom.cpp \ … … 299 300 bindings/js/JSHTMLInputElementCustom.cpp \ 300 301 bindings/js/JSHTMLLinkElementCustom.cpp \ 302 bindings/js/JSHTMLMediaElementCustom.cpp \ 301 303 bindings/js/JSHTMLObjectElementCustom.cpp \ 302 304 bindings/js/JSHTMLOptionsCollectionCustom.cpp \ … … 1015 1017 platform/text/LocalizedNumberNone.cpp \ 1016 1018 platform/text/QuotedPrintable.cpp \ 1019 platform/Clock.cpp \ 1020 platform/ClockGeneric.cpp \ 1017 1021 platform/ContentType.cpp \ 1018 1022 platform/CrossThreadCopier.cpp \ … … 1025 1029 platform/FileStream.cpp \ 1026 1030 platform/FileSystem.cpp \ 1027 platform/ClockGeneric.cpp \1028 1031 platform/GeolocationService.cpp \ 1029 1032 platform/image-decoders/qt/ImageFrameQt.cpp \ … … 1859 1862 html/LinkRelAttribute.h \ 1860 1863 html/LoadableTextTrack.h \ 1864 html/MediaController.h \ 1861 1865 html/MediaDocument.h \ 1862 1866 html/MicroDataItemValue.h \ … … 2047 2051 platform/Arena.h \ 2048 2052 platform/AsyncFileStream.h \ 2053 platform/Clock.h \ 2054 platform/ClockGeneric.h \ 2049 2055 platform/ContentType.h \ 2050 2056 platform/ContextMenu.h \ … … 2065 2071 platform/mock/SpeechInputClientMock.h \ 2066 2072 platform/mock/ScrollbarThemeMock.h \ 2067 platform/ClockGeneric.h \2068 2073 platform/graphics/BitmapImage.h \ 2069 2074 platform/graphics/Color.h \ … … 3089 3094 html/HTMLSourceElement.cpp \ 3090 3095 html/HTMLVideoElement.cpp \ 3096 html/MediaController.cpp \ 3091 3097 html/shadow/MediaControlElements.cpp \ 3092 3098 html/TimeRanges.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r100145 r100159 1332 1332 'html/HTMLVideoElement.idl', 1333 1333 'html/ImageData.idl', 1334 'html/MediaController.idl', 1334 1335 'html/MediaError.idl', 1335 1336 'html/TextMetrics.idl', … … 1878 1879 'bindings/js/JSHTMLInputElementCustom.h', 1879 1880 'bindings/js/JSHTMLLinkElementCustom.cpp', 1881 'bindings/js/JSHTMLMediaElementCustom.cpp', 1880 1882 'bindings/js/JSHTMLObjectElementCustom.cpp', 1881 1883 'bindings/js/JSHTMLObjectElementCustom.h', … … 2200 2202 'bindings/v8/custom/V8HTMLInputElementCustom.cpp', 2201 2203 'bindings/v8/custom/V8HTMLLinkElementCustom.cpp', 2204 'bindings/v8/custom/V8HTMLMediaElementCustom.cpp', 2202 2205 'bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp', 2203 2206 'bindings/v8/custom/V8HTMLOutputElementCustom.cpp', … … 5607 5610 'html/LoadableTextTrack.cpp', 5608 5611 'html/LoadableTextTrack.h', 5612 'html/MediaController.cpp', 5613 'html/MediaController.h', 5609 5614 'html/MediaDocument.cpp', 5610 5615 'html/MediaDocument.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r100145 r100159 26263 26263 </File> 26264 26264 <File 26265 RelativePath="..\platform\Clock.cpp" 26266 > 26267 </File> 26268 <File 26269 RelativePath="..\platform\Clock.h" 26270 > 26271 </File> 26272 <File 26273 RelativePath="..\platform\ClockGeneric.cpp" 26274 > 26275 </File> 26276 <File 26277 RelativePath="..\platform\ClockGeneric.h" 26278 > 26279 </File> 26280 <File 26265 26281 RelativePath="..\platform\ContentType.cpp" 26266 26282 > … … 57719 57735 </File> 57720 57736 <File 57737 RelativePath="..\html\MediaController.cpp" 57738 > 57739 </File> 57740 <File 57741 RelativePath="..\html\MediaController.h" 57742 > 57743 </File> 57744 <File 57721 57745 RelativePath="..\html\MediaDocument.cpp" 57722 57746 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r100035 r100159 5721 5721 CD0DBFEF1422768500280263 /* IRC_Composite_C_R0195_T345_P330.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBE0E1422759500280263 /* IRC_Composite_C_R0195_T345_P330.wav */; }; 5722 5722 CD0DBFF01422768500280263 /* IRC_Composite_C_R0195_T345_P345.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBE0F1422759500280263 /* IRC_Composite_C_R0195_T345_P345.wav */; }; 5723 CD27F6E51457685A0078207D /* JSMediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E2145767580078207D /* JSMediaController.cpp */; }; 5724 CD27F6E7145770D30078207D /* MediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E6145770D30078207D /* MediaController.cpp */; }; 5723 5725 CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5724 5726 CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; settings = {COMPILER_FLAGS = "-Wno-undef"; }; }; … … 5727 5729 CD8203101395ACE700F956C6 /* WebWindowAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */; }; 5728 5730 CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */; }; 5731 CDD525D7145B6DD0008D204D /* JSHTMLMediaElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */; }; 5729 5732 CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */; }; 5730 5733 CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA76321460AE29008B31F1 /* ClockGeneric.cpp */; }; … … 5732 5735 CDEA7C841276230400B846DD /* RenderFullScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = CDEA7C821276230400B846DD /* RenderFullScreen.h */; }; 5733 5736 CDEA7C851276230400B846DD /* RenderFullScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA7C831276230400B846DD /* RenderFullScreen.cpp */; }; 5737 CDF65CC8145B1E7500C4C7AA /* MediaController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD27F6E4145767870078207D /* MediaController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5738 CDF65CCA145B448800C4C7AA /* MediaControllerInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5734 5739 CE02F0C411E83ADD00C6684A /* ScriptControllerBase.h in Headers */ = {isa = PBXBuildFile; fileRef = CE02F0C311E83ADD00C6684A /* ScriptControllerBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5735 5740 CE057FA51220731100A476D5 /* DocumentMarkerController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */; }; … … 13041 13046 CD0DBE0E1422759500280263 /* IRC_Composite_C_R0195_T345_P330.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = IRC_Composite_C_R0195_T345_P330.wav; path = platform/audio/resources/IRC_Composite_C_R0195_T345_P330.wav; sourceTree = SOURCE_ROOT; }; 13042 13047 CD0DBE0F1422759500280263 /* IRC_Composite_C_R0195_T345_P345.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = IRC_Composite_C_R0195_T345_P345.wav; path = platform/audio/resources/IRC_Composite_C_R0195_T345_P345.wav; sourceTree = SOURCE_ROOT; }; 13048 CD27F6E014575C1B0078207D /* MediaController.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaController.idl; sourceTree = "<group>"; }; 13049 CD27F6E2145767580078207D /* JSMediaController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaController.cpp; sourceTree = "<group>"; }; 13050 CD27F6E3145767580078207D /* JSMediaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaController.h; sourceTree = "<group>"; }; 13051 CD27F6E4145767870078207D /* MediaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaController.h; sourceTree = "<group>"; }; 13052 CD27F6E6145770D30078207D /* MediaController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaController.cpp; sourceTree = "<group>"; }; 13043 13053 CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; }; 13044 13054 CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; }; … … 13049 13059 CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebWindowAnimation.mm; sourceTree = "<group>"; }; 13050 13060 CDBD93BA1333BD4B002570E3 /* fullscreenQuickTime.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreenQuickTime.css; sourceTree = "<group>"; }; 13061 CDCE5CCF14633BC900D47CCA /* EventFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventFactory.in; sourceTree = "<group>"; }; 13062 CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; }; 13051 13063 CDEA762C14608224008B31F1 /* Clock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clock.h; sourceTree = "<group>"; }; 13052 13064 CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformClockCA.cpp; sourceTree = "<group>"; }; … … 13057 13069 CDEA7C821276230400B846DD /* RenderFullScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFullScreen.h; sourceTree = "<group>"; }; 13058 13070 CDEA7C831276230400B846DD /* RenderFullScreen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFullScreen.cpp; sourceTree = "<group>"; }; 13071 CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControllerInterface.h; sourceTree = "<group>"; }; 13072 CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMediaElementCustom.cpp; sourceTree = "<group>"; }; 13059 13073 CE02F0C311E83ADD00C6684A /* ScriptControllerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptControllerBase.h; sourceTree = "<group>"; }; 13060 13074 CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarkerController.cpp; sourceTree = "<group>"; }; … … 17399 17413 F55B3DAB1251F12D003EF269 /* WeekInputType.cpp */, 17400 17414 F55B3DAC1251F12D003EF269 /* WeekInputType.h */, 17415 CD27F6E014575C1B0078207D /* MediaController.idl */, 17416 CD27F6E4145767870078207D /* MediaController.h */, 17417 CD27F6E6145770D30078207D /* MediaController.cpp */, 17418 CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */, 17401 17419 ); 17402 17420 path = html; … … 17632 17650 isa = PBXGroup; 17633 17651 children = ( 17652 CD27F6E2145767580078207D /* JSMediaController.cpp */, 17653 CD27F6E3145767580078207D /* JSMediaController.h */, 17634 17654 49EECEF2105070C400099FAB /* JSArrayBuffer.cpp */, 17635 17655 49EECEF3105070C400099FAB /* JSArrayBuffer.h */, … … 19658 19678 E1AD14221295EA7F00ACA989 /* JSHTMLInputElementCustom.h */, 19659 19679 E1AD139A1295D92600ACA989 /* JSHTMLLinkElementCustom.cpp */, 19680 CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */, 19660 19681 BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */, 19661 19682 E1AD14241295EA9500ACA989 /* JSHTMLObjectElementCustom.h */, … … 20975 20996 isa = PBXGroup; 20976 20997 children = ( 20998 CDCE5CCF14633BC900D47CCA /* EventFactory.in */, 20999 CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */, 20977 21000 E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */, 20978 21001 E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */, … … 24674 24697 31313F661443B35F006E2A90 /* FilterEffectRenderer.h in Headers */, 24675 24698 29CD61DE146D02890068E82A /* WebKitCSSShaderValue.h in Headers */, 24699 CDF65CC8145B1E7500C4C7AA /* MediaController.h in Headers */, 24700 CDF65CCA145B448800C4C7AA /* MediaControllerInterface.h in Headers */, 24676 24701 ); 24677 24702 runOnlyForDeploymentPostprocessing = 0; … … 27532 27557 CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */, 27533 27558 CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */, 27559 CD27F6E51457685A0078207D /* JSMediaController.cpp in Sources */, 27560 CD27F6E7145770D30078207D /* MediaController.cpp in Sources */, 27561 CDD525D7145B6DD0008D204D /* JSHTMLMediaElementCustom.cpp in Sources */, 27534 27562 CDEA76351460B71A008B31F1 /* Clock.cpp in Sources */, 27535 27563 976F36EA14686225005E93B4 /* SecurityContext.cpp in Sources */, -
trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
r99500 r100159 114 114 } 115 115 116 bool RuntimeEnabledFeatures::mediaControllerEnabled() 117 { 118 return MediaPlayer::isAvailable(); 119 } 120 116 121 bool RuntimeEnabledFeatures::mediaErrorEnabled() 117 122 { -
trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
r100091 r100159 93 93 static bool htmlVideoElementEnabled(); 94 94 static bool htmlSourceElementEnabled(); 95 static bool mediaControllerEnabled(); 95 96 static bool mediaErrorEnabled(); 96 97 static bool timeRangesEnabled(); -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r99984 r100159 93 93 #include "JSHTMLInputElementCustom.cpp" 94 94 #include "JSHTMLLinkElementCustom.cpp" 95 #include "JSHTMLMediaElementCustom.cpp" 95 96 #include "JSHTMLObjectElementCustom.cpp" 96 97 #include "JSHTMLOptionsCollectionCustom.cpp" -
trunk/Source/WebCore/bindings/js/JSHTMLMediaElementCustom.cpp
r100158 r100159 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER,INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER,INC. OR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 24 24 */ 25 25 26 #i fndef ClockGeneric_h27 # define ClockGeneric_h26 #include "config.h" 27 #if ENABLE(VIDEO) 28 28 29 #include "Clock.h" 29 #include "JSHTMLMediaElement.h" 30 31 #include "JSMediaController.h" 30 32 31 33 namespace WebCore { 32 34 33 class ClockGeneric : public Clock { 34 public: 35 ClockGeneric(); 35 using namespace JSC; 36 36 37 private: 38 virtual void setCurrentTime(float); 39 virtual float currentTime() const; 40 41 virtual void setPlayRate(float); 42 virtual float playRate() const { return m_rate; } 43 44 virtual void start(); 45 virtual void stop(); 46 virtual bool isRunning() const { return m_running; } 47 48 bool m_running; 49 float m_rate; 50 float m_offset; 51 double m_startTime; 52 mutable double m_lastTime; 53 }; 37 void JSHTMLMediaElement::setController(ExecState*, JSValue value) 38 { 39 HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl()); 40 // 4.8.10.11.2 Media controllers: controller attribute. 41 // On setting, it must first remove the element's mediagroup attribute, if any, 42 imp->setMediaGroup(String()); 43 // and then set the current media controller to the given value. 44 imp->setController(toMediaController(value)); 45 } 54 46 55 47 } 56 57 48 #endif -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLMediaElementCustom.cpp
r100158 r100159 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER,INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER,INC. OR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 24 24 */ 25 25 26 #ifndef ClockGeneric_h 27 #define ClockGeneric_h 26 #include "config.h" 28 27 29 #include "Clock.h" 28 #if ENABLE(VIDEO) 29 30 #include "V8HTMLMediaElement.h" 31 32 #include "V8MediaController.h" 33 #include "V8Proxy.h" 30 34 31 35 namespace WebCore { 32 36 33 class ClockGeneric : public Clock { 34 public: 35 ClockGeneric(); 37 void V8HTMLMediaElement::controllerAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 38 { 39 INC_STATS("DOM.HTMLMediaElement.mediaController._set"); 40 HTMLMediaElement* imp = V8HTMLMediaElement::toNative(info.Holder()); 41 MediaController* controller = 0; 42 if (V8MediaController::HasInstance(value)) 43 controller = V8MediaController::toNative(value->ToObject()); 44 45 if (!controller) { 46 throwError("Value is not of type MediaController"); 47 return; 48 } 36 49 37 private: 38 virtual void setCurrentTime(float); 39 virtual float currentTime() const; 40 41 virtual void setPlayRate(float); 42 virtual float playRate() const { return m_rate; } 43 44 virtual void start(); 45 virtual void stop(); 46 virtual bool isRunning() const { return m_running; } 47 48 bool m_running; 49 float m_rate; 50 float m_offset; 51 double m_startTime; 52 mutable double m_lastTime; 53 }; 50 // 4.8.10.11.2 Media controllers: controller attribute. 51 // On setting, it must first remove the element's mediagroup attribute, if any, 52 imp->setMediaGroup(String()); 53 // and then set the current media controller to the given value. 54 imp->setController(controller); 55 } 54 56 55 57 } 56 58 57 59 #endif 60 -
trunk/Source/WebCore/dom/EventTarget.h
r100064 r100159 56 56 class JavaScriptAudioNode; 57 57 class LocalMediaStream; 58 class MediaController; 58 59 class MediaStream; 59 60 class MessagePort; -
trunk/Source/WebCore/dom/EventTargetFactory.in
r100064 r100159 14 14 JavaScriptAudioNode conditional=WEB_AUDIO 15 15 LocalMediaStream conditional=MEDIA_STREAM 16 MediaController conditional=VIDEO 16 17 MediaStream conditional=MEDIA_STREAM 17 18 MessagePort -
trunk/Source/WebCore/html/HTMLAttributeNames.in
r99821 r100159 149 149 mayscript 150 150 media 151 mediagroup 151 152 method 152 153 min -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r100064 r100159 53 53 #include "HTMLVideoElement.h" 54 54 #include "Logging.h" 55 #include "MediaController.h" 55 56 #include "MediaControls.h" 56 57 #include "MediaDocument.h" … … 139 140 140 141 using namespace HTMLNames; 142 using namespace std; 143 144 typedef HashMap<Document*, HashSet<HTMLMediaElement*> > DocumentElementSetMap; 145 static DocumentElementSetMap& documentToElementSetMap() 146 { 147 DEFINE_STATIC_LOCAL(DocumentElementSetMap, map, ()); 148 return map; 149 } 150 151 static void addElementToDocumentMap(HTMLMediaElement* element, Document* document) 152 { 153 DocumentElementSetMap& map = documentToElementSetMap(); 154 HashSet<HTMLMediaElement*> set = map.take(document); 155 set.add(element); 156 map.add(document, set); 157 } 158 159 static void removeElementFromDocumentMap(HTMLMediaElement* element, Document* document) 160 { 161 DocumentElementSetMap& map = documentToElementSetMap(); 162 HashSet<HTMLMediaElement*> set = map.take(document); 163 set.remove(element); 164 if (!set.isEmpty()) 165 map.add(document, set); 166 } 141 167 142 168 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* document) … … 220 246 221 247 setHasCustomWillOrDidRecalcStyle(); 248 addElementToDocumentMap(this, document); 222 249 } 223 250 … … 239 266 } 240 267 #endif 268 269 if (m_mediaController) 270 m_mediaController->removeMediaElement(this); 271 272 removeElementFromDocumentMap(this, document()); 241 273 } 242 274 … … 248 280 document()->unregisterForDocumentActivationCallbacks(this); 249 281 document()->unregisterForMediaVolumeCallbacks(this); 282 removeElementFromDocumentMap(this, document()); 250 283 HTMLElement::willMoveToNewOwnerDocument(); 251 284 } … … 259 292 document()->registerForDocumentActivationCallbacks(this); 260 293 document()->registerForMediaVolumeCallbacks(this); 294 addElementToDocumentMap(this, document()); 261 295 HTMLElement::didMoveToNewOwnerDocument(); 262 296 } … … 305 339 m_player->setPreload(m_preload); 306 340 307 } else if (attrName == onabortAttr) 341 } else if (attrName == mediagroupAttr) 342 setMediaGroup(attr->value()); 343 else if (attrName == onabortAttr) 308 344 setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr)); 309 345 else if (attrName == onbeforeloadAttr) … … 614 650 invalidateCachedTime(); 615 651 scheduleEvent(eventNames().emptiedEvent); 652 updateMediaController(); 616 653 } 617 654 … … 1249 1286 1250 1287 updatePlayState(); 1288 updateMediaController(); 1251 1289 } 1252 1290 … … 1548 1586 void HTMLMediaElement::setCurrentTime(float time, ExceptionCode& ec) 1549 1587 { 1588 if (m_mediaController) { 1589 ec = INVALID_STATE_ERR; 1590 return; 1591 } 1550 1592 seek(time, ec); 1551 1593 } … … 1599 1641 { 1600 1642 LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); 1601 1643 1602 1644 if (m_playbackRate != rate) { 1603 1645 m_playbackRate = rate; … … 1605 1647 scheduleEvent(eventNames().ratechangeEvent); 1606 1648 } 1607 if (m_player && potentiallyPlaying() && m_player->rate() != rate) 1649 1650 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_mediaController) 1608 1651 m_player->setRate(rate); 1652 } 1653 1654 void HTMLMediaElement::updatePlaybackRate() 1655 { 1656 float effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate; 1657 if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate && !m_mediaController) 1658 m_player->setRate(effectiveRate); 1609 1659 } 1610 1660 … … 1701 1751 seek(0, unused); 1702 1752 } 1703 1753 1754 if (m_mediaController) 1755 m_mediaController->bringElementUpToSpeed(this); 1756 1704 1757 if (m_paused) { 1705 1758 m_paused = false; … … 1715 1768 1716 1769 updatePlayState(); 1770 updateMediaController(); 1717 1771 } 1718 1772 … … 1906 1960 // this method is only called from the built-in media controller 1907 1961 if (canPlay()) { 1908 setPlaybackRate(defaultPlaybackRate());1962 updatePlaybackRate(); 1909 1963 playInternal(); 1910 1964 } else … … 2334 2388 float now = currentTime(); 2335 2389 float dur = duration(); 2336 if (!isnan(dur) && dur && now >= dur) { 2337 if (loop()) { 2390 2391 // When the current playback position reaches the end of the media resource when the direction of 2392 // playback is forwards, then the user agent must follow these steps: 2393 if (!isnan(dur) && dur && now >= dur && m_playbackRate > 0) { 2394 // If the media element has a loop attribute specified and does not have a current media controller, 2395 if (loop() && !m_mediaController) { 2338 2396 ExceptionCode ignoredException; 2339 2397 m_sentEndEvent = false; 2340 seek(0, ignoredException); 2398 // then seek to the earliest possible position of the media resource and abort these steps. 2399 seek(startTime(), ignoredException); 2341 2400 } else { 2342 if (!m_paused) { 2401 // If the media element does not have a current media controller, and the media element 2402 // has still ended playback, and the direction of playback is still forwards, and paused 2403 // is false, 2404 if (!m_mediaController && !m_paused) { 2405 // changes paused to true and fires a simple event named pause at the media element. 2343 2406 m_paused = true; 2344 2407 scheduleEvent(eventNames().pauseEvent); 2345 2408 } 2409 // Queue a task to fire a simple event named ended at the media element. 2346 2410 if (!m_sentEndEvent) { 2347 2411 m_sentEndEvent = true; 2348 2412 scheduleEvent(eventNames().endedEvent); 2349 2413 } 2414 // If the media element has a current media controller, then report the controller state 2415 // for the media element's current media controller. 2416 updateMediaController(); 2350 2417 } 2351 2418 } … … 2534 2601 PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const 2535 2602 { 2536 // FIXME real ranges support 2537 if (!maxTimeSeekable()) 2538 return TimeRanges::create(); 2539 return TimeRanges::create(minTimeSeekable(), maxTimeSeekable()); 2603 return m_player ? m_player->seekable() : TimeRanges::create(); 2540 2604 } 2541 2605 … … 2546 2610 // checks in couldPlayIfEnoughData(). 2547 2611 bool pausedToBuffer = m_readyStateMaximum >= HAVE_FUTURE_DATA && m_readyState < HAVE_FUTURE_DATA; 2548 return (pausedToBuffer || m_readyState >= HAVE_FUTURE_DATA) && couldPlayIfEnoughData() ;2612 return (pausedToBuffer || m_readyState >= HAVE_FUTURE_DATA) && couldPlayIfEnoughData() && !isBlockedOnMediaController(); 2549 2613 } 2550 2614 … … 2568 2632 2569 2633 // and the current playback position is the end of the media resource and the direction 2570 // of playback is forwards and the media element does not have a loop attribute specified, 2634 // of playback is forwards, Either the media element does not have a loop attribute specified, 2635 // or the media element has a current media controller. 2571 2636 float now = currentTime(); 2572 2637 if (m_playbackRate > 0) 2573 return dur > 0 && now >= dur && !loop();2638 return dur > 0 && now >= dur && (!loop() || m_mediaController); 2574 2639 2575 2640 // or the current playback position is the earliest possible position and the direction … … 2617 2682 Page* page = document()->page(); 2618 2683 float volumeMultiplier = page ? page->mediaVolume() : 1; 2619 2620 m_player->setMuted(m_muted); 2684 bool shouldMute = m_muted; 2685 2686 if (m_mediaController) { 2687 volumeMultiplier *= m_mediaController->volume(); 2688 shouldMute = m_mediaController->muted(); 2689 } 2690 2691 m_player->setMuted(shouldMute); 2621 2692 m_player->setVolume(m_volume * volumeMultiplier); 2622 2693 } … … 2685 2756 mediaControls()->playbackStopped(); 2686 2757 } 2687 2758 2759 updateMediaController(); 2760 2688 2761 if (renderer()) 2689 2762 renderer()->updateFromElement(); 2690 2763 } 2691 2764 2692 2765 void HTMLMediaElement::setPausedInternal(bool b) 2693 2766 { … … 2749 2822 // Reset m_readyState since m_player is gone. 2750 2823 m_readyState = HAVE_NOTHING; 2824 updateMediaController(); 2751 2825 } 2752 2826 … … 3241 3315 #endif 3242 3316 3243 } 3244 3245 #endif 3317 const String& HTMLMediaElement::mediaGroup() const 3318 { 3319 return m_mediaGroup; 3320 } 3321 3322 void HTMLMediaElement::setMediaGroup(const String& group) 3323 { 3324 if (m_mediaGroup == group) 3325 return; 3326 m_mediaGroup = group; 3327 3328 // When a media element is created with a mediagroup attribute, and when a media element's mediagroup 3329 // attribute is set, changed, or removed, the user agent must run the following steps: 3330 // 1. Let m [this] be the media element in question. 3331 // 2. Let m have no current media controller, if it currently has one. 3332 setController(0); 3333 3334 // 3. If m's mediagroup attribute is being removed, then abort these steps. 3335 if (group.isNull() || group.isEmpty()) 3336 return; 3337 3338 // 4. If there is another media element whose Document is the same as m's Document (even if one or both 3339 // of these elements are not actually in the Document), 3340 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(document()); 3341 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != elements.end(); ++i) { 3342 if (*i == this) 3343 continue; 3344 3345 // and which also has a mediagroup attribute, and whose mediagroup attribute has the same value as 3346 // the new value of m's mediagroup attribute, 3347 if ((*i)->mediaGroup() == group) { 3348 // then let controller be that media element's current media controller. 3349 setController((*i)->controller()); 3350 return; 3351 } 3352 } 3353 3354 // Otherwise, let controller be a newly created MediaController. 3355 setController(MediaController::create(Node::scriptExecutionContext())); 3356 } 3357 3358 MediaController* HTMLMediaElement::controller() const 3359 { 3360 return m_mediaController.get(); 3361 } 3362 3363 void HTMLMediaElement::setController(PassRefPtr<MediaController> controller) 3364 { 3365 if (m_mediaController) 3366 m_mediaController->removeMediaElement(this); 3367 3368 m_mediaController = controller; 3369 3370 if (m_mediaController) 3371 m_mediaController->addMediaElement(this); 3372 } 3373 3374 void HTMLMediaElement::updateMediaController() 3375 { 3376 if (m_mediaController) 3377 m_mediaController->reportControllerState(); 3378 } 3379 3380 bool HTMLMediaElement::isBlocked() const 3381 { 3382 // A media element is a blocked media element if its readyState attribute is in the 3383 // HAVE_NOTHING state, the HAVE_METADATA state, or the HAVE_CURRENT_DATA state, 3384 if (m_readyState <= HAVE_CURRENT_DATA) 3385 return true; 3386 3387 // or if the element has paused for user interaction. 3388 return pausedForUserInteraction(); 3389 } 3390 3391 bool HTMLMediaElement::isBlockedOnMediaController() const 3392 { 3393 if (!m_mediaController) 3394 return false; 3395 3396 // A media element is blocked on its media controller if the MediaController is a blocked 3397 // media controller, 3398 if (m_mediaController->isBlocked()) 3399 return true; 3400 3401 // or if its media controller position is either before the media resource's earliest possible 3402 // position relative to the MediaController's timeline or after the end of the media resource 3403 // relative to the MediaController's timeline. 3404 float mediaControllerPosition = m_mediaController->currentTime(); 3405 if (mediaControllerPosition < startTime() || mediaControllerPosition > startTime() + duration()) 3406 return true; 3407 3408 return false; 3409 } 3410 3411 } 3412 3413 #endif -
trunk/Source/WebCore/html/HTMLMediaElement.h
r100064 r100159 32 32 #include "ActiveDOMObject.h" 33 33 #include "MediaCanStartListener.h" 34 #include "MediaControllerInterface.h" 34 35 #include "MediaPlayer.h" 35 36 … … 53 54 class HTMLSourceElement; 54 55 class HTMLTrackElement; 56 class MediaController; 55 57 class MediaControls; 56 58 class MediaError; … … 67 69 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. 68 70 69 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener, public ActiveDOMObject 71 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, private MediaCanStartListener, public ActiveDOMObject, public MediaControllerInterface 70 72 #if ENABLE(VIDEO_TRACK) 71 73 , private TextTrackClient … … 113 115 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO_SOURCE }; 114 116 NetworkState networkState() const; 115 117 116 118 String preload() const; 117 119 void setPreload(const String&); … … 122 124 123 125 // ready state 124 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, HAVE_ENOUGH_DATA };125 126 ReadyState readyState() const; 126 127 bool seeking() const; … … 137 138 float playbackRate() const; 138 139 void setPlaybackRate(float); 140 void updatePlaybackRate(); 139 141 bool webkitPreservesPitch() const; 140 142 void setWebkitPreservesPitch(bool); … … 251 253 enum InvalidURLAction { DoNothing, Complain }; 252 254 bool isSafeToLoadURL(const KURL&, InvalidURLAction); 255 256 const String& mediaGroup() const; 257 void setMediaGroup(const String&); 258 259 MediaController* controller() const; 260 void setController(PassRefPtr<MediaController>); 253 261 254 262 protected: … … 405 413 void setPausedInternal(bool); 406 414 415 void setPlaybackRateInternal(float); 416 407 417 virtual void mediaCanStart(); 408 418 … … 422 432 virtual void setItemValueText(const String&, ExceptionCode&); 423 433 #endif 434 435 void updateMediaController(); 436 bool isBlocked() const; 437 bool isBlockedOnMediaController() const; 438 bool hasCurrentSrc() const { return !m_currentSrc.isEmpty(); } 439 bool isLiveStream() const { return movieLoadType() == MediaPlayer::LiveStream; } 440 bool isAutoplaying() const { return m_autoplaying; } 424 441 425 442 Timer<HTMLMediaElement> m_loadTimer; … … 534 551 Vector<CueIntervalTree::IntervalType> m_currentlyVisibleCues; 535 552 #endif 553 554 String m_mediaGroup; 555 friend class MediaController; 556 RefPtr<MediaController> m_mediaController; 536 557 }; 537 558 -
trunk/Source/WebCore/html/HTMLMediaElement.idl
r99984 r100159 116 116 readonly attribute [EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; 117 117 #endif 118 119 attribute [Reflect, ConvertNullToNullString, ConvertNullStringToNull] DOMString mediaGroup; 120 attribute [CustomSetter] MediaController controller; 118 121 }; 119 122 } -
trunk/Source/WebCore/html/MediaController.idl
r100158 r100159 1 1 /* 2 * Copyright (C) 2011 Apple Inc. 2 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #include "config.h" 27 #include "ClockGeneric.h" 26 module html { 27 interface [ 28 Conditional=VIDEO, 29 Constructor, 30 CallWith=ScriptExecutionContext, 31 GenerateToJS, 32 EventTarget 33 ] MediaController { 34 readonly attribute TimeRanges buffered; 35 readonly attribute TimeRanges seekable; 28 36 29 #include "FloatConversion.h" 30 #include <wtf/CurrentTime.h> 37 readonly attribute double duration; 38 attribute double currentTime 39 setter raises (DOMException); 31 40 32 using namespace WebCore; 41 readonly attribute boolean paused; 42 readonly attribute TimeRanges played; 43 void play(); 44 void pause(); 33 45 34 ClockGeneric::ClockGeneric() 35 : m_running(false) 36 , m_rate(1) 37 , m_offset(0) 38 { 39 m_startTime = m_lastTime = currentTime(); 46 attribute double defaultPlaybackRate; 47 attribute double playbackRate; 48 49 attribute double volume 50 setter raises (DOMException); 51 attribute boolean muted; 52 53 // EventTarget interface 54 void addEventListener(in DOMString type, 55 in EventListener listener, 56 in [Optional] boolean useCapture); 57 void removeEventListener(in DOMString type, 58 in EventListener listener, 59 in [Optional] boolean useCapture); 60 boolean dispatchEvent(in Event evt) 61 raises(EventException); 62 }; 40 63 } 41 42 void ClockGeneric::setCurrentTime(float time)43 {44 m_startTime = m_lastTime = currentTime();45 m_offset = time;46 }47 48 float ClockGeneric::currentTime() const49 {50 if (m_running)51 m_lastTime = currentTime();52 float time = (narrowPrecisionToFloat(m_lastTime - m_startTime) * m_rate) + m_offset;53 return time;54 }55 56 void ClockGeneric::setPlayRate(float rate)57 {58 m_offset = currentTime();59 m_lastTime = m_startTime = currentTime();60 m_rate = rate;61 }62 63 void ClockGeneric::start()64 {65 if (m_running)66 return;67 68 m_lastTime = m_startTime = currentTime();69 m_running = true;70 }71 72 void ClockGeneric::stop()73 {74 if (!m_running)75 return;76 77 m_offset = currentTime();78 m_lastTime = m_startTime = currentTime();79 m_running = false;80 } -
trunk/Source/WebCore/html/TimeRanges.cpp
r99645 r100159 32 32 33 33 using namespace WebCore; 34 using namespace std; 34 35 35 36 TimeRanges::TimeRanges(float start, float end) … … 38 39 } 39 40 40 PassRefPtr<TimeRanges> TimeRanges::copy() 41 PassRefPtr<TimeRanges> TimeRanges::copy() const 41 42 { 42 43 RefPtr<TimeRanges> newSession = TimeRanges::create(); … … 47 48 48 49 return newSession.release(); 50 } 51 52 void TimeRanges::invert() 53 { 54 RefPtr<TimeRanges> inverted = TimeRanges::create(); 55 float posInf = std::numeric_limits<float>::infinity(); 56 float negInf = -std::numeric_limits<float>::infinity(); 57 58 if (!m_ranges.size()) 59 inverted->add(negInf, posInf); 60 else { 61 if (float start = m_ranges.first().m_start != negInf) 62 inverted->add(negInf, start); 63 64 for (size_t index = 0; index + 1 < m_ranges.size(); ++index) 65 inverted->add(m_ranges[index].m_end, m_ranges[index + 1].m_start); 66 67 if (float end = m_ranges.last().m_end != posInf) 68 inverted->add(end, posInf); 69 } 70 71 m_ranges.swap(inverted->m_ranges); 72 } 73 74 void TimeRanges::intersectWith(const TimeRanges* other) 75 { 76 ASSERT(other); 77 RefPtr<TimeRanges> inverted = copy(); 78 RefPtr<TimeRanges> invertedOther = other->copy(); 79 inverted->unionWith(invertedOther.get()); 80 inverted->invert(); 81 82 m_ranges.swap(inverted->m_ranges); 83 } 84 85 void TimeRanges::unionWith(const TimeRanges* other) 86 { 87 ASSERT(other); 88 RefPtr<TimeRanges> unioned = copy(); 89 for (size_t index = 0; index < other->m_ranges.size(); ++index) { 90 const Range& range = other->m_ranges[index]; 91 unioned->add(range.m_start, range.m_end); 92 } 93 94 m_ranges.swap(unioned->m_ranges); 49 95 } 50 96 -
trunk/Source/WebCore/html/TimeRanges.h
r99645 r100159 47 47 } 48 48 49 PassRefPtr<TimeRanges> copy(); 49 PassRefPtr<TimeRanges> copy() const; 50 void invert(); 51 void intersectWith(const TimeRanges*); 52 void unionWith(const TimeRanges*); 50 53 51 54 unsigned length() const { return m_ranges.size(); } -
trunk/Source/WebCore/page/DOMWindow.idl
r99984 r100159 636 636 attribute [Conditional=VIDEO, EnabledAtRuntime] TimeRangesConstructor TimeRanges; 637 637 attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLSourceElementConstructor HTMLSourceElement; 638 attribute [Conditional=VIDEO, EnabledAtRuntime] MediaControllerConstructor MediaController; 638 639 639 640 #if defined(ENABLE_ANIMATION_API) && ENABLE_ANIMATION_API -
trunk/Source/WebCore/platform/ClockGeneric.cpp
r99530 r100159 37 37 , m_offset(0) 38 38 { 39 m_startTime = m_lastTime = currentTime();39 m_startTime = m_lastTime = now(); 40 40 } 41 41 42 42 void ClockGeneric::setCurrentTime(float time) 43 43 { 44 m_startTime = m_lastTime = currentTime();44 m_startTime = m_lastTime = now(); 45 45 m_offset = time; 46 46 } … … 49 49 { 50 50 if (m_running) 51 m_lastTime = currentTime();51 m_lastTime = now(); 52 52 float time = (narrowPrecisionToFloat(m_lastTime - m_startTime) * m_rate) + m_offset; 53 53 return time; … … 56 56 void ClockGeneric::setPlayRate(float rate) 57 57 { 58 m_offset = currentTime();59 m_lastTime = m_startTime = currentTime();58 m_offset = now(); 59 m_lastTime = m_startTime = now(); 60 60 m_rate = rate; 61 61 } … … 66 66 return; 67 67 68 m_lastTime = m_startTime = currentTime();68 m_lastTime = m_startTime = now(); 69 69 m_running = true; 70 70 } … … 75 75 return; 76 76 77 m_offset = currentTime();78 m_lastTime = m_startTime = currentTime();77 m_offset = now(); 78 m_lastTime = m_startTime = now(); 79 79 m_running = false; 80 80 } 81 82 float ClockGeneric::now() const 83 { 84 return WTF::currentTime(); 85 } 86 -
trunk/Source/WebCore/platform/ClockGeneric.h
r99488 r100159 46 46 virtual bool isRunning() const { return m_running; } 47 47 48 float now() const; 49 48 50 bool m_running; 49 51 float m_rate; -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r97100 r100159 610 610 } 611 611 612 PassRefPtr<TimeRanges> MediaPlayer::seekable() 613 { 614 return m_private->seekable(); 615 } 616 612 617 float MediaPlayer::maxTimeSeekable() 613 618 { -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r97100 r100159 242 242 243 243 PassRefPtr<TimeRanges> buffered(); 244 PassRefPtr<TimeRanges> seekable(); 244 245 float maxTimeSeekable(); 245 246 -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r97100 r100159 30 30 31 31 #include "MediaPlayer.h" 32 #include "TimeRanges.h" 32 33 #include <wtf/Forward.h> 33 34 … … 92 93 virtual MediaPlayer::ReadyState readyState() const = 0; 93 94 95 virtual PassRefPtr<TimeRanges> seekable() const { return maxTimeSeekable() ? TimeRanges::create(0, maxTimeSeekable()) : TimeRanges::create(); } 94 96 virtual float maxTimeSeekable() const = 0; 95 97 virtual PassRefPtr<TimeRanges> buffered() const = 0;
Note: See TracChangeset
for help on using the changeset viewer.