Rubber stamped by Adele.
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 01:03:35 +0000 (01:03 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2007 01:03:35 +0000 (01:03 +0000)
        Initial media (<video> and <audio>) support from feature branch and
        QTKit based platform implementation.

        This will need to be updated to match current draft specification.

        * Configurations/WebCore.xcconfig:
        * DerivedSources.make:
        * WebCore.base.exp:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSEventCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSHTMLAudioElementConstructor.cpp: Added.
        (WebCore::JSHTMLAudioElementConstructor::JSHTMLAudioElementConstructor):
        (WebCore::JSHTMLAudioElementConstructor::implementsConstruct):
        (WebCore::JSHTMLAudioElementConstructor::construct):
        * bindings/js/JSHTMLAudioElementConstructor.h: Added.
        * bindings/js/JSHTMLElementWrapperFactory.cpp:
        (WebCore::createJSHTMLWrapper):
        * bindings/js/kjs_window.cpp:
        (KJS::Window::getValueProperty):
        * bindings/js/kjs_window.h:
        (KJS::Window::):
        * bindings/scripts/CodeGeneratorJS.pm:
        * dom/Document.cpp:
        (WebCore::Document::createEvent):
        (WebCore::Document::willSaveToCache):
        (WebCore::Document::didRestoreFromCache):
        (WebCore::Document::registerForCacheCallbacks):
        (WebCore::Document::unregisterForCacheCallbacks):
        * dom/Document.h:
        * dom/Element.cpp:
        (WebCore::Element::setBooleanAttribute):
        * dom/Element.h:
        (WebCore::Element::willSaveToCache):
        * dom/Event.cpp:
        (WebCore::Event::isProgressEvent):
        * dom/Event.h:
        * dom/EventNames.h:
        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::dispatchProgressEvent):
        * dom/EventTargetNode.h:
        * dom/ProgressEvent.cpp: Added.
        (WebCore::ProgressEvent::ProgressEvent):
        (WebCore::ProgressEvent::initProgressEvent):
        (WebCore::ProgressEvent::initProgressEventNS):
        * dom/ProgressEvent.h: Added.
        (WebCore::ProgressEvent::lengthComputable):
        (WebCore::ProgressEvent::loaded):
        (WebCore::ProgressEvent::total):
        (WebCore::ProgressEvent::isProgressEvent):
        * dom/ProgressEvent.idl: Added.
        * history/CachedPage.cpp:
        (WebCore::CachedPage::CachedPage):
        * html/HTMLAttributeNames.in:
        * html/HTMLAudioElement.cpp: Added.
        (WebCore::HTMLAudioElement::HTMLAudioElement):
        * html/HTMLAudioElement.h: Added.
        (WebCore::HTMLAudioElement::tagPriority):
        * html/HTMLAudioElement.idl: Added.
        * html/HTMLElement.cpp:
        (WebCore::inlineTagList):
        * html/HTMLElementFactory.cpp:
        (WebCore::audioConstructor):
        (WebCore::videoConstructor):
        (WebCore::sourceConstructor):
        (WebCore::createFunctionMap):
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::~HTMLInputElement):
        (WebCore::HTMLInputElement::setInputType):
        (WebCore::HTMLInputElement::willMoveToNewOwnerDocument):
        (WebCore::HTMLInputElement::didMoveToNewOwnerDocument):
        * html/HTMLMediaElement.cpp: Added.
        (WebCore::HTMLMediaElement::HTMLMediaElement):
        (WebCore::HTMLMediaElement::~HTMLMediaElement):
        (WebCore::HTMLMediaElement::checkDTD):
        (WebCore::HTMLMediaElement::rendererIsNeeded):
        (WebCore::HTMLMediaElement::createRenderer):
        (WebCore::HTMLMediaElement::insertedIntoDocument):
        (WebCore::HTMLMediaElement::removedFromDocument):
        (WebCore::HTMLMediaElement::scheduleLoad):
        (WebCore::HTMLMediaElement::initAndDispatchProgressEvent):
        (WebCore::HTMLMediaElement::dispatchEventAsync):
        (WebCore::HTMLMediaElement::loadTimerFired):
        (WebCore::HTMLMediaElement::asyncEventTimerFired):
        (WebCore::serializeTimeOffset):
        (WebCore::parseTimeOffset):
        (WebCore::HTMLMediaElement::getTimeOffsetAttribute):
        (WebCore::HTMLMediaElement::setTimeOffsetAttribute):
        (WebCore::HTMLMediaElement::error):
        (WebCore::HTMLMediaElement::src):
        (WebCore::HTMLMediaElement::HTMLMediaElement::setSrc):
        (WebCore::HTMLMediaElement::currentSrc):
        (WebCore::HTMLMediaElement::networkState):
        (WebCore::HTMLMediaElement::bufferingRate):
        (WebCore::HTMLMediaElement::load):
        (WebCore::HTMLMediaElement::movieNetworkStateChanged):
        (WebCore::HTMLMediaElement::movieReadyStateChanged):
        (WebCore::HTMLMediaElement::setReadyState):
        (WebCore::HTMLMediaElement::progressEventTimerFired):
        (WebCore::HTMLMediaElement::seek):
        (WebCore::HTMLMediaElement::readyState):
        (WebCore::HTMLMediaElement::seeking):
        (WebCore::HTMLMediaElement::currentTime):
        (WebCore::HTMLMediaElement::setCurrentTime):
        (WebCore::HTMLMediaElement::duration):
        (WebCore::HTMLMediaElement::paused):
        (WebCore::HTMLMediaElement::defaultPlaybackRate):
        (WebCore::HTMLMediaElement::setDefaultPlaybackRate):
        (WebCore::HTMLMediaElement::playbackRate):
        (WebCore::HTMLMediaElement::setPlaybackRate):
        (WebCore::HTMLMediaElement::ended):
        (WebCore::HTMLMediaElement::autoplay):
        (WebCore::HTMLMediaElement::setAutoplay):
        (WebCore::HTMLMediaElement::play):
        (WebCore::HTMLMediaElement::pause):
        (WebCore::HTMLMediaElement::loopCount):
        (WebCore::HTMLMediaElement::setLoopCount):
        (WebCore::HTMLMediaElement::start):
        (WebCore::HTMLMediaElement::setStart):
        (WebCore::HTMLMediaElement::end):
        (WebCore::HTMLMediaElement::setEnd):
        (WebCore::HTMLMediaElement::loopStart):
        (WebCore::HTMLMediaElement::setLoopStart):
        (WebCore::HTMLMediaElement::loopEnd):
        (WebCore::HTMLMediaElement::setLoopEnd):
        (WebCore::HTMLMediaElement::currentLoop):
        (WebCore::HTMLMediaElement::setCurrentLoop):
        (WebCore::HTMLMediaElement::controls):
        (WebCore::HTMLMediaElement::setControls):
        (WebCore::HTMLMediaElement::volume):
        (WebCore::HTMLMediaElement::setVolume):
        (WebCore::HTMLMediaElement::muted):
        (WebCore::HTMLMediaElement::setMuted):
        (WebCore::HTMLMediaElement::pickMedia):
        (WebCore::HTMLMediaElement::checkIfSeekNeeded):
        (WebCore::HTMLMediaElement::movieVolumeChanged):
        (WebCore::HTMLMediaElement::movieDidEnd):
        (WebCore::HTMLMediaElement::movieCuePointReached):
        (WebCore::HTMLMediaElement::addCuePoint):
        (WebCore::HTMLMediaElement::removeCuePoint):
        (WebCore::HTMLMediaElement::buffered):
        (WebCore::HTMLMediaElement::played):
        (WebCore::HTMLMediaElement::seekable):
        (WebCore::HTMLMediaElement::effectiveStart):
        (WebCore::HTMLMediaElement::effectiveEnd):
        (WebCore::HTMLMediaElement::effectiveLoopStart):
        (WebCore::HTMLMediaElement::effectiveLoopEnd):
        (WebCore::HTMLMediaElement::activelyPlaying):
        (WebCore::HTMLMediaElement::endedPlayback):
        (WebCore::HTMLMediaElement::willSaveToCache):
        (WebCore::HTMLMediaElement::didRestoreFromCache):
        * html/HTMLMediaElement.h: Added.
        (WebCore::HTMLMediaElement::movie):
        (WebCore::HTMLMediaElement::isVideo):
        (WebCore::HTMLMediaElement::):
        (WebCore::HTMLMediaElement::CallbackEntry::CallbackEntry):
        * html/HTMLMediaElement.idl: Added.
        * html/HTMLSourceElement.cpp: Added.
        (WebCore::HTMLSourceElement::HTMLSourceElement):
        (WebCore::HTMLSourceElement::~HTMLSourceElement):
        (WebCore::HTMLSourceElement::insertedIntoDocument):
        (WebCore::HTMLSourceElement::src):
        (WebCore::HTMLSourceElement::setSrc):
        (WebCore::HTMLSourceElement::media):
        (WebCore::HTMLSourceElement::setMedia):
        (WebCore::HTMLSourceElement::type):
        (WebCore::HTMLSourceElement::setType):
        * html/HTMLSourceElement.h: Added.
        (WebCore::HTMLSourceElement::endTagRequirement):
        (WebCore::HTMLSourceElement::tagPriority):
        * html/HTMLSourceElement.idl: Added.
        * html/HTMLTagNames.in:
        * html/HTMLVideoElement.cpp: Added.
        (WebCore::HTMLVideoElement::HTMLVideoElement):
        (WebCore::HTMLVideoElement::videoWidth):
        (WebCore::HTMLVideoElement::videoHeight):
        * html/HTMLVideoElement.h: Added.
        (WebCore::HTMLVideoElement::tagPriority):
        (WebCore::HTMLVideoElement::isVideo):
        * html/HTMLVideoElement.idl: Added.
        * html/MediaError.h: Added.
        (WebCore::MediaError::):
        (WebCore::MediaError::MediaError):
        (WebCore::MediaError::code):
        * html/MediaError.idl: Added.
        * html/TimeRanges.cpp: Added.
        (TimeRanges::TimeRanges):
        (TimeRanges::start):
        (TimeRanges::end):
        (TimeRanges::add):
        (TimeRanges::contain):
        * html/TimeRanges.h: Added.
        (WebCore::TimeRanges::TimeRanges):
        (WebCore::TimeRanges::length):
        (WebCore::TimeRanges::Range::Range):
        * html/TimeRanges.idl: Added.
        * page/DOMWindow.idl:
        * platform/MIMETypeRegistry.cpp:
        (WebCore::initialiseSupportedMovieMIMETypes):
        (WebCore::initialiseMIMETypeRegistry):
        (WebCore::MIMETypeRegistry::isSupportedMovieMIMEType):
        (WebCore::MIMETypeRegistry::getSupportedMovieMIMETypes):
        * platform/MIMETypeRegistry.h:
        * platform/graphics/Movie.cpp: Added.
        (WebCore::Movie::Movie):
        (WebCore::Movie::~Movie):
        (WebCore::Movie::load):
        (WebCore::Movie::cancelLoad):
        (WebCore::Movie::play):
        (WebCore::Movie::pause):
        (WebCore::Movie::duration):
        (WebCore::Movie::currentTime):
        (WebCore::Movie::seek):
        (WebCore::Movie::paused):
        (WebCore::Movie::seeking):
        (WebCore::Movie::naturalSize):
        (WebCore::Movie::hasVideo):
        (WebCore::Movie::networkState):
        (WebCore::Movie::readyState):
        (WebCore::Movie::volume):
        (WebCore::Movie::setVolume):
        (WebCore::Movie::rate):
        (WebCore::Movie::setRate):
        (WebCore::Movie::muted):
        (WebCore::Movie::setMuted):
        (WebCore::Movie::dataRate):
        (WebCore::Movie::setEndTime):
        (WebCore::Movie::addCuePoint):
        (WebCore::Movie::removeCuePoint):
        (WebCore::Movie::clearCuePoints):
        (WebCore::Movie::maxTimeBuffered):
        (WebCore::Movie::maxTimeSeekable):
        (WebCore::Movie::bytesLoaded):
        (WebCore::Movie::totalBytesKnown):
        (WebCore::Movie::totalBytes):
        (WebCore::Movie::setRect):
        (WebCore::Movie::visible):
        (WebCore::Movie::setVisible):
        (WebCore::Movie::paint):
        (WebCore::Movie::getSupportedTypes):
        (WebCore::Movie::networkStateChanged):
        (WebCore::Movie::readyStateChanged):
        (WebCore::Movie::volumeChanged):
        (WebCore::Movie::didEnd):
        (WebCore::Movie::cuePointReached):
        * platform/graphics/Movie.h: Added.
        (WebCore::MovieClient::~MovieClient):
        (WebCore::MovieClient::movieNetworkStateChanged):
        (WebCore::MovieClient::movieReadyStateChanged):
        (WebCore::MovieClient::movieVolumeChanged):
        (WebCore::MovieClient::movieDidEnd):
        (WebCore::MovieClient::movieCuePointReached):
        (WebCore::Movie::parentWidget):
        (WebCore::Movie::setParentWidget):
        (WebCore::Movie::rect):
        (WebCore::Movie::):
        * platform/graphics/mac/MoviePrivateQTKit.h: Added.
        * platform/graphics/mac/MoviePrivateQTKit.mm: Added.
        (WebCore::MoviePrivate::MoviePrivate):
        (WebCore::MoviePrivate::~MoviePrivate):
        (WebCore::MoviePrivate::createQTMovie):
        (WebCore::MoviePrivate::createQTMovieView):
        (WebCore::MoviePrivate::createQTTime):
        (WebCore::MoviePrivate::load):
        (WebCore::MoviePrivate::play):
        (WebCore::MoviePrivate::pause):
        (WebCore::MoviePrivate::duration):
        (WebCore::MoviePrivate::currentTime):
        (WebCore::MoviePrivate::seek):
        (WebCore::MoviePrivate::setEndTime):
        (WebCore::MoviePrivate::addCuePoint):
        (WebCore::MoviePrivate::removeCuePoint):
        (WebCore::MoviePrivate::clearCuePoints):
        (WebCore::MoviePrivate::startCuePointTimerIfNeeded):
        (WebCore::MoviePrivate::cancelSeek):
        (WebCore::MoviePrivate::seekTimerFired):
        (WebCore::MoviePrivate::cuePointTimerFired):
        (WebCore::MoviePrivate::paused):
        (WebCore::MoviePrivate::seeking):
        (WebCore::MoviePrivate::naturalSize):
        (WebCore::MoviePrivate::hasVideo):
        (WebCore::MoviePrivate::setVolume):
        (WebCore::MoviePrivate::setMuted):
        (WebCore::MoviePrivate::setRate):
        (WebCore::MoviePrivate::dataRate):
        (WebCore::MoviePrivate::networkState):
        (WebCore::MoviePrivate::readyState):
        (WebCore::MoviePrivate::maxTimeBuffered):
        (WebCore::MoviePrivate::maxTimeSeekable):
        (WebCore::MoviePrivate::maxTimeLoaded):
        (WebCore::MoviePrivate::bytesLoaded):
        (WebCore::MoviePrivate::totalBytesKnown):
        (WebCore::MoviePrivate::totalBytes):
        (WebCore::MoviePrivate::cancelLoad):
        (WebCore::MoviePrivate::updateStates):
        (WebCore::MoviePrivate::loadStateChanged):
        (WebCore::MoviePrivate::rateChanged):
        (WebCore::MoviePrivate::sizeChanged):
        (WebCore::MoviePrivate::timeChanged):
        (WebCore::MoviePrivate::volumeChanged):
        (WebCore::MoviePrivate::didEnd):
        (WebCore::MoviePrivate::setRect):
        (WebCore::MoviePrivate::setVisible):
        (WebCore::MoviePrivate::paint):
        (WebCore::MoviePrivate::getSupportedTypes):
        (-[WebCoreMovieObserver loadStateChanged:]):
        (-[WebCoreMovieObserver rateChanged:]):
        (-[WebCoreMovieObserver sizeChanged:]):
        (-[WebCoreMovieObserver timeChanged:]):
        (-[WebCoreMovieObserver volumeChanged:]):
        (-[WebCoreMovieObserver didEnd:]):
        (-[WebCoreMovieObserver setCallback:WebCore::]):
        * platform/mac/WebCoreSystemInterface.h:
        * platform/mac/WebCoreSystemInterface.mm:
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::collectLayers):
        * rendering/RenderVideo.cpp: Added.
        (WebCore::RenderVideo::RenderVideo):
        (WebCore::RenderVideo::~RenderVideo):
        (WebCore::RenderVideo::movie):
        (WebCore::RenderVideo::videoSizeChanged):
        (WebCore::RenderVideo::paint):
        (WebCore::RenderVideo::layout):
        (WebCore::RenderVideo::updateFromElement):
        (WebCore::RenderVideo::updateMovie):
        (WebCore::RenderVideo::isWidthSpecified):
        (WebCore::RenderVideo::isHeightSpecified):
        (WebCore::RenderVideo::calcReplacedWidth):
        (WebCore::RenderVideo::calcReplacedHeight):
        (WebCore::RenderVideo::calcAspectRatioWidth):
        (WebCore::RenderVideo::calcAspectRatioHeight):
        (WebCore::RenderVideo::calcPrefWidths):
        * rendering/RenderVideo.h: Added.
        (WebCore::RenderVideo::renderName):

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

59 files changed:
WebCore/ChangeLog
WebCore/Configurations/WebCore.xcconfig
WebCore/DerivedSources.make
WebCore/WebCore.base.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSEventCustom.cpp
WebCore/bindings/js/JSHTMLAudioElementConstructor.cpp [new file with mode: 0644]
WebCore/bindings/js/JSHTMLAudioElementConstructor.h [new file with mode: 0644]
WebCore/bindings/js/JSHTMLElementWrapperFactory.cpp
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/js/kjs_window.h
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/Event.cpp
WebCore/dom/Event.h
WebCore/dom/EventNames.h
WebCore/dom/EventTargetNode.cpp
WebCore/dom/EventTargetNode.h
WebCore/dom/ProgressEvent.cpp [new file with mode: 0644]
WebCore/dom/ProgressEvent.h [new file with mode: 0644]
WebCore/dom/ProgressEvent.idl [new file with mode: 0644]
WebCore/history/CachedPage.cpp
WebCore/html/HTMLAttributeNames.in
WebCore/html/HTMLAudioElement.cpp [new file with mode: 0644]
WebCore/html/HTMLAudioElement.h [new file with mode: 0644]
WebCore/html/HTMLAudioElement.idl [new file with mode: 0644]
WebCore/html/HTMLElement.cpp
WebCore/html/HTMLElementFactory.cpp
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLMediaElement.cpp [new file with mode: 0644]
WebCore/html/HTMLMediaElement.h [new file with mode: 0644]
WebCore/html/HTMLMediaElement.idl [new file with mode: 0644]
WebCore/html/HTMLSourceElement.cpp [new file with mode: 0644]
WebCore/html/HTMLSourceElement.h [new file with mode: 0644]
WebCore/html/HTMLSourceElement.idl [new file with mode: 0644]
WebCore/html/HTMLTagNames.in
WebCore/html/HTMLVideoElement.cpp [new file with mode: 0644]
WebCore/html/HTMLVideoElement.h [new file with mode: 0644]
WebCore/html/HTMLVideoElement.idl [new file with mode: 0644]
WebCore/html/MediaError.h [new file with mode: 0644]
WebCore/html/MediaError.idl [new file with mode: 0644]
WebCore/html/TimeRanges.cpp [new file with mode: 0644]
WebCore/html/TimeRanges.h [new file with mode: 0644]
WebCore/html/TimeRanges.idl [new file with mode: 0644]
WebCore/page/DOMWindow.idl
WebCore/platform/MIMETypeRegistry.cpp
WebCore/platform/MIMETypeRegistry.h
WebCore/platform/graphics/Movie.cpp [new file with mode: 0644]
WebCore/platform/graphics/Movie.h [new file with mode: 0644]
WebCore/platform/graphics/mac/MoviePrivateQTKit.h [new file with mode: 0644]
WebCore/platform/graphics/mac/MoviePrivateQTKit.mm [new file with mode: 0644]
WebCore/platform/mac/WebCoreSystemInterface.h
WebCore/platform/mac/WebCoreSystemInterface.mm
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderVideo.cpp [new file with mode: 0644]
WebCore/rendering/RenderVideo.h [new file with mode: 0644]

index df26ef7..2f49be7 100644 (file)
@@ -1,3 +1,342 @@
+2007-10-29  Antti Koivisto  <antti@apple.com>
+
+        Rubber stamped by Adele.
+
+        Initial media (<video> and <audio>) support from feature branch and 
+        QTKit based platform implementation.
+        
+        This will need to be updated to match current draft specification.
+
+        * Configurations/WebCore.xcconfig:
+        * DerivedSources.make:
+        * WebCore.base.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSHTMLAudioElementConstructor.cpp: Added.
+        (WebCore::JSHTMLAudioElementConstructor::JSHTMLAudioElementConstructor):
+        (WebCore::JSHTMLAudioElementConstructor::implementsConstruct):
+        (WebCore::JSHTMLAudioElementConstructor::construct):
+        * bindings/js/JSHTMLAudioElementConstructor.h: Added.
+        * bindings/js/JSHTMLElementWrapperFactory.cpp:
+        (WebCore::createJSHTMLWrapper):
+        * bindings/js/kjs_window.cpp:
+        (KJS::Window::getValueProperty):
+        * bindings/js/kjs_window.h:
+        (KJS::Window::):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * dom/Document.cpp:
+        (WebCore::Document::createEvent):
+        (WebCore::Document::willSaveToCache):
+        (WebCore::Document::didRestoreFromCache):
+        (WebCore::Document::registerForCacheCallbacks):
+        (WebCore::Document::unregisterForCacheCallbacks):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::Element::setBooleanAttribute):
+        * dom/Element.h:
+        (WebCore::Element::willSaveToCache):
+        * dom/Event.cpp:
+        (WebCore::Event::isProgressEvent):
+        * dom/Event.h:
+        * dom/EventNames.h:
+        * dom/EventTargetNode.cpp:
+        (WebCore::EventTargetNode::dispatchProgressEvent):
+        * dom/EventTargetNode.h:
+        * dom/ProgressEvent.cpp: Added.
+        (WebCore::ProgressEvent::ProgressEvent):
+        (WebCore::ProgressEvent::initProgressEvent):
+        (WebCore::ProgressEvent::initProgressEventNS):
+        * dom/ProgressEvent.h: Added.
+        (WebCore::ProgressEvent::lengthComputable):
+        (WebCore::ProgressEvent::loaded):
+        (WebCore::ProgressEvent::total):
+        (WebCore::ProgressEvent::isProgressEvent):
+        * dom/ProgressEvent.idl: Added.
+        * history/CachedPage.cpp:
+        (WebCore::CachedPage::CachedPage):
+        * html/HTMLAttributeNames.in:
+        * html/HTMLAudioElement.cpp: Added.
+        (WebCore::HTMLAudioElement::HTMLAudioElement):
+        * html/HTMLAudioElement.h: Added.
+        (WebCore::HTMLAudioElement::tagPriority):
+        * html/HTMLAudioElement.idl: Added.
+        * html/HTMLElement.cpp:
+        (WebCore::inlineTagList):
+        * html/HTMLElementFactory.cpp:
+        (WebCore::audioConstructor):
+        (WebCore::videoConstructor):
+        (WebCore::sourceConstructor):
+        (WebCore::createFunctionMap):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::~HTMLInputElement):
+        (WebCore::HTMLInputElement::setInputType):
+        (WebCore::HTMLInputElement::willMoveToNewOwnerDocument):
+        (WebCore::HTMLInputElement::didMoveToNewOwnerDocument):
+        * html/HTMLMediaElement.cpp: Added.
+        (WebCore::HTMLMediaElement::HTMLMediaElement):
+        (WebCore::HTMLMediaElement::~HTMLMediaElement):
+        (WebCore::HTMLMediaElement::checkDTD):
+        (WebCore::HTMLMediaElement::rendererIsNeeded):
+        (WebCore::HTMLMediaElement::createRenderer):
+        (WebCore::HTMLMediaElement::insertedIntoDocument):
+        (WebCore::HTMLMediaElement::removedFromDocument):
+        (WebCore::HTMLMediaElement::scheduleLoad):
+        (WebCore::HTMLMediaElement::initAndDispatchProgressEvent):
+        (WebCore::HTMLMediaElement::dispatchEventAsync):
+        (WebCore::HTMLMediaElement::loadTimerFired):
+        (WebCore::HTMLMediaElement::asyncEventTimerFired):
+        (WebCore::serializeTimeOffset):
+        (WebCore::parseTimeOffset):
+        (WebCore::HTMLMediaElement::getTimeOffsetAttribute):
+        (WebCore::HTMLMediaElement::setTimeOffsetAttribute):
+        (WebCore::HTMLMediaElement::error):
+        (WebCore::HTMLMediaElement::src):
+        (WebCore::HTMLMediaElement::HTMLMediaElement::setSrc):
+        (WebCore::HTMLMediaElement::currentSrc):
+        (WebCore::HTMLMediaElement::networkState):
+        (WebCore::HTMLMediaElement::bufferingRate):
+        (WebCore::HTMLMediaElement::load):
+        (WebCore::HTMLMediaElement::movieNetworkStateChanged):
+        (WebCore::HTMLMediaElement::movieReadyStateChanged):
+        (WebCore::HTMLMediaElement::setReadyState):
+        (WebCore::HTMLMediaElement::progressEventTimerFired):
+        (WebCore::HTMLMediaElement::seek):
+        (WebCore::HTMLMediaElement::readyState):
+        (WebCore::HTMLMediaElement::seeking):
+        (WebCore::HTMLMediaElement::currentTime):
+        (WebCore::HTMLMediaElement::setCurrentTime):
+        (WebCore::HTMLMediaElement::duration):
+        (WebCore::HTMLMediaElement::paused):
+        (WebCore::HTMLMediaElement::defaultPlaybackRate):
+        (WebCore::HTMLMediaElement::setDefaultPlaybackRate):
+        (WebCore::HTMLMediaElement::playbackRate):
+        (WebCore::HTMLMediaElement::setPlaybackRate):
+        (WebCore::HTMLMediaElement::ended):
+        (WebCore::HTMLMediaElement::autoplay):
+        (WebCore::HTMLMediaElement::setAutoplay):
+        (WebCore::HTMLMediaElement::play):
+        (WebCore::HTMLMediaElement::pause):
+        (WebCore::HTMLMediaElement::loopCount):
+        (WebCore::HTMLMediaElement::setLoopCount):
+        (WebCore::HTMLMediaElement::start):
+        (WebCore::HTMLMediaElement::setStart):
+        (WebCore::HTMLMediaElement::end):
+        (WebCore::HTMLMediaElement::setEnd):
+        (WebCore::HTMLMediaElement::loopStart):
+        (WebCore::HTMLMediaElement::setLoopStart):
+        (WebCore::HTMLMediaElement::loopEnd):
+        (WebCore::HTMLMediaElement::setLoopEnd):
+        (WebCore::HTMLMediaElement::currentLoop):
+        (WebCore::HTMLMediaElement::setCurrentLoop):
+        (WebCore::HTMLMediaElement::controls):
+        (WebCore::HTMLMediaElement::setControls):
+        (WebCore::HTMLMediaElement::volume):
+        (WebCore::HTMLMediaElement::setVolume):
+        (WebCore::HTMLMediaElement::muted):
+        (WebCore::HTMLMediaElement::setMuted):
+        (WebCore::HTMLMediaElement::pickMedia):
+        (WebCore::HTMLMediaElement::checkIfSeekNeeded):
+        (WebCore::HTMLMediaElement::movieVolumeChanged):
+        (WebCore::HTMLMediaElement::movieDidEnd):
+        (WebCore::HTMLMediaElement::movieCuePointReached):
+        (WebCore::HTMLMediaElement::addCuePoint):
+        (WebCore::HTMLMediaElement::removeCuePoint):
+        (WebCore::HTMLMediaElement::buffered):
+        (WebCore::HTMLMediaElement::played):
+        (WebCore::HTMLMediaElement::seekable):
+        (WebCore::HTMLMediaElement::effectiveStart):
+        (WebCore::HTMLMediaElement::effectiveEnd):
+        (WebCore::HTMLMediaElement::effectiveLoopStart):
+        (WebCore::HTMLMediaElement::effectiveLoopEnd):
+        (WebCore::HTMLMediaElement::activelyPlaying):
+        (WebCore::HTMLMediaElement::endedPlayback):
+        (WebCore::HTMLMediaElement::willSaveToCache):
+        (WebCore::HTMLMediaElement::didRestoreFromCache):
+        * html/HTMLMediaElement.h: Added.
+        (WebCore::HTMLMediaElement::movie):
+        (WebCore::HTMLMediaElement::isVideo):
+        (WebCore::HTMLMediaElement::):
+        (WebCore::HTMLMediaElement::CallbackEntry::CallbackEntry):
+        * html/HTMLMediaElement.idl: Added.
+        * html/HTMLSourceElement.cpp: Added.
+        (WebCore::HTMLSourceElement::HTMLSourceElement):
+        (WebCore::HTMLSourceElement::~HTMLSourceElement):
+        (WebCore::HTMLSourceElement::insertedIntoDocument):
+        (WebCore::HTMLSourceElement::src):
+        (WebCore::HTMLSourceElement::setSrc):
+        (WebCore::HTMLSourceElement::media):
+        (WebCore::HTMLSourceElement::setMedia):
+        (WebCore::HTMLSourceElement::type):
+        (WebCore::HTMLSourceElement::setType):
+        * html/HTMLSourceElement.h: Added.
+        (WebCore::HTMLSourceElement::endTagRequirement):
+        (WebCore::HTMLSourceElement::tagPriority):
+        * html/HTMLSourceElement.idl: Added.
+        * html/HTMLTagNames.in:
+        * html/HTMLVideoElement.cpp: Added.
+        (WebCore::HTMLVideoElement::HTMLVideoElement):
+        (WebCore::HTMLVideoElement::videoWidth):
+        (WebCore::HTMLVideoElement::videoHeight):
+        * html/HTMLVideoElement.h: Added.
+        (WebCore::HTMLVideoElement::tagPriority):
+        (WebCore::HTMLVideoElement::isVideo):
+        * html/HTMLVideoElement.idl: Added.
+        * html/MediaError.h: Added.
+        (WebCore::MediaError::):
+        (WebCore::MediaError::MediaError):
+        (WebCore::MediaError::code):
+        * html/MediaError.idl: Added.
+        * html/TimeRanges.cpp: Added.
+        (TimeRanges::TimeRanges):
+        (TimeRanges::start):
+        (TimeRanges::end):
+        (TimeRanges::add):
+        (TimeRanges::contain):
+        * html/TimeRanges.h: Added.
+        (WebCore::TimeRanges::TimeRanges):
+        (WebCore::TimeRanges::length):
+        (WebCore::TimeRanges::Range::Range):
+        * html/TimeRanges.idl: Added.
+        * page/DOMWindow.idl:
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::initialiseSupportedMovieMIMETypes):
+        (WebCore::initialiseMIMETypeRegistry):
+        (WebCore::MIMETypeRegistry::isSupportedMovieMIMEType):
+        (WebCore::MIMETypeRegistry::getSupportedMovieMIMETypes):
+        * platform/MIMETypeRegistry.h:
+        * platform/graphics/Movie.cpp: Added.
+        (WebCore::Movie::Movie):
+        (WebCore::Movie::~Movie):
+        (WebCore::Movie::load):
+        (WebCore::Movie::cancelLoad):
+        (WebCore::Movie::play):
+        (WebCore::Movie::pause):
+        (WebCore::Movie::duration):
+        (WebCore::Movie::currentTime):
+        (WebCore::Movie::seek):
+        (WebCore::Movie::paused):
+        (WebCore::Movie::seeking):
+        (WebCore::Movie::naturalSize):
+        (WebCore::Movie::hasVideo):
+        (WebCore::Movie::networkState):
+        (WebCore::Movie::readyState):
+        (WebCore::Movie::volume):
+        (WebCore::Movie::setVolume):
+        (WebCore::Movie::rate):
+        (WebCore::Movie::setRate):
+        (WebCore::Movie::muted):
+        (WebCore::Movie::setMuted):
+        (WebCore::Movie::dataRate):
+        (WebCore::Movie::setEndTime):
+        (WebCore::Movie::addCuePoint):
+        (WebCore::Movie::removeCuePoint):
+        (WebCore::Movie::clearCuePoints):
+        (WebCore::Movie::maxTimeBuffered):
+        (WebCore::Movie::maxTimeSeekable):
+        (WebCore::Movie::bytesLoaded):
+        (WebCore::Movie::totalBytesKnown):
+        (WebCore::Movie::totalBytes):
+        (WebCore::Movie::setRect):
+        (WebCore::Movie::visible):
+        (WebCore::Movie::setVisible):
+        (WebCore::Movie::paint):
+        (WebCore::Movie::getSupportedTypes):
+        (WebCore::Movie::networkStateChanged):
+        (WebCore::Movie::readyStateChanged):
+        (WebCore::Movie::volumeChanged):
+        (WebCore::Movie::didEnd):
+        (WebCore::Movie::cuePointReached):
+        * platform/graphics/Movie.h: Added.
+        (WebCore::MovieClient::~MovieClient):
+        (WebCore::MovieClient::movieNetworkStateChanged):
+        (WebCore::MovieClient::movieReadyStateChanged):
+        (WebCore::MovieClient::movieVolumeChanged):
+        (WebCore::MovieClient::movieDidEnd):
+        (WebCore::MovieClient::movieCuePointReached):
+        (WebCore::Movie::parentWidget):
+        (WebCore::Movie::setParentWidget):
+        (WebCore::Movie::rect):
+        (WebCore::Movie::):
+        * platform/graphics/mac/MoviePrivateQTKit.h: Added.
+        * platform/graphics/mac/MoviePrivateQTKit.mm: Added.
+        (WebCore::MoviePrivate::MoviePrivate):
+        (WebCore::MoviePrivate::~MoviePrivate):
+        (WebCore::MoviePrivate::createQTMovie):
+        (WebCore::MoviePrivate::createQTMovieView):
+        (WebCore::MoviePrivate::createQTTime):
+        (WebCore::MoviePrivate::load):
+        (WebCore::MoviePrivate::play):
+        (WebCore::MoviePrivate::pause):
+        (WebCore::MoviePrivate::duration):
+        (WebCore::MoviePrivate::currentTime):
+        (WebCore::MoviePrivate::seek):
+        (WebCore::MoviePrivate::setEndTime):
+        (WebCore::MoviePrivate::addCuePoint):
+        (WebCore::MoviePrivate::removeCuePoint):
+        (WebCore::MoviePrivate::clearCuePoints):
+        (WebCore::MoviePrivate::startCuePointTimerIfNeeded):
+        (WebCore::MoviePrivate::cancelSeek):
+        (WebCore::MoviePrivate::seekTimerFired):
+        (WebCore::MoviePrivate::cuePointTimerFired):
+        (WebCore::MoviePrivate::paused):
+        (WebCore::MoviePrivate::seeking):
+        (WebCore::MoviePrivate::naturalSize):
+        (WebCore::MoviePrivate::hasVideo):
+        (WebCore::MoviePrivate::setVolume):
+        (WebCore::MoviePrivate::setMuted):
+        (WebCore::MoviePrivate::setRate):
+        (WebCore::MoviePrivate::dataRate):
+        (WebCore::MoviePrivate::networkState):
+        (WebCore::MoviePrivate::readyState):
+        (WebCore::MoviePrivate::maxTimeBuffered):
+        (WebCore::MoviePrivate::maxTimeSeekable):
+        (WebCore::MoviePrivate::maxTimeLoaded):
+        (WebCore::MoviePrivate::bytesLoaded):
+        (WebCore::MoviePrivate::totalBytesKnown):
+        (WebCore::MoviePrivate::totalBytes):
+        (WebCore::MoviePrivate::cancelLoad):
+        (WebCore::MoviePrivate::updateStates):
+        (WebCore::MoviePrivate::loadStateChanged):
+        (WebCore::MoviePrivate::rateChanged):
+        (WebCore::MoviePrivate::sizeChanged):
+        (WebCore::MoviePrivate::timeChanged):
+        (WebCore::MoviePrivate::volumeChanged):
+        (WebCore::MoviePrivate::didEnd):
+        (WebCore::MoviePrivate::setRect):
+        (WebCore::MoviePrivate::setVisible):
+        (WebCore::MoviePrivate::paint):
+        (WebCore::MoviePrivate::getSupportedTypes):
+        (-[WebCoreMovieObserver loadStateChanged:]):
+        (-[WebCoreMovieObserver rateChanged:]):
+        (-[WebCoreMovieObserver sizeChanged:]):
+        (-[WebCoreMovieObserver timeChanged:]):
+        (-[WebCoreMovieObserver volumeChanged:]):
+        (-[WebCoreMovieObserver didEnd:]):
+        (-[WebCoreMovieObserver setCallback:WebCore::]):
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::collectLayers):
+        * rendering/RenderVideo.cpp: Added.
+        (WebCore::RenderVideo::RenderVideo):
+        (WebCore::RenderVideo::~RenderVideo):
+        (WebCore::RenderVideo::movie):
+        (WebCore::RenderVideo::videoSizeChanged):
+        (WebCore::RenderVideo::paint):
+        (WebCore::RenderVideo::layout):
+        (WebCore::RenderVideo::updateFromElement):
+        (WebCore::RenderVideo::updateMovie):
+        (WebCore::RenderVideo::isWidthSpecified):
+        (WebCore::RenderVideo::isHeightSpecified):
+        (WebCore::RenderVideo::calcReplacedWidth):
+        (WebCore::RenderVideo::calcReplacedHeight):
+        (WebCore::RenderVideo::calcAspectRatioWidth):
+        (WebCore::RenderVideo::calcAspectRatioHeight):
+        (WebCore::RenderVideo::calcPrefWidths):
+        * rendering/RenderVideo.h: Added.
+        (WebCore::RenderVideo::renderName):
+
 2007-10-30  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Adam Roben.
index 6038380..e7c3094 100644 (file)
@@ -5,7 +5,7 @@ EXPORTED_SYMBOLS_FILE_i386 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCor
 EXPORTED_SYMBOLS_FILE_ppc = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp;
 EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp;
 EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp;
-FEATURE_DEFINES = ENABLE_DATABASE ENABLE_ICONDATABASE ENABLE_SVG ENABLE_SVG_EXPERIMENTAL_FEATURES ENABLE_XPATH ENABLE_XSLT;
+FEATURE_DEFINES = ENABLE_DATABASE ENABLE_ICONDATABASE ENABLE_SVG ENABLE_SVG_EXPERIMENTAL_FEATURES ENABLE_XPATH ENABLE_XSLT ENABLE_VIDEO;
 GCC_PREFIX_HEADER = WebCorePrefix.h;
 GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) $(GCC_PREPROCESSOR_DEFINITIONS);
 FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS);
index 5db0e64..070a2bf 100644 (file)
@@ -347,6 +347,7 @@ all : \
     JSHTMLAppletElement.h \
     JSHTMLAnchorElement.h \
     JSHTMLAreaElement.h \
+    JSHTMLAudioElement.h \
     JSHTMLBaseElement.h \
     JSHTMLBaseFontElement.h \
     JSHTMLBlockquoteElement.h \
@@ -381,6 +382,7 @@ all : \
     JSHTMLLinkElement.h \
     JSHTMLMapElement.h \
     JSHTMLMarqueeElement.h \
+    JSHTMLMediaElement.h \
     JSHTMLMenuElement.h \
     JSHTMLMetaElement.h \
     JSHTMLModElement.h \
@@ -395,6 +397,7 @@ all : \
     JSHTMLQuoteElement.h \
     JSHTMLScriptElement.h \
     JSHTMLSelectElement.h \
+    JSHTMLSourceElement.h \
     JSHTMLStyleElement.h \
     JSHTMLTableCaptionElement.h \
     JSHTMLTableCellElement.h \
@@ -405,8 +408,10 @@ all : \
     JSHTMLTextAreaElement.h \
     JSHTMLTitleElement.h \
     JSHTMLUListElement.h \
+    JSHTMLVideoElement.h \
     JSHistory.h \
     JSKeyboardEvent.h \
+    JSMediaError.h \
     JSMediaList.h \
     JSMouseEvent.h \
     JSMutationEvent.h \
@@ -418,6 +423,7 @@ all : \
     JSNotation.h \
     JSOverflowEvent.h \
     JSProcessingInstruction.h \
+    JSProgressEvent.h \
     JSRange.h \
     JSRangeException.h \
     JSRect.h \
@@ -560,9 +566,11 @@ all : \
     JSStyleSheetList.h \
     JSText.h \
     JSTextEvent.h \
+    JSTimeRanges.h \
     JSTreeWalker.h \
     JSUIEvent.h \
     JSVersionChangeCallback.h \
+    JSVoidCallback.h \
     JSXPathEvaluator.h \
     JSXPathExpression.h \
     JSXPathNSResolver.h \
index 8836e41..6b93262 100644 (file)
@@ -740,6 +740,8 @@ _wkInitializeGlyphVector
 _wkNSURLProtocolClassForReqest
 _wkPathFromFont
 _wkPopupMenu
+_wkQTMovieDataRate
+_wkQTMovieMaxTimeLoaded
 _wkReleaseStyleGroup
 _wkSecondsSinceLastInputEvent
 _wkSetCGFontRenderingMode
index ccb1f14..c4630ca 100644 (file)
                E1ED8AC30CC49BE000BFC557 /* CSSPrimitiveValueMappings.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ED8AC20CC49BE000BFC557 /* CSSPrimitiveValueMappings.h */; };
                E1F1E82F0C3C2BB9006DB391 /* XSLTExtensions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F1E82D0C3C2BB9006DB391 /* XSLTExtensions.cpp */; };
                E1F1E8300C3C2BB9006DB391 /* XSLTExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */; };
+               E44613A10CD6331000FADA75 /* HTMLAudioElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */; };
+               E44613A20CD6331000FADA75 /* HTMLAudioElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E44613900CD6331000FADA75 /* HTMLAudioElement.h */; };
+               E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44613920CD6331000FADA75 /* HTMLMediaElement.cpp */; };
+               E44613A50CD6331000FADA75 /* HTMLMediaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E44613930CD6331000FADA75 /* HTMLMediaElement.h */; };
+               E44613A70CD6331000FADA75 /* HTMLSourceElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44613950CD6331000FADA75 /* HTMLSourceElement.cpp */; };
+               E44613A80CD6331000FADA75 /* HTMLSourceElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E44613960CD6331000FADA75 /* HTMLSourceElement.h */; };
+               E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44613980CD6331000FADA75 /* HTMLVideoElement.cpp */; };
+               E44613AB0CD6331000FADA75 /* HTMLVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E44613990CD6331000FADA75 /* HTMLVideoElement.h */; };
+               E44613AD0CD6331000FADA75 /* MediaError.h in Headers */ = {isa = PBXBuildFile; fileRef = E446139B0CD6331000FADA75 /* MediaError.h */; };
+               E44613AF0CD6331000FADA75 /* TimeRanges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E446139D0CD6331000FADA75 /* TimeRanges.cpp */; };
+               E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = E446139E0CD6331000FADA75 /* TimeRanges.h */; };
+               E44613B10CD6331000FADA75 /* TimeRanges.idl in Resources */ = {isa = PBXBuildFile; fileRef = E446139F0CD6331000FADA75 /* TimeRanges.idl */; };
+               E44613B20CD6331000FADA75 /* VoidCallback.idl in Resources */ = {isa = PBXBuildFile; fileRef = E44613A00CD6331000FADA75 /* VoidCallback.idl */; };
+               E44613B50CD6344E00FADA75 /* VoidCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44613B30CD6344E00FADA75 /* VoidCallback.cpp */; };
+               E44613B60CD6344E00FADA75 /* VoidCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = E44613B40CD6344E00FADA75 /* VoidCallback.h */; };
+               E44613E30CD6819F00FADA75 /* Movie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B41E0C0CBF90BD00AF2ECE /* Movie.cpp */; };
+               E44613E40CD681A200FADA75 /* Movie.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E0D0CBF90BD00AF2ECE /* Movie.h */; };
+               E44613E50CD681A600FADA75 /* MoviePrivateQTKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4B41E110CBF90EF00AF2ECE /* MoviePrivateQTKit.mm */; };
+               E44613E60CD681A900FADA75 /* MoviePrivateQTKit.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E100CBF90EF00AF2ECE /* MoviePrivateQTKit.h */; };
+               E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B41E010CBF8EAA00AF2ECE /* ProgressEvent.cpp */; };
+               E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E020CBF8EAA00AF2ECE /* ProgressEvent.h */; };
+               E44613ED0CD681BA00FADA75 /* JSProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */; };
+               E44613EE0CD681BB00FADA75 /* JSProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */; };
+               E44614160CD6826900FADA75 /* JSHTMLVideoElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E446140E0CD6826900FADA75 /* JSHTMLVideoElement.cpp */; };
+               E44614170CD6826900FADA75 /* JSHTMLVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E446140F0CD6826900FADA75 /* JSHTMLVideoElement.h */; };
+               E44614180CD6826900FADA75 /* JSMediaError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44614100CD6826900FADA75 /* JSMediaError.cpp */; };
+               E44614190CD6826900FADA75 /* JSMediaError.h in Headers */ = {isa = PBXBuildFile; fileRef = E44614110CD6826900FADA75 /* JSMediaError.h */; };
+               E446141A0CD6826900FADA75 /* JSTimeRanges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44614120CD6826900FADA75 /* JSTimeRanges.cpp */; };
+               E446141B0CD6826900FADA75 /* JSTimeRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = E44614130CD6826900FADA75 /* JSTimeRanges.h */; };
+               E446141C0CD6826900FADA75 /* JSVoidCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44614140CD6826900FADA75 /* JSVoidCallback.cpp */; };
+               E446141D0CD6826900FADA75 /* JSVoidCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = E44614150CD6826900FADA75 /* JSVoidCallback.h */; };
+               E44614370CD689C400FADA75 /* JSHTMLAudioElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B4237D0CBFB73C00AF2ECE /* JSHTMLAudioElement.cpp */; };
+               E44614380CD689C500FADA75 /* JSHTMLAudioElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B4237E0CBFB73C00AF2ECE /* JSHTMLAudioElement.h */; };
+               E44614390CD689C700FADA75 /* JSHTMLMediaElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B4237F0CBFB73C00AF2ECE /* JSHTMLMediaElement.cpp */; };
+               E446143A0CD689C800FADA75 /* JSHTMLMediaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B423800CBFB73C00AF2ECE /* JSHTMLMediaElement.h */; };
+               E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B423710CBFB6E000AF2ECE /* JSHTMLSourceElement.cpp */; };
+               E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B423720CBFB6E000AF2ECE /* JSHTMLSourceElement.h */; };
+               E446143D0CD68A2300FADA75 /* JSHTMLAudioElementConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B41E070CBF8F2100AF2ECE /* JSHTMLAudioElementConstructor.cpp */; };
+               E446143E0CD68A2300FADA75 /* JSHTMLAudioElementConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E080CBF8F2100AF2ECE /* JSHTMLAudioElementConstructor.h */; };
+               E44614510CD68A3500FADA75 /* RenderVideo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B41E330CBFB60900AF2ECE /* RenderVideo.cpp */; };
+               E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E340CBFB60900AF2ECE /* RenderVideo.h */; };
+               E4B4232F0CBFB66400AF2ECE /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4B4232E0CBFB66400AF2ECE /* QTKit.framework */; };
                ED048ABC0833F132006E1E67 /* textAreaResizeCorner.tiff in Resources */ = {isa = PBXBuildFile; fileRef = ED048ABB0833F132006E1E67 /* textAreaResizeCorner.tiff */; };
                ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */; settings = {ATTRIBUTES = (Private, ); }; };
                ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; };
                E1ED8AC20CC49BE000BFC557 /* CSSPrimitiveValueMappings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSPrimitiveValueMappings.h; sourceTree = "<group>"; };
                E1F1E82D0C3C2BB9006DB391 /* XSLTExtensions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTExtensions.cpp; sourceTree = "<group>"; };
                E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLTExtensions.h; sourceTree = "<group>"; };
+               E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLAudioElement.cpp; sourceTree = "<group>"; };
+               E44613900CD6331000FADA75 /* HTMLAudioElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLAudioElement.h; sourceTree = "<group>"; };
+               E44613910CD6331000FADA75 /* HTMLAudioElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLAudioElement.idl; sourceTree = "<group>"; };
+               E44613920CD6331000FADA75 /* HTMLMediaElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMediaElement.cpp; sourceTree = "<group>"; };
+               E44613930CD6331000FADA75 /* HTMLMediaElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMediaElement.h; sourceTree = "<group>"; };
+               E44613940CD6331000FADA75 /* HTMLMediaElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMediaElement.idl; sourceTree = "<group>"; };
+               E44613950CD6331000FADA75 /* HTMLSourceElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLSourceElement.cpp; sourceTree = "<group>"; };
+               E44613960CD6331000FADA75 /* HTMLSourceElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLSourceElement.h; sourceTree = "<group>"; };
+               E44613970CD6331000FADA75 /* HTMLSourceElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLSourceElement.idl; sourceTree = "<group>"; };
+               E44613980CD6331000FADA75 /* HTMLVideoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLVideoElement.cpp; sourceTree = "<group>"; };
+               E44613990CD6331000FADA75 /* HTMLVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLVideoElement.h; sourceTree = "<group>"; };
+               E446139A0CD6331000FADA75 /* HTMLVideoElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLVideoElement.idl; sourceTree = "<group>"; };
+               E446139B0CD6331000FADA75 /* MediaError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaError.h; sourceTree = "<group>"; };
+               E446139C0CD6331000FADA75 /* MediaError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaError.idl; sourceTree = "<group>"; };
+               E446139D0CD6331000FADA75 /* TimeRanges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeRanges.cpp; sourceTree = "<group>"; };
+               E446139E0CD6331000FADA75 /* TimeRanges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeRanges.h; sourceTree = "<group>"; };
+               E446139F0CD6331000FADA75 /* TimeRanges.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TimeRanges.idl; sourceTree = "<group>"; };
+               E44613A00CD6331000FADA75 /* VoidCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VoidCallback.idl; sourceTree = "<group>"; };
+               E44613B30CD6344E00FADA75 /* VoidCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VoidCallback.cpp; sourceTree = "<group>"; };
+               E44613B40CD6344E00FADA75 /* VoidCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VoidCallback.h; sourceTree = "<group>"; };
+               E446140E0CD6826900FADA75 /* JSHTMLVideoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLVideoElement.cpp; sourceTree = "<group>"; };
+               E446140F0CD6826900FADA75 /* JSHTMLVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLVideoElement.h; sourceTree = "<group>"; };
+               E44614100CD6826900FADA75 /* JSMediaError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaError.cpp; sourceTree = "<group>"; };
+               E44614110CD6826900FADA75 /* JSMediaError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaError.h; sourceTree = "<group>"; };
+               E44614120CD6826900FADA75 /* JSTimeRanges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTimeRanges.cpp; sourceTree = "<group>"; };
+               E44614130CD6826900FADA75 /* JSTimeRanges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTimeRanges.h; sourceTree = "<group>"; };
+               E44614140CD6826900FADA75 /* JSVoidCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVoidCallback.cpp; sourceTree = "<group>"; };
+               E44614150CD6826900FADA75 /* JSVoidCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVoidCallback.h; sourceTree = "<group>"; };
+               E4B41E010CBF8EAA00AF2ECE /* ProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProgressEvent.cpp; sourceTree = "<group>"; };
+               E4B41E020CBF8EAA00AF2ECE /* ProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressEvent.h; sourceTree = "<group>"; };
+               E4B41E030CBF8EAA00AF2ECE /* ProgressEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ProgressEvent.idl; sourceTree = "<group>"; };
+               E4B41E070CBF8F2100AF2ECE /* JSHTMLAudioElementConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAudioElementConstructor.cpp; sourceTree = "<group>"; };
+               E4B41E080CBF8F2100AF2ECE /* JSHTMLAudioElementConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLAudioElementConstructor.h; sourceTree = "<group>"; };
+               E4B41E0C0CBF90BD00AF2ECE /* Movie.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Movie.cpp; sourceTree = "<group>"; };
+               E4B41E0D0CBF90BD00AF2ECE /* Movie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Movie.h; sourceTree = "<group>"; };
+               E4B41E100CBF90EF00AF2ECE /* MoviePrivateQTKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MoviePrivateQTKit.h; sourceTree = "<group>"; };
+               E4B41E110CBF90EF00AF2ECE /* MoviePrivateQTKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MoviePrivateQTKit.mm; sourceTree = "<group>"; };
+               E4B41E330CBFB60900AF2ECE /* RenderVideo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderVideo.cpp; sourceTree = "<group>"; };
+               E4B41E340CBFB60900AF2ECE /* RenderVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderVideo.h; sourceTree = "<group>"; };
+               E4B4232E0CBFB66400AF2ECE /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = "<absolute>"; };
+               E4B423710CBFB6E000AF2ECE /* JSHTMLSourceElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSourceElement.cpp; sourceTree = "<group>"; };
+               E4B423720CBFB6E000AF2ECE /* JSHTMLSourceElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLSourceElement.h; sourceTree = "<group>"; };
+               E4B4237D0CBFB73C00AF2ECE /* JSHTMLAudioElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAudioElement.cpp; sourceTree = "<group>"; };
+               E4B4237E0CBFB73C00AF2ECE /* JSHTMLAudioElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLAudioElement.h; sourceTree = "<group>"; };
+               E4B4237F0CBFB73C00AF2ECE /* JSHTMLMediaElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMediaElement.cpp; sourceTree = "<group>"; };
+               E4B423800CBFB73C00AF2ECE /* JSHTMLMediaElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLMediaElement.h; sourceTree = "<group>"; };
+               E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSProgressEvent.cpp; sourceTree = "<group>"; };
+               E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSProgressEvent.h; sourceTree = "<group>"; };
                ED048ABB0833F132006E1E67 /* textAreaResizeCorner.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = textAreaResizeCorner.tiff; sourceTree = "<group>"; };
                ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarker.h; sourceTree = "<group>"; };
                ED501DC50B249F2900AE18D9 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EditorMac.mm; path = mac/EditorMac.mm; sourceTree = "<group>"; };
                                DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */,
                                937256100A61564200B053B9 /* libsqlite3.dylib in Frameworks */,
                                1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */,
+                               E4B4232F0CBFB66400AF2ECE /* QTKit.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                1CFAE3220A6D6A3F0032593D /* libobjc.dylib */,
                                9372560F0A61564200B053B9 /* libsqlite3.dylib */,
                                DD763BB10992C2C900740B8E /* libxml2.dylib */,
+                               E4B4232E0CBFB66400AF2ECE /* QTKit.framework */,
                                A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */,
                        );
                        name = Frameworks;
                                A8EA7D270A19385500A8EF5F /* HTMLAreaElement.cpp */,
                                A8EA7D260A19385500A8EF5F /* HTMLAreaElement.h */,
                                1AE2A9F00A1CDA5700B42B25 /* HTMLAreaElement.idl */,
+                               E446138F0CD6331000FADA75 /* HTMLAudioElement.cpp */,
+                               E44613900CD6331000FADA75 /* HTMLAudioElement.h */,
+                               E44613910CD6331000FADA75 /* HTMLAudioElement.idl */,
                                A871DC1E0A15205700B12A68 /* HTMLBaseElement.cpp */,
                                A871DC130A15205700B12A68 /* HTMLBaseElement.h */,
                                A80E7AAF0A19D1F1007FB8C5 /* HTMLBaseElement.idl */,
                                A8EA7C9E0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp */,
                                A8EA7C9D0A192B9C00A8EF5F /* HTMLMarqueeElement.h */,
                                BC491B4E0C023E2D009D6316 /* HTMLMarqueeElement.idl */,
+                               E44613920CD6331000FADA75 /* HTMLMediaElement.cpp */,
+                               E44613930CD6331000FADA75 /* HTMLMediaElement.h */,
+                               E44613940CD6331000FADA75 /* HTMLMediaElement.idl */,
                                A8EA79EC0A1916DF00A8EF5F /* HTMLMenuElement.cpp */,
                                A8EA79E80A1916DF00A8EF5F /* HTMLMenuElement.h */,
                                1AE2AE430A1D269E00B42B25 /* HTMLMenuElement.idl */,
                                1AE2AB720A1CE81500B42B25 /* HTMLParamElement.idl */,
                                F523D25002DE4396018635CA /* HTMLParser.cpp */,
                                F523D25102DE4396018635CA /* HTMLParser.h */,
-                               BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */,
                                BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */,
+                               BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */,
                                A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */,
                                A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */,
                                A8EA7C9F0A192B9C00A8EF5F /* HTMLPreElement.cpp */,
                                A81369BD097374F500D74463 /* HTMLSelectElement.cpp */,
                                A81369BC097374F500D74463 /* HTMLSelectElement.h */,
                                855542990AA4938800BA89F2 /* HTMLSelectElement.idl */,
+                               E44613950CD6331000FADA75 /* HTMLSourceElement.cpp */,
+                               E44613960CD6331000FADA75 /* HTMLSourceElement.h */,
+                               E44613970CD6331000FADA75 /* HTMLSourceElement.idl */,
                                A871DC1A0A15205700B12A68 /* HTMLStyleElement.cpp */,
                                A871DC170A15205700B12A68 /* HTMLStyleElement.h */,
                                A80E7AB20A19D1F1007FB8C5 /* HTMLStyleElement.idl */,
                                A8EA79E70A1916DF00A8EF5F /* HTMLUListElement.cpp */,
                                A8EA79E60A1916DF00A8EF5F /* HTMLUListElement.h */,
                                1A85B1D50A1B236C00D8C87C /* HTMLUListElement.idl */,
+                               E44613980CD6331000FADA75 /* HTMLVideoElement.cpp */,
+                               E44613990CD6331000FADA75 /* HTMLVideoElement.h */,
+                               E446139A0CD6331000FADA75 /* HTMLVideoElement.idl */,
                                BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */,
                                BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */,
+                               E446139B0CD6331000FADA75 /* MediaError.h */,
+                               E446139C0CD6331000FADA75 /* MediaError.idl */,
+                               E446139D0CD6331000FADA75 /* TimeRanges.cpp */,
+                               E446139E0CD6331000FADA75 /* TimeRanges.h */,
+                               E446139F0CD6331000FADA75 /* TimeRanges.idl */,
+                               E44613B30CD6344E00FADA75 /* VoidCallback.cpp */,
+                               E44613B40CD6344E00FADA75 /* VoidCallback.h */,
+                               E44613A00CD6331000FADA75 /* VoidCallback.idl */,
                        );
                        path = html;
                        sourceTree = "<group>";
                                1A4A2DEE0A1B852A00C807F8 /* JSHTMLAppletElement.h */,
                                1AE2AA0A0A1CDAB300B42B25 /* JSHTMLAreaElement.cpp */,
                                1AE2AA0B0A1CDAB300B42B25 /* JSHTMLAreaElement.h */,
+                               E4B4237D0CBFB73C00AF2ECE /* JSHTMLAudioElement.cpp */,
+                               E4B4237E0CBFB73C00AF2ECE /* JSHTMLAudioElement.h */,
                                A80E7B080A19D606007FB8C5 /* JSHTMLBaseElement.cpp */,
                                A80E7B070A19D606007FB8C5 /* JSHTMLBaseElement.h */,
                                1AE2AA0C0A1CDAB300B42B25 /* JSHTMLBaseFontElement.cpp */,
                                1AE2AB1E0A1CE63B00B42B25 /* JSHTMLMapElement.h */,
                                BC491B760C023EFD009D6316 /* JSHTMLMarqueeElement.cpp */,
                                BC491B770C023EFD009D6316 /* JSHTMLMarqueeElement.h */,
+                               E4B4237F0CBFB73C00AF2ECE /* JSHTMLMediaElement.cpp */,
+                               E4B423800CBFB73C00AF2ECE /* JSHTMLMediaElement.h */,
                                1AE2AE590A1D26F200B42B25 /* JSHTMLMenuElement.cpp */,
                                1AE2AE5A0A1D26F200B42B25 /* JSHTMLMenuElement.h */,
                                A80E7A150A19C3D6007FB8C5 /* JSHTMLMetaElement.cpp */,
                                1AE2ABA50A1CE90500B42B25 /* JSHTMLScriptElement.h */,
                                E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */,
                                E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */,
+                               E4B423710CBFB6E000AF2ECE /* JSHTMLSourceElement.cpp */,
+                               E4B423720CBFB6E000AF2ECE /* JSHTMLSourceElement.h */,
                                A80E7B050A19D606007FB8C5 /* JSHTMLStyleElement.cpp */,
                                A80E7B040A19D606007FB8C5 /* JSHTMLStyleElement.h */,
                                BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */,
                                A80E7B020A19D606007FB8C5 /* JSHTMLTitleElement.h */,
                                1A85B20E0A1B258700D8C87C /* JSHTMLUListElement.cpp */,
                                1A85B20F0A1B258700D8C87C /* JSHTMLUListElement.h */,
+                               E446140E0CD6826900FADA75 /* JSHTMLVideoElement.cpp */,
+                               E446140F0CD6826900FADA75 /* JSHTMLVideoElement.h */,
+                               E44614100CD6826900FADA75 /* JSMediaError.cpp */,
+                               E44614110CD6826900FADA75 /* JSMediaError.h */,
+                               E44614120CD6826900FADA75 /* JSTimeRanges.cpp */,
+                               E44614130CD6826900FADA75 /* JSTimeRanges.h */,
+                               E44614140CD6826900FADA75 /* JSVoidCallback.cpp */,
+                               E44614150CD6826900FADA75 /* JSVoidCallback.h */,
                        );
                        name = HTML;
                        sourceTree = "<group>";
                                65DF31EA09D1CC60000BE325 /* JSNotation.h */,
                                65DF31EB09D1CC60000BE325 /* JSProcessingInstruction.cpp */,
                                65DF31EC09D1CC60000BE325 /* JSProcessingInstruction.h */,
+                               E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */,
+                               E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */,
+                               65DF31ED09D1CC60000BE325 /* JSRange.cpp */,
+                               65DF31EE09D1CC60000BE325 /* JSRange.h */,
+                               D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */,
+                               D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */,
                                65DF31EF09D1CC60000BE325 /* JSText.cpp */,
                                65DF31F009D1CC60000BE325 /* JSText.h */,
                        );
                B27535490B053814002CE64F /* mac */ = {
                        isa = PBXGroup;
                        children = (
-                               B277B4030B22F37C0004BEC6 /* GraphicsContextMac.mm */,
-                               B275358D0B053A66002CE64F /* IconMac.mm */,
+                               EDE3A4FF0C7A430600956A37 /* ColorMac.h */,
                                B275354A0B053814002CE64F /* ColorMac.mm */,
                                B275354B0B053814002CE64F /* FloatPointMac.mm */,
                                B275354C0B053814002CE64F /* FloatRectMac.mm */,
                                B275354D0B053814002CE64F /* FloatSizeMac.mm */,
+                               B277B4030B22F37C0004BEC6 /* GraphicsContextMac.mm */,
+                               B275358D0B053A66002CE64F /* IconMac.mm */,
                                B275354E0B053814002CE64F /* ImageMac.mm */,
                                B275354F0B053814002CE64F /* IntPointMac.mm */,
                                B27535500B053814002CE64F /* IntRectMac.mm */,
                                B27535510B053814002CE64F /* IntSizeMac.mm */,
-                               EDE3A4FF0C7A430600956A37 /* ColorMac.h */,
+                               E4B41E100CBF90EF00AF2ECE /* MoviePrivateQTKit.h */,
+                               E4B41E110CBF90EF00AF2ECE /* MoviePrivateQTKit.mm */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                B27535470B053814002CE64F /* IntSize.h */,
                                B27535480B053814002CE64F /* IntSizeHash.h */,
                                B27535490B053814002CE64F /* mac */,
+                               E4B41E0C0CBF90BD00AF2ECE /* Movie.cpp */,
+                               E4B41E0D0CBF90BD00AF2ECE /* Movie.h */,
                                B27535520B053814002CE64F /* Path.cpp */,
-                               A88DD4860B4629A300C02990 /* PathTraversalState.h */,
-                               A88DD4880B4629B000C02990 /* PathTraversalState.cpp */,
                                B27535530B053814002CE64F /* Path.h */,
+                               A88DD4880B4629B000C02990 /* PathTraversalState.cpp */,
+                               A88DD4860B4629A300C02990 /* PathTraversalState.h */,
                                B27535540B053814002CE64F /* Pen.cpp */,
                                B27535550B053814002CE64F /* Pen.h */,
                                B2A015960AF6CD53006BCE0E /* svg */,
                                BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */,
                                BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */,
                                BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */,
+                               E4B41E070CBF8F2100AF2ECE /* JSHTMLAudioElementConstructor.cpp */,
+                               E4B41E080CBF8F2100AF2ECE /* JSHTMLAudioElementConstructor.h */,
                                BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */,
                                BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */,
                                BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */,
                                1A750E330A90F89F000FF215 /* JSTreeWalkerCustom.cpp */,
                                B2080A110B3CA3B600120852 /* JSSVGPointListCustom.cpp */,
                                1A750E330A90F89F000FF215 /* JSTreeWalkerCustom.cpp */,
+                               B2080A110B3CA3B600120852 /* JSSVGPointListCustom.cpp */,
+                               1A750E330A90F89F000FF215 /* JSTreeWalkerCustom.cpp */,
                        );
                        name = Custom;
                        sourceTree = "<group>";
                F523D2F302DE443B018635CA /* rendering */ = {
                        isa = PBXGroup;
                        children = (
-                               AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */,
-                               AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */,
                                A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */,
                                A8CFF0490A154F09000A4234 /* AutoTableLayout.h */,
                                BCEA4813097D93020094C9E4 /* bidi.cpp */,
                                853CA9CF0AEEC5E9002372DC /* RenderSVGInline.h */,
                                853CA9D00AEEC5E9002372DC /* RenderSVGInlineText.cpp */,
                                853CA9D10AEEC5E9002372DC /* RenderSVGInlineText.h */,
+                               AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */,
+                               AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */,
                                853CA9D20AEEC5E9002372DC /* RenderSVGText.cpp */,
                                853CA9D30AEEC5E9002372DC /* RenderSVGText.h */,
                                B26554E80B80D74900A50EC3 /* RenderSVGTextPath.cpp */,
                                BCEA4849097D93020094C9E4 /* RenderThemeMac.mm */,
                                93955A4203D72932008635CE /* RenderTreeAsText.cpp */,
                                93955A4103D72932008635CE /* RenderTreeAsText.h */,
+                               E4B41E330CBFB60900AF2ECE /* RenderVideo.cpp */,
+                               E4B41E340CBFB60900AF2ECE /* RenderVideo.h */,
                                BCEA4828097D93020094C9E4 /* RenderView.cpp */,
                                BCEA4829097D93020094C9E4 /* RenderView.h */,
                                A871DFE10A15376B00B12A68 /* RenderWidget.cpp */,
                F523D32402DE4478018635CA /* dom */ = {
                        isa = PBXGroup;
                        children = (
-                               A784941A0B5FE507001E237A /* Clipboard.cpp */,
                                BC3B364705C9D5E200E42902 /* AtomicStringList.h */,
                                A8C4A7FC09D563270003AC8D /* Attr.cpp */,
                                A8C4A7FB09D563270003AC8D /* Attr.h */,
                                93EEC1E609C2877700C515D1 /* CharacterData.idl */,
                                A818721A0977D3C0005826D9 /* ChildNodeList.cpp */,
                                A81872150977D3C0005826D9 /* ChildNodeList.h */,
+                               A784941A0B5FE507001E237A /* Clipboard.cpp */,
                                85031B280A44EFC700F992E0 /* Clipboard.h */,
                                4B8AF4A90B1CE02B00687690 /* ClipboardAccessPolicy.h */,
                                85031B290A44EFC700F992E0 /* ClipboardEvent.cpp */,
                                A8EA7EB50A1945D000A8EF5F /* ProcessingInstruction.cpp */,
                                A8EA7EB40A1945D000A8EF5F /* ProcessingInstruction.h */,
                                93EEC1F509C2877700C515D1 /* ProcessingInstruction.idl */,
+                               E4B41E010CBF8EAA00AF2ECE /* ProgressEvent.cpp */,
+                               E4B41E020CBF8EAA00AF2ECE /* ProgressEvent.h */,
+                               E4B41E030CBF8EAA00AF2ECE /* ProgressEvent.idl */,
                                550A0BC7085F6039007353D6 /* QualifiedName.cpp */,
                                550A0BC8085F6039007353D6 /* QualifiedName.h */,
                                F523D30302DE4476018635CA /* Range.cpp */,
                                6550B69C099DF0270090D781 /* Text.h */,
                                93EEC1F609C2877700C515D1 /* Text.idl */,
                                933A142B0B7D188600A53FFD /* TextEvent.cpp */,
-                               933A142C0B7D188600A53FFD /* TextEvent.idl */,
                                933A142D0B7D188600A53FFD /* TextEvent.h */,
+                               933A142C0B7D188600A53FFD /* TextEvent.idl */,
                                BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */,
                                854FE72C0A2297BE0058D7AD /* Traversal.cpp */,
                                854FE72D0A2297BE0058D7AD /* Traversal.h */,
                                A80F3A750CCDA318002DD990 /* DOMSVGPathSegCurvetoQuadraticAbs.h in Headers */,
                                A80F3A7D0CCDA324002DD990 /* DOMSVGAngle.h in Headers */,
                                A80F43520CCDE604002DD990 /* DOMSVGAnimateElementInternal.h in Headers */,
+                               E44613A20CD6331000FADA75 /* HTMLAudioElement.h in Headers */,
+                               E44613A50CD6331000FADA75 /* HTMLMediaElement.h in Headers */,
+                               E44613A80CD6331000FADA75 /* HTMLSourceElement.h in Headers */,
+                               E44613AB0CD6331000FADA75 /* HTMLVideoElement.h in Headers */,
+                               E44613AD0CD6331000FADA75 /* MediaError.h in Headers */,
+                               E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */,
+                               E44613B60CD6344E00FADA75 /* VoidCallback.h in Headers */,
+                               E44613E40CD681A200FADA75 /* Movie.h in Headers */,
+                               E44613E60CD681A900FADA75 /* MoviePrivateQTKit.h in Headers */,
+                               E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */,
+                               E44613EE0CD681BB00FADA75 /* JSProgressEvent.h in Headers */,
+                               E44614170CD6826900FADA75 /* JSHTMLVideoElement.h in Headers */,
+                               E44614190CD6826900FADA75 /* JSMediaError.h in Headers */,
+                               E446141B0CD6826900FADA75 /* JSTimeRanges.h in Headers */,
+                               E446141D0CD6826900FADA75 /* JSVoidCallback.h in Headers */,
+                               E44614380CD689C500FADA75 /* JSHTMLAudioElement.h in Headers */,
+                               E446143A0CD689C800FADA75 /* JSHTMLMediaElement.h in Headers */,
+                               E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */,
+                               E446143E0CD68A2300FADA75 /* JSHTMLAudioElementConstructor.h in Headers */,
+                               E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */,
                                BC80C9880CD294EE00A0B7B3 /* CSSTimingFunctionValue.h in Headers */,
                                BC80C98C0CD2950500A0B7B3 /* AnimationController.h in Headers */,
                                E15863990CD10B730066E2C9 /* TextCodecUserDefined.h in Headers */,
                                06693F7B0BFBC91700216072 /* inspector in Resources */,
                                1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
                                1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
+                               E44613B10CD6331000FADA75 /* TimeRanges.idl in Resources */,
+                               E44613B20CD6331000FADA75 /* VoidCallback.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A83B79560CCB0125000B0825 /* DOMSVGFontFaceElement.mm in Sources */,
                                A80F393E0CCD971A002DD990 /* JSSVGDefinitionSrcElement.cpp in Sources */,
                                A80F39590CCD9796002DD990 /* DOMSVGDefinitionSrcElement.mm in Sources */,
+                               E44613A10CD6331000FADA75 /* HTMLAudioElement.cpp in Sources */,
+                               E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */,
+                               E44613A70CD6331000FADA75 /* HTMLSourceElement.cpp in Sources */,
+                               E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */,
+                               E44613AF0CD6331000FADA75 /* TimeRanges.cpp in Sources */,
+                               E44613B50CD6344E00FADA75 /* VoidCallback.cpp in Sources */,
+                               E44613E30CD6819F00FADA75 /* Movie.cpp in Sources */,
+                               E44613E50CD681A600FADA75 /* MoviePrivateQTKit.mm in Sources */,
+                               E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */,
+                               E44613ED0CD681BA00FADA75 /* JSProgressEvent.cpp in Sources */,
+                               E44614160CD6826900FADA75 /* JSHTMLVideoElement.cpp in Sources */,
+                               E44614180CD6826900FADA75 /* JSMediaError.cpp in Sources */,
+                               E446141A0CD6826900FADA75 /* JSTimeRanges.cpp in Sources */,
+                               E446141C0CD6826900FADA75 /* JSVoidCallback.cpp in Sources */,
+                               E44614370CD689C400FADA75 /* JSHTMLAudioElement.cpp in Sources */,
+                               E44614390CD689C700FADA75 /* JSHTMLMediaElement.cpp in Sources */,
+                               E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */,
+                               E446143D0CD68A2300FADA75 /* JSHTMLAudioElementConstructor.cpp in Sources */,
+                               E44614510CD68A3500FADA75 /* RenderVideo.cpp in Sources */,
                                BC80C9870CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp in Sources */,
                                BC80C98B0CD2950500A0B7B3 /* AnimationController.cpp in Sources */,
                                E158639A0CD10B730066E2C9 /* TextCodecUserDefined.cpp in Sources */,
index d0acac4..50e3e2d 100644 (file)
@@ -35,6 +35,7 @@
 #include "JSMouseEvent.h"
 #include "JSMutationEvent.h"
 #include "JSOverflowEvent.h"
+#include "JSProgressEvent.h"
 #include "JSTextEvent.h"
 #include "JSUIEvent.h"
 #include "JSWheelEvent.h"
@@ -42,6 +43,7 @@
 #include "MouseEvent.h"
 #include "MutationEvent.h"
 #include "OverflowEvent.h"
+#include "ProgressEvent.h"
 #include "TextEvent.h"
 #include "UIEvent.h"
 #include "WheelEvent.h"
@@ -81,6 +83,8 @@ KJS::JSValue* toJS(KJS::ExecState* exec, Event* event)
         ret = new JSMutationEvent(exec, static_cast<MutationEvent*>(event));
     else if (event->isOverflowEvent())
         ret = new JSOverflowEvent(exec, static_cast<OverflowEvent*>(event));
+    else if (event->isProgressEvent())
+        ret = new JSProgressEvent(exec, static_cast<ProgressEvent*>(event));
     else
         ret = new JSEvent(exec, event);
 
diff --git a/WebCore/bindings/js/JSHTMLAudioElementConstructor.cpp b/WebCore/bindings/js/JSHTMLAudioElementConstructor.cpp
new file mode 100644 (file)
index 0000000..8a83032
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 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)
+#include "JSHTMLAudioElementConstructor.h"
+
+#include "Document.h"
+#include "HTMLAudioElement.h"
+#include "JSHTMLAudioElement.h"
+#include "Text.h"
+
+using namespace KJS;
+
+namespace WebCore {
+
+JSHTMLAudioElementConstructor::JSHTMLAudioElementConstructor(ExecState* exec, Document* d)
+    : m_doc(d)
+{
+    setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
+    put(exec, exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
+}
+
+bool JSHTMLAudioElementConstructor::implementsConstruct() const
+{
+    return true;
+}
+
+JSObject* JSHTMLAudioElementConstructor::construct(ExecState* exec, const List& args)
+{
+    int exception = 0;
+    RefPtr<Element> el(m_doc->createElement("audio", exception));
+    HTMLAudioElement* audio = 0;
+    if (el && !exception) {
+        audio = static_cast<HTMLAudioElement*>(el.get());
+        int sz = args.size();
+        if (sz > 0) {
+            audio->setSrc(args[0]->toString(exec));
+            audio->scheduleLoad();
+        }
+    }
+
+    setDOMException(exec, exception);
+    return static_cast<JSObject*>(toJS(exec, audio));
+}
+
+}
+#endif
diff --git a/WebCore/bindings/js/JSHTMLAudioElementConstructor.h b/WebCore/bindings/js/JSHTMLAudioElementConstructor.h
new file mode 100644 (file)
index 0000000..5ca5166
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007 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 JSHTMLAudioElementConstructor_h
+#define JSHTMLAudioElementConstructor_h
+
+#if ENABLE(VIDEO)
+
+#include "kjs_binding.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+    class JSHTMLAudioElementConstructor : public KJS::DOMObject {
+    public:
+        JSHTMLAudioElementConstructor(KJS::ExecState*, Document*);
+        virtual bool implementsConstruct() const;
+        virtual KJS::JSObject *construct(KJS::ExecState*, const KJS::List& args);
+    private:
+        RefPtr<Document> m_doc;
+    };
+
+}
+
+#endif
+#endif
index e745912..9d51cea 100644 (file)
@@ -22,6 +22,7 @@
 #include "HTMLAnchorElement.h"
 #include "HTMLAppletElement.h"
 #include "HTMLAreaElement.h"
+#include "HTMLAudioElement.h"
 #include "HTMLBRElement.h"
 #include "HTMLBaseElement.h"
 #include "HTMLBaseFontElement.h"
@@ -65,6 +66,7 @@
 #include "HTMLQuoteElement.h"
 #include "HTMLScriptElement.h"
 #include "HTMLSelectElement.h"
+#include "HTMLSourceElement.h"
 #include "HTMLStyleElement.h"
 #include "HTMLTableCaptionElement.h"
 #include "HTMLTableCellElement.h"
 #include "HTMLTextAreaElement.h"
 #include "HTMLTitleElement.h"
 #include "HTMLUListElement.h"
+#include "HTMLVideoElement.h"
 
 #include "HTMLNames.h"
 
 #include "JSHTMLAnchorElement.h"
 #include "JSHTMLAppletElement.h"
 #include "JSHTMLAreaElement.h"
+#include "JSHTMLAudioElement.h"
 #include "JSHTMLBRElement.h"
 #include "JSHTMLBaseElement.h"
 #include "JSHTMLBaseFontElement.h"
 #include "JSHTMLQuoteElement.h"
 #include "JSHTMLScriptElement.h"
 #include "JSHTMLSelectElement.h"
+#include "JSHTMLSourceElement.h"
 #include "JSHTMLStyleElement.h"
 #include "JSHTMLTableCaptionElement.h"
 #include "JSHTMLTableCellElement.h"
 #include "JSHTMLTextAreaElement.h"
 #include "JSHTMLTitleElement.h"
 #include "JSHTMLUListElement.h"
+#include "JSHTMLVideoElement.h"
 
 #include "kjs_html.h"
 
@@ -206,12 +212,21 @@ typedef JSNode* (*CreateHTMLElementWrapperFunction)(ExecState*, PassRefPtr<HTMLE
     macro(ul, UList) \
     // end of macro
 
+#define FOR_EACH_VIDEO_TAG(macro) \
+    macro(audio, Audio) \
+    macro(source, Source) \
+    macro(video, Video) \
+    // end of macro
+
 #define CREATE_WRAPPER_FUNCTION(tag, name) \
 static JSNode* create##name##Wrapper(ExecState* exec, PassRefPtr<HTMLElement> element) \
 { \
     return new JSHTML##name##Element(exec, static_cast<HTML##name##Element*>(element.get())); \
 }
 FOR_EACH_TAG(CREATE_WRAPPER_FUNCTION)
+#if ENABLE(VIDEO)
+    FOR_EACH_VIDEO_TAG(CREATE_WRAPPER_FUNCTION)
+#endif
 #undef CREATE_WRAPPER_FUNCTION
 
 JSNode* createJSHTMLWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
@@ -220,6 +235,9 @@ JSNode* createJSHTMLWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
     if (map.isEmpty()) {
 #define ADD_TO_HASH_MAP(tag, name) map.set(tag##Tag.localName().impl(), create##name##Wrapper);
 FOR_EACH_TAG(ADD_TO_HASH_MAP)
+#if ENABLE(VIDEO)
+FOR_EACH_VIDEO_TAG(ADD_TO_HASH_MAP)
+#endif
 #undef ADD_TO_HASH_MAP
         map.set(colgroupTag.localName().impl(), createTableColWrapper);
         map.set(h2Tag.localName().impl(), createHeadingWrapper);
index 77e3218..2d214be 100644 (file)
@@ -45,6 +45,7 @@
 #include "JSDOMExceptionConstructor.h"
 #include "JSDOMWindow.h"
 #include "JSEvent.h"
+#include "JSHTMLAudioElementConstructor.h"
 #include "JSHTMLCollection.h"
 #include "JSHTMLOptionElementConstructor.h"
 #include "JSMutationEvent.h"
@@ -203,6 +204,7 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
   onunload              Window::Onunload            DontDelete
   onbeforeunload        Window::Onbeforeunload      DontDelete
 # -- Constructors --
+  Audio                 Window::Audio               DontDelete
   DOMException          Window::DOMException        DontDelete
   Image                 Window::Image               DontDelete
   Option                Window::Option              DontDelete
@@ -550,6 +552,12 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
       if (!isSafeScript(exec))
         return jsUndefined();
       return new JSXMLHttpRequestConstructorImp(exec, impl()->frame()->document());
+    case Audio:
+#if ENABLE(VIDEO)
+      return new JSHTMLAudioElementConstructor(exec, impl()->frame()->document());
+#else
+      return jsUndefined();
+#endif
 #if ENABLE(XSLT)
     case XSLTProcessor_:
       if (!isSafeScript(exec))
index d364810..7b3658b 100644 (file)
@@ -164,7 +164,7 @@ namespace KJS {
         Onbeforeunload,
 
         // Constructors
-        DOMException, Image, Option, XMLHttpRequest,
+        DOMException, Audio, Image, Option, XMLHttpRequest,
         XSLTProcessor_
     };
 
index 706981b..52cc250 100644 (file)
@@ -1373,7 +1373,8 @@ sub TypeCanFailConversion
                 $type eq "HTMLOptionElement" or
                 $type eq "unsigned short" or # or can it?
                 $type eq "CompareHow" or # or can it?
-                $type eq "SVGPaintType"; # or can it?
+                $type eq "SVGPaintType" or # or can it?
+                $type eq "VoidCallback";
 
     if ($type eq "unsigned long" or $type eq "long" or $type eq "Attr") {
         $implIncludes{"ExceptionCode.h"} = 1;
@@ -1425,6 +1426,11 @@ sub JSValueToNative
         $implIncludes{"FloatPoint.h"} = 1;
     }
 
+    if ($type eq "VoidCallback") {
+        $implIncludes{"VoidCallback.h"} = 1;
+        return "toVoidCallback($value)";
+    }
+
     # Default, assume autogenerated type conversion routines
     $implIncludes{"JS$type.h"} = 1;
     return "to$type($value)";
index 370d1a9..d31a65c 100644 (file)
@@ -81,6 +81,7 @@
 #include "Page.h"
 #include "PlatformKeyboardEvent.h"
 #include "ProcessingInstruction.h"
+#include "ProgressEvent.h"
 #include "RegisteredEventListener.h"
 #include "RegularExpression.h"
 #include "RenderArena.h"
@@ -2424,6 +2425,8 @@ PassRefPtr<Event> Document::createEvent(const String &eventType, ExceptionCode&
         return new KeyboardEvent;
     if (eventType == "HTMLEvents" || eventType == "Event" || eventType == "Events")
         return new Event;
+    if (eventType == "ProgressEvent")
+        return new ProgressEvent;
     if (eventType == "TextEvent")
         return new TextEvent;
     if (eventType == "OverflowEvent")
@@ -2838,21 +2841,28 @@ void Document::setInPageCache(bool flag)
     }
 }
 
-void Document::registerForDidRestoreFromCacheCallback(Element* e)
+void Document::willSaveToCache() 
 {
-    m_didRestorePageCallbackSet.add(e);
+    HashSet<Element*>::iterator end = m_pageCacheCallbackElements.end();
+    for (HashSet<Element*>::iterator i = m_pageCacheCallbackElements.begin(); i != end; ++i)
+        (*i)->willSaveToCache();
 }
 
-void Document::unregisterForDidRestoreFromCacheCallback(Element* e)
+void Document::didRestoreFromCache() 
 {
-    m_didRestorePageCallbackSet.remove(e);
+    HashSet<Element*>::iterator end = m_pageCacheCallbackElements.end();
+    for (HashSet<Element*>::iterator i = m_pageCacheCallbackElements.begin(); i != end; ++i)
+        (*i)->didRestoreFromCache();
 }
 
-void Document::didRestoreFromCache()
+void Document::registerForCacheCallbacks(Element* e)
 {
-    HashSet<Element*>::iterator it = m_didRestorePageCallbackSet.begin();
-    for (; it != m_didRestorePageCallbackSet.end(); ++it) 
-        (*it)->didRestoreFromCache();
+    m_pageCacheCallbackElements.add(e);
+}
+
+void Document::unregisterForCacheCallbacks(Element* e)
+{
+    m_pageCacheCallbackElements.remove(e);
 }
 
 void Document::setShouldCreateRenderers(bool f)
index 730028d..87dc25e 100644 (file)
@@ -747,8 +747,6 @@ private:
     typedef HashMap<FormElementKey, Vector<String>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
     ListHashSet<HTMLFormControlElementWithState*> m_formElementsWithState;
     FormElementStateMap m_stateForNewFormElements;
-
-    HashSet<Element*> m_didRestorePageCallbackSet;
     
     Color m_linkColor;
     Color m_visitedLinkColor;
@@ -818,12 +816,12 @@ private:
 public:
     bool inPageCache();
     void setInPageCache(bool flag);
-
-    // Elements can register themselves for the "didRestoreFromCache()" callback which will be
-    // called if the document is restored from the Page Cache
-    void registerForDidRestoreFromCacheCallback(Element*);
-    void unregisterForDidRestoreFromCacheCallback(Element*);
     
+    // Elements can register themselves for the "willSaveToCache()" and  
+    // "didRestoreFromCache()" callbacks
+    void registerForCacheCallbacks(Element*);
+    void unregisterForCacheCallbacks(Element*);
+    void willSaveToCache();
     void didRestoreFromCache();
 
     void setShouldCreateRenderers(bool);
@@ -917,9 +915,11 @@ private:
     bool m_createRenderers;
     bool m_inPageCache;
     String m_iconURL;
+    
+    HashSet<Element*> m_pageCacheCallbackElements;
 
     bool m_isAllowedToLoadLocalResources;
-    
+
     bool m_useSecureKeyboardEntryWhenActive;
 
     bool m_isXHTML;
index 0bfb6a7..274515e 100644 (file)
@@ -167,6 +167,16 @@ void Element::setAttribute(const QualifiedName& name, const String &value)
     setAttribute(name, value.impl(), ec);
 }
 
+void Element::setBooleanAttribute(const QualifiedName& name, bool b)
+{
+    if (b)
+        setAttribute(name, name.localName());
+    else {
+        ExceptionCode ex;
+        removeAttribute(name, ex);
+    }
+}
+
 // Virtual function, defined in base class.
 NamedAttrMap *Element::attributes() const
 {
index 533c484..c22960a 100644 (file)
@@ -123,6 +123,7 @@ public:
 
     // convenience methods which ignore exceptions
     void setAttribute(const QualifiedName&, const String& value);
+    void setBooleanAttribute(const QualifiedName& name, bool);
 
     virtual NamedAttrMap* attributes() const;
     NamedAttrMap* attributes(bool readonly) const;
@@ -181,8 +182,8 @@ public:
     IntSize minimumSizeForResizing() const;
     void setMinimumSizeForResizing(const IntSize&);
 
-    // The following method is called when a Document is restored from the page cache
-    // and the element has registered itself with the Document via registerForDidRestorePageCallback()
+    // Use Document::registerForPageCacheCallbacks() to subscribe these
+    virtual void willSaveToCache() { }
     virtual void didRestoreFromCache() { }
     
 private:
index af37805..2399be6 100644 (file)
@@ -120,6 +120,11 @@ bool Event::isOverflowEvent() const
     return false;
 }
 
+bool Event::isProgressEvent() const
+{
+    return false;
+}
+
 #if ENABLE(SVG)
 bool Event::isSVGZoomEvent() const
 {
index ef0c6dd..dd01045 100644 (file)
@@ -109,6 +109,7 @@ namespace WebCore {
         virtual bool isWheelEvent() const;
         virtual bool isBeforeTextInsertedEvent() const;
         virtual bool isOverflowEvent() const;
+        virtual bool isProgressEvent() const;
 #if ENABLE(SVG)
         virtual bool isSVGZoomEvent() const;
 #endif
index 0942614..31f3cf8 100644 (file)
@@ -89,6 +89,26 @@ namespace WebCore { namespace EventNames {
     macro(webkitBeforeTextInserted) \
     macro(webkitEditableContentChanged) \
     \
+    macro(canshowcurrentframe) \
+    macro(canplay) \
+    macro(canplaythrough) \
+    macro(dataunavailable) \
+    macro(durationchange) \
+    macro(emptied) \
+    macro(ended) \
+    macro(loadedfirstframe) \
+    macro(loadedmetadata) \
+    macro(pause) \
+    macro(play) \
+    macro(ratechange) \
+    macro(timeupdate) \
+    macro(volumechange) \
+    macro(waiting) \
+    \
+    macro(begin) \
+    macro(progress) \
+    macro(stalled) \
+    \
 // end of DOM_EVENT_NAMES_FOR_EACH
 
 #ifndef DOM_EVENT_NAMES_HIDE_GLOBALS
index e6c8905..b3d768a 100644 (file)
@@ -42,6 +42,7 @@
 #include "Page.h"
 #include "PlatformMouseEvent.h"
 #include "PlatformWheelEvent.h"
+#include "ProgressEvent.h"
 #include "RegisteredEventListener.h"
 #include "TextEvent.h"
 #include "UIEvent.h"
@@ -541,6 +542,13 @@ bool EventTargetNode::dispatchHTMLEvent(const AtomicString &eventType, bool canB
     return dispatchEvent(new Event(eventType, canBubbleArg, cancelableArg), ec, true);
 }
 
+bool EventTargetNode::dispatchProgressEvent(const AtomicString &eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg)
+{
+    ASSERT(!eventDispatchForbidden());
+    ExceptionCode ec = 0;
+    return dispatchEvent(new ProgressEvent(eventType, lengthComputableArg, loadedArg, totalArg), ec, true);
+}
+
 void EventTargetNode::removeHTMLEventListener(const AtomicString &eventType)
 {
     if (!m_regdListeners) // nothing to remove
index 6e95920..a4effe3 100644 (file)
@@ -63,6 +63,7 @@ public:
         bool isSimulated = false, Node* relatedTarget = 0, PassRefPtr<Event> underlyingEvent = 0);
     void dispatchSimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<Event> underlyingEvent = 0);
     void dispatchSimulatedClick(PassRefPtr<Event> underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
+    bool dispatchProgressEvent(const AtomicString &eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg);
 
     virtual void handleLocalEvents(Event*, bool useCapture);
 
diff --git a/WebCore/dom/ProgressEvent.cpp b/WebCore/dom/ProgressEvent.cpp
new file mode 100644 (file)
index 0000000..c57d8f4
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007 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"
+#include "ProgressEvent.h"
+
+#include "EventNames.h"
+
+namespace WebCore {
+    
+using namespace EventNames;
+    
+ProgressEvent::ProgressEvent()
+    : m_lengthComputable(false)
+    , m_loaded(0)
+    , m_total(0)
+{
+}
+
+ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total)
+    : Event(type, false, true)
+    , m_lengthComputable(lengthComputable)
+    , m_loaded(loaded)
+    , m_total(total)
+{
+}
+    
+void ProgressEvent::initProgressEvent(const AtomicString& typeArg, 
+                                      bool /*canBubbleArg*/,
+                                      bool /*cancelableArg*/,
+                                      bool lengthComputableArg,
+                                      unsigned loadedArg,
+                                      unsigned totalArg)
+{    
+    initEvent(typeArg, false, true);
+    m_lengthComputable = lengthComputableArg;
+    m_loaded = loadedArg;
+    m_total = totalArg;
+}
+
+void ProgressEvent::initProgressEventNS(const AtomicString& /*namespaceURI*/,
+                                        const AtomicString& typeArg, 
+                                        bool /*canBubbleArg*/,
+                                        bool /*cancelableArg*/,
+                                        bool lengthComputableArg,
+                                        unsigned loadedArg,
+                                        unsigned totalArg)
+{
+    initEvent(typeArg, false, true);
+    m_lengthComputable = lengthComputableArg;
+    m_loaded = loadedArg;
+    m_total = lengthComputableArg ? totalArg : 0;
+}
+
+}
diff --git a/WebCore/dom/ProgressEvent.h b/WebCore/dom/ProgressEvent.h
new file mode 100644 (file)
index 0000000..2bfe3eb
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2007 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 ProgressEvent_h
+#define ProgressEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+    
+    class ProgressEvent : public Event {
+    public:
+
+        ProgressEvent();
+        ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total);
+
+        void initProgressEvent(const AtomicString& typeArg, 
+                               bool canBubbleArg,
+                               bool cancelableArg,
+                               bool lengthComputableArg,
+                               unsigned loadedArg,
+                               unsigned totalArg);
+        void initProgressEventNS(const AtomicString& namespaceURI,
+                                 const AtomicString& typeArg, 
+                                 bool canBubbleArg,
+                                 bool cancelableArg,
+                                 bool lengthComputableArg,
+                                 unsigned loadedArg,
+                                 unsigned totalArg);
+        
+        bool lengthComputable() const { return m_lengthComputable; }
+        unsigned loaded() const { return m_loaded; }
+        unsigned total() const { return m_total; }
+        
+        virtual bool isProgressEvent() const { return true; }
+        
+    private:
+        bool m_lengthComputable;
+        unsigned m_loaded;
+        unsigned m_total;
+    };
+}
+
+#endif // ProgressEvent_h
+
diff --git a/WebCore/dom/ProgressEvent.idl b/WebCore/dom/ProgressEvent.idl
new file mode 100644 (file)
index 0000000..36659ab
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+module events {
+
+interface ProgressEvent : Event {
+     readonly attribute boolean         lengthComputable;
+     readonly attribute unsigned long   loaded;
+     readonly attribute unsigned long   total;
+     void               initProgressEvent(in DOMString typeArg,
+                                          in boolean       canBubbleArg,
+                                          in boolean       cancelableArg,
+                                          in boolean       lengthComputableArg,
+                                          in unsigned long loadedArg,
+                                          in unsigned long totalArg);
+     void               initProgressEventNS(in DOMString namespaceURI,
+                                            in DOMString typeArg,
+                                            in boolean       canBubbleArg,
+                                            in boolean       cancelableArg,
+                                            in boolean       lengthComputableArg,
+                                            in unsigned long loadedArg,
+                                            in unsigned long totalArg);
+};
+
+}
index 80d8322..def742f 100644 (file)
@@ -87,6 +87,8 @@ CachedPage::CachedPage(Page* page)
     ++CachedPageCounter::count;
 #endif
     
+    m_document->willSaveToCache(); 
+    
     Frame* mainFrame = page->mainFrame();
     KJSProxy* proxy = mainFrame->scriptProxy();
     KJS::Window* window = KJS::Window::retrieveWindow(mainFrame);
index 0c10480..1f0b89d 100644 (file)
@@ -8,6 +8,7 @@ alink
 alt
 archive
 autocomplete
+autoplay
 autosave
 axis
 background
@@ -38,6 +39,7 @@ compact
 composite
 content
 contenteditable
+controls
 coords
 data
 datetime
@@ -47,6 +49,7 @@ dir
 direction
 disabled
 enctype
+end
 face
 for
 frame
@@ -70,6 +73,9 @@ leftmargin
 link
 longdesc
 loop
+loopcount
+loopend
+loopstart
 lowsrc
 marginheight
 marginwidth
diff --git a/WebCore/html/HTMLAudioElement.cpp b/WebCore/html/HTMLAudioElement.cpp
new file mode 100644 (file)
index 0000000..101eb3e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2007 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)
+#include "HTMLAudioElement.h"
+
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLAudioElement::HTMLAudioElement(Document* doc)
+    : HTMLMediaElement(HTMLNames::audioTag, doc)
+{
+}
+
+}
+#endif
diff --git a/WebCore/html/HTMLAudioElement.h b/WebCore/html/HTMLAudioElement.h
new file mode 100644 (file)
index 0000000..7796af8
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007 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 HTMLAudioElement_h
+#define HTMLAudioElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLMediaElement.h"
+
+namespace WebCore {
+
+class HTMLAudioElement : public HTMLMediaElement
+{
+public:
+    HTMLAudioElement(Document*);
+    
+    virtual int tagPriority() const { return 5; }
+};
+
+} //namespace
+
+#endif
+#endif
diff --git a/WebCore/html/HTMLAudioElement.idl b/WebCore/html/HTMLAudioElement.idl
new file mode 100644 (file)
index 0000000..107b8b1
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+
+module html {
+    interface [Conditional=VIDEO] HTMLAudioElement : HTMLMediaElement {
+    
+    };
+}
index 434e1cf..508c39a 100644 (file)
@@ -799,6 +799,8 @@ HashSet<AtomicStringImpl*>* inlineTagList()
         tagList.add(delTag.localName().impl());
         tagList.add(nobrTag.localName().impl());
         tagList.add(wbrTag.localName().impl());
+        tagList.add(audioTag.localName().impl());
+        tagList.add(videoTag.localName().impl());
     }
     return &tagList;
 }
index a3e7e0b..0c3cc55 100644 (file)
@@ -26,6 +26,7 @@
 #include "HTMLAnchorElement.h"
 #include "HTMLAppletElement.h"
 #include "HTMLAreaElement.h"
+#include "HTMLAudioElement.h"
 #include "HTMLBaseFontElement.h"
 #include "HTMLBaseElement.h"
 #include "HTMLBlockquoteElement.h"
@@ -70,6 +71,7 @@
 #include "HTMLPreElement.h"
 #include "HTMLScriptElement.h"
 #include "HTMLSelectElement.h"
+#include "HTMLSourceElement.h"
 #include "HTMLStyleElement.h"
 #include "HTMLTextAreaElement.h"
 #include "HTMLTableElement.h"
@@ -79,6 +81,7 @@
 #include "HTMLTableRowElement.h"
 #include "HTMLTableSectionElement.h"
 #include "HTMLTitleElement.h"
+#include "HTMLVideoElement.h"
 #include "HTMLUListElement.h"
 #include "HTMLQuoteElement.h"
 
@@ -381,6 +384,23 @@ static PassRefPtr<HTMLElement> marqueeConstructor(const AtomicString&, Document*
     return new HTMLMarqueeElement(doc);
 }
 
+#if ENABLE(VIDEO)
+static PassRefPtr<HTMLElement> audioConstructor(const AtomicString&, Document* doc, HTMLFormElement*, bool)
+{
+    return new HTMLAudioElement(doc);
+}
+
+static PassRefPtr<HTMLElement> videoConstructor(const AtomicString&, Document* doc, HTMLFormElement*, bool)
+{
+    return new HTMLVideoElement(doc);
+}
+
+static PassRefPtr<HTMLElement> sourceConstructor(const AtomicString&, Document* doc, HTMLFormElement*, bool)
+{
+    return new HTMLSourceElement(doc);
+}
+#endif
+
 static void addTag(const QualifiedName& tag, ConstructorFunc func)
 {
     gFunctionMap->set(tag.localName().impl(), func);
@@ -462,6 +482,11 @@ static void createFunctionMap()
     addTag(trTag, tableRowConstructor);
     addTag(ulTag, ulConstructor);
     addTag(xmpTag, preConstructor);
+#if ENABLE(VIDEO)
+    addTag(audioTag, audioConstructor);
+    addTag(sourceTag, sourceConstructor);
+    addTag(videoTag, videoConstructor);
+#endif
 }
 
 PassRefPtr<HTMLElement> HTMLElementFactory::createHTMLElement(const AtomicString& tagName, Document* doc, HTMLFormElement* form, bool createdByParser)
index 7ede411..13834fa 100644 (file)
@@ -141,7 +141,7 @@ void HTMLInputElement::init()
 HTMLInputElement::~HTMLInputElement()
 {
     if (inputType() == PASSWORD)
-        document()->unregisterForDidRestoreFromCacheCallback(this);
+        document()->unregisterForCacheCallbacks(this);
 
     document()->checkedRadioButtons().removeButton(this);
     
@@ -319,9 +319,9 @@ void HTMLInputElement::setInputType(const String& t)
                 recheckValue();
 
             if (wasPasswordField && !isPasswordField)
-                document()->unregisterForDidRestoreFromCacheCallback(this);
+                document()->unregisterForCacheCallbacks(this);
             else if (!wasPasswordField && isPasswordField)
-                document()->registerForDidRestoreFromCacheCallback(this);
+                document()->registerForCacheCallbacks(this);
 
             if (didRespectHeightAndWidth != willRespectHeightAndWidth) {
                 NamedMappedAttrMap* map = mappedAttributes();
@@ -1475,7 +1475,7 @@ void HTMLInputElement::didRestoreFromCache()
 void HTMLInputElement::willMoveToNewOwnerDocument()
 {
     if (inputType() == PASSWORD)
-        document()->unregisterForDidRestoreFromCacheCallback(this);
+        document()->unregisterForCacheCallbacks(this);
         
     document()->checkedRadioButtons().removeButton(this);
     
@@ -1485,7 +1485,7 @@ void HTMLInputElement::willMoveToNewOwnerDocument()
 void HTMLInputElement::didMoveToNewOwnerDocument()
 {
     if (inputType() == PASSWORD)
-        document()->registerForDidRestoreFromCacheCallback(this);
+        document()->registerForCacheCallbacks(this);
         
     HTMLFormControlElementWithState::didMoveToNewOwnerDocument();
 }
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
new file mode 100644 (file)
index 0000000..c98f586
--- /dev/null
@@ -0,0 +1,994 @@
+/*
+ * Copyright (C) 2007 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)
+#include "HTMLMediaElement.h"
+
+#include "csshelper.h"
+#include "CSSPropertyNames.h"
+#include "CSSValueKeywords.h"
+#include "EventNames.h"
+#include "ExceptionCode.h"
+#include "HTMLDocument.h"
+#include "HTMLNames.h"
+#include "HTMLSourceElement.h"
+#include <limits>
+#include "MediaError.h"
+#include "MediaList.h"
+#include "MediaQueryEvaluator.h"
+#include "MIMETypeRegistry.h"
+#include "Movie.h"
+#include "RenderVideo.h"
+#include "SystemTime.h"
+#include "TimeRanges.h"
+#include "VoidCallback.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace EventNames;
+using namespace HTMLNames;
+
+HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc)
+    : HTMLElement(tagName, doc)
+    , m_loadTimer(this, &HTMLMediaElement::loadTimerFired)
+    , m_asyncEventTimer(this, &HTMLMediaElement::asyncEventTimerFired)
+    , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired)
+    , m_defaultPlaybackRate(1.0f)
+    , m_networkState(EMPTY)
+    , m_readyState(DATA_UNAVAILABLE)
+    , m_begun(false)
+    , m_loadedFirstFrame(false)
+    , m_autoplaying(true)
+    , m_wasPlayingBeforeMovingToPageCache(false)
+    , m_currentLoop(0)
+    , m_volume(0.5f)
+    , m_muted(false)
+    , m_previousProgress(0)
+    , m_previousProgressTime(numeric_limits<double>::max())
+    , m_sentStalledEvent(false)
+    , m_bufferingRate(0)
+    , m_loadNestingLevel(0)
+    , m_terminateLoadBelowNestingLevel(0)
+    , m_movie(0)
+{
+    document()->registerForCacheCallbacks(this);
+}
+
+HTMLMediaElement::~HTMLMediaElement()
+{
+    document()->unregisterForCacheCallbacks(this);
+    delete m_movie;
+    for (HashMap<float, CallbackVector*>::iterator it = m_cuePoints.begin(); it != m_cuePoints.end(); ++it)
+        delete it->second;
+}
+
+bool HTMLMediaElement::checkDTD(const Node* newChild)
+{
+    return newChild->hasTagName(sourceTag) || HTMLElement::checkDTD(newChild);
+}
+
+bool HTMLMediaElement::rendererIsNeeded(RenderStyle* style) 
+{
+    if (isVideo())
+        return HTMLElement::rendererIsNeeded(style); 
+    return false;
+}
+
+RenderObject* HTMLMediaElement::createRenderer(RenderArena* arena, RenderStyle* style)
+{
+    if (isVideo())
+        return new (arena) RenderVideo(this);
+    return HTMLElement::createRenderer(arena, style);
+}
+
+void HTMLMediaElement::insertedIntoDocument()
+{
+    HTMLElement::insertedIntoDocument();
+    if (!src().isEmpty())
+        scheduleLoad();
+}
+
+void HTMLMediaElement::removedFromDocument()
+{
+    delete m_movie;
+    m_movie = 0;
+    HTMLElement::removedFromDocument();
+}
+
+void HTMLMediaElement::scheduleLoad()
+{
+    m_loadTimer.startOneShot(0);
+}
+
+void HTMLMediaElement::initAndDispatchProgressEvent(const AtomicString& eventName)
+{
+    bool totalKnown = m_movie && m_movie->totalBytesKnown();
+    unsigned loaded = m_movie ? m_movie->bytesLoaded() : 0;
+    unsigned total = m_movie ? m_movie->totalBytes() : 0;
+    dispatchProgressEvent(eventName, totalKnown, loaded, total);
+}
+
+void HTMLMediaElement::dispatchEventAsync(const AtomicString& eventName)
+{
+    m_asyncEventsToDispatch.add(eventName);
+    if (!m_asyncEventTimer.isActive())                            
+        m_asyncEventTimer.startOneShot(0);
+}
+
+void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*)
+{
+    ExceptionCode ec;
+    load(ec);
+}
+
+void HTMLMediaElement::asyncEventTimerFired(Timer<HTMLMediaElement>*)
+{
+    HashSet<String>::const_iterator end = m_asyncEventsToDispatch.end();
+    for (HashSet<String>::const_iterator it = m_asyncEventsToDispatch.begin(); it != end; ++it)
+        dispatchHTMLEvent(*it, false, true);
+    m_asyncEventsToDispatch.clear();
+}
+
+String serializeTimeOffset(float time)
+{
+    String timeString = String::number(time);
+    // FIXME serialize time offset values properly (format not specified yet)
+    timeString.append("s");
+    return timeString;
+}
+
+float parseTimeOffset(String timeString, bool* ok = 0)
+{
+    if (timeString.endsWith("s"))
+        timeString = timeString.left(timeString.length() - 1);
+    // FIXME parse time offset values (format not specified yet)
+    float val = (float)timeString.toDouble(ok);
+    return val;
+}
+
+float HTMLMediaElement::getTimeOffsetAttribute(const QualifiedName& name, float valueOnError) const
+{
+    bool ok;
+    String timeString = getAttribute(name);
+    float result = parseTimeOffset(timeString, &ok);
+    if (ok)
+        return result;
+    return valueOnError;
+}
+
+void HTMLMediaElement::setTimeOffsetAttribute(const QualifiedName& name, float value)
+{
+    setAttribute(name, serializeTimeOffset(value));
+}
+
+PassRefPtr<MediaError> HTMLMediaElement::error() const 
+{
+    return m_error;
+}
+
+String HTMLMediaElement::src() const
+{
+    return document()->completeURL(getAttribute(srcAttr));
+}
+
+void HTMLMediaElement::HTMLMediaElement::setSrc(const String& url)
+{
+    setAttribute(srcAttr, url);
+}
+
+String HTMLMediaElement::currentSrc() const
+{
+    return m_currentSrc;
+}
+
+HTMLMediaElement::NetworkState HTMLMediaElement::networkState() const
+{
+    return m_networkState;
+}
+
+float HTMLMediaElement::bufferingRate()
+{
+    if (!m_movie)
+        return 0;
+    return m_bufferingRate;
+    //return m_movie->dataRate();
+}
+
+void HTMLMediaElement::load(ExceptionCode& ec)
+{
+    String mediaSrc;
+    
+    // 3.14.9.4. Loading the media resource
+    // 1
+    // if an event generated during load() ends up re-entering load(), terminate previous instances
+    m_loadNestingLevel++;
+    m_terminateLoadBelowNestingLevel = m_loadNestingLevel;
+    
+    m_progressEventTimer.stop();
+    m_sentStalledEvent = false;
+    m_bufferingRate = 0;
+    
+    m_loadTimer.stop();
+    
+    // 2
+    if (m_begun) {
+        m_begun = false;
+        m_error = new MediaError(MediaError::MEDIA_ERR_ABORTED);
+        initAndDispatchProgressEvent(abortEvent);
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            goto end;
+    }
+    
+    // 3
+    m_error = 0;
+    m_loadedFirstFrame = false;
+    m_autoplaying = true;
+    
+    // 4
+    setPlaybackRate(defaultPlaybackRate(), ec);
+    
+    // 5
+    if (networkState() != EMPTY) {
+        m_networkState = EMPTY;
+        m_readyState = DATA_UNAVAILABLE;
+        if (m_movie) {
+            m_movie->pause();
+            m_movie->seek(0);
+        }
+        m_currentLoop = 0;
+        dispatchHTMLEvent(emptiedEvent, false, true);
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            goto end;
+    }
+    
+    // 6
+    mediaSrc = pickMedia();
+    if (mediaSrc.isEmpty()) {
+        ec = INVALID_STATE_ERR;
+        goto end;
+    }
+    
+    // 7
+    m_networkState = LOADING;
+    
+    // 8
+    m_currentSrc = mediaSrc;
+    
+    // 9
+    m_begun = true;        
+    dispatchProgressEvent(beginEvent, false, 0, 0); // progress event draft calls this loadstart
+    if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+        goto end;
+    
+    // 10, 11, 12, 13
+    delete m_movie;
+    m_movie = new Movie(this);
+    m_movie->setVolume(m_volume);
+    m_movie->setMuted(m_muted);
+    for (HashMap<float, CallbackVector*>::iterator it = m_cuePoints.begin(); it != m_cuePoints.end(); ++it)
+        m_movie->addCuePoint(it->first);
+    m_movie->load(m_currentSrc);
+    if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+        goto end;
+    
+    if (renderer()) {
+        renderer()->updateFromElement();
+        m_movie->setVisible(true);
+    }
+    
+    // 14
+    m_previousProgressTime = WebCore::currentTime();
+    m_previousProgress = 0;
+    if (m_begun)
+        // 350ms is not magic, it is in the spec!
+        m_progressEventTimer.startRepeating(0.350);
+end:
+    ASSERT(m_loadNestingLevel);
+    m_loadNestingLevel--;
+}
+
+
+void HTMLMediaElement::movieNetworkStateChanged(Movie*)
+{
+    if (!m_begun || m_networkState == EMPTY)
+        return;
+    
+    m_terminateLoadBelowNestingLevel = m_loadNestingLevel;
+
+    Movie::NetworkState state = m_movie->networkState();
+    
+    // 3.14.9.4. Loading the media resource
+    // 14
+    if (state == Movie::LoadFailed) {
+        //delete m_movie;
+        //m_movie = 0;
+        // FIXME better error handling
+        m_error = new MediaError(MediaError::MEDIA_ERR_NETWORK);
+        m_begun = false;
+        m_progressEventTimer.stop();
+        m_bufferingRate = 0;
+        
+        initAndDispatchProgressEvent(errorEvent); 
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            return;
+        
+        m_networkState = EMPTY;
+        
+        dispatchHTMLEvent(emptiedEvent, false, true);
+        return;
+    }
+    
+    if (state >= Movie::Loading && m_networkState < LOADING)
+        m_networkState = LOADING;
+    
+    if (state >= Movie::LoadedMetaData && m_networkState < LOADED_METADATA) {
+        m_movie->seek(effectiveStart());
+        m_movie->setEndTime(currentLoop() == loopCount() - 1 ? effectiveEnd() : effectiveLoopEnd());
+        m_networkState = LOADED_METADATA;
+        
+        dispatchHTMLEvent(durationchangeEvent, false, true);
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            return;
+        
+        dispatchHTMLEvent(loadedmetadataEvent, false, true);
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            return;
+    }
+    
+    if (state >= Movie::LoadedFirstFrame && m_networkState < LOADED_FIRST_FRAME) {
+        m_networkState = LOADED_FIRST_FRAME;
+        
+        setReadyState(CAN_SHOW_CURRENT_FRAME);
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            return;
+        
+        m_loadedFirstFrame = true;
+        if (renderer())
+            static_cast<RenderVideo*>(renderer())->videoSizeChanged();
+        
+        dispatchHTMLEvent(loadedfirstframeEvent, false, true);
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            return;
+        
+        dispatchHTMLEvent(canshowcurrentframeEvent, false, true);
+        if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel)
+            return;
+    }
+    
+    // 15
+    if (state == Movie::Loaded && m_networkState < LOADED) {
+        m_begun = false;
+        m_networkState = LOADED;
+        m_progressEventTimer.stop();
+        m_bufferingRate = 0;
+        initAndDispatchProgressEvent(loadEvent); 
+    }
+}
+
+void HTMLMediaElement::movieReadyStateChanged(Movie*)
+{
+    Movie::ReadyState state = m_movie->readyState();
+    setReadyState((ReadyState)state);
+}
+
+void HTMLMediaElement::setReadyState(ReadyState state)
+{
+    // 3.14.9.6. The ready states
+    if (m_readyState == state)
+        return;
+    
+    bool wasActivelyPlaying = activelyPlaying();
+    m_readyState = state;
+    
+    if (networkState() == EMPTY)
+        return;
+    
+    if (state == DATA_UNAVAILABLE) {
+        dispatchHTMLEvent(dataunavailableEvent, false, true);
+        if (wasActivelyPlaying) {
+            dispatchHTMLEvent(timeupdateEvent, false, true);
+            dispatchHTMLEvent(waitingEvent, false, true);
+        }
+    } else if (state == CAN_SHOW_CURRENT_FRAME) {
+        if (m_loadedFirstFrame)
+            dispatchHTMLEvent(canshowcurrentframeEvent, false, true);
+        if (wasActivelyPlaying) {
+            dispatchHTMLEvent(timeupdateEvent, false, true);
+            dispatchHTMLEvent(waitingEvent, false, true);
+        }
+    } else if (state == CAN_PLAY) {
+        dispatchHTMLEvent(canplayEvent, false, true);
+    } else if (state == CAN_PLAY_THROUGH) {
+        dispatchHTMLEvent(canplaythroughEvent, false, true);
+        if (m_autoplaying && paused() && autoplay()) {
+            m_movie->play();
+            dispatchHTMLEvent(playEvent, false, true);
+        }
+    }
+}
+
+void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
+{
+    ASSERT(m_movie);
+    unsigned progress = m_movie->bytesLoaded();
+    double time = WebCore::currentTime();
+    double timedelta = time - m_previousProgressTime;
+    if (timedelta)
+        m_bufferingRate = (float)(0.8 * m_bufferingRate + 0.2 * ((float)(progress - m_previousProgress)) / timedelta);
+    
+    if (progress == m_previousProgress) {
+        if (timedelta > 3.0 && !m_sentStalledEvent) {
+            m_bufferingRate = 0;
+            initAndDispatchProgressEvent(stalledEvent);
+            m_sentStalledEvent = true;
+        }
+    } else {
+        initAndDispatchProgressEvent(progressEvent);
+        m_previousProgress = progress;
+        m_previousProgressTime = time;
+        m_sentStalledEvent = false;
+    }
+}
+
+void HTMLMediaElement::seek(float time, ExceptionCode& ec)
+{
+    // 3.14.9.8. Seeking
+    // 1
+    if (networkState() < LOADED_METADATA) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+    
+    // 2
+    float minTime;
+    if (currentLoop() == 0)
+        minTime = effectiveStart();
+    else
+        minTime = effectiveLoopStart();
+    // 3
+    float maxTime = currentLoop() == loopCount() - 1 ? effectiveEnd() : effectiveLoopEnd();
+    
+    // 4
+    time = min(time, maxTime);
+    
+    // 5
+    time = max(time, minTime);
+    
+    // 6
+    RefPtr<TimeRanges> seekableRanges = seekable();
+    if (!seekableRanges->contain(time)) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+    
+    // 7
+    if (m_movie) {
+        m_movie->seek(time);
+        m_movie->setEndTime(maxTime);
+    }
+    
+    // 8
+    // The seeking DOM attribute is implicitly set to true
+    
+    // 9
+    dispatchHTMLEvent(timeupdateEvent, false, true);
+    
+    // 10
+    // As soon as the user agent has established whether or not the media data for the new playback position is available, 
+    // and, if it is, decoded enough data to play back that position, the seeking DOM attribute must be set to false.
+}
+
+HTMLMediaElement::ReadyState HTMLMediaElement::readyState() const
+{
+    return m_readyState;
+}
+
+bool HTMLMediaElement::seeking() const
+{
+    if (!m_movie)
+        return false;
+    RefPtr<TimeRanges> seekableRanges = seekable();
+    return m_movie->seeking() && seekableRanges->contain(currentTime());
+}
+
+// playback state
+float HTMLMediaElement::currentTime() const
+{
+    return m_movie ? m_movie->currentTime() : 0;
+}
+
+void HTMLMediaElement::setCurrentTime(float time, ExceptionCode& ec)
+{
+    seek(time, ec);
+}
+
+float HTMLMediaElement::duration() const
+{
+    return m_movie ? m_movie->duration() : 0;
+}
+
+bool HTMLMediaElement::paused() const
+{
+    return m_movie ? m_movie->paused() : true;
+}
+
+float HTMLMediaElement::defaultPlaybackRate() const
+{
+    return m_defaultPlaybackRate;
+}
+
+void HTMLMediaElement::setDefaultPlaybackRate(float rate, ExceptionCode& ec)
+{
+    if (rate == 0.0f) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    if (m_defaultPlaybackRate != rate) {
+        m_defaultPlaybackRate = rate;
+        dispatchEventAsync(ratechangeEvent);
+    }
+}
+
+float HTMLMediaElement::playbackRate() const
+{
+    return m_movie ? m_movie->rate() : 0;
+}
+
+void HTMLMediaElement::setPlaybackRate(float rate, ExceptionCode& ec)
+{
+    if (rate == 0.0f) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    if (m_movie && m_movie->rate() != rate) {
+        m_movie->setRate(rate);
+        dispatchEventAsync(ratechangeEvent);
+    }
+}
+
+bool HTMLMediaElement::ended()
+{
+    return networkState() >= LOADED_METADATA && currentTime() >= effectiveEnd() && currentLoop() == loopCount() - 1;
+}
+
+bool HTMLMediaElement::autoplay() const
+{
+    return hasAttribute(autoplayAttr);
+}
+
+void HTMLMediaElement::setAutoplay(bool b)
+{
+    setBooleanAttribute(autoplayAttr, b);
+}
+
+void HTMLMediaElement::play(ExceptionCode& ec)
+{
+    // 3.14.9.7. Playing the media resource
+    if (!m_movie || networkState() == EMPTY) {
+        load(ec);
+        if (ec)
+            return;
+    }
+    if (endedPlayback()) {
+        m_currentLoop = 0;
+        seek(effectiveStart(), ec);
+        if (ec)
+            return;
+    }
+    setPlaybackRate(defaultPlaybackRate(), ec);
+    if (ec)
+        return;
+    
+    m_autoplaying = false;
+    
+    if (m_movie->paused()) {
+        dispatchHTMLEvent(playEvent, false, true);
+        m_movie->play();
+    }
+}
+
+void HTMLMediaElement::pause(ExceptionCode& ec)
+{
+    // 3.14.9.7. Playing the media resource
+    if (!m_movie || networkState() == EMPTY) {
+        load(ec);
+    }
+
+    m_autoplaying = false;
+
+    if (!m_movie->paused()) {
+        dispatchHTMLEvent(pauseEvent, false, true);
+        m_movie->pause();
+    }
+}
+
+unsigned HTMLMediaElement::loopCount() const
+{
+    String val = getAttribute(loopcountAttr);
+    int count = val.toInt();
+    return max(count, 1); 
+}
+
+void HTMLMediaElement::setLoopCount(unsigned count, ExceptionCode& ec)
+{
+    if (!count) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+    setAttribute(loopcountAttr, String::number(count));
+    checkIfSeekNeeded();
+}
+
+float HTMLMediaElement::start() const 
+{ 
+    return getTimeOffsetAttribute(startAttr, 0); 
+}
+
+void HTMLMediaElement::setStart(float time) 
+{ 
+    setTimeOffsetAttribute(startAttr, time); 
+    checkIfSeekNeeded();
+}
+
+float HTMLMediaElement::end() const 
+{ 
+    return getTimeOffsetAttribute(endAttr, std::numeric_limits<float>::infinity()); 
+}
+
+void HTMLMediaElement::setEnd(float time) 
+{ 
+    setTimeOffsetAttribute(endAttr, time); 
+    checkIfSeekNeeded();
+}
+
+float HTMLMediaElement::loopStart() const 
+{ 
+    return getTimeOffsetAttribute(loopstartAttr, 0); 
+}
+
+void HTMLMediaElement::setLoopStart(float time) 
+{
+    setTimeOffsetAttribute(loopstartAttr, time); 
+    checkIfSeekNeeded();
+}
+
+float HTMLMediaElement::loopEnd() const 
+{ 
+    return getTimeOffsetAttribute(loopendAttr, std::numeric_limits<float>::infinity()); 
+}
+
+void HTMLMediaElement::setLoopEnd(float time) 
+{ 
+    setTimeOffsetAttribute(loopendAttr, time); 
+    checkIfSeekNeeded();
+}
+
+unsigned HTMLMediaElement::currentLoop() const
+{
+    return m_currentLoop;
+}
+
+void HTMLMediaElement::setCurrentLoop(unsigned currentLoop)
+{
+    m_currentLoop = currentLoop;
+}
+
+bool HTMLMediaElement::controls() const
+{
+    return hasAttribute(controlsAttr);
+}
+
+void HTMLMediaElement::setControls(bool b)
+{
+    setBooleanAttribute(controlsAttr, b);
+}
+
+float HTMLMediaElement::volume() const
+{
+    return m_volume;
+}
+
+void HTMLMediaElement::setVolume(float vol, ExceptionCode& ec)
+{
+    if (vol < 0.0f || vol > 1.0f) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+    
+    if (m_volume != vol) {
+        m_volume = vol;
+        dispatchEventAsync(volumechangeEvent);
+    
+        if (m_movie)
+            m_movie->setVolume(vol);
+    }
+}
+
+bool HTMLMediaElement::muted() const
+{
+    return m_muted;
+}
+
+void HTMLMediaElement::setMuted(bool muted)
+{
+    if (m_muted != muted) {
+        m_muted = muted;
+        dispatchEventAsync(volumechangeEvent);
+        if (m_movie)
+            m_movie->setMuted(muted);
+    }
+}
+
+String HTMLMediaElement::pickMedia()
+{
+    // 3.14.9.2. Location of the media resource
+    String mediaSrc = getAttribute(srcAttr);
+    if (mediaSrc.isEmpty()) {
+        for (Node* n = firstChild(); n; n = n->nextSibling()) {
+            if (n->hasTagName(sourceTag)) {
+                HTMLSourceElement* source = static_cast<HTMLSourceElement*>(n);
+                if (!source->hasAttribute(srcAttr))
+                    continue; 
+                if (source->hasAttribute(mediaAttr)) {
+                    MediaQueryEvaluator screenEval("screen", document()->page(), renderer() ? renderer()->style() : 0);
+                    RefPtr<MediaList> media = new MediaList((CSSStyleSheet*)0, source->media(), true);
+                    if (!screenEval.eval(media.get()))
+                        continue;
+                }
+                if (source->hasAttribute(typeAttr)) {
+                    String type = source->type();
+                    if (!MIMETypeRegistry::isSupportedMovieMIMEType(type))
+                        continue;
+                }
+                mediaSrc = source->src();
+                break;
+            }
+        }
+    }
+    if (!mediaSrc.isEmpty())
+        mediaSrc = document()->completeURL(mediaSrc);
+    return mediaSrc;
+}
+
+void HTMLMediaElement::checkIfSeekNeeded()
+{
+    // 3.14.9.5. Offsets into the media resource
+    // 1
+    if (loopCount() - 1 < m_currentLoop)
+        m_currentLoop = loopCount() - 1;
+    
+    // 2
+    if (networkState() <= LOADING)
+        return;
+    
+    // 3
+    ExceptionCode ec;
+    float time = currentTime();
+    if (!m_currentLoop && time < effectiveStart())
+        seek(effectiveStart(), ec);
+
+    // 4
+    if (m_currentLoop && time < effectiveLoopStart())
+        seek(effectiveLoopStart(), ec);
+        
+    // 5
+    if (m_currentLoop < loopCount() - 1 && time > effectiveLoopEnd()) {
+        seek(effectiveLoopStart(), ec);
+        m_currentLoop++;
+    }
+    
+    // 6
+    if (m_currentLoop == loopCount() - 1 && time > effectiveEnd())
+        seek(effectiveEnd(), ec);
+}
+
+void HTMLMediaElement::movieVolumeChanged(Movie*)
+{
+    if (!m_movie)
+        return;
+    if (m_movie->volume() != m_volume || m_movie->muted() != m_muted) {
+        m_volume = m_movie->volume();
+        m_muted = m_movie->muted();
+        dispatchEventAsync(volumechangeEvent);
+    }
+}
+
+void HTMLMediaElement::movieDidEnd(Movie*)
+{
+    if (m_currentLoop < loopCount() - 1 && currentTime() >= effectiveLoopEnd()) {
+        m_movie->seek(effectiveLoopStart());
+        m_currentLoop++;
+        m_movie->setEndTime(m_currentLoop == loopCount() - 1 ? effectiveEnd() : effectiveLoopEnd());
+        if (m_movie)
+            m_movie->play();
+        dispatchHTMLEvent(timeupdateEvent, false, true);
+    }
+    
+    if (m_currentLoop == loopCount() - 1 && currentTime() >= effectiveEnd()) {
+        dispatchHTMLEvent(timeupdateEvent, false, true);
+        dispatchHTMLEvent(endedEvent, false, true);
+    }
+}
+
+void HTMLMediaElement::movieCuePointReached(Movie*, float cueTime)
+{
+    CallbackVector* callbackVector = m_cuePoints.get(cueTime);
+    if (!callbackVector)
+        return;
+    for (unsigned n = 0; n < callbackVector->size(); n++) {
+        CallbackEntry ce = (*callbackVector)[n];
+        if (ce.m_pause) {
+            ExceptionCode ec;
+            pause(ec);
+            break;
+        }
+    }    
+    
+    dispatchHTMLEvent(timeupdateEvent, false, true);
+    
+    for (unsigned n = 0; n < callbackVector->size(); n++) {
+        CallbackEntry ce = (*callbackVector)[n];
+        if (ce.m_voidCallback) 
+            ce.m_voidCallback->execute(document()->frame());
+    }      
+}
+
+void HTMLMediaElement::addCuePoint(float time, VoidCallback* voidCallback, bool pause)
+{
+    if (time < 0 || !isfinite(time))
+        return;
+    CallbackVector* callbackVector = m_cuePoints.get(time);
+    if (!callbackVector) {
+        callbackVector = new CallbackVector;
+        m_cuePoints.add(time, callbackVector);
+    }
+    callbackVector->append(CallbackEntry(voidCallback, pause));
+    
+    if (m_movie)
+        m_movie->addCuePoint(time);
+}
+
+void HTMLMediaElement::removeCuePoint(float time, VoidCallback* callback)
+{
+    if (time < 0 || !isfinite(time))
+        return;
+    CallbackVector* callbackVector = m_cuePoints.get(time);
+    if (callbackVector) {
+        for (unsigned n = 0; n < callbackVector->size(); n++) {
+            if (*(*callbackVector)[n].m_voidCallback == *callback) {
+                callbackVector->remove(n);
+                break;
+            }
+        }
+        if (!callbackVector->size()) {
+            delete callbackVector;
+            m_cuePoints.remove(time);
+            if (m_movie)
+                m_movie->removeCuePoint(time);
+        }
+    }
+}
+
+PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const
+{
+    // FIXME real ranges support
+    if (!m_movie || !m_movie->maxTimeBuffered())
+        return new TimeRanges;
+    return new TimeRanges(0, m_movie->maxTimeBuffered());
+}
+
+PassRefPtr<TimeRanges> HTMLMediaElement::played() const
+{
+    // FIXME track played
+    return new TimeRanges;
+}
+
+PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const
+{
+    // FIXME real ranges support
+    if (!m_movie || !m_movie->maxTimeSeekable())
+        return new TimeRanges;
+    return new TimeRanges(0, m_movie->maxTimeSeekable());
+}
+
+float HTMLMediaElement::effectiveStart() const
+{
+    if (!m_movie)
+        return 0;
+    return min(start(), m_movie->duration());
+}
+
+float HTMLMediaElement::effectiveEnd() const
+{
+    if (!m_movie)
+        return 0;
+    return min(max(end(), max(start(), loopStart())), m_movie->duration());
+}
+
+float HTMLMediaElement::effectiveLoopStart() const
+{
+    if (!m_movie)
+        return 0;
+    return min(loopStart(), m_movie->duration());
+}
+
+float HTMLMediaElement::effectiveLoopEnd() const
+{
+    if (!m_movie)
+        return 0;
+    return min(max(start(), max(loopStart(), loopEnd())), m_movie->duration());
+}
+
+bool HTMLMediaElement::activelyPlaying() const
+{
+    return !paused() && readyState() >= CAN_PLAY && !endedPlayback(); // && !stoppedDueToErrors() && !pausedForUserInteraction();
+}
+
+bool HTMLMediaElement::endedPlayback() const
+{
+    return networkState() >= LOADED_METADATA && currentTime() >= effectiveEnd() && currentLoop() == loopCount() - 1;
+}
+
+void HTMLMediaElement::willSaveToCache()
+{
+    // 3.14.9.4. Loading the media resource
+    // 14
+    if (m_begun) {
+        if (m_movie)
+            m_movie->cancelLoad();
+        m_error = new MediaError(MediaError::MEDIA_ERR_ABORTED);
+        m_begun = false;
+        initAndDispatchProgressEvent(abortEvent);
+        if (m_networkState >= LOADING) {
+            m_networkState = EMPTY;
+            dispatchHTMLEvent(emptiedEvent, false, true);
+        }
+    }
+    
+    ExceptionCode ec;
+    m_wasPlayingBeforeMovingToPageCache = !paused();
+    if (m_wasPlayingBeforeMovingToPageCache)
+        pause(ec);
+    if (m_movie)
+        m_movie->setVisible(false);
+}
+
+void HTMLMediaElement::didRestoreFromCache()
+{
+    ExceptionCode ec;
+    if (m_wasPlayingBeforeMovingToPageCache)
+        play(ec);
+    if (renderer())
+        m_movie->setVisible(true);
+}
+
+}
+
+#endif
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
new file mode 100644 (file)
index 0000000..6b267dd
--- /dev/null
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2007 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 HTMLMediaElement_h
+#define HTMLMediaElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLElement.h"
+#include "Movie.h"
+#include "Timer.h"
+#include "StringHash.h"
+#include "VoidCallback.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class MediaError;
+class TimeRanges;
+    
+class HTMLMediaElement : public HTMLElement, public MovieClient {
+public:
+    HTMLMediaElement(const QualifiedName&, Document*);
+    virtual ~HTMLMediaElement();
+
+    bool checkDTD(const Node* newChild);
+
+    virtual bool rendererIsNeeded(RenderStyle*);
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+    virtual void insertedIntoDocument();
+    virtual void removedFromDocument();
+    
+    Movie* movie() const { return m_movie; }
+    
+    virtual bool isVideo() const { return false; }
+    
+    void scheduleLoad();
+    
+// DOM API
+// error state
+    PassRefPtr<MediaError> error() const;
+
+// network state
+    String src() const;
+    void setSrc(const String&);
+    String currentSrc() const;
+    
+    enum NetworkState { EMPTY, LOADING, LOADED_METADATA, LOADED_FIRST_FRAME, LOADED };
+    NetworkState networkState() const;
+    float bufferingRate();
+    PassRefPtr<TimeRanges> buffered() const;
+    void load(ExceptionCode&);
+
+// ready state
+    enum ReadyState { DATA_UNAVAILABLE, CAN_SHOW_CURRENT_FRAME, CAN_PLAY, CAN_PLAY_THROUGH };
+    ReadyState readyState() const;
+    bool seeking() const;
+
+// playback state
+    float currentTime() const;
+    void setCurrentTime(float, ExceptionCode&);
+    float duration() const;
+    bool paused() const;
+    float defaultPlaybackRate() const;
+    void setDefaultPlaybackRate(float, ExceptionCode&);
+    float playbackRate() const;
+    void setPlaybackRate(float, ExceptionCode&);
+    PassRefPtr<TimeRanges> played() const;
+    PassRefPtr<TimeRanges> seekable() const;
+    bool ended();
+    bool autoplay() const;    
+    void setAutoplay(bool b);
+    void play(ExceptionCode&);
+    void pause(ExceptionCode&);
+    
+// looping
+    float start() const;
+    void setStart(float time);
+    float end() const;
+    void setEnd(float time);
+    float loopStart() const;
+    void setLoopStart(float time);
+    float loopEnd() const;
+    void setLoopEnd(float time);
+    unsigned loopCount() const;
+    void setLoopCount(unsigned, ExceptionCode&);
+    unsigned currentLoop() const;
+    void setCurrentLoop(unsigned);
+// cue points
+    void addCuePoint(float time, VoidCallback* callback, bool pause);
+    void removeCuePoint(float time, VoidCallback* callback);
+    
+// controls
+    bool controls() const;
+    void setControls(bool);
+    float volume() const;
+    void setVolume(float, ExceptionCode&);
+    bool muted() const;
+    void setMuted(bool);
+
+protected:
+    float getTimeOffsetAttribute(const QualifiedName&, float valueOnError) const;
+    void setTimeOffsetAttribute(const QualifiedName&, float value);
+    
+    virtual void willSaveToCache();
+    virtual void didRestoreFromCache();
+    
+    void initAndDispatchProgressEvent(const AtomicString& eventName);
+    void dispatchEventAsync(const AtomicString& eventName);
+    
+    void setReadyState(ReadyState);
+    
+private: // MovieObserver
+    virtual void movieNetworkStateChanged(Movie*);
+    virtual void movieReadyStateChanged(Movie*);
+    virtual void movieVolumeChanged(Movie*);
+    virtual void movieDidEnd(Movie*);
+    virtual void movieCuePointReached(Movie*, float cueTime);
+        
+private:
+    void loadTimerFired(Timer<HTMLMediaElement>*);
+    void asyncEventTimerFired(Timer<HTMLMediaElement>*);
+    void progressEventTimerFired(Timer<HTMLMediaElement>*);
+    void seek(float time, ExceptionCode& ec);
+    void checkIfSeekNeeded();
+    
+    String pickMedia();
+    float effectiveStart() const;
+    float effectiveEnd() const;
+    float effectiveLoopStart() const;
+    float effectiveLoopEnd() const;
+    bool activelyPlaying() const;
+    bool endedPlayback() const;
+    
+protected:
+    Timer<HTMLMediaElement> m_loadTimer;
+    Timer<HTMLMediaElement> m_asyncEventTimer;
+    Timer<HTMLMediaElement> m_progressEventTimer;
+    HashSet<String> m_asyncEventsToDispatch;
+    
+    float m_defaultPlaybackRate;
+    NetworkState m_networkState;
+    ReadyState m_readyState;
+    String m_currentSrc;
+    
+    RefPtr<MediaError> m_error;
+    
+    bool m_begun;
+    bool m_loadedFirstFrame;
+    bool m_autoplaying;
+    
+    bool m_wasPlayingBeforeMovingToPageCache;
+    
+    unsigned m_currentLoop;
+    float m_volume;
+    bool m_muted;
+    
+    bool m_seeking;
+    
+    unsigned m_previousProgress;
+    double m_previousProgressTime;
+    bool m_sentStalledEvent;
+    
+    float m_bufferingRate;
+    
+    unsigned m_loadNestingLevel;
+    unsigned m_terminateLoadBelowNestingLevel;
+    
+    struct CallbackEntry {
+        CallbackEntry() : m_voidCallback(0), m_pause(false) { }
+        CallbackEntry(VoidCallback* voidCallback, bool pause) {    
+            m_voidCallback = voidCallback;
+            m_pause = pause;
+        }
+        RefPtr<VoidCallback> m_voidCallback;
+        bool m_pause;
+    };
+    typedef Vector<CallbackEntry> CallbackVector;
+    HashMap<float, CallbackVector*> m_cuePoints;
+    
+    Movie* m_movie;
+};
+
+} //namespace
+
+#endif
+#endif
diff --git a/WebCore/html/HTMLMediaElement.idl b/WebCore/html/HTMLMediaElement.idl
new file mode 100644 (file)
index 0000000..015177f
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+
+module html {
+interface [GenerateConstructor, Conditional=VIDEO] HTMLMediaElement : HTMLElement {
+
+    // error state
+    readonly attribute MediaError error;
+
+    // network state
+    attribute DOMString src;
+    readonly attribute DOMString currentSrc;
+    
+    const unsigned short EMPTY = 0;
+    const unsigned short LOADING = 1;
+    const unsigned short LOADED_METADATA = 2;
+    const unsigned short LOADED_FIRST_FRAME = 3;
+    const unsigned short LOADED = 4;
+    readonly attribute unsigned short networkState;
+    readonly attribute float bufferingRate;
+    readonly attribute TimeRanges buffered;
+    void load() 
+        raises (DOMException);
+
+    // ready state
+    const unsigned short DATA_UNAVAILABLE = 0;
+    const unsigned short CAN_SHOW_CURRENT_FRAME = 1;
+    const unsigned short CAN_PLAY = 2;
+    const unsigned short CAN_PLAY_THROUGH = 3;
+    readonly attribute unsigned short readyState;
+    readonly attribute boolean seeking;
+
+    // playback state
+    attribute float currentTime
+        setter raises (DOMException);
+    readonly attribute float duration;
+    readonly attribute boolean paused;
+    attribute float defaultPlaybackRate 
+        setter raises (DOMException);
+    attribute float playbackRate 
+        setter raises (DOMException);
+    readonly attribute TimeRanges played;
+    readonly attribute TimeRanges seekable;
+    readonly attribute boolean ended;
+    attribute boolean autoplay;
+    void play() 
+        raises (DOMException);
+    void pause() 
+        raises (DOMException);
+
+    // looping
+    attribute float start;
+    attribute float end;
+    attribute float loopStart;
+    attribute float loopEnd;
+    attribute unsigned long loopCount
+        setter raises (DOMException);
+    attribute unsigned long currentLoop;
+
+    // cue points
+    void addCuePoint(in float time, in VoidCallback callback, in boolean pause);
+    void removeCuePoint(in float time, in VoidCallback callback);
+
+    // controls
+    attribute boolean controls;
+    attribute float volume 
+        setter raises (DOMException);
+    attribute boolean muted;
+};
+}
diff --git a/WebCore/html/HTMLSourceElement.cpp b/WebCore/html/HTMLSourceElement.cpp
new file mode 100644 (file)
index 0000000..66f7305
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2007 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)
+#include "HTMLSourceElement.h"
+
+#include "HTMLDocument.h"
+#include "HTMLMediaElement.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLSourceElement::HTMLSourceElement(Document* doc)
+    : HTMLElement(sourceTag, doc)
+{
+}
+
+HTMLSourceElement::~HTMLSourceElement()
+{
+}
+
+void HTMLSourceElement::insertedIntoDocument()
+{
+    HTMLElement::insertedIntoDocument();
+    if (parentNode() && (parentNode()->hasTagName(audioTag) ||  parentNode()->hasTagName(videoTag))) {
+        HTMLMediaElement* media = static_cast<HTMLMediaElement*>(parentNode());
+        if (media->networkState() == HTMLMediaElement::EMPTY)
+            media->scheduleLoad();
+    }
+}
+
+String HTMLSourceElement::src() const
+{
+    return document()->completeURL(getAttribute(srcAttr));
+}
+
+void HTMLSourceElement::setSrc(const String& url)
+{
+    setAttribute(srcAttr, url);
+}
+
+String HTMLSourceElement::media() const
+{
+    return getAttribute(mediaAttr);
+}
+
+void HTMLSourceElement::setMedia(const String& media)
+{
+    setAttribute(mediaAttr, media);
+}
+
+String HTMLSourceElement::type() const
+{
+    return getAttribute(typeAttr);
+}
+
+void HTMLSourceElement::setType(const String& type)
+{
+    setAttribute(typeAttr, type);
+}
+
+}
+#endif
diff --git a/WebCore/html/HTMLSourceElement.h b/WebCore/html/HTMLSourceElement.h
new file mode 100644 (file)
index 0000000..e47411a
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2007 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 HTMLSourceElement_h
+#define HTMLSourceElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLElement.h"
+#include "HTMLNames.h"
+#include <limits>
+
+namespace WebCore {
+
+using namespace HTMLNames;
+    
+class MediaError;
+    
+class HTMLSourceElement : public HTMLElement {
+public:
+    HTMLSourceElement(Document*);
+    virtual ~HTMLSourceElement();
+
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+    virtual int tagPriority() const { return 0; }
+    
+    virtual void insertedIntoDocument();
+    
+    String src() const;
+    String media() const;
+    String type() const;
+    void setSrc(const String&);    
+    void setMedia(const String&);
+    void setType(const String&);
+};
+
+} //namespace
+
+#endif
+#endif
diff --git a/WebCore/html/HTMLSourceElement.idl b/WebCore/html/HTMLSourceElement.idl
new file mode 100644 (file)
index 0000000..5a25c23
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+
+module html {
+interface [GenerateConstructor, Conditional=VIDEO] HTMLSourceElement : HTMLElement {
+    attribute DOMString src;
+    attribute DOMString type;
+    attribute DOMString media;
+};
+}
index 1894f53..816f88d 100644 (file)
@@ -4,6 +4,7 @@ acronym
 address
 applet
 area
+audio
 b
 base
 basefont
@@ -81,6 +82,7 @@ samp
 script
 select
 small
+source
 span
 strike
 strong
@@ -100,5 +102,6 @@ tt
 u
 ul
 var
+video
 wbr
 xmp
diff --git a/WebCore/html/HTMLVideoElement.cpp b/WebCore/html/HTMLVideoElement.cpp
new file mode 100644 (file)
index 0000000..25643c7
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 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)
+#include "HTMLVideoElement.h"
+
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLVideoElement::HTMLVideoElement(Document* doc)
+    : HTMLMediaElement(HTMLNames::videoTag, doc)
+{
+}
+
+int HTMLVideoElement::videoWidth() const
+{
+    if (!m_movie)
+        return 0;
+    return m_movie->naturalSize().width();
+}
+
+int HTMLVideoElement::videoHeight() const
+{
+    if (!m_movie)
+        return 0;
+    return m_movie->naturalSize().height();
+}
+
+}
+#endif
diff --git a/WebCore/html/HTMLVideoElement.h b/WebCore/html/HTMLVideoElement.h
new file mode 100644 (file)
index 0000000..f6a2863
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2007 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 HTMLVideoElement_h
+#define HTMLVideoElement_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLMediaElement.h"
+
+namespace WebCore {
+
+class HTMLVideoElement : public HTMLMediaElement
+{
+public:
+    HTMLVideoElement(Document*);
+    
+    virtual int tagPriority() const { return 5; }
+    
+    int videoWidth() const;
+    int videoHeight() const;
+    
+    virtual bool isVideo() const { return true; }
+
+};
+
+} //namespace
+
+#endif
+#endif
diff --git a/WebCore/html/HTMLVideoElement.idl b/WebCore/html/HTMLVideoElement.idl
new file mode 100644 (file)
index 0000000..b57bcf0
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+
+module html {
+    interface [GenerateConstructor, Conditional=VIDEO] HTMLVideoElement : HTMLMediaElement {
+        readonly attribute unsigned long videoWidth;
+        readonly attribute unsigned long videoHeight;
+    };
+}
diff --git a/WebCore/html/MediaError.h b/WebCore/html/MediaError.h
new file mode 100644 (file)
index 0000000..bb32a87
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007 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 MediaError_h
+#define MediaError_h
+
+#if ENABLE(VIDEO)
+
+#include "Shared.h"
+
+namespace WebCore {
+
+class MediaError : public Shared<MediaError> {
+public:
+    enum Code { MEDIA_ERR_ABORTED = 1, MEDIA_ERR_NETWORK, MEDIA_ERR_DECODE };
+
+    MediaError(Code code) { m_code = code; }
+    Code code() const { return m_code; }
+
+private:
+    Code m_code;
+};
+
+} // namespace WebCore
+
+#endif
+#endif
diff --git a/WebCore/html/MediaError.idl b/WebCore/html/MediaError.idl
new file mode 100644 (file)
index 0000000..5b4f0a2
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+
+module html {
+    interface [GenerateConstructor, Conditional=VIDEO] MediaError {
+          const unsigned short MEDIA_ERR_ABORTED = 1;
+          const unsigned short MEDIA_ERR_NETWORK = 2;
+          const unsigned short MEDIA_ERR_DECODE = 3;
+          readonly attribute unsigned short code;
+    };
+}
diff --git a/WebCore/html/TimeRanges.cpp b/WebCore/html/TimeRanges.cpp
new file mode 100644 (file)
index 0000000..ad81ac8
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2007 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"
+
+#include "TimeRanges.h"
+
+using namespace WebCore;
+
+TimeRanges::TimeRanges(float start, float end)
+{
+    add(start, end);
+}
+
+float TimeRanges::start(unsigned index, ExceptionCode& ec) const 
+{ 
+    if (index >= length()) {
+        ec = INDEX_SIZE_ERR;
+        return 0;
+    }
+    return m_ranges[index].m_start;
+}
+
+float TimeRanges::end(unsigned index, ExceptionCode& ec) const 
+{ 
+    if (index >= length()) {
+        ec = INDEX_SIZE_ERR;
+        return 0;
+    }
+    return m_ranges[index].m_end;
+}
+
+void TimeRanges::add(float start, float end) 
+{ 
+    m_ranges.append(Range(start, end));
+    // FIXME normalize
+}
+
+bool TimeRanges::contain(float time) const
+{ 
+    ExceptionCode unused;
+    for (unsigned n = 0; n < length(); n++) {
+        if (time >= start(n, unused) && time <= end(n, unused))
+            return true;
+    }
+    return false;
+}
diff --git a/WebCore/html/TimeRanges.h b/WebCore/html/TimeRanges.h
new file mode 100644 (file)
index 0000000..90a6de9
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2007 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 TimeRanges_h
+#define TimeRanges_h
+
+#include "ExceptionCode.h"
+#include "Shared.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class TimeRanges : public Shared<TimeRanges> {
+public:
+    TimeRanges() { }
+    TimeRanges(float start, float end);
+    
+    unsigned length() const { return m_ranges.size(); }
+    float start(unsigned index, ExceptionCode& ec) const;
+    float end(unsigned index, ExceptionCode& ec) const;
+    
+    void add(float start, float end);
+    
+    bool contain(float time) const;
+
+private:
+    struct Range {
+        Range() { }
+        Range(float start, float end) {
+            m_start = start;
+            m_end = end;
+        }
+        float m_start;
+        float m_end;
+    };
+    
+    Vector<Range> m_ranges;
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/html/TimeRanges.idl b/WebCore/html/TimeRanges.idl
new file mode 100644 (file)
index 0000000..c6776a9
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+
+module html {
+
+interface TimeRanges {
+    readonly attribute unsigned long length;
+    float start(in unsigned long index)
+        raises (DOMException);
+    float end(in unsigned long index)
+        raises (DOMException);
+};
+
+}
index 9314d02..1689c58 100644 (file)
@@ -245,6 +245,13 @@ module window {
         attribute DOMParserConstructor DOMParser;
         attribute XMLSerializerConstructor XMLSerializer;
 
+#if defined(ENABLE_VIDEO)
+        attribute HTMLAudioElementConstructor HTMLAudioElement;
+        attribute HTMLMediaElementConstructor HTMLMediaElement;
+        attribute HTMLVideoElementConstructor HTMLVideoElement;
+        attribute MediaErrorConstructor MediaError;
+#endif
+
 #if defined(ENABLE_XPATH)
         attribute XPathEvaluatorConstructor XPathEvaluator;
         attribute XPathResultConstructor XPathResult;
index d5d44d1..f791c2b 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
+#include "Movie.h"
 #include "StringHash.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
@@ -44,7 +45,8 @@ namespace WebCore
 static WTF::HashSet<String>* supportedImageResourceMIMETypes;
 static WTF::HashSet<String>* supportedImageMIMETypes;
 static WTF::HashSet<String>* supportedNonImageMIMETypes;
-    
+static WTF::HashSet<String>* supportedMovieMIMETypes;
+
 #if PLATFORM(CG)
 extern String getMIMETypeForUTI(const String& uti);
 #endif
@@ -144,15 +146,24 @@ static void initialiseSupportedNonImageMimeTypes()
     for (size_t i = 0; i < sizeof(types)/sizeof(types[0]); ++i)
       supportedNonImageMIMETypes->add(types[i]);
 }
+    
+static void initialiseSupportedMovieMIMETypes()
+{
+#if ENABLE(VIDEO)
+    Movie::getSupportedTypes(*supportedMovieMIMETypes);
+#endif
+}
 
 static void initialiseMIMETypeRegistry()
 {
     supportedImageResourceMIMETypes = new WTF::HashSet<String>();
     supportedImageMIMETypes = new WTF::HashSet<String>();
     supportedNonImageMIMETypes = new WTF::HashSet<String>();
+    supportedMovieMIMETypes = new WTF::HashSet<String>();
     
     initialiseSupportedNonImageMimeTypes();
     initialiseSupportedImageMIMETypes();
+    initialiseSupportedMovieMIMETypes();
 }
 
 String MIMETypeRegistry::getMIMETypeForPath(const String& path)
@@ -186,6 +197,14 @@ bool MIMETypeRegistry::isSupportedNonImageMIMEType(const String& mimeType)
     return !mimeType.isEmpty() && supportedNonImageMIMETypes->contains(mimeType);
 }
 
+bool MIMETypeRegistry::isSupportedMovieMIMEType(const String& mimeType)
+{
+    if (!supportedMovieMIMETypes)
+        initialiseMIMETypeRegistry();
+    return !mimeType.isEmpty() && supportedMovieMIMETypes->contains(mimeType);     
+}
+    
+    
 bool MIMETypeRegistry::isJavaAppletMIMEType(const String& mimeType)
 {
     // Since this set is very limited and is likely to remain so we won't bother with the overhead
@@ -218,4 +237,11 @@ HashSet<String> &MIMETypeRegistry::getSupportedNonImageMIMETypes()
     return *supportedNonImageMIMETypes;
 }
 
+HashSet<String> &MIMETypeRegistry::getSupportedMovieMIMETypes()
+{
+    if (!supportedMovieMIMETypes)
+        initialiseMIMETypeRegistry();
+    return *supportedMovieMIMETypes;
+}
+    
 }
index 424646f..b34e80b 100644 (file)
@@ -52,12 +52,16 @@ public:
     // document in a frame.
     static bool isSupportedNonImageMIMEType(const String& mimeType);
     
+    // Check to see if a mime type is suitable for being loaded using <movie>
+    static bool isSupportedMovieMIMEType(const String& mimeType); 
+
     // Check to see if a mime type is a valid Java applet mime type
     static bool isJavaAppletMIMEType(const String& mimeType);
     
     static HashSet<String>& getSupportedImageMIMETypes();
     static HashSet<String>& getSupportedImageResourceMIMETypes();
     static HashSet<String>& getSupportedNonImageMIMETypes();
+    static HashSet<String>& getSupportedMovieMIMETypes();
 };
 
 } // namespace WebCore
diff --git a/WebCore/platform/graphics/Movie.cpp b/WebCore/platform/graphics/Movie.cpp
new file mode 100644 (file)
index 0000000..db6696a
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2007 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)
+#include "Movie.h"
+
+#include "IntRect.h"
+#include "MimeTypeRegistry.h"
+
+#if PLATFORM(MAC)
+#include "MoviePrivateQTKit.h"
+#endif
+
+namespace WebCore {
+    
+    Movie::Movie(MovieClient* client)
+    : m_movieClient(client)
+    , m_private(new MoviePrivate(this))
+    , m_parentWidget(0)
+    , m_visible(false)
+    , m_rate(1.0f)
+    , m_volume(0.5f)
+    , m_muted(false)
+{
+}
+
+Movie::~Movie()
+{
+    delete m_private;
+}
+
+void Movie::load(String url)
+{
+    m_private->load(url);
+}    
+
+void Movie::cancelLoad()
+{
+    m_private->cancelLoad();
+}    
+
+void Movie::play()
+{
+    m_private->play();
+}
+
+void Movie::pause()
+{
+    m_private->pause();
+}
+
+float Movie::duration() const
+{
+    return m_private->duration();
+}
+
+float Movie::currentTime() const
+{
+    return m_private->currentTime();  
+}
+
+void Movie::seek(float time)
+{
+    m_private->seek(time);
+}
+
+bool Movie::paused() const
+{
+    return m_private->paused();
+}
+
+bool Movie::seeking() const
+{
+    return m_private->seeking();
+}
+
+IntSize Movie::naturalSize()
+{
+    return m_private->naturalSize();
+}
+
+bool Movie::hasVideo()
+{
+    return m_private->hasVideo();
+}
+
+Movie::NetworkState Movie::networkState()
+{
+    return m_private->networkState();
+}
+
+Movie::ReadyState Movie::readyState()
+{
+    return m_private->readyState();
+}
+
+float Movie::volume() const
+{
+    return m_volume;
+}
+
+void Movie::setVolume(float volume)
+{
+    if (volume != m_volume) {
+        m_volume = volume;
+        m_private->setVolume(volume);   
+    }
+}
+
+float Movie::rate() const
+{
+    return m_rate;
+}
+
+void Movie::setRate(float rate)
+{
+    if (rate == m_rate) 
+        return;
+    m_rate = rate;
+    m_private->setRate(rate);   
+}
+
+bool Movie::muted() const
+{
+    return m_muted;
+}
+
+void Movie::setMuted(bool muted)
+{
+    if (muted == m_muted) 
+        return;
+    m_muted = muted;
+    m_private->setMuted(muted);
+}
+
+int Movie::dataRate() const
+{
+    return m_private->dataRate();
+}
+
+void Movie::setEndTime(float time)
+{
+    m_private->setEndTime(time);
+}
+
+void Movie::addCuePoint(float time)
+{
+    if (m_cuePoints.contains(time))
+        return;
+    m_cuePoints.add(time);
+    m_private->addCuePoint(time);
+}
+
+void Movie::removeCuePoint(float time)
+{
+    if (!m_cuePoints.contains(time))
+        return;
+    m_cuePoints.remove(time);
+    m_private->removeCuePoint(time);
+}
+
+void Movie::clearCuePoints()
+{
+    m_cuePoints.clear();
+    m_private->clearCuePoints();
+}
+
+float Movie::maxTimeBuffered()
+{
+    return m_private->maxTimeBuffered();
+}
+
+float Movie::maxTimeSeekable()
+{
+    return m_private->maxTimeSeekable();
+}
+
+unsigned Movie::bytesLoaded()
+{
+    return m_private->bytesLoaded();
+}
+
+bool Movie::totalBytesKnown()
+{
+    return m_private->totalBytesKnown();
+}
+
+unsigned Movie::totalBytes()
+{
+    return m_private->totalBytes();
+}
+
+void Movie::setRect(const IntRect& r) 
+{ 
+    if (m_rect == r)
+        return;
+    m_rect = r;
+    m_private->setRect(r);
+}
+
+bool Movie::visible() const
+{
+    return m_visible;
+}
+
+void Movie::setVisible(bool b)
+{
+    if (m_visible == b)
+        return;
+    m_visible = b;
+    m_private->setVisible(b);
+}
+
+void Movie::paint(GraphicsContext* p, const IntRect& r)
+{
+    m_private->paint(p, r);
+}
+
+void Movie::getSupportedTypes(HashSet<String>& types)
+{
+    MoviePrivate::getSupportedTypes(types);
+} 
+
+void Movie::networkStateChanged()
+{
+    if (m_movieClient)
+        m_movieClient->movieNetworkStateChanged(this);
+}
+
+void Movie::readyStateChanged()
+{
+    if (m_movieClient)
+        m_movieClient->movieReadyStateChanged(this);
+}
+
+void Movie::volumeChanged()
+{
+    if (m_movieClient)
+        m_movieClient->movieVolumeChanged(this);
+}
+
+void Movie::didEnd()
+{
+    if (m_movieClient)
+        m_movieClient->movieDidEnd(this);
+}
+
+void Movie::cuePointReached(float cueTime)
+{
+    if (m_movieClient)
+        m_movieClient->movieCuePointReached(this, cueTime);
+}
+
+}
+#endif
diff --git a/WebCore/platform/graphics/Movie.h b/WebCore/platform/graphics/Movie.h
new file mode 100644 (file)
index 0000000..970683a
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2007 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 Movie_h
+#define Movie_h
+
+#if ENABLE(VIDEO)
+
+#include "IntRect.h"
+#include "StringHash.h"
+#include "wtf/HashSet.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+class GraphicsContext;
+class IntSize;
+class Movie;
+class MoviePrivate;
+class String;
+class Widget;
+
+class MovieClient
+{
+public:
+    virtual ~MovieClient() { }
+    virtual void movieNetworkStateChanged(Movie*) { }
+    virtual void movieReadyStateChanged(Movie*) { }
+    virtual void movieVolumeChanged(Movie*) { }
+    virtual void movieDidEnd(Movie*) { }
+    virtual void movieCuePointReached(Movie*, float cueTime) { }
+};
+
+class Movie : Noncopyable {
+public:
+    Movie(MovieClient*);
+    virtual ~Movie();
+    
+    static void getSupportedTypes(HashSet<String>&);
+    
+    IntSize naturalSize();
+    bool hasVideo();
+    
+    Widget* parentWidget() const { return m_parentWidget; }
+    void setParentWidget(Widget* parent) { m_parentWidget = parent; }
+    
+    IntRect rect() const { return m_rect; }
+    void setRect(const IntRect& r);
+    
+    void load(String url);
+    void cancelLoad();
+    
+    bool visible() const;
+    void setVisible(bool);
+    
+    void play();
+    void pause();    
+    
+    bool paused() const;
+    bool seeking() const;
+    
+    float duration() const;
+    float currentTime() const;
+    void seek(float time);
+    
+    void setEndTime(float time);
+    
+    void addCuePoint(float time);
+    void removeCuePoint(float time);
+    void clearCuePoints();
+    
+    float rate() const;
+    void setRate(float);
+    
+    float maxTimeBuffered();
+    float maxTimeSeekable();
+    
+    unsigned bytesLoaded();
+    bool totalBytesKnown();
+    unsigned totalBytes();
+    
+    float volume() const;
+    void setVolume(float);
+    bool muted() const;
+    void setMuted(bool);
+    
+    int dataRate() const;
+    
+    void paint(GraphicsContext*, const IntRect&);
+    
+    enum NetworkState { Empty, LoadFailed, Loading, LoadedMetaData, LoadedFirstFrame, Loaded };
+    NetworkState networkState();
+
+    enum ReadyState  { DataUnavailable, CanShowCurrentFrame, CanPlay, CanPlayThrough };
+    ReadyState readyState();
+    
+    void networkStateChanged();
+    void readyStateChanged();
+    void volumeChanged();
+    void didEnd();
+    void cuePointReached(float cueTime);
+
+private:
+        
+    friend class MoviePrivate;
+    
+    MovieClient* m_movieClient;
+    MoviePrivate* m_private;
+    Widget* m_parentWidget;
+    IntRect m_rect;
+    bool m_visible;
+    float m_rate;
+    float m_volume;
+    bool m_muted;
+    HashSet<float> m_cuePoints;
+};
+
+}
+
+#endif
+#endif
diff --git a/WebCore/platform/graphics/mac/MoviePrivateQTKit.h b/WebCore/platform/graphics/mac/MoviePrivateQTKit.h
new file mode 100644 (file)
index 0000000..fd1fb01
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2007 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 MoviePrivateQTKit_h
+#define MoviePrivateQTKit_h
+
+#if ENABLE(VIDEO)
+
+#include "Movie.h"
+#include "Timer.h"
+#include "wtf/RetainPtr.h"
+#include "wtf/Noncopyable.h"
+
+#ifdef __OBJC__
+#import "QTKit/QTTime.h"
+@class QTMovie;
+@class QTMovieView;
+@class WebCoreMovieObserver;
+#else
+class QTMovie;
+class QTMovieView;
+class QTTime;
+class WebCoreMovieObserver;
+#endif
+
+namespace WebCore {
+
+class GraphicsContext;
+class IntSize;
+class IntRect;
+class String;
+
+class MoviePrivate : Noncopyable
+{
+public:
+    MoviePrivate(Movie* m);
+    ~MoviePrivate();
+    
+    IntSize naturalSize();
+    bool hasVideo();
+    
+    void load(String url);
+    void cancelLoad();
+    
+    void play();
+    void pause();    
+    
+    bool paused() const;
+    bool seeking() const;
+    
+    float duration() const;
+    float currentTime() const;
+    void seek(float time);
+    void setEndTime(float time);
+    
+    void addCuePoint(float time);
+    void removeCuePoint(float time);
+    void clearCuePoints();
+    
+    void setRate(float);
+    void setVolume(float);
+    void setMuted(bool);
+    
+    int dataRate() const;
+    
+    Movie::NetworkState networkState();
+    Movie::ReadyState readyState();
+    
+    float maxTimeBuffered();
+    float maxTimeSeekable();
+    unsigned bytesLoaded();
+    bool totalBytesKnown();
+    unsigned totalBytes();
+    
+    void setVisible(bool);
+    void setRect(const IntRect& r);
+    
+    void loadStateChanged();
+    void rateChanged();
+    void sizeChanged();
+    void timeChanged();
+    void volumeChanged();
+    void didEnd();
+    
+    void paint(GraphicsContext* p, const IntRect& r);
+    
+    void createQTMovie(String url);
+    void createQTMovieView();
+    QTTime createQTTime(float time);
+    
+    static void getSupportedTypes(HashSet<String>& types);
+    
+private:
+    
+    void updateStates();
+    void cancelSeek();
+    void seekTimerFired(Timer<MoviePrivate>*);
+    void cuePointTimerFired(Timer<MoviePrivate>*);
+    float maxTimeLoaded();
+    void startCuePointTimerIfNeeded();
+    
+private:    
+    Movie* m_movie;
+    RetainPtr<QTMovie> m_qtMovie;
+    RetainPtr<QTMovieView> m_qtMovieView;
+    RetainPtr<WebCoreMovieObserver> m_objcObserver;
+    float m_seekTo;
+    float m_endTime;
+    Timer<MoviePrivate> m_seekTimer;
+    Timer<MoviePrivate> m_cuePointTimer;
+    float m_previousTimeCueTimerFired;
+    float m_rateBeforeSeek;
+    Movie::NetworkState m_networkState;
+    Movie::ReadyState m_readyState;
+    bool m_startedPlaying;
+    bool m_blockStateUpdate;
+    bool m_isStreaming;
+};
+
+}
+
+#endif
+#endif
diff --git a/WebCore/platform/graphics/mac/MoviePrivateQTKit.mm b/WebCore/platform/graphics/mac/MoviePrivateQTKit.mm
new file mode 100644 (file)
index 0000000..d8a79cb
--- /dev/null
@@ -0,0 +1,616 @@
+/*
+ * Copyright (C) 2007 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. 
+ */
+
+#import "config.h"
+
+#if ENABLE(VIDEO)
+#import "MoviePrivateQTKit.h"
+
+#import "BlockExceptions.h"
+#import "DeprecatedString.h"
+#import "GraphicsContext.h"
+#import "IntRect.h"
+#import "KURL.h"
+#import <limits>
+#import "MimeTypeRegistry.h"
+#import "Movie.h"
+#import <QTKit/QTKit.h>
+#import "ScrollView.h"
+#import "WebCoreSystemInterface.h"
+#import "Widget.h"
+#import "wtf/RetainPtr.h"
+
+@interface WebCoreMovieObserver : NSObject
+{
+    WebCore::MoviePrivate* callback;
+}
+-(void)setCallback:(WebCore::MoviePrivate *)c;
+-(void)loadStateChanged:(NSNotification *)notification;
+-(void)rateChanged:(NSNotification *)notification;
+-(void)sizeChanged:(NSNotification *)notification;
+-(void)timeChanged:(NSNotification *)notification;
+-(void)volumeChanged:(NSNotification *)notification;
+-(void)didEnd:(NSNotification *)notification;
+@end
+
+namespace WebCore {
+    
+MoviePrivate::MoviePrivate(Movie* movie)
+    : m_movie(movie)
+    , m_qtMovie(nil)
+    , m_qtMovieView(nil)
+    , m_seekTo(-1)
+    , m_endTime(std::numeric_limits<float>::infinity())
+    , m_seekTimer(this, &MoviePrivate::seekTimerFired)
+    , m_cuePointTimer(this, &MoviePrivate::cuePointTimerFired)
+    , m_previousTimeCueTimerFired(0)
+    , m_rateBeforeSeek(0)
+    , m_networkState(Movie::Empty)
+    , m_readyState(Movie::DataUnavailable)
+    , m_startedPlaying(false)
+    , m_blockStateUpdate(false)
+    , m_isStreaming(false)
+{
+    m_objcObserver = [[[WebCoreMovieObserver alloc] init] autorelease];
+    [m_objcObserver.get() setCallback: this];
+}
+
+
+MoviePrivate::~MoviePrivate()
+{
+    if (m_qtMovieView)
+        [m_qtMovieView.get() removeFromSuperview];
+    [[NSNotificationCenter defaultCenter] removeObserver:m_objcObserver.get()];
+}
+
+void MoviePrivate::createQTMovie(String url)
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:m_objcObserver.get()];
+    
+    m_qtMovie = nil;
+    
+    NSError* error = nil;
+    m_qtMovie = [[[QTMovie alloc] initWithURL:KURL(url.deprecatedString()).getNSURL() error:&error] autorelease];
+    
+    // FIXME: find a proper way to do this
+    m_isStreaming = url.startsWith("rtsp:");
+    
+    if (!m_qtMovie)
+        return;
+    
+    [m_qtMovie.get() setVolume: m_movie->volume()];
+    [m_qtMovie.get() setMuted: m_movie->muted()];
+    
+    [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
+                                             selector:@selector(loadStateChanged:) 
+                                                 name:QTMovieLoadStateDidChangeNotification 
+                                               object:m_qtMovie.get()];
+    [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
+                                             selector:@selector(rateChanged:) 
+                                                 name:QTMovieRateDidChangeNotification 
+                                               object:m_qtMovie.get()];
+    [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
+                                             selector:@selector(sizeChanged:) 
+                                                 name:QTMovieSizeDidChangeNotification 
+                                               object:m_qtMovie.get()];
+    [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
+                                             selector:@selector(timeChanged:) 
+                                                 name:QTMovieTimeDidChangeNotification 
+                                               object:m_qtMovie.get()];
+    [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
+                                             selector:@selector(volumeChanged:) 
+                                                 name:QTMovieVolumeDidChangeNotification 
+                                               object:m_qtMovie.get()];
+    [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()
+                                             selector:@selector(didEnd:) 
+                                                 name:QTMovieDidEndNotification 
+                                               object:m_qtMovie.get()];
+}
+
+void MoviePrivate::createQTMovieView()
+{
+    if (m_qtMovieView) {
+        [m_qtMovieView.get() removeFromSuperview];
+        m_qtMovieView = nil;
+    }
+    if (!m_movie->m_parentWidget || !m_qtMovie)
+        return;
+    m_qtMovieView = [[[QTMovieView alloc] initWithFrame:m_movie->rect()] autorelease];
+    NSView* parentView = static_cast<ScrollView*>(m_movie->m_parentWidget)->getDocumentView();
+    [parentView addSubview:m_qtMovieView.get()];
+    [m_qtMovieView.get() setMovie:m_qtMovie.get()];
+    [m_qtMovieView.get() setControllerVisible:NO];
+    [m_qtMovieView.get() setPreservesAspectRatio:YES];
+}
+
+QTTime MoviePrivate::createQTTime(float time)
+{
+    if (!m_qtMovie)
+        return QTMakeTime(0, 600);
+    int timeScale = [[m_qtMovie.get() attributeForKey:QTMovieTimeScaleAttribute] intValue];
+    return QTMakeTime((long long)(time * timeScale), timeScale);
+}
+
+void MoviePrivate::load(String url)
+{
+    if (m_networkState != Movie::Loading) {
+        m_networkState = Movie::Loading;
+        m_movie->networkStateChanged();
+    }
+    if (m_readyState != Movie::DataUnavailable) {
+        m_readyState = Movie::DataUnavailable;
+        m_movie->readyStateChanged();
+    }
+    cancelSeek();
+    m_cuePointTimer.stop();
+    createQTMovie(url);
+    if (m_movie->visible())
+        createQTMovieView();
+    
+    updateStates();
+}
+
+void MoviePrivate::play()
+{
+    cancelSeek();
+    if (!m_qtMovie)
+        return;
+    m_startedPlaying = true;
+    [m_qtMovie.get() setRate: m_movie->rate()];
+    startCuePointTimerIfNeeded();
+}
+
+void MoviePrivate::pause()
+{
+    cancelSeek();
+    if (!m_qtMovie)
+        return;
+    m_startedPlaying = false;
+    [m_qtMovie.get() stop];
+    m_cuePointTimer.stop();
+}
+
+float MoviePrivate::duration() const
+{
+    if (!m_qtMovie)
+        return 0;
+    QTTime time = [m_qtMovie.get() duration];
+    if (time.flags == kQTTimeIsIndefinite)
+        return std::numeric_limits<float>::infinity();
+    return (float)time.timeValue / time.timeScale;
+}
+
+float MoviePrivate::currentTime() const
+{
+    if (!m_qtMovie)
+        return 0;
+    if (seeking())
+        return m_seekTo;
+    QTTime time = [m_qtMovie.get() currentTime];
+    float current = (float)time.timeValue / time.timeScale;    
+    current = std::min(current, m_endTime);
+    return current;
+}
+
+void MoviePrivate::seek(float time)
+{
+    cancelSeek();
+    
+    if (!m_qtMovie)
+        return;
+    
+    if (time > duration())
+        time = duration();
+    
+    if (maxTimeLoaded() < time) {
+        m_seekTo = time;
+        m_seekTimer.startRepeating(0.5f);
+        m_rateBeforeSeek = [m_qtMovie.get() rate];
+        [m_qtMovie.get() setRate:0.0f];
+        updateStates();
+    } else {
+        QTTime qttime = createQTTime(time);
+        // setCurrentTime generates several event callbacks, update afterwards
+        m_blockStateUpdate = true;
+        [m_qtMovie.get() setCurrentTime: qttime];
+        m_blockStateUpdate = false;
+        updateStates();
+    }
+}
+
+void MoviePrivate::setEndTime(float time)
+{
+    m_endTime = time;
+    startCuePointTimerIfNeeded();
+}
+
+void MoviePrivate::addCuePoint(float time)
+{
+    // FIXME: simulate with timer for now
+    startCuePointTimerIfNeeded();
+}
+
+void MoviePrivate::removeCuePoint(float time)
+{
+}
+
+void MoviePrivate::clearCuePoints()
+{
+}
+
+void MoviePrivate::startCuePointTimerIfNeeded()
+{
+    
+    if ((m_endTime < duration() || !m_movie->m_cuePoints.isEmpty())
+        && m_startedPlaying && !m_cuePointTimer.isActive()) {
+        m_previousTimeCueTimerFired = currentTime();
+        m_cuePointTimer.startRepeating(0.020f);
+    }
+}
+
+void MoviePrivate::cancelSeek()
+{
+    if (m_seekTo > -1) {
+        m_seekTo = -1;
+        if (m_qtMovie)
+            [m_qtMovie.get() setRate:m_rateBeforeSeek];
+    }
+    m_rateBeforeSeek = 0.0f;
+    m_seekTimer.stop();
+}
+
+void MoviePrivate::seekTimerFired(Timer<MoviePrivate>*)
+{        
+    if (!m_qtMovie) {
+        cancelSeek();
+        return;
+    }
+    if (!seeking()) {
+        updateStates();
+        return;
+    }
+    
+    if (maxTimeLoaded() > m_seekTo) {
+        QTTime qttime = createQTTime(m_seekTo);
+        // setCurrentTime generates several event callbacks, update afterwards
+        m_blockStateUpdate = true;
+        [m_qtMovie.get() setCurrentTime: qttime];
+        m_blockStateUpdate = false;
+        cancelSeek();
+        updateStates();
+    }
+
+    Movie::NetworkState state = networkState();
+    if (state == Movie::Empty || state == Movie::Loaded) {
+        cancelSeek();
+        updateStates();
+    }
+}
+
+void MoviePrivate::cuePointTimerFired(Timer<MoviePrivate>*)
+{
+    float time = currentTime();
+    float previousTime = m_previousTimeCueTimerFired;
+    m_previousTimeCueTimerFired = time;
+    
+    // just do end for now
+    if (time >= m_endTime) {
+        pause();
+        didEnd();
+    }
+    HashSet<float>::const_iterator end = m_movie->m_cuePoints.end();
+    for (HashSet<float>::const_iterator it = m_movie->m_cuePoints.begin(); it != end; ++it) {
+        float cueTime = *it;
+        if (previousTime < cueTime && cueTime <= time)
+            m_movie->cuePointReached(cueTime);
+    }
+}
+
+bool MoviePrivate::paused() const
+{
+    if (!m_qtMovie)
+        return true;
+    return [m_qtMovie.get() rate] == 0.0f && (!seeking() || m_rateBeforeSeek == 0.0f);
+}
+
+bool MoviePrivate::seeking() const
+{
+    if (!m_qtMovie)
+        return false;
+    return m_seekTo >= 0;
+}
+
+IntSize MoviePrivate::naturalSize()
+{
+    if (!m_qtMovie)
+        return IntSize();
+    NSSize val = [[m_qtMovie.get() attributeForKey:QTMovieNaturalSizeAttribute] sizeValue];
+    return IntSize(val);
+}
+
+bool MoviePrivate::hasVideo()
+{
+    if (!m_qtMovie)
+        return false;
+    BOOL val = [[m_qtMovie.get() attributeForKey: QTMovieHasVideoAttribute] boolValue];
+    return val;
+}
+
+void MoviePrivate::setVolume(float volume)
+{
+    if (!m_qtMovie)
+        return;
+    [m_qtMovie.get() setVolume:volume];  
+}
+
+void MoviePrivate::setMuted(bool b)
+{
+    if (!m_qtMovie)
+        return;
+    [m_qtMovie.get() setMuted:b];
+}
+
+void MoviePrivate::setRate(float rate)
+{
+    if (!m_qtMovie)
+        return;
+    if (!paused())
+        [m_qtMovie.get() setRate:rate];
+}
+
+int MoviePrivate::dataRate() const
+{
+    if (!m_qtMovie)
+        return 0;
+    return wkQTMovieDataRate(m_qtMovie.get()); 
+}
+
+
+Movie::NetworkState MoviePrivate::networkState()
+{
+    return m_networkState;
+}
+
+Movie::ReadyState MoviePrivate::readyState()
+{
+    return m_readyState;
+}
+
+float MoviePrivate::maxTimeBuffered()
+{
+    // rtsp streams are not buffered
+    return m_isStreaming ? 0 : maxTimeLoaded();
+}
+
+float MoviePrivate::maxTimeSeekable()
+{
+    // infinite duration means live stream
+    return isinf(duration()) ? 0 : maxTimeLoaded();
+}
+
+float MoviePrivate::maxTimeLoaded()
+{
+    if (!m_qtMovie)
+        return 0;
+    return wkQTMovieMaxTimeLoaded(m_qtMovie.get()); 
+}
+
+unsigned MoviePrivate::bytesLoaded()
+{
+    if (!m_qtMovie)
+        return 0;
+    float dur = duration();
+    float maxTime = maxTimeLoaded();
+    if (!dur)
+        return 0;
+    return totalBytes() * maxTime / dur;
+}
+
+bool MoviePrivate::totalBytesKnown()
+{
+    return totalBytes() > 0;
+}
+
+unsigned MoviePrivate::totalBytes()
+{
+    if (!m_qtMovie)
+        return 0;
+    return [[m_qtMovie.get() attributeForKey: QTMovieDataSizeAttribute] intValue];
+}
+
+void MoviePrivate::cancelLoad()
+{
+    // FIXME better way to do this?
+    if (m_networkState < Movie::Loading || m_networkState == Movie::Loaded)
+        return;
+    
+    if (m_qtMovieView) {
+        [m_qtMovieView.get() removeFromSuperview];
+        m_qtMovieView = nil;
+    }
+    m_qtMovie = nil;
+    
+    updateStates();
+}
+
+void MoviePrivate::updateStates()
+{
+    if (m_blockStateUpdate)
+        return;
+    
+    Movie::NetworkState oldNetworkState = m_networkState;
+    Movie::ReadyState oldReadyState = m_readyState;
+    
+    long loadState = m_qtMovie ? [[m_qtMovie.get() attributeForKey:QTMovieLoadStateAttribute] longValue] : -1;
+    // "Loaded" is reserved for fully buffered movies, never the case when rtsp streaming
+    if (loadState >= 100000 && !m_isStreaming) {
+        // 100000 is kMovieLoadStateComplete
+        if (m_networkState < Movie::Loaded)
+            m_networkState = Movie::Loaded;
+            m_readyState = Movie::CanPlayThrough;
+    } else if (loadState >= 20000) {
+        // 20000 is kMovieLoadStatePlaythroughOK
+        if (m_networkState < Movie::LoadedFirstFrame && !seeking())
+            m_networkState = Movie::LoadedFirstFrame;
+        m_readyState = ([m_qtMovie.get() rate] == 0.0f && m_startedPlaying) ? Movie::DataUnavailable : Movie::CanPlayThrough;
+    } else if (loadState >= 10000) {
+        // 10000 is kMovieLoadStatePlayable
+        if (m_networkState < Movie::LoadedFirstFrame && !seeking())
+            m_networkState = Movie::LoadedFirstFrame;
+        m_readyState = ([m_qtMovie.get() rate] == 0.0f && m_startedPlaying) ? Movie::DataUnavailable : Movie::CanPlay;
+    } else if (loadState >= 2000) {
+        // 10000 is kMovieLoadStateLoaded
+        if (m_networkState < Movie::LoadedMetaData)
+            m_networkState = Movie::LoadedMetaData;
+        m_readyState = Movie::DataUnavailable;
+    } else if (loadState >= 0) {
+        if (m_networkState < Movie::Loading)
+            m_networkState = Movie::Loading;
+        m_readyState = Movie::DataUnavailable;        
+    } else {
+        m_networkState = Movie::LoadFailed;
+        m_readyState = Movie::DataUnavailable; 
+    }
+    
+    if (seeking())
+        m_readyState = Movie::DataUnavailable;
+    
+    if (m_networkState != oldNetworkState)
+        m_movie->networkStateChanged();
+    if (m_readyState != oldReadyState)
+        m_movie->readyStateChanged();
+}
+
+void MoviePrivate::loadStateChanged()
+{
+    updateStates();
+}
+
+void MoviePrivate::rateChanged()
+{
+    updateStates();
+}
+
+void MoviePrivate::sizeChanged()
+{
+}
+
+void MoviePrivate::timeChanged()
+{
+    m_previousTimeCueTimerFired = -1;
+    updateStates();
+}
+
+void MoviePrivate::volumeChanged()
+{
+    m_movie->volumeChanged();
+}
+
+void MoviePrivate::didEnd()
+{
+    m_cuePointTimer.stop();
+    m_startedPlaying = false;
+    m_movie->didEnd();
+}
+
+void MoviePrivate::setRect(const IntRect& r) 
+{ 
+    if (m_qtMovieView)
+        [m_qtMovieView.get() setFrame: r];
+}
+
+void MoviePrivate::setVisible(bool b)
+{
+    if (b)
+        createQTMovieView();
+    else if (m_qtMovieView) {
+        [m_qtMovieView.get() removeFromSuperview];
+        m_qtMovieView = nil;
+    }
+}
+
+void MoviePrivate::paint(GraphicsContext* p, const IntRect& r)
+{
+    if (p->paintingDisabled())
+        return;
+    NSView *view = m_qtMovieView.get();
+    if (view == nil)
+        return;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]]];
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+void MoviePrivate::getSupportedTypes(HashSet<String>& types)
+{
+    NSArray* fileTypes = [QTMovie movieFileTypes:(QTMovieFileTypeOptions)0];
+    int count = [fileTypes count];
+    for (int n = 0; n < count; n++) {
+        NSString* ext = (NSString*)[fileTypes objectAtIndex:n];
+        CFStringRef uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)ext, NULL);
+        if (!uti)
+            continue;
+        NSString* mime = (NSString*)UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType);
+        if (!mime)
+            continue;
+        types.add(String(mime));
+    }
+} 
+
+}
+
+@implementation WebCoreMovieObserver
+-(void)loadStateChanged:(NSNotification *)notification
+{
+    callback->loadStateChanged();
+}
+-(void)rateChanged:(NSNotification *)notification
+{
+    callback->rateChanged();
+}
+-(void)sizeChanged:(NSNotification *)notification
+{
+    callback->sizeChanged();
+}
+-(void)timeChanged:(NSNotification *)notification
+{
+    callback->timeChanged();
+}
+-(void)volumeChanged:(NSNotification *)notification
+{
+    callback->volumeChanged();
+}
+-(void)didEnd:(NSNotification *)notification
+{
+    callback->didEnd();
+}
+-(void)setCallback:(WebCore::MoviePrivate *)c
+{
+    callback = c;
+}
+@end
+
+#endif
+
index 2e7c55a..a22b40c 100644 (file)
@@ -44,6 +44,7 @@ typedef struct _NSRect NSRect;
 @class NSFont;
 @class NSMutableURLRequest;
 @class NSURLRequest;
+@class QTMovie;
 #else
 typedef struct NSArray NSArray;
 typedef struct NSDate NSDate;
@@ -59,6 +60,7 @@ typedef struct NSURLConnection NSURLConnection;
 typedef struct NSURLResponse NSURLResponse;
 typedef struct NSView NSView;
 typedef struct objc_object *id;
+typedef struct QTMovie QTMovie;
 #endif
 
 #ifdef __cplusplus
@@ -108,6 +110,8 @@ extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOO
 extern OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
 extern NSString* (*wkPathFromFont)(NSFont*);
 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
+extern int (*wkQTMovieDataRate)(QTMovie*);
+extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
 extern void (*wkReleaseStyleGroup)(void* group);
 extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
index 2d9f811..ab99afb 100644 (file)
@@ -57,6 +57,8 @@ void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* cont
 OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
 NSString* (*wkPathFromFont)(NSFont*);
 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
+int (*wkQTMovieDataRate)(QTMovie*);
+float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
 void (*wkReleaseStyleGroup)(void* group);
 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
 void (*wkSetDragImage)(NSImage*, NSPoint offset);
index 6ea7dbf..f90d3b4 100644 (file)
@@ -2172,7 +2172,7 @@ void RenderLayer::collectLayers(Vector<RenderLayer*>*& posBuffer, Vector<RenderL
     updateVisibilityStatus();
         
     // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists.
-    if (m_hasVisibleContent && !isOverflowOnly()) {
+    if ((m_hasVisibleContent || (m_hasVisibleDescendant && isStackingContext())) && !isOverflowOnly()) {
         // Determine which buffer the child should be in.
         Vector<RenderLayer*>*& buffer = (zIndex() >= 0) ? posBuffer : negBuffer;
 
diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp
new file mode 100644 (file)
index 0000000..535aefb
--- /dev/null
@@ -0,0 +1,268 @@
+/*
+ * Copyright (C) 2007 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)
+#include "RenderVideo.h"
+
+#include "Document.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "HTMLMediaElement.h"
+#include "HTMLNames.h"
+#include "Movie.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+RenderVideo::RenderVideo(HTMLMediaElement* video)
+    : RenderReplaced(video)
+{
+    setIntrinsicSize(IntSize(0, 0));
+}
+
+RenderVideo::~RenderVideo()
+{
+    if (Movie* m = movie()) {
+        m->setVisible(false);
+        m->setParentWidget(0);
+    }
+}
+
+Movie* RenderVideo::movie() const
+{
+    return static_cast<HTMLMediaElement*>(element())->movie();
+}
+
+void RenderVideo::videoSizeChanged()
+{
+    if (!movie())
+        return;
+    IntSize size = movie()->naturalSize();
+    if (size != intrinsicSize()) {
+        setIntrinsicSize(size);
+        
+        int oldWidth = width();
+        int oldHeight = height();
+        
+        calcWidth();
+        calcHeight();
+        
+        if (oldWidth != m_width || oldHeight != m_height) {
+            setPrefWidthsDirty(true);
+            setNeedsLayout(true);
+        }
+    }
+}
+
+void RenderVideo::paint(PaintInfo& paintInfo, int tx, int ty)
+{
+    if (!shouldPaint(paintInfo, tx, ty))
+        return;
+
+    tx += m_x;
+    ty += m_y;
+        
+    if (hasBoxDecorations() && paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline) 
+        paintBoxDecorations(paintInfo, tx, ty);
+
+    GraphicsContext* context = paintInfo.context;
+
+    if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
+        paintOutline(context, tx, ty, width(), height(), style());
+
+    if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
+        return;
+
+    if (!shouldPaintWithinRoot(paintInfo))
+        return;
+        
+    bool isPrinting = document()->printing();
+    if (isPrinting)
+        return;
+    
+    if (!movie())
+        return;
+           
+    updateMovie();
+        
+    int cWidth = contentWidth();
+    int cHeight = contentHeight();
+    int leftBorder = borderLeft();
+    int topBorder = borderTop();
+    int leftPad = paddingLeft();
+    int topPad = paddingTop();
+
+    IntRect rect(IntPoint(tx + leftBorder + leftPad, ty + topBorder + topPad), IntSize(cWidth, cHeight));
+
+    movie()->paint(context, rect);
+}
+
+void RenderVideo::layout()
+{
+    ASSERT(needsLayout());
+
+    IntRect oldBounds;
+    IntRect oldOutlineBox;
+    bool checkForRepaint = checkForRepaintDuringLayout();
+    if (checkForRepaint) {
+        oldBounds = absoluteClippedOverflowRect();
+        oldOutlineBox = absoluteOutlineBox();
+    }
+
+    calcWidth();
+    calcHeight();
+    
+    updateMovie();
+        
+    if (checkForRepaint)
+        repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);
+    
+    setNeedsLayout(false);
+}
+
+void RenderVideo::updateFromElement()
+{
+    updateMovie();
+}
+
+void RenderVideo::updateMovie()
+{
+    int x;
+    int y;
+    absolutePosition(x, y);
+    x += borderLeft() + paddingLeft();
+    y += borderTop() + paddingTop();
+    
+    int width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
+    int height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
+    
+    IntRect newBounds(x, y, width, height);
+    
+    if (Movie* m = movie()) {
+        m->setParentWidget(document()->view());
+        m->setRect(newBounds);    
+    }    
+}
+
+bool RenderVideo::isWidthSpecified() const
+{
+    switch (style()->width().type()) {
+        case Fixed:
+        case Percent:
+            return true;
+        default:
+            return false;
+    }
+    ASSERT(false);
+    return false;
+}
+
+bool RenderVideo::isHeightSpecified() const
+{
+    switch (style()->height().type()) {
+        case Fixed:
+        case Percent:
+            return true;
+        default:
+            return false;
+    }
+    ASSERT(false);
+    return false;
+}
+
+int RenderVideo::calcReplacedWidth() const
+{
+    int width;
+    if (isWidthSpecified())
+        width = calcReplacedWidthUsing(style()->width());
+    else
+        width = calcAspectRatioWidth();
+
+    int minW = calcReplacedWidthUsing(style()->minWidth());
+    int maxW = style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
+
+    return max(minW, min(width, maxW));
+}
+
+int RenderVideo::calcReplacedHeight() const
+{
+    int height;
+    if (isHeightSpecified())
+        height = calcReplacedHeightUsing(style()->height());
+    else
+        height = calcAspectRatioHeight();
+
+    int minH = calcReplacedHeightUsing(style()->minHeight());
+    int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
+
+    return max(minH, min(height, maxH));
+}
+
+int RenderVideo::calcAspectRatioWidth() const
+{
+    int intrinsicWidth = intrinsicSize().width();
+    int intrinsicHeight = intrinsicSize().height();
+    if (!intrinsicHeight)
+        return 0;
+    //if (!m_cachedImage || m_cachedImage->errorOccurred())
+   //     return intrinsicWidth(); // Don't bother scaling.
+    return RenderReplaced::calcReplacedHeight() * intrinsicWidth / intrinsicHeight;
+}
+
+int RenderVideo::calcAspectRatioHeight() const
+{
+    int intrinsicWidth = intrinsicSize().width();
+    int intrinsicHeight = intrinsicSize().height();
+    if (!intrinsicWidth)
+        return 0;
+    //if (!m_cachedImage || m_cachedImage->errorOccurred())
+    //    return intrinsicHeight(); // Don't bother scaling.
+    return RenderReplaced::calcReplacedWidth() * intrinsicHeight / intrinsicWidth;
+}
+
+void RenderVideo::calcPrefWidths()
+{
+    ASSERT(prefWidthsDirty());
+
+    m_maxPrefWidth = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
+
+    if (style()->width().isPercent() || style()->height().isPercent() || 
+        style()->maxWidth().isPercent() || style()->maxHeight().isPercent() ||
+        style()->minWidth().isPercent() || style()->minHeight().isPercent())
+        m_minPrefWidth = 0;
+    else
+        m_minPrefWidth = m_maxPrefWidth;
+
+    setPrefWidthsDirty(false);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/rendering/RenderVideo.h b/WebCore/rendering/RenderVideo.h
new file mode 100644 (file)
index 0000000..df05742
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2007 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 RenderVideo_h
+#define RenderVideo_h
+
+#if ENABLE(VIDEO)
+
+#include "RenderReplaced.h"
+
+namespace WebCore {
+    
+class HTMLMediaElement;
+class Movie;
+
+class RenderVideo : public RenderReplaced {
+public:
+    RenderVideo(HTMLMediaElement*);
+    virtual ~RenderVideo();
+
+    virtual const char* renderName() const { return "RenderVideo"; }
+    
+    virtual void paint(PaintInfo&, int tx, int ty);
+
+    virtual void layout();
+
+    virtual int calcReplacedWidth() const;
+    virtual int calcReplacedHeight() const;
+
+    virtual void calcPrefWidths();
+    
+    void videoSizeChanged();
+    
+    Movie* movie() const;
+    
+    void updateFromElement();
+    void updateMovie();
+
+private:
+    int calcAspectRatioWidth() const;
+    int calcAspectRatioHeight() const;
+
+    bool isWidthSpecified() const;
+    bool isHeightSpecified() const;
+};
+
+} // namespace WebCore
+
+#endif
+#endif // RenderVideo_h