diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2011-06-03 20:53:43 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2011-06-03 20:53:43 (GMT) |
commit | e62f24018fee11831cbf66e9608d0ab82917c8ee (patch) | |
tree | 0f511f62be65e2f9c9f2aa3bebaefa7a4835be63 /src/3rdparty/webkit | |
parent | b1c3521316566b54184d097e9ee020350426850f (diff) | |
download | Qt-e62f24018fee11831cbf66e9608d0ab82917c8ee.zip Qt-e62f24018fee11831cbf66e9608d0ab82917c8ee.tar.gz Qt-e62f24018fee11831cbf66e9608d0ab82917c8ee.tar.bz2 |
Updated WebKit to 4e7dfbab30278b0427e699baaadbf3e5aab88203
Reviewed-by: Andreas Kling
Diffstat (limited to 'src/3rdparty/webkit')
65 files changed, 1772 insertions, 367 deletions
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index baa5bf2..71b9b1b 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -dbda3e9596b836ab6eb88c500766dba6745759be +4e7dfbab30278b0427e699baaadbf3e5aab88203 diff --git a/src/3rdparty/webkit/Source/WebCore/ChangeLog b/src/3rdparty/webkit/Source/WebCore/ChangeLog index af420e0..419d10e 100644 --- a/src/3rdparty/webkit/Source/WebCore/ChangeLog +++ b/src/3rdparty/webkit/Source/WebCore/ChangeLog @@ -1,3 +1,620 @@ +2011-06-03 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Andreas Kling. + + To support building namespaced Qt, we require that forward-declarations + of Qt classes be wrapped in QT_BEGIN_NAMESPACE and QT_END_NAMESPACE. + + * platform/network/qt/QtMIMETypeSniffer.h: + +2011-06-01 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt] Fix the Phonon build when logging is disabled + https://bugs.webkit.org/show_bug.cgi?id=61869 + + No new tests needed. + + * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp: Add missing guards. + (WebCore::MediaPlayerPrivatePhonon::networkState): + (WebCore::MediaPlayerPrivatePhonon::readyState): + (WebCore::MediaPlayerPrivatePhonon::updateStates): + (WebCore::MediaPlayerPrivatePhonon::stateChanged): + +2011-05-31 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dimitri Glazkov. + + Improve hasMediaControls logic to check that node has + media controls. This can be false when cloning nodes. + https://bugs.webkit.org/show_bug.cgi?id=61765 + + Test: media/media-controls-clone-crash.html + + * dom/Node.h: + (WebCore::Node::isMediaControls): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::mediaControls): + (WebCore::HTMLMediaElement::hasMediaControls): + * html/shadow/MediaControls.h: + (WebCore::MediaControls::isMediaControls): + (WebCore::toMediaControls): + +2011-05-30 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Alexey Proskuryakov. + + Audio and video files saved to the Application Cache should preserve the original file extension + https://bugs.webkit.org/show_bug.cgi?id=61750 + <rdar://9524922> + + No new tests, it isn't possible to check the name of the file in the cache from within + DRT. Changes verified manually. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::store): Append the original file extension to the cache + file name. + (WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory): Add extension parameter. + * loader/appcache/ApplicationCacheStorage.h: + +2011-05-30 Jer Noble <jer.noble@apple.com> + + Reviewed by Darin Adler and Simon Fraser. + + REGRESSION (r87622): Scrubbing a Vimeo movie when in fullscreen stops playback; no way to make it start again + https://bugs.webkit.org/show_bug.cgi?id=61717 + rdar://problem/9522272 + + May be some good way to test this later. No immediate idea about the best way. + + When a media element is taken into full-screen mode, stop events from propagating + outside the media element's shadow DOM, EventDispatcher::determineDispatchBehavior() + has been changed to take a shadow root node. In our full screen media element check, + we check to see if the passed shadow root is the shadow root of the full screen media + element, and if so, specify events should StayInsideShadowDOM. The end result is that + inside EventDispatcher::ensureEventAncestors, an ancestor chain is built up all the + way from the SliderThumb to the video element's shadow root, but no further. + + * dom/EventDispatcher.cpp: + (WebCore::EventDispatcher::determineDispatchBehavior): Restrict events to the + shadow DOM when showing a full screen video. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): Removed code to manage full screen controls. + The events telling us about activity in the shadow DOM no longer bubble out so we need to + handle this inside the shadow DOM on the root element. + (WebCore::HTMLMediaElement::play): Ditto. + (WebCore::HTMLMediaElement::playbackProgressTimerFired): Ditto. + (WebCore::HTMLMediaElement::defaultEventHandler): Ditto. + (WebCore::HTMLMediaElement::enterFullscreen): Ditto. + (WebCore::HTMLMediaElement::exitFullscreen): Ditto. + * html/HTMLMediaElement.h: Added isPlaying function, removed things moved to the root element. + + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler): Rolled out + changes that tried to make special rules for events using preDispatchEventHandler and such. + This rolls out both r87622 and r87655. + (WebCore::MediaControlMuteButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlPanelMuteButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlPlayButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlSeekButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlRewindButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlReturnToRealtimeButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlTimelineElement::defaultEventHandler): Ditto. + (WebCore::MediaControlVolumeSliderElement::defaultEventHandler): Ditto. + (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlFullscreenVolumeMinButtonElement::defaultEventHandler): Ditto. + (WebCore::MediaControlFullscreenVolumeMaxButtonElement::defaultEventHandler): Ditto. + * html/shadow/MediaControlElements.h: Ditto. + + * html/shadow/MediaControlRootElement.cpp: + (WebCore::MediaControlRootElement::MediaControlRootElement): Initialize new data members. + (WebCore::MediaControlRootElement::playbackStarted): Start the timer so we will consider + hiding the controls later. + (WebCore::MediaControlRootElement::playbackProgressed): Hide the controls if the mouse + is no longer over the controls. + (WebCore::MediaControlRootElement::playbackStopped): Stop the timer since we only hide + automatically if we're playing. + (WebCore::MediaControlRootElement::enteredFullscreen): Start the timer. + (WebCore::MediaControlRootElement::exitedFullscreen): Stop the timer since we only care + if we are full screen. + (WebCore::MediaControlRootElement::containsRelatedTarget): Added. Helper for next function. + (WebCore::MediaControlRootElement::defaultEventHandler): Do the hide/show and timer functions + as the mouse is moved in and out. + (WebCore::MediaControlRootElement::startHideFullscreenControlsTimer): Start the timer if + needed. + (WebCore::MediaControlRootElement::hideFullscreenControlsTimerFired): Hide if the conditions + are met. + (WebCore::MediaControlRootElement::stopHideFullscreenControlsTimer): Stop the timer. + + * html/shadow/MediaControlRootElement.h: Added new functions and data members. + + +2011-05-29 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Darin Adler. + + Controls never hide in full screen after user stops moving mouse + https://bugs.webkit.org/show_bug.cgi?id=61715 + <rdar://problem/9522182> + + When we get a mouse move event in HTMLMediaElement::defaultEventHandler, and we are in full screen, + show the media controls, and then start a timer. + + The timer fires 3 seconds after the user's last mouse movement (timer is restarted on every mouse + move), and hides the controls. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize our new timer. + (WebCore::HTMLMediaElement::play): If we are in full screen mode, start our timer to hide the full screen + controls. We don't want the user to have to move the mouse to hide them when they use the spacebar + to play. + (WebCore::HTMLMediaElement::startHideFullscreenControlsTimer): Starts a oneshot timer 3 seconds in the future + if we are in full screen. + (WebCore::HTMLMediaElement::hideFullscreenControlsTimerFired): Make sure that we are currently playing, and + we are in full screen, and hide the controls. We don't want to hide the controls if we are paused. + (WebCore::HTMLMediaElement::stopHideFullscreenControlsTimer): Stops the timer. + (WebCore::HTMLMediaElement::defaultEventHandler): If we get a mouse move event and are in full screen, show the + controls and start a timer to hide them. + (WebCore::HTMLMediaElement::enterFullscreen): Start a timer to hide the full screen controls. The user shouldn't + have the move the mouse once they enter full screen to hide the controls. + (WebCore::HTMLMediaElement::exitFullscreen): Stop the timer to hide the full screen controls. + * html/HTMLMediaElement.h: + * html/shadow/MediaControls.h: Added pure virtual shouldHideControls() method. + * html/shadow/MediaControlRootElement.cpp: + (WebCore::MediaControlRootElement::playbackStopped): Stop the timer to hide the full screen controls. + (WebCore::MediaControlRootElement::shouldHideControls): Added, only report that + the caller should hide the controls if the panel is not hovered. + * html/shadow/MediaControlRootElement.h: + +2011-05-29 Darin Adler <darin@apple.com> + + Reviewed by Kevin Decker. + + REGRESSION (r87622): In media documents, clicking the full screen button and the play button pauses the video + https://bugs.webkit.org/show_bug.cgi?id=61713 + + We need to come up with a way to regression-test these changes. Nothing at the moment. + + The bug is that we removed calls to preventDefault, but we still do need to prevent + default handling of this event. + + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlElement::preDispatchEventHandler): Add back the preventDefault + that was in here before r87622 as well as the stopPropagation that was added in r87622. + (WebCore::MediaControlMuteButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlPlayButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlSeekButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlRewindButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlReturnToRealtimeButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlToggleClosedCaptionsButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlFullscreenButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlFullscreenVolumeMinButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlFullscreenVolumeMaxButtonElement::preDispatchEventHandler): Ditto. + +2011-05-28 Jer Noble <jer.noble@apple.com> + + Reviewed by Maciej Stachowiak. + + Mouse clicks propagate outside full-screen media controls. + https://bugs.webkit.org/show_bug.cgi?id=61689 + + Mouse click events are propagating out of the media controls, so mouse click + listeners registered on the video element are getting fired when the user + clicks on media controller buttons. By default, block propagation of click + events from MediaControlElements by overriding preDispatchEventHandler, and + convert all instances of defaultEventHandler -> preDispatchEventHandler. Change + all calls of event->setDefaultHandled() to event->stopPropagation(). + + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlElement::preDispatchEventHandler): Added. Block + propagation of all mouse click events. + (WebCore::MediaControlVolumeSliderContainerElement::preDispatchEventHandler): + Renamed from setDefaultHandled. + (WebCore::MediaControlMuteButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlPanelMuteButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlPlayButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlSeekButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlRewindButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlReturnToRealtimeButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlToggleClosedCaptionsButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlTimelineElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlVolumeSliderElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlFullscreenButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlFullscreenVolumeMinButtonElement::preDispatchEventHandler): Ditto. + (WebCore::MediaControlFullscreenVolumeMaxButtonElement::preDispatchEventHandler): Ditto. + * html/shadow/MediaControlElements.h: + +2011-05-26 Alexis Menard <alexis.menard@openbossa.org> + + Unreviewed build fix for Qt and QuickTime backend. + + r87328 added a new system interface, we need to add it too. + + * platform/qt/WebCoreSystemInterface.h: + * platform/qt/WebCoreSystemInterface.mm: + +2011-05-24 Jer Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + Video fails to play on Vimeo + https://bugs.webkit.org/show_bug.cgi?id=61403 + + No new tests; Covered by media/video-canvas-source.html. + + Vimeo redirects their assets from player.vimeo.com to av.vimeo.com, which is rejected + by AVFoundation and QTKit due to our setting a ForbidCrossSiteReference option when + creating an AVAsset or QTMovie. Instead, we should just reject local->remote and + remote->local and make our answer to hasSingleSecurityOrigin dynamic. + + When checking whether a given request has a single security origin, use a + SecurityOrigin to check the host, port, and scheme. + + * WebCore.exp.in: + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: + (WebCore::MediaPlayerPrivateAVFoundation::assetURL): Added. + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h: + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm: + (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Exchange ForbidCrossSiteReference + for ForbidRemoteReferenceToLocal and ForbidLocalReferenceToRemote + (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin): Check to see that the + requested and resolved URLs have the same host and port. + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::MediaPlayerPrivateQTKit::commonMovieAttributes): Exchange NoCrossSiteAttribute for + NoRemoteToLocalSiteAttribute and NoLocalToRemoteSiteAttribute. + (WebCore::MediaPlayerPrivateQTKit::hasSingleSecurityOrigin): Check to see that the + requested and resolved URLs have the same host and port. + * platform/mac/WebCoreSystemInterface.h: Added wkAVAssetResolvedURL. + * platform/mac/WebCoreSystemInterface.mm: Ditto. + +2011-05-15 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Maciej Stachowiak. + + Use new AVAssetReferenceRestrictions to prevent cross site media references + https://bugs.webkit.org/show_bug.cgi?id=60791 + <rdar://problem/9374202> + + Test: http/tests/media/video-cross-site.html + + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm: + (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Set restriction + to prevent cross-domain references from being followed. + +2011-05-10 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Darin Adler. + + Files that load quickly sometimes won't play. + https://bugs.webkit.org/show_bug.cgi?id=60556 + <rdar://problem/9330567> + + No new tests, this failure is very difficult to reproduce on some machines. The fix was + verified manually. + + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: + (WebCore::MediaPlayerPrivateAVFoundation::playabilityKnown): Move the call to updateStates + to dispatchNotification so it is more obvious which state changes call it. + (WebCore::MediaPlayerPrivateAVFoundation::setNaturalSize): Correct logging typo. + (WebCore::MediaPlayerPrivateAVFoundation::metadataLoaded): Move updateStates call to + dispatchNotification. + (WebCore::MediaPlayerPrivateAVFoundation::rateChanged): Ditto. + (WebCore::MediaPlayerPrivateAVFoundation::loadedTimeRangesChanged): Ditto. + (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): Call updateStates after + processing "size changed" notification so we detect all state changes. Consolidate + calls to updateStates here. + + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm: + (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Name the video layer in + a debug build. + +2011-05-05 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Adam Roben. + + Block callbacks delivered during destruction + https://bugs.webkit.org/show_bug.cgi?id=60291 + <rdar://problem/9382942> + + No new tests, tested by existing tests. + + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: + (WebCore::MediaPlayerPrivateAVFoundation::~MediaPlayerPrivateAVFoundation): Call + setIgnoreLoadStateChanges(true) to cancel all callbacks. + (WebCore::MediaPlayerPrivateAVFoundation::updateStates): Return immediately if + m_ignoreLoadStateChanges is true. + (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): loadStateChanged -> updateStates. + Don't call updateStates after calling loadedTimeRangesChanged, it already does it. + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: + +2011-05-25 Andrew Scherkus <scherkus@chromium.org> + + Reviewed by Eric Carlson. + + Fix media element regression where ended event stopped firing after changing the src attribute. + + https://bugs.webkit.org/show_bug.cgi?id=61336 + + Test: media/media-ended.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::prepareForLoad): + +2011-05-25 Jer Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + REGRESSION: Fullscreen button on embedded Vimeo videos does nothing + https://bugs.webkit.org/show_bug.cgi?id=61461 + + Tests: fullscreen/full-screen-iframe-legacy.html + + Allow calls from the legacy full-screen API to bypass the iframe + "webkitallowfullscreen" requirement by adding a parameter to + Document::webkitRequestFullScreenForElement specifying the strictness + of that check. Specify this new parameter everywhere that function is + called, including in the default controls' full-screen button handler. + + * dom/Document.cpp: + (WebCore::Document::webkitRequestFullScreenForElement): + * dom/Document.h: + * dom/Element.cpp: + (WebCore::Element::requestFullScreen): Renamed from webkitRequestFullScreen. + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::enterFullscreen): + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler): + +2011-05-25 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Eric Carlson. + + [Qt] Enable usage of QuickTime mediaplayer for the Qt port on Mac. + https://bugs.webkit.org/show_bug.cgi?id=61279 + + Enable the QuickTime backend for the Qt port on Mac. The patch adds the bits in WebCore + to enable the QTKit backend of the Mac port. It can be enabled by passing DEFINES+=USE_QTKIT=1 + when calling build-webkit. + + * WebCore.pri: + * WebCore.pro: + * features.pri: + * platform/KURL.h: + * platform/SharedBuffer.h: + * platform/cf/KURLCFNet.cpp: + * platform/cf/SharedBufferCF.cpp: + * platform/graphics/FloatSize.h: + * platform/graphics/IntRect.h: + * platform/graphics/IntSize.h: + * platform/graphics/MediaPlayer.cpp: + * platform/graphics/cg/FloatSizeCG.cpp: + * platform/graphics/cg/IntRectCG.cpp: + * platform/graphics/mac/MediaPlayerPrivateQTKit.h: + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::MediaPlayerPrivateQTKit::createQTMovieView): + (WebCore::MediaPlayerPrivateQTKit::createQTVideoRenderer): + (WebCore::MediaPlayerPrivateQTKit::createQTMovieLayer): + (WebCore::MediaPlayerPrivateQTKit::preferredRenderingMode): + (WebCore::MediaPlayerPrivateQTKit::paint): + (-[WebCoreMovieObserver layerHostChanged:]): + * platform/mac/KURLMac.mm: + * platform/mac/SharedBufferMac.mm: + (+[WebCoreSharedBufferData initialize]): + * platform/mac/WebCoreObjCExtras.mm: + * platform/qt/WebCoreSystemInterface.h: Added. + * platform/qt/WebCoreSystemInterface.mm: Added. + +2011-05-16 Jeremy Noble <jer.noble@apple.com> + + Unreviewed; build fix for non-SnowLeopard builds. + + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Wrap definition + of layerIsDescendentOf in a #if check. + +2011-05-13 Jer Noble <jer.noble@apple.com> + + Reviewed by Simon Fraser. + + Video is blank, controller is misplaced on trailers.apple.com movie in fullscreen (with two screens) + https://bugs.webkit.org/show_bug.cgi?id=60826 + + Listen for a WebKitLayerHostChanged notification and, if the affected layer is an + ancestor layer of the qtMovieLayer, tear down the layer and recreate it the + next time setVisible(true) is called. + + * dom/Document.cpp: + (WebCore::Document::webkitDidEnterFullScreenForElement): Call setFullScreenRootLayer(0) + before disabling animation on the full screen renderer. + * platform/graphics/mac/MediaPlayerPrivateQTKit.h: + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::MediaPlayerPrivateQTKit::createQTMovie): Register an observer for the new + WebKitLayerHostChanged notification. + (WebCore::layerIsDescendentOf): Added. + (WebCore::MediaPlayerPrivateQTKit::layerHostChanged): Added. If the changed + layer is an ancestor of the movie layer, tear down rendering and re- + create the next time setVisible(true) is called. + (-[WebCoreMovieObserver layerHostChanged:]): Added ObjC listener wrapper. + +2011-05-18 Jeremy Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + Poster is not shown in Safari for video element with no playable source elements. + https://bugs.webkit.org/show_bug.cgi?id=61109 + + Test: media/video-src-invalid-poster.html + + In the case where no video sources are playable, update the display state and + renderer, allowing the poster image to display. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::waitForSourceChange): + +2011-05-14 Jeremy Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + Exiting full screen causes <video> element inline controls to become visible + https://bugs.webkit.org/show_bug.cgi?id=60142 + + Create a queue of elements who must be targeted with webkitfullscreenchange events. Instead of dispatching + a single event with whatever the current value of m_fullScreenElement is (which may have been cleared, or + changed since the timer was asked to fire), dispatch one event for each entry in the queue. + + Test: fullscreen/video-controls-override.html + + * dom/Document.cpp: + (WebCore::Document::webkitDidEnterFullScreenForElement): Push current full screen element onto the + webkitfullscreenchange event delay queue. + (WebCore::Document::webkitDidExitFullScreenForElement): Ditto. + (WebCore::Document::fullScreenElementRemoved): Ditto. + (WebCore::Document::fullScreenChangeDelayTimerFired): Empty the queue, dispatching a + webkitfullscreenchange event for each entry. + * dom/Document.h: + +2011-05-05 Jer Noble <jer.noble@apple.com> + + Reviewed by Maciej Stachowiak. + + Removing the full screen element via parent.innerHTML="" does not result in a webkitfullscreenchange event. + https://bugs.webkit.org/show_bug.cgi?id=60278 + + Handle the removal of a full screen element from within Node::willRemove() instead + of Document::nodeWillBeRemoved(). The new function Document::fullScreenElementWillBeRemoved() will + be called by Node::willRemove() to handle those changes which used to occur in nodeWillBeRemoved(). + + Test: fullscreen/full-screen-remove-children.html + + * dom/Document.cpp: + (WebCore::Document::nodeWillBeRemoved): Removed the code checking for the full screen element. + (WebCore::Document::fullScreenElementWillBeRemoved): Added, moved from nodeWillBeRemoved. + * dom/Document.h: + * dom/Node.cpp: + (WebCore::Node::willRemove): Check to see if this is the current full screen element. + +2011-05-04 Philippe Normand <pnormand@igalia.com> + + Reviewed by Martin Robinson. + + [Gtk+] deadlock in gstreamer video player when exiting fullscreen + https://bugs.webkit.org/show_bug.cgi?id=58548 + + Block data flow towards the pipeline branch to remove to avoid + potential deadlocks during the PAUSED->READY transitions of the + elements to remove. + + * platform/graphics/gstreamer/GStreamerGWorld.cpp: + (WebCore::GStreamerGWorld::exitFullscreen): + +2011-05-11 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Darin Adler. + + Video track sometimes fails to draw. + https://bugs.webkit.org/show_bug.cgi?id=60635 + <rdar://problem/9281951> + + No new tests, covered by existing pixel tests. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::loadResource): Set display mode to "Unknown" to force a + recalculation, and media engine notification, the next time the state machine runs. + +2011-05-05 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Adam Roben. + + The preload attribute of the video tag is not completely implemented + https://bugs.webkit.org/show_bug.cgi?id=43673 + <rdar://problem/9369746> + + This change implements "preload=metadata" for the AVFoundation backend. + Tested manually with manual-tests/media-elements/video-preload.html. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_havePreparedToPlay. + (WebCore::HTMLMediaElement::prepareForLoad): Ditto. + (WebCore::HTMLMediaElement::prepareToPlay): New, tell player to prepare to play. + (WebCore::HTMLMediaElement::seek): Call prepareToPlay when preload is less than 'auto' + because we need to have media data loaded to seek. + (WebCore::HTMLMediaElement::updatePlayState): Call prepareToPlay. + * html/HTMLMediaElement.h: + + * manual-tests/media-elements/video-preload.html: Make changing urls work. + + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: + (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): Remove + m_videoFrameHasDrawn and m_delayingLoad as they are no longer used. + (WebCore::MediaPlayerPrivateAVFoundation::resumeLoad): Removed. + (WebCore::MediaPlayerPrivateAVFoundation::load): Don't initialize m_videoFrameHasDrawn. + Move all preload logic to setPreload, call it from here. + (WebCore::MediaPlayerPrivateAVFoundation::prepareToPlay): Move all preload logic to + setPreload, call it. + (WebCore::MediaPlayerPrivateAVFoundation::duration): Don't cache duration = 0, it is + unlikely to be correct and isn't worth caching. Use invalidTime() function. + (WebCore::MediaPlayerPrivateAVFoundation::seeking): Use invalidTime() function. + (WebCore::MediaPlayerPrivateAVFoundation::setNaturalSize): Add logging. + (WebCore::MediaPlayerPrivateAVFoundation::updateStates): Update for name change AVAssetStatus + to AssetStatus. Always create a AVPlayerItem for live streams because they can't be inspected + without one. Set networkState to 'idle' when the playback buffer is full because that is + a signal that AVFoundation won't do any more IO. Set readyState to 'HAVE_CURRENT_DATA' + when the first frame is available. + (WebCore::MediaPlayerPrivateAVFoundation::metadataLoaded): Call tracksChanged so we cache + width, height, hasVideo, etc. + (WebCore::MediaPlayerPrivateAVFoundation::loadedTimeRangesChanged): Use invalidTime() function. + (WebCore::MediaPlayerPrivateAVFoundation::timeChanged): Ditto. + (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted): Ditto. + (WebCore::MediaPlayerPrivateAVFoundation::repaint): Don't set m_videoFrameHasDrawn, it is done + in derived classes. + (WebCore::MediaPlayerPrivateAVFoundation::setPreload): Centralize all logic about when to create + AVAsset and AVPlayerItem here. + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: + + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h: + * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm: + (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Initialize + m_videoFrameHasDrawn. + (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame): New, renamed from + videoLayerIsReadyToDisplay. Return true if we have a layer with frames available or + if we have painted a frame to the context. + (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): New, create the AVAsset + if necessary. + (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForCacheResource): Ditto. + (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Restructure logic. + (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): New, create AVPlayerItem. + (WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata): Correct logging. + (WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatus): Return "buffer full" when + the buffer is full. + (WebCore::MediaPlayerPrivateAVFoundationObjC::platformDuration): Get the duration from the + AVAsset when we haven't allocated the AVPlayerItem yet so that we can return duration + when we only have metadata. + (WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus): Update for name change. + (WebCore::MediaPlayerPrivateAVFoundationObjC::paint): Set m_videoFrameHasDrawn. + (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Get attributes from AVAsset + when when we haven't allocated the AVPlayerItem yet so that we can report attributes + when we only have metadata. + (WebCore::MediaPlayerPrivateAVFoundationObjC::sizeChanged): Guard against being called before + we have allocated the AVPlayerItem. + +2011-06-03 Doreen Jiang <doreen.jiang@nokia.com> + + Reviewed by Benjamin Poulain. + + [Qt]The minimum size of the select menu list is incorrect for qtwebkit + https://bugs.webkit.org/show_bug.cgi?id=56752 + + The minimum width of the select-box is calculated to be as small as possible + instead of hardcoded value (width of 7 characters) in minimumMenuListSize() function + This will avoid overapping the select lists in popular websites. + + Test: fast/forms/selectlist-minsize.html + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::minimumMenuListSize): + 2011-06-02 Ryosuke Niwa <rniwa@webkit.org> Reviewed by Eric Seidel. diff --git a/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in b/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in index 6523589..83317a8 100644 --- a/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in +++ b/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in @@ -1448,6 +1448,8 @@ _wkSetScrollbarPainterTrackAlpha _wkVerticalScrollbarPainterForController _wkWillEndLiveResize _wkWillStartLiveResize +_wkQTMovieResolvedURL +_wkAVAssetResolvedURL #else _wkGetNSEventMomentumPhase #endif diff --git a/src/3rdparty/webkit/Source/WebCore/WebCore.pri b/src/3rdparty/webkit/Source/WebCore/WebCore.pri index ca2e46a..85ca1d5 100644 --- a/src/3rdparty/webkit/Source/WebCore/WebCore.pri +++ b/src/3rdparty/webkit/Source/WebCore/WebCore.pri @@ -242,7 +242,16 @@ contains(DEFINES, WTF_USE_QT_BEARER=1) { } contains(DEFINES, ENABLE_VIDEO=1) { - contains(DEFINES, USE_GSTREAMER=1) { + contains(DEFINES, USE_QTKIT=1) { + DEFINES += WTF_USE_QTKIT=1 + + INCLUDEPATH += $$PWD/platform/graphics/mac + + LIBS += -framework AppKit -framework AudioUnit \ + -framework AudioToolbox -framework CoreAudio \ + -framework QuartzCore -framework QTKit + + } else:contains(DEFINES, USE_GSTREAMER=1) { DEFINES += WTF_USE_GSTREAMER=1 DEFINES += ENABLE_GLIB_SUPPORT=1 diff --git a/src/3rdparty/webkit/Source/WebCore/WebCore.pro b/src/3rdparty/webkit/Source/WebCore/WebCore.pro index abb9882..03cdf4e 100644 --- a/src/3rdparty/webkit/Source/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/Source/WebCore/WebCore.pro @@ -2934,7 +2934,31 @@ contains(DEFINES, ENABLE_VIDEO=1) { bindings/js/JSAudioConstructor.cpp } - contains(DEFINES, USE_GSTREAMER=1) { + contains(DEFINES, USE_QTKIT=1) { + HEADERS += \ + platform/graphics/mac/MediaPlayerPrivateQTKit.h \ + platform/mac/WebCoreObjCExtras.h \ + platform/qt/WebCoreSystemInterface.h \ + platform/mac/BlockExceptions.h \ + platform/mac/WebCoreObjCExtras.h + SOURCES += \ + platform/graphics/mac/MediaPlayerPrivateQTKit.mm \ + platform/mac/SharedBufferMac.mm \ + platform/mac/KURLMac.mm \ + platform/text/mac/StringMac.mm \ + platform/graphics/mac/FloatSizeMac.mm \ + platform/graphics/mac/IntRectMac.mm \ + platform/graphics/cg/IntRectCG.cpp \ + platform/graphics/cg/FloatSizeCG.cpp \ + platform/cf/SharedBufferCF.cpp \ + platform/cf/KURLCFNet.cpp \ + platform/qt/WebCoreSystemInterface.mm \ + platform/mac/BlockExceptions.mm \ + platform/mac/WebCoreObjCExtras.mm + + DEFINES+=NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES + + } else: contains(DEFINES, USE_GSTREAMER=1) { HEADERS += \ platform/graphics/gstreamer/GOwnPtrGStreamer.h \ platform/graphics/gstreamer/GRefPtrGStreamer.h \ diff --git a/src/3rdparty/webkit/Source/WebCore/dom/ContainerNode.cpp b/src/3rdparty/webkit/Source/WebCore/dom/ContainerNode.cpp index 9ae34a5..24e427e 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/ContainerNode.cpp +++ b/src/3rdparty/webkit/Source/WebCore/dom/ContainerNode.cpp @@ -434,6 +434,11 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec) document()->removeFocusedNodeOfSubtree(child.get()); +#if ENABLE(FULLSCREEN_API) + document()->removeFullScreenElementOfSubtree(child.get()); +#endif + + // Events fired when blurring currently focused node might have moved this // child into a different parent. if (child->parentNode() != this) { @@ -525,6 +530,10 @@ void ContainerNode::removeChildren() // exclude this node when looking for removed focusedNode since only children will be removed document()->removeFocusedNodeOfSubtree(this, true); +#if ENABLE(FULLSCREEN_API) + document()->removeFullScreenElementOfSubtree(this, true); +#endif + forbidEventDispatch(); Vector<RefPtr<Node>, 10> removedChildren; removedChildren.reserveInitialCapacity(childNodeCount()); diff --git a/src/3rdparty/webkit/Source/WebCore/dom/Document.cpp b/src/3rdparty/webkit/Source/WebCore/dom/Document.cpp index 19bf8b2..4d6220d 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/Document.cpp +++ b/src/3rdparty/webkit/Source/WebCore/dom/Document.cpp @@ -3391,24 +3391,6 @@ void Document::nodeWillBeRemoved(Node* n) frame->selection()->nodeWillBeRemoved(n); frame->page()->dragCaretController()->nodeWillBeRemoved(n); } - -#if ENABLE(FULLSCREEN_API) - // If the current full screen element or any of its ancestors is removed, set the current - // full screen element to the document root, and fire a fullscreenchange event to inform - // clients of the DOM. - ASSERT(n); - if (n->contains(m_fullScreenElement.get())) { - ASSERT(n != documentElement()); - - if (m_fullScreenRenderer) - m_fullScreenRenderer->remove(); - - setFullScreenRenderer(0); - m_fullScreenElement = documentElement(); - recalcStyle(Force); - m_fullScreenChangeDelayTimer.startOneShot(0); - } -#endif } void Document::textInserted(Node* text, unsigned offset, unsigned length) @@ -4803,7 +4785,7 @@ bool Document::fullScreenIsAllowedForElement(Element* element) const return true; } -void Document::webkitRequestFullScreenForElement(Element* element, unsigned short flags) +void Document::requestFullScreenForElement(Element* element, unsigned short flags, FullScreenCheckType checkType) { if (!page() || !page()->settings()->fullScreenEnabled()) return; @@ -4811,7 +4793,7 @@ void Document::webkitRequestFullScreenForElement(Element* element, unsigned shor if (!element) element = documentElement(); - if (!fullScreenIsAllowedForElement(element)) + if (checkType == EnforceIFrameAllowFulScreenRequirement && !fullScreenIsAllowedForElement(element)) return; if (!ScriptController::processingUserGesture()) @@ -4872,12 +4854,15 @@ void Document::webkitWillEnterFullScreenForElement(Element* element) void Document::webkitDidEnterFullScreenForElement(Element*) { if (m_fullScreenRenderer) { +#if USE(ACCELERATED_COMPOSITING) + page()->chrome()->client()->setRootFullScreenLayer(0); +#endif m_fullScreenRenderer->setAnimating(false); #if USE(ACCELERATED_COMPOSITING) view()->updateCompositingLayers(); - page()->chrome()->client()->setRootFullScreenLayer(0); #endif } + m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement); m_fullScreenChangeDelayTimer.startOneShot(0); } @@ -4905,7 +4890,7 @@ void Document::webkitDidExitFullScreenForElement(Element*) if (m_fullScreenElement != documentElement()) m_fullScreenElement->detach(); - m_fullScreenElement = 0; + m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement.release()); setFullScreenRenderer(0); #if USE(ACCELERATED_COMPOSITING) page()->chrome()->client()->setRootFullScreenLayer(0); @@ -4958,13 +4943,48 @@ void Document::setFullScreenRendererBackgroundColor(Color backgroundColor) void Document::fullScreenChangeDelayTimerFired(Timer<Document>*) { - Element* element = m_fullScreenElement.get(); - if (!element) - element = documentElement(); + while (!m_fullScreenChangeEventTargetQueue.isEmpty()) { + RefPtr<Element> element = m_fullScreenChangeEventTargetQueue.takeFirst(); + if (!element) + element = documentElement(); + + element->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false)); + } +} + +void Document::fullScreenElementRemoved() +{ + // If the current full screen element or any of its ancestors is removed, set the current + // full screen element to the document root, and fire a fullscreenchange event to inform + // clients of the DOM. + if (m_fullScreenRenderer) + m_fullScreenRenderer->remove(); + setFullScreenRenderer(0); + + m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement.release()); + m_fullScreenElement = documentElement(); + recalcStyle(Force); - element->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false)); + // Dispatch this event manually, before the element is actually removed from the DOM + // so that the message cascades as expected. + fullScreenChangeDelayTimerFired(&m_fullScreenChangeDelayTimer); + m_fullScreenChangeDelayTimer.stop(); } +void Document::removeFullScreenElementOfSubtree(Node* node, bool amongChildrenOnly) +{ + if (!m_fullScreenElement) + return; + + bool elementInSubtree = false; + if (amongChildrenOnly) + elementInSubtree = m_fullScreenElement->isDescendantOf(node); + else + elementInSubtree = (m_fullScreenElement == node) || m_fullScreenElement->isDescendantOf(node); + + if (elementInSubtree) + fullScreenElementRemoved(); +} #endif void Document::decrementLoadEventDelayCount() diff --git a/src/3rdparty/webkit/Source/WebCore/dom/Document.h b/src/3rdparty/webkit/Source/WebCore/dom/Document.h index 2315e79..6e2f5ec 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/Document.h +++ b/src/3rdparty/webkit/Source/WebCore/dom/Document.h @@ -40,6 +40,7 @@ #include "Timer.h" #include "TreeScope.h" #include "ViewportArguments.h" +#include <wtf/Deque.h> #include <wtf/FixedArray.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -1042,7 +1043,13 @@ public: bool webkitIsFullScreen() const { return m_fullScreenElement.get(); } bool webkitFullScreenKeyboardInputAllowed() const { return m_fullScreenElement.get() && m_areKeysEnabledInFullScreen; } Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement.get(); } - void webkitRequestFullScreenForElement(Element*, unsigned short flags); + + enum FullScreenCheckType { + EnforceIFrameAllowFulScreenRequirement, + ExemptIFrameAllowFulScreenRequirement, + }; + + void requestFullScreenForElement(Element*, unsigned short flags, FullScreenCheckType); void webkitCancelFullScreen(); void webkitWillEnterFullScreenForElement(Element*); @@ -1058,6 +1065,8 @@ public: void fullScreenChangeDelayTimerFired(Timer<Document>*); bool fullScreenIsAllowedForElement(Element*) const; + void fullScreenElementRemoved(); + void removeFullScreenElementOfSubtree(Node*, bool amongChildrenOnly = false); #endif // Used to allow element that loads data without going through a FrameLoader to delay the 'load' event. @@ -1363,6 +1372,7 @@ private: RefPtr<Element> m_fullScreenElement; RenderFullScreen* m_fullScreenRenderer; Timer<Document> m_fullScreenChangeDelayTimer; + Deque<RefPtr<Element> > m_fullScreenChangeEventTargetQueue; #endif int m_loadEventDelayCount; diff --git a/src/3rdparty/webkit/Source/WebCore/dom/Element.cpp b/src/3rdparty/webkit/Source/WebCore/dom/Element.cpp index 5f9e851..063bda6 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/Element.cpp +++ b/src/3rdparty/webkit/Source/WebCore/dom/Element.cpp @@ -1886,7 +1886,7 @@ bool Element::childShouldCreateRenderer(Node* child) const #if ENABLE(FULLSCREEN_API) void Element::webkitRequestFullScreen(unsigned short flags) { - document()->webkitRequestFullScreenForElement(this, flags); + document()->requestFullScreenForElement(this, flags, Document::EnforceIFrameAllowFulScreenRequirement); } #endif diff --git a/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.cpp b/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.cpp index 2b57285..47eae8d 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.cpp +++ b/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * Copyright (C) 2011 Google Inc. All rights reserved. @@ -26,15 +26,14 @@ #include "config.h" #include "EventDispatcher.h" -#include "Element.h" -#include "Event.h" #include "EventContext.h" -#include "EventTarget.h" #include "FrameView.h" +#include "HTMLMediaElement.h" #include "InspectorInstrumentation.h" #include "MouseEvent.h" -#include "Node.h" #include "ScopedEventQueue.h" +#include "WindowEventContext.h" +#include <wtf/RefPtr.h> #if ENABLE(SVG) #include "SVGElementInstance.h" @@ -42,12 +41,6 @@ #include "SVGUseElement.h" #endif -#include "UIEvent.h" -#include "UIEventWithKeyState.h" -#include "WindowEventContext.h" - -#include <wtf/RefPtr.h> - namespace WebCore { static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0; @@ -235,8 +228,6 @@ EventDispatcher::EventDispatcher(Node* node) void EventDispatcher::ensureEventAncestors(Event* event) { - EventDispatchBehavior behavior = determineDispatchBehavior(event); - if (!m_node->inDocument()) return; @@ -251,7 +242,7 @@ void EventDispatcher::ensureEventAncestors(Event* event) while (true) { bool isSVGShadowRoot = ancestor->isSVGShadowRoot(); if (isSVGShadowRoot || ancestor->isShadowRoot()) { - if (behavior == StayInsideShadowDOM) + if (determineDispatchBehavior(event, ancestor) == StayInsideShadowDOM) return; #if ENABLE(SVG) ancestor = isSVGShadowRoot ? ancestor->svgShadowHost() : ancestor->shadowHost(); @@ -375,8 +366,19 @@ const EventContext* EventDispatcher::topEventContext() return m_ancestors.isEmpty() ? 0 : &m_ancestors.last(); } -EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event) +EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, Node* shadowRoot) { +#if ENABLE(FULLSCREEN_API) + // Video-only full screen is a mode where we use the shadow DOM as an implementation + // detail that should not be detectable by the web content. + if (Element* element = m_node->document()->webkitCurrentFullScreenElement()) { + // FIXME: We assume that if the full screen element is a media element that it's + // the video-only full screen. Both here and elsewhere. But that is probably wrong. + if (element->isMediaElement() && shadowRoot && shadowRoot->shadowHost() == element) + return StayInsideShadowDOM; + } +#endif + // Per XBL 2.0 spec, mutation events should never cross shadow DOM boundary: // http://dev.w3.org/2006/xbl2/#event-flow-and-targeting-across-shadow-s if (event->isMutationEvent()) diff --git a/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.h b/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.h index 88e9756..3c9548b 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.h +++ b/src/3rdparty/webkit/Source/WebCore/dom/EventDispatcher.h @@ -61,7 +61,7 @@ private: EventDispatcher(Node*); PassRefPtr<EventTarget> adjustToShadowBoundaries(PassRefPtr<Node> relatedTarget, const Vector<Node*> relatedTargetAncestors); - EventDispatchBehavior determineDispatchBehavior(Event*); + EventDispatchBehavior determineDispatchBehavior(Event*, Node* shadowRoot); void ensureEventAncestors(Event*); const EventContext* topEventContext(); diff --git a/src/3rdparty/webkit/Source/WebCore/dom/Node.h b/src/3rdparty/webkit/Source/WebCore/dom/Node.h index 9ff632b..bd4d414 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/Node.h +++ b/src/3rdparty/webkit/Source/WebCore/dom/Node.h @@ -202,6 +202,7 @@ public: #endif virtual bool isMediaControlElement() const { return false; } + virtual bool isMediaControls() const { return false; } bool isStyledElement() const { return getFlag(IsStyledElementFlag); } virtual bool isFrameOwnerElement() const { return false; } virtual bool isAttributeNode() const { return false; } diff --git a/src/3rdparty/webkit/Source/WebCore/features.pri b/src/3rdparty/webkit/Source/WebCore/features.pri index e148cf0..9614a41 100644 --- a/src/3rdparty/webkit/Source/WebCore/features.pri +++ b/src/3rdparty/webkit/Source/WebCore/features.pri @@ -162,7 +162,12 @@ symbian|maemo5|maemo6 { DEFINES -= ENABLE_VIDEO=1 DEFINES += ENABLE_VIDEO=0 - contains(DEFINES, USE_GSTREAMER=1) { + contains(DEFINES, USE_QTKIT=1) { + DEFINES -= ENABLE_VIDEO=0 + DEFINES += ENABLE_VIDEO=1 + DEFINES -= WTF_USE_QT_MULTIMEDIA=1 + DEFINES += WTF_USE_QT_MULTIMEDIA=0 + } else: contains(DEFINES, USE_GSTREAMER=1) { DEFINES -= ENABLE_VIDEO=0 DEFINES += ENABLE_VIDEO=1 DEFINES -= WTF_USE_QT_MULTIMEDIA=1 diff --git a/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.cpp b/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.cpp index 49edccb..bc46eba 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.cpp +++ b/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.cpp @@ -164,13 +164,13 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum , m_sendProgressEvents(true) , m_isFullscreen(false) , m_closedCaptionsVisible(false) - , m_mouseOver(false) #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) , m_needWidgetUpdate(false) #endif , m_dispatchingCanPlayEvent(false) , m_loadInitiatedByUserGesture(false) , m_completelyLoaded(false) + , m_havePreparedToPlay(false) { LOG(Media, "HTMLMediaElement::HTMLMediaElement"); document->registerForDocumentActivationCallbacks(this); @@ -514,9 +514,11 @@ void HTMLMediaElement::prepareForLoad() // Perform the cleanup required for the resource load algorithm to run. stopPeriodicTimers(); m_loadTimer.stop(); + m_sentEndEvent = false; m_sentStalledEvent = false; m_haveFiredLoadedData = false; m_completelyLoaded = false; + m_havePreparedToPlay = false; m_displayMode = Unknown; // 1 - Abort any already-running instance of the resource selection algorithm for this element. @@ -708,6 +710,9 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content bool privateMode = !settings || settings->privateBrowsingEnabled(); m_player->setPrivateBrowsingMode(privateMode); + // Reset display mode to force a recalculation of what to show because we are resetting the player. + setDisplayMode(Unknown); + if (!autoplay()) m_player->setPreload(m_preload); m_player->setPreservesPitch(m_webkitPreservesPitch); @@ -767,6 +772,11 @@ void HTMLMediaElement::waitForSourceChange() // 6.18 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event. setShouldDelayLoadEvent(false); + + updateDisplayState(); + + if (renderer()) + renderer()->updateFromElement(); } void HTMLMediaElement::noneSupported() @@ -1085,7 +1095,15 @@ bool HTMLMediaElement::supportsSave() const { return m_player ? m_player->supportsSave() : false; } - + +void HTMLMediaElement::prepareToPlay() +{ + if (m_havePreparedToPlay) + return; + m_havePreparedToPlay = true; + m_player->prepareToPlay(); +} + void HTMLMediaElement::seek(float time, ExceptionCode& ec) { LOG(Media, "HTMLMediaElement::seek(%f)", time); @@ -1098,6 +1116,10 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec) return; } + // If the media engine has been told to postpone loading data, let it go ahead now. + if (m_preload < MediaPlayer::Auto && m_readyState < HAVE_FUTURE_DATA) + prepareToPlay(); + // Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set. refreshCachedTime(); float now = currentTime(); @@ -1599,6 +1621,8 @@ void HTMLMediaElement::endScrubbing() // "15 to 250ms", we choose the slowest frequency static const double maxTimeupdateEventFrequency = 0.25; +static const double timeWithoutMouseMovementBeforeHidingControls = 3; + void HTMLMediaElement::startPlaybackProgressTimer() { if (m_playbackProgressTimer.isActive()) @@ -1616,11 +1640,8 @@ void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*) return; scheduleTimeupdateEvent(true); - if (hasMediaControls()) { - if (!m_mouseOver && controls() && hasVideo()) - mediaControls()->makeTransparent(); + if (hasMediaControls()) mediaControls()->playbackProgressed(); - } // FIXME: deal with cue ranges here } @@ -2199,7 +2220,7 @@ void HTMLMediaElement::updatePlayState() addPlayedRange(m_lastSeekTime, time); if (couldPlayIfEnoughData()) - m_player->prepareToPlay(); + prepareToPlay(); if (hasMediaControls()) mediaControls()->playbackStopped(); @@ -2351,18 +2372,6 @@ void HTMLMediaElement::defaultEventHandler(Event* event) if (widget) widget->handleEvent(event); #else - if (event->isMouseEvent()) { - MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); - if (mouseEvent->relatedTarget() != this) { - if (event->type() == eventNames().mouseoverEvent) { - m_mouseOver = true; - if (hasMediaControls() && controls() && !canPlay()) - mediaControls()->makeOpaque(); - } else if (event->type() == eventNames().mouseoutEvent) - m_mouseOver = false; - } - } - HTMLElement::defaultEventHandler(event); #endif } @@ -2495,9 +2504,10 @@ bool HTMLMediaElement::isFullscreen() const void HTMLMediaElement::enterFullscreen() { LOG(Media, "HTMLMediaElement::enterFullscreen"); + #if ENABLE(FULLSCREEN_API) if (document() && document()->settings() && document()->settings()->fullScreenEnabled()) { - webkitRequestFullScreen(0); + document()->requestFullScreenForElement(this, 0, Document::ExemptIFrameAllowFulScreenRequirement); return; } #endif @@ -2514,6 +2524,7 @@ void HTMLMediaElement::enterFullscreen() void HTMLMediaElement::exitFullscreen() { LOG(Media, "HTMLMediaElement::exitFullscreen"); + #if ENABLE(FULLSCREEN_API) if (document() && document()->settings() && document()->settings()->fullScreenEnabled()) { if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == this) @@ -2657,17 +2668,16 @@ void HTMLMediaElement::privateBrowsingStateDidChange() MediaControls* HTMLMediaElement::mediaControls() { - if (!shadowRoot()) - return 0; - - Node* node = shadowRoot()->firstChild(); - ASSERT(node->isHTMLElement()); - return static_cast<MediaControls*>(node); + return toMediaControls(shadowRoot()->firstChild()); } bool HTMLMediaElement::hasMediaControls() { - return shadowRoot(); + if (!shadowRoot()) + return false; + + Node* node = shadowRoot()->firstChild(); + return node && node->isMediaControls(); } void HTMLMediaElement::ensureMediaControls() diff --git a/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.h b/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.h index 89e1add..81fdeca 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.h +++ b/src/3rdparty/webkit/Source/WebCore/html/HTMLMediaElement.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -146,7 +146,7 @@ public: void togglePlayState(); void beginScrubbing(); void endScrubbing(); - + bool canPlay() const; float percentLoaded() const; @@ -201,6 +201,8 @@ public: static void clearMediaCache(); static void clearMediaCacheForSite(const String&); + bool isPlaying() const { return m_playing; } + protected: HTMLMediaElement(const QualifiedName&, Document*); virtual ~HTMLMediaElement(); @@ -288,6 +290,7 @@ private: void mediaEngineError(PassRefPtr<MediaError> err); void cancelPendingEventsAndCallbacks(); void waitForSourceChange(); + void prepareToPlay(); enum InvalidSourceAction { DoNothing, Complain }; bool isSafeToLoadURL(const KURL&, InvalidSourceAction); @@ -410,7 +413,6 @@ private: bool m_isFullscreen : 1; bool m_closedCaptionsVisible : 1; - bool m_mouseOver : 1; #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) bool m_needWidgetUpdate : 1; @@ -419,6 +421,7 @@ private: bool m_dispatchingCanPlayEvent : 1; bool m_loadInitiatedByUserGesture : 1; bool m_completelyLoaded : 1; + bool m_havePreparedToPlay : 1; }; } //namespace diff --git a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.cpp b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.cpp index 8c216de..e0205b3 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -654,6 +654,9 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) if (event->type() == eventNames().mousedownEvent) mediaElement()->beginScrubbing(); + if (event->type() == eventNames().mouseupEvent) + mediaElement()->endScrubbing(); + MediaControlInputElement::defaultEventHandler(event); if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent) @@ -669,9 +672,6 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) RenderSlider* slider = toRenderSlider(renderer()); if (slider && slider->inDragMode()) m_controls->updateTimeDisplay(); - - if (event->type() == eventNames().mouseupEvent) - mediaElement()->endScrubbing(); } void MediaControlTimelineElement::setPosition(float currentTime) @@ -797,7 +797,7 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) document()->webkitCancelFullScreen(); m_controls->exitedFullscreen(); } else { - mediaElement()->webkitRequestFullScreen(0); + document()->requestFullScreenForElement(mediaElement(), 0, Document::ExemptIFrameAllowFulScreenRequirement); m_controls->enteredFullscreen(); } } else diff --git a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.h b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.h index db3158b..ff8f461 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.h +++ b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlElements.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.cpp b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.cpp index 24289a0..6ea1ea3 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.cpp +++ b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +30,7 @@ #include "MediaControlRootElement.h" #include "MediaControlElements.h" +#include "MouseEvent.h" #include "Page.h" #include "RenderTheme.h" @@ -37,6 +38,8 @@ using namespace std; namespace WebCore { +static const double timeWithoutMouseMovementBeforeHidingControls = 3; + MediaControlRootElement::MediaControlRootElement(HTMLMediaElement* mediaElement) : MediaControls(mediaElement) , m_mediaElement(mediaElement) @@ -61,6 +64,8 @@ MediaControlRootElement::MediaControlRootElement(HTMLMediaElement* mediaElement) , m_fullScreenMaxVolumeButton(0) , m_panel(0) , m_opaque(true) + , m_isMouseOverControls(false) + , m_hideFullscreenControlsTimer(this, &MediaControlRootElement::hideFullscreenControlsTimerFired) { } @@ -321,12 +326,18 @@ void MediaControlRootElement::playbackStarted() m_playButton->updateDisplayType(); m_timeline->setPosition(m_mediaElement->currentTime()); updateTimeDisplay(); + + if (m_mediaElement->isFullscreen()) + startHideFullscreenControlsTimer(); } void MediaControlRootElement::playbackProgressed() { m_timeline->setPosition(m_mediaElement->currentTime()); updateTimeDisplay(); + + if (!m_isMouseOverControls && m_mediaElement->hasVideo()) + makeTransparent(); } void MediaControlRootElement::playbackStopped() @@ -335,6 +346,8 @@ void MediaControlRootElement::playbackStopped() m_timeline->setPosition(m_mediaElement->currentTime()); updateTimeDisplay(); makeOpaque(); + + stopHideFullscreenControlsTimer(); } void MediaControlRootElement::updateTimeDisplay() @@ -414,6 +427,8 @@ void MediaControlRootElement::enteredFullscreen() m_seekForwardButton->hide(); } else m_rewindButton->hide(); + + startHideFullscreenControlsTimer(); } void MediaControlRootElement::exitedFullscreen() @@ -424,6 +439,8 @@ void MediaControlRootElement::exitedFullscreen() m_rewindButton->show(); m_seekBackButton->show(); m_seekForwardButton->show(); + + stopHideFullscreenControlsTimer(); } void MediaControlRootElement::showVolumeSlider() @@ -435,6 +452,77 @@ void MediaControlRootElement::showVolumeSlider() m_volumeSliderContainer->show(); } +bool MediaControlRootElement::shouldHideControls() +{ + return !m_panel->hovered(); +} + +bool MediaControlRootElement::containsRelatedTarget(Event* event) +{ + if (!event->isMouseEvent()) + return false; + EventTarget* relatedTarget = static_cast<MouseEvent*>(event)->relatedTarget(); + if (!relatedTarget) + return false; + return contains(relatedTarget->toNode()); +} + +void MediaControlRootElement::defaultEventHandler(Event* event) +{ + MediaControls::defaultEventHandler(event); + + if (event->type() == eventNames().mouseoverEvent) { + if (!containsRelatedTarget(event)) { + m_isMouseOverControls = true; + if (!m_mediaElement->canPlay()) { + makeOpaque(); + if (shouldHideControls()) + startHideFullscreenControlsTimer(); + } + } + } else if (event->type() == eventNames().mouseoutEvent) { + if (!containsRelatedTarget(event)) { + m_isMouseOverControls = false; + stopHideFullscreenControlsTimer(); + } + } else if (event->type() == eventNames().mousemoveEvent) { + if (m_mediaElement->isFullscreen()) { + // When we get a mouse move in fullscreen mode, show the media controls, and start a timer + // that will hide the media controls after a 3 seconds without a mouse move. + makeOpaque(); + if (shouldHideControls()) + startHideFullscreenControlsTimer(); + } + } +} + +void MediaControlRootElement::startHideFullscreenControlsTimer() +{ + if (!m_mediaElement->isFullscreen()) + return; + + m_hideFullscreenControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHidingControls); +} + +void MediaControlRootElement::hideFullscreenControlsTimerFired(Timer<MediaControlRootElement>*) +{ + if (!m_mediaElement->isPlaying()) + return; + + if (!m_mediaElement->isFullscreen()) + return; + + if (!shouldHideControls()) + return; + + makeTransparent(); +} + +void MediaControlRootElement::stopHideFullscreenControlsTimer() +{ + m_hideFullscreenControlsTimer.stop(); +} + const AtomicString& MediaControlRootElement::shadowPseudoId() const { DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls")); diff --git a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.h b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.h index 1fdcc01..78ce06f 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.h +++ b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControlRootElement.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,11 +96,20 @@ public: void updateTimeDisplay(); void updateStatusDisplay(); + virtual bool shouldHideControls(); + private: MediaControlRootElement(HTMLMediaElement*); + virtual void defaultEventHandler(Event*); + void hideFullscreenControlsTimerFired(Timer<MediaControlRootElement>*); + void startHideFullscreenControlsTimer(); + void stopHideFullscreenControlsTimer(); + virtual const AtomicString& shadowPseudoId() const; + bool containsRelatedTarget(Event*); + HTMLMediaElement* m_mediaElement; MediaControlRewindButtonElement* m_rewindButton; @@ -123,8 +132,9 @@ private: MediaControlFullscreenVolumeSliderElement* m_fullScreenVolumeSlider; MediaControlFullscreenVolumeMaxButtonElement* m_fullScreenMaxVolumeButton; MediaControlPanelElement* m_panel; - bool m_opaque; + bool m_isMouseOverControls; + Timer<MediaControlRootElement> m_hideFullscreenControlsTimer; }; } diff --git a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControls.h b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControls.h index 9acdb65..e4a2f5e 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControls.h +++ b/src/3rdparty/webkit/Source/WebCore/html/shadow/MediaControls.h @@ -68,13 +68,26 @@ class MediaControls : public HTMLDivElement { virtual void updateTimeDisplay() = 0; virtual void updateStatusDisplay() = 0; + virtual bool shouldHideControls() = 0; + protected: MediaControls(HTMLMediaElement*); private: MediaControls(); + + virtual bool isMediaControls() const { return true; } }; +inline MediaControls* toMediaControls(Node* node) +{ + ASSERT(!node || node->isMediaControls()); + return static_cast<MediaControls*>(node); +} + +// This will catch anyone doing an unneccessary cast. +void toMediaControls(const Node*); + } #endif diff --git a/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp index a126f8a..a2cc0c2 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp +++ b/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp @@ -803,8 +803,16 @@ bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, unsigned String flatFileDirectory = pathByAppendingComponent(m_cacheDirectory, flatFileSubdirectory); makeAllDirectories(flatFileDirectory); + + String extension; + + String fileName = resource->response().suggestedFilename(); + size_t dotIndex = fileName.reverseFind('.'); + if (dotIndex != notFound && dotIndex < (fileName.length() - 1)) + extension = fileName.substring(dotIndex); + String path; - if (!writeDataToUniqueFileInDirectory(resource->data(), flatFileDirectory, path)) + if (!writeDataToUniqueFileInDirectory(resource->data(), flatFileDirectory, path, extension)) return false; fullPath = pathByAppendingComponent(flatFileDirectory, path); @@ -1228,12 +1236,12 @@ bool ApplicationCacheStorage::shouldStoreResourceAsFlatFile(ApplicationCacheReso || resource->response().mimeType().startsWith("video/", false); } -bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer* data, const String& directory, String& path) +bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer* data, const String& directory, String& path, const String& fileExtension) { String fullPath; do { - path = encodeForFileName(createCanonicalUUIDString()); + path = encodeForFileName(createCanonicalUUIDString()) + fileExtension; // Guard against the above function being called on a platform which does not implement // createCanonicalUUIDString(). ASSERT(!path.isEmpty()); diff --git a/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.h b/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.h index 3136b52..07f6854 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.h +++ b/src/3rdparty/webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.h @@ -115,7 +115,7 @@ private: bool ensureOriginRecord(const SecurityOrigin*); bool shouldStoreResourceAsFlatFile(ApplicationCacheResource*); void deleteTables(); - bool writeDataToUniqueFileInDirectory(SharedBuffer*, const String& directory, String& outFilename); + bool writeDataToUniqueFileInDirectory(SharedBuffer*, const String& directory, String& outFilename, const String& fileExtension); void loadManifestHostHashes(); diff --git a/src/3rdparty/webkit/Source/WebCore/platform/KURL.h b/src/3rdparty/webkit/Source/WebCore/platform/KURL.h index 94dcba8..fd2af60 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/KURL.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/KURL.h @@ -34,7 +34,7 @@ typedef const struct __CFURL* CFURLRef; #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) #ifdef __OBJC__ @class NSURL; #else @@ -202,7 +202,7 @@ public: CFURLRef createCFURL() const; #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) KURL(NSURL*); operator NSURL*() const; #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/SharedBuffer.h b/src/3rdparty/webkit/Source/WebCore/platform/SharedBuffer.h index 967ed96..4f1d629 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/SharedBuffer.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/SharedBuffer.h @@ -36,7 +36,7 @@ #include <wtf/RetainPtr.h> #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) #ifdef __OBJC__ @class NSData; #else @@ -65,7 +65,7 @@ public: ~SharedBuffer(); -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) NSData *createNSData(); static PassRefPtr<SharedBuffer> wrapNSData(NSData *data); #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/cf/KURLCFNet.cpp b/src/3rdparty/webkit/Source/WebCore/platform/cf/KURLCFNet.cpp index f060b28..bc84909 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/cf/KURLCFNet.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/cf/KURLCFNet.cpp @@ -78,6 +78,7 @@ CFURLRef KURL::createCFURL() const return result; } +#if !(PLATFORM(QT) && USE(QTKIT)) String KURL::fileSystemPath() const { RetainPtr<CFURLRef> cfURL(AdoptCF, createCFURL()); @@ -91,5 +92,5 @@ String KURL::fileSystemPath() const #endif return RetainPtr<CFStringRef>(AdoptCF, CFURLCopyFileSystemPath(cfURL.get(), pathStyle)).get(); } - +#endif } diff --git a/src/3rdparty/webkit/Source/WebCore/platform/cf/SharedBufferCF.cpp b/src/3rdparty/webkit/Source/WebCore/platform/cf/SharedBufferCF.cpp index 319f484..3e1b03d 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/cf/SharedBufferCF.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/cf/SharedBufferCF.cpp @@ -40,7 +40,7 @@ SharedBuffer::SharedBuffer(CFDataRef cfData) // Mac is a CF platform but has an even more efficient version of this method, // so only use this version for non-Mac -#if !PLATFORM(MAC) +#if !PLATFORM(MAC) && !(PLATFORM(QT) && USE(QTKIT)) CFDataRef SharedBuffer::createCFData() { if (m_cfData) { diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatSize.h b/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatSize.h index df9c19a..9e9245c 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatSize.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatSize.h @@ -35,7 +35,7 @@ typedef struct CGSize CGSize; #endif -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(QT) && USE(QTKIT)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGSize NSSize; #else @@ -97,7 +97,7 @@ public: #endif #if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ - || (PLATFORM(CHROMIUM) && OS(DARWIN)) + || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(QT) && USE(QTKIT)) explicit FloatSize(const NSSize &); // don't do this implicitly since it's lossy operator NSSize() const; #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntRect.h b/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntRect.h index d2b348b..96ee826 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntRect.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntRect.h @@ -33,7 +33,7 @@ typedef struct CGRect CGRect; #endif -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(QT) && USE(QTKIT)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGRect NSRect; #else @@ -199,7 +199,7 @@ public: #endif #if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ - || (PLATFORM(CHROMIUM) && OS(DARWIN)) + || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(QT) && USE(QTKIT)) operator NSRect() const; #endif @@ -239,7 +239,7 @@ IntRect enclosingIntRect(const CGRect&); #endif #if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ - || (PLATFORM(CHROMIUM) && OS(DARWIN)) + || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(QT) && USE(QTKIT)) IntRect enclosingIntRect(const NSRect&); #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntSize.h b/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntSize.h index 8cfabf5..db4e54c 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntSize.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/IntSize.h @@ -30,7 +30,7 @@ typedef struct CGSize CGSize; #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGSize NSSize; #else @@ -114,7 +114,7 @@ public: operator CGSize() const; #endif -#if PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) +#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT))) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) explicit IntSize(const NSSize &); // don't do this implicitly since it's lossy operator NSSize() const; #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/MediaPlayer.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/MediaPlayer.cpp index 40ea0ae..fb583b6 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/MediaPlayer.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/MediaPlayer.cpp @@ -46,7 +46,7 @@ #include "MediaPlayerPrivateGStreamer.h" #endif -#if PLATFORM(MAC) +#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) #include "MediaPlayerPrivateQTKit.h" #if USE(AVFOUNDATION) #include "MediaPlayerPrivateAVFoundationObjC.h" @@ -62,7 +62,7 @@ #if USE(QT_MULTIMEDIA) && !USE(GSTREAMER) #include "MediaPlayerPrivateQt.h" #define PlatformMediaEngineClassName MediaPlayerPrivateQt -#elif !USE(GSTREAMER) +#elif !USE(GSTREAMER) && !USE(QTKIT) #include "MediaPlayerPrivatePhonon.h" #define PlatformMediaEngineClassName MediaPlayerPrivatePhonon #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp index 096ebb2..bff20c0 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp @@ -30,6 +30,7 @@ #include "MediaPlayerPrivateAVFoundation.h" #include "ApplicationCacheHost.h" +#include "ApplicationCacheResource.h" #include "DocumentLoader.h" #include "FrameView.h" #include "GraphicsContext.h" @@ -45,30 +46,25 @@ using namespace std; namespace WebCore { -static const float invalidTime = -1.0f; - MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation(MediaPlayer* player) : m_player(player) , m_queuedNotifications() , m_queueMutex() - , m_mainThreadCallPending(false) , m_networkState(MediaPlayer::Empty) , m_readyState(MediaPlayer::HaveNothing) , m_preload(MediaPlayer::Auto) , m_scaleFactor(1, 1) , m_cachedMaxTimeLoaded(0) , m_cachedMaxTimeSeekable(0) - , m_cachedDuration(invalidTime) - , m_reportedDuration(invalidTime) - , m_seekTo(invalidTime) + , m_cachedDuration(invalidTime()) + , m_reportedDuration(invalidTime()) + , m_seekTo(invalidTime()) , m_requestedRate(1) - , m_delayCallbacks(false) - , m_havePreparedToPlay(false) + , m_delayCallbacks(0) + , m_mainThreadCallPending(false) , m_assetIsPlayable(false) , m_visible(false) - , m_videoFrameHasDrawn(false) , m_loadingMetadata(false) - , m_delayingLoad(false) , m_isAllowedToRender(false) , m_cachedHasAudio(false) , m_cachedHasVideo(false) @@ -83,6 +79,7 @@ MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation(MediaPlayer* play MediaPlayerPrivateAVFoundation::~MediaPlayerPrivateAVFoundation() { LOG(Media, "MediaPlayerPrivateAVFoundation::~MediaPlayerPrivateAVFoundation(%p)", this); + setIgnoreLoadStateChanges(true); cancelCallOnMainThread(mainThreadCallback, this); } @@ -167,17 +164,6 @@ bool MediaPlayerPrivateAVFoundation::hasSetUpVideoRendering() const return hasLayerRenderer() || hasContextRenderer(); } -void MediaPlayerPrivateAVFoundation::resumeLoad() -{ - LOG(Media, "MediaPlayerPrivateAVFoundation::resumeLoad(%p)", this); - - ASSERT(m_delayingLoad); - m_delayingLoad = false; - - if (m_assetURL.length()) - prepareToPlay(); -} - void MediaPlayerPrivateAVFoundation::load(const String& url) { LOG(Media, "MediaPlayerPrivateAVFoundation::load(%p)", this); @@ -191,27 +177,19 @@ void MediaPlayerPrivateAVFoundation::load(const String& url) m_player->readyStateChanged(); } - m_videoFrameHasDrawn = false; m_assetURL = url; // Don't do any more work if the url is empty. if (!url.length()) return; - if (m_preload == MediaPlayer::None) { - LOG(Media, "MediaPlayerPrivateAVFoundation::load(%p) - preload==none so returning", this); - m_delayingLoad = true; - return; - } - - prepareToPlay(); + setPreload(m_preload); } void MediaPlayerPrivateAVFoundation::playabilityKnown() { LOG(Media, "MediaPlayerPrivateAVFoundation::playabilityKnown(%p)", this); - updateStates(); if (m_assetIsPlayable) return; @@ -232,22 +210,7 @@ void MediaPlayerPrivateAVFoundation::prepareToPlay() { LOG(Media, "MediaPlayerPrivateAVFoundation::prepareToPlay(%p)", this); - m_preload = MediaPlayer::Auto; - if (m_havePreparedToPlay) - return; - m_havePreparedToPlay = true; - - m_delayingLoad = false; -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - Frame* frame = m_player->frameView() ? m_player->frameView()->frame() : 0; - ApplicationCacheHost* cacheHost = frame ? frame->loader()->documentLoader()->applicationCacheHost() : 0; - ApplicationCacheResource* resource = 0; - if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(m_assetURL), resource) && resource) - createAVPlayerForCacheResource(resource); - else -#endif - createAVPlayerForURL(m_assetURL); - checkPlayability(); + setPreload(MediaPlayer::Auto); } void MediaPlayerPrivateAVFoundation::play() @@ -269,22 +232,17 @@ void MediaPlayerPrivateAVFoundation::pause() platformPause(); } -void MediaPlayerPrivateAVFoundation::paint(GraphicsContext*, const IntRect&) -{ - // This is the base class, only need to remember that a frame has been drawn. - m_videoFrameHasDrawn = true; -} - float MediaPlayerPrivateAVFoundation::duration() const { - if (!metaDataAvailable()) - return 0; + if (m_cachedDuration != invalidTime()) + return m_cachedDuration; - if (m_cachedDuration == invalidTime) { - m_cachedDuration = platformDuration(); - LOG(Media, "MediaPlayerPrivateAVFMac::duration(%p) - caching %f", this, m_cachedDuration); - } + float duration = platformDuration(); + if (!duration || duration == invalidTime()) + return 0; + m_cachedDuration = duration; + LOG(Media, "MediaPlayerPrivateAVFoundation::duration(%p) - caching %f", this, m_cachedDuration); return m_cachedDuration; } @@ -326,7 +284,7 @@ bool MediaPlayerPrivateAVFoundation::seeking() const if (!metaDataAvailable()) return false; - return m_seekTo != invalidTime; + return m_seekTo != invalidTime(); } IntSize MediaPlayerPrivateAVFoundation::naturalSize() const @@ -346,6 +304,8 @@ IntSize MediaPlayerPrivateAVFoundation::naturalSize() const void MediaPlayerPrivateAVFoundation::setNaturalSize(IntSize size) { + LOG(Media, "MediaPlayerPrivateAVFoundation:setNaturalSize(%p) - size = %d x %d", this, size.width(), size.height()); + IntSize oldSize = m_cachedNaturalSize; m_cachedNaturalSize = size; if (oldSize != m_cachedNaturalSize) @@ -422,6 +382,9 @@ bool MediaPlayerPrivateAVFoundation::supportsFullscreen() const void MediaPlayerPrivateAVFoundation::updateStates() { + if (m_ignoreLoadStateChanges) + return; + MediaPlayer::NetworkState oldNetworkState = m_networkState; MediaPlayer::ReadyState oldReadyState = m_readyState; @@ -432,24 +395,23 @@ void MediaPlayerPrivateAVFoundation::updateStates() m_networkState = MediaPlayer::Loading; else { // -loadValuesAsynchronouslyForKeys:completionHandler: has invoked its handler; test status of keys and determine state. - AVAssetStatus avAssetStatus = assetStatus(); + AssetStatus assetStatus = this->assetStatus(); ItemStatus itemStatus = playerItemStatus(); - m_assetIsPlayable = (avAssetStatus == MediaPlayerAVAssetStatusPlayable); - if (m_readyState < MediaPlayer::HaveMetadata && avAssetStatus > MediaPlayerAVAssetStatusLoading) { + m_assetIsPlayable = (assetStatus == MediaPlayerAVAssetStatusPlayable); + if (m_readyState < MediaPlayer::HaveMetadata && assetStatus > MediaPlayerAVAssetStatusLoading) { if (m_assetIsPlayable) { - if (itemStatus == MediaPlayerAVPlayerItemStatusUnknown) { - if (avAssetStatus == MediaPlayerAVAssetStatusFailed || m_preload > MediaPlayer::MetaData) { - // We may have a playable asset that doesn't support inspection prior to playback; go ahead - // and create the AVPlayerItem now. When the AVPlayerItem becomes ready to play, we will - // have access to its metadata. Or we may have been asked to become ready to play immediately. + if (assetStatus >= MediaPlayerAVAssetStatusLoaded) + m_readyState = MediaPlayer::HaveMetadata; + if (itemStatus <= MediaPlayerAVPlayerItemStatusUnknown) { + if (assetStatus == MediaPlayerAVAssetStatusFailed || m_preload > MediaPlayer::MetaData || isLiveStream()) { + // The asset is playable but doesn't support inspection prior to playback (eg. streaming files), + // or we are supposed to prepare for playback immediately, so create the player item now. m_networkState = MediaPlayer::Loading; prepareToPlay(); } else m_networkState = MediaPlayer::Idle; } - if (avAssetStatus == MediaPlayerAVAssetStatusLoaded) - m_readyState = MediaPlayer::HaveMetadata; } else { // FIX ME: fetch the error associated with the @"playable" key to distinguish between format // and network errors. @@ -457,36 +419,40 @@ void MediaPlayerPrivateAVFoundation::updateStates() } } - if (avAssetStatus >= MediaPlayerAVAssetStatusLoaded && itemStatus > MediaPlayerAVPlayerItemStatusUnknown) { + if (assetStatus >= MediaPlayerAVAssetStatusLoaded && itemStatus > MediaPlayerAVPlayerItemStatusUnknown) { if (seeking()) m_readyState = m_readyState >= MediaPlayer::HaveMetadata ? MediaPlayer::HaveMetadata : MediaPlayer::HaveNothing; else { - float maxLoaded = maxTimeLoaded(); switch (itemStatus) { + case MediaPlayerAVPlayerItemStatusDoesNotExist: case MediaPlayerAVPlayerItemStatusUnknown: - break; case MediaPlayerAVPlayerItemStatusFailed: - m_networkState = MediaPlayer::DecodeError; break; + case MediaPlayerAVPlayerItemStatusPlaybackLikelyToKeepUp: m_readyState = MediaPlayer::HaveEnoughData; break; - case MediaPlayerAVPlayerItemStatusReadyToPlay: + case MediaPlayerAVPlayerItemStatusPlaybackBufferFull: + case MediaPlayerAVPlayerItemStatusReadyToPlay: // If the readyState is already HaveEnoughData, don't go lower because of this state change. if (m_readyState == MediaPlayer::HaveEnoughData) break; case MediaPlayerAVPlayerItemStatusPlaybackBufferEmpty: - if (maxLoaded > currentTime()) + if (maxTimeLoaded() > currentTime()) m_readyState = MediaPlayer::HaveFutureData; else m_readyState = MediaPlayer::HaveCurrentData; break; } - if (itemStatus >= MediaPlayerAVPlayerItemStatusReadyToPlay) - m_networkState = (maxLoaded == duration()) ? MediaPlayer::Loaded : MediaPlayer::Loading; + if (itemStatus == MediaPlayerAVPlayerItemStatusPlaybackBufferFull) + m_networkState = MediaPlayer::Idle; + else if (itemStatus == MediaPlayerAVPlayerItemStatusFailed) + m_networkState = MediaPlayer::DecodeError; + else if (itemStatus != MediaPlayerAVPlayerItemStatusPlaybackBufferFull && itemStatus >= MediaPlayerAVPlayerItemStatusReadyToPlay) + m_networkState = (maxTimeLoaded() == duration()) ? MediaPlayer::Loaded : MediaPlayer::Loading; } } } @@ -495,6 +461,8 @@ void MediaPlayerPrivateAVFoundation::updateStates() setUpVideoRendering(); if (!m_haveReportedFirstVideoFrame && m_cachedHasVideo && hasAvailableVideoFrame()) { + if (m_readyState < MediaPlayer::HaveCurrentData) + m_readyState = MediaPlayer::HaveCurrentData; m_haveReportedFirstVideoFrame = true; m_player->firstVideoFrameAvailable(); } @@ -530,16 +498,6 @@ void MediaPlayerPrivateAVFoundation::setVisible(bool visible) platformSetVisible(visible); } -bool MediaPlayerPrivateAVFoundation::hasAvailableVideoFrame() const -{ - if (currentRenderingMode() == MediaRenderingToLayer) - return videoLayerIsReadyToDisplay(); - - // When using the software renderer we hope someone will signal that a frame is available so we might as well - // wait until we know that a frame has been drawn. - return m_videoFrameHasDrawn; -} - void MediaPlayerPrivateAVFoundation::acceleratedRenderingStateChanged() { // Set up or change the rendering path if necessary. @@ -549,19 +507,11 @@ void MediaPlayerPrivateAVFoundation::acceleratedRenderingStateChanged() void MediaPlayerPrivateAVFoundation::metadataLoaded() { m_loadingMetadata = false; - updateStates(); -} - -void MediaPlayerPrivateAVFoundation::loadStateChanged() -{ - if (m_ignoreLoadStateChanges) - return; - updateStates(); + tracksChanged(); } void MediaPlayerPrivateAVFoundation::rateChanged() { - updateStates(); m_player->rateChanged(); } @@ -569,13 +519,12 @@ void MediaPlayerPrivateAVFoundation::loadedTimeRangesChanged() { m_cachedLoadedTimeRanges = 0; m_cachedMaxTimeLoaded = 0; - updateStates(); // For some media files, reported duration is estimated and updated as media is loaded // so report duration changed when the estimate is upated. float dur = duration(); if (dur != m_reportedDuration) { - if (m_reportedDuration != invalidTime) + if (m_reportedDuration != invalidTime()) m_player->durationChanged(); m_reportedDuration = dur; } @@ -590,7 +539,7 @@ void MediaPlayerPrivateAVFoundation::timeChanged(double time) { LOG(Media, "MediaPlayerPrivateAVFoundation::timeChanged(%p) - time = %f", this, time); - if (m_seekTo == invalidTime) + if (m_seekTo == invalidTime()) return; // AVFoundation may call our observer more than once during a seek, and we can't currently tell @@ -600,7 +549,7 @@ void MediaPlayerPrivateAVFoundation::timeChanged(double time) float currentRate = rate(); if ((currentRate > 0 && time >= m_seekTo) || (currentRate < 0 && time <= m_seekTo) || (abs(m_seekTo - time) <= smallSeekDelta)) { - m_seekTo = invalidTime; + m_seekTo = invalidTime(); updateStates(); m_player->timeChanged(); } @@ -611,7 +560,7 @@ void MediaPlayerPrivateAVFoundation::seekCompleted(bool finished) LOG(Media, "MediaPlayerPrivateAVFoundation::seekCompleted(%p) - finished = %d", this, finished); if (finished) - m_seekTo = invalidTime; + m_seekTo = invalidTime(); } void MediaPlayerPrivateAVFoundation::didEnd() @@ -628,7 +577,6 @@ void MediaPlayerPrivateAVFoundation::didEnd() void MediaPlayerPrivateAVFoundation::repaint() { - m_videoFrameHasDrawn = true; m_player->repaint(); } @@ -646,8 +594,38 @@ MediaPlayer::MovieLoadType MediaPlayerPrivateAVFoundation::movieLoadType() const void MediaPlayerPrivateAVFoundation::setPreload(MediaPlayer::Preload preload) { m_preload = preload; - if (m_delayingLoad && m_preload != MediaPlayer::None) - resumeLoad(); + if (!m_assetURL.length()) + return; + + setDelayCallbacks(true); + + if (m_preload >= MediaPlayer::MetaData && assetStatus() == MediaPlayerAVAssetStatusDoesNotExist) { +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + Frame* frame = m_player->frameView() ? m_player->frameView()->frame() : 0; + ApplicationCacheHost* cacheHost = frame ? frame->loader()->documentLoader()->applicationCacheHost() : 0; + ApplicationCacheResource* resource; + if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(m_assetURL), resource) && resource) { + // AVFoundation can't open arbitrary data pointers, so if this ApplicationCacheResource doesn't + // have a valid local path, just open the resource's original URL. + if (resource->path().isEmpty()) + createAVAssetForURL(resource->url()); + else + createAVAssetForCacheResource(resource); + } else +#endif + createAVAssetForURL(m_assetURL); + + createAVPlayer(); + + checkPlayability(); + } + + // Don't force creation of the player item unless we already know that the asset is playable. If we aren't + // there yet, or if we already know it is not playable, creating it now won't help. + if (m_preload == MediaPlayer::Auto && m_assetIsPlayable) + createAVPlayerItem(); + + setDelayCallbacks(false); } void MediaPlayerPrivateAVFoundation::setDelayCallbacks(bool delay) @@ -742,31 +720,34 @@ void MediaPlayerPrivateAVFoundation::dispatchNotification() break; case Notification::ItemTracksChanged: tracksChanged(); + updateStates(); break; case Notification::ItemStatusChanged: - loadStateChanged(); + updateStates(); break; case Notification::ItemSeekableTimeRangesChanged: seekableTimeRangesChanged(); - loadStateChanged(); + updateStates(); break; case Notification::ItemLoadedTimeRangesChanged: loadedTimeRangesChanged(); - loadStateChanged(); + updateStates(); break; case Notification::ItemPresentationSizeChanged: sizeChanged(); + updateStates(); break; case Notification::ItemIsPlaybackLikelyToKeepUpChanged: - loadStateChanged(); + updateStates(); break; case Notification::ItemIsPlaybackBufferEmptyChanged: - loadStateChanged(); + updateStates(); break; case Notification::ItemIsPlaybackBufferFullChanged: - loadStateChanged(); + updateStates(); break; case Notification::PlayerRateChanged: + updateStates(); rateChanged(); break; case Notification::PlayerTimeChanged: @@ -777,8 +758,10 @@ void MediaPlayerPrivateAVFoundation::dispatchNotification() break; case Notification::AssetMetadataLoaded: metadataLoaded(); + updateStates(); break; case Notification::AssetPlayabilityKnown: + updateStates(); playabilityKnown(); break; case Notification::None: diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h index 225f6cf..91c632d 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h @@ -42,7 +42,6 @@ public: virtual void repaint(); virtual void metadataLoaded(); - virtual void loadStateChanged(); virtual void playabilityKnown(); virtual void rateChanged(); virtual void loadedTimeRangesChanged(); @@ -142,16 +141,14 @@ protected: virtual PassRefPtr<TimeRanges> buffered() const; virtual unsigned bytesLoaded() const; virtual void setSize(const IntSize&); - virtual void paint(GraphicsContext*, const IntRect&); + virtual void paint(GraphicsContext*, const IntRect&) = 0; virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) = 0; virtual void setPreload(MediaPlayer::Preload); - virtual bool hasAvailableVideoFrame() const; #if USE(ACCELERATED_COMPOSITING) virtual PlatformLayer* platformLayer() const { return 0; } virtual bool supportsAcceleratedRendering() const = 0; virtual void acceleratedRenderingStateChanged(); #endif - virtual bool hasSingleSecurityOrigin() const { return true; } virtual MediaPlayer::MovieLoadType movieLoadType() const; virtual void prepareForRendering(); virtual float mediaTimeForTimeValue(float) const = 0; @@ -159,12 +156,15 @@ protected: virtual bool supportsFullscreen() const; // Required interfaces for concrete derived classes. - virtual void createAVPlayerForURL(const String& url) = 0; + virtual void createAVAssetForURL(const String&) = 0; + virtual void createAVPlayer() = 0; + virtual void createAVPlayerItem() = 0; #if ENABLE(OFFLINE_WEB_APPLICATIONS) - virtual void createAVPlayerForCacheResource(ApplicationCacheResource*) = 0; + virtual void createAVAssetForCacheResource(ApplicationCacheResource*) = 0; #endif enum ItemStatus { + MediaPlayerAVPlayerItemStatusDoesNotExist, MediaPlayerAVPlayerItemStatusUnknown, MediaPlayerAVPlayerItemStatusFailed, MediaPlayerAVPlayerItemStatusReadyToPlay, @@ -174,7 +174,8 @@ protected: }; virtual ItemStatus playerItemStatus() const = 0; - enum AVAssetStatus { + enum AssetStatus { + MediaPlayerAVAssetStatusDoesNotExist, MediaPlayerAVAssetStatusUnknown, MediaPlayerAVAssetStatusLoading, MediaPlayerAVAssetStatusFailed, @@ -182,7 +183,7 @@ protected: MediaPlayerAVAssetStatusLoaded, MediaPlayerAVAssetStatusPlayable, }; - virtual AVAssetStatus assetStatus() const = 0; + virtual AssetStatus assetStatus() const = 0; virtual void platformSetVisible(bool) = 0; virtual void platformPlay() = 0; @@ -206,13 +207,13 @@ protected: virtual void createVideoLayer() = 0; virtual void destroyVideoLayer() = 0; - virtual bool videoLayerIsReadyToDisplay() const = 0; + + virtual bool hasAvailableVideoFrame() const = 0; virtual bool hasContextRenderer() const = 0; virtual bool hasLayerRenderer() const = 0; protected: - void resumeLoad(); void updateStates(); void setHasVideo(bool b) { m_cachedHasVideo = b; }; @@ -236,14 +237,15 @@ protected: bool hasSetUpVideoRendering() const; static void mainThreadCallback(void*); + + float invalidTime() const { return -1.0f; } + const String& assetURL() const { return m_assetURL; } private: - MediaPlayer* m_player; Vector<Notification> m_queuedNotifications; Mutex m_queueMutex; - bool m_mainThreadCallPending; mutable RefPtr<TimeRanges> m_cachedLoadedTimeRanges; @@ -263,12 +265,10 @@ private: float m_seekTo; float m_requestedRate; int m_delayCallbacks; - bool m_havePreparedToPlay; + bool m_mainThreadCallPending; bool m_assetIsPlayable; bool m_visible; - bool m_videoFrameHasDrawn; bool m_loadingMetadata; - bool m_delayingLoad; bool m_isAllowedToRender; bool m_cachedHasAudio; bool m_cachedHasVideo; diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h index ebc6b27..b670a4d 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h @@ -88,12 +88,13 @@ private: virtual float mediaTimeForTimeValue(float) const; virtual void createAVPlayer(); - virtual void createAVPlayerForURL(const String& url); + virtual void createAVPlayerItem(); + virtual void createAVAssetForURL(const String& url); #if ENABLE(OFFLINE_WEB_APPLICATIONS) - virtual void createAVPlayerForCacheResource(ApplicationCacheResource*); + virtual void createAVAssetForCacheResource(ApplicationCacheResource*); #endif virtual MediaPlayerPrivateAVFoundation::ItemStatus playerItemStatus() const; - virtual MediaPlayerPrivateAVFoundation::AVAssetStatus assetStatus() const; + virtual MediaPlayerPrivateAVFoundation::AssetStatus assetStatus() const; virtual void checkPlayability(); virtual void updateRate(); @@ -107,16 +108,19 @@ private: virtual void beginLoadingMetadata(); virtual void sizeChanged(); + virtual bool hasAvailableVideoFrame() const; + virtual void createContextVideoRenderer(); virtual void destroyContextVideoRenderer(); virtual void createVideoLayer(); virtual void destroyVideoLayer(); - virtual bool videoLayerIsReadyToDisplay() const; virtual bool hasContextRenderer() const; virtual bool hasLayerRenderer() const; + virtual bool hasSingleSecurityOrigin() const; + RetainPtr<CGImageRef> createImageForTimeInRect(float, const IntRect&); MediaPlayer* m_player; @@ -127,6 +131,8 @@ private: RetainPtr<WebCoreAVFMovieObserver> m_objcObserver; RetainPtr<AVAssetImageGenerator> m_imageGenerator; id m_timeObserver; + bool m_videoFrameHasDrawn; + bool m_haveCheckedPlayability; }; } diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm index af612ca..fa10aee 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm @@ -37,6 +37,7 @@ #import "GraphicsContext.h" #import "KURL.h" #import "Logging.h" +#import "SecurityOrigin.h" #import "SoftLinking.h" #import "TimeRanges.h" #import "WebCoreSystemInterface.h" @@ -67,6 +68,7 @@ SOFT_LINK_POINTER(AVFoundation, AVMediaTypeVideo, NSString *) SOFT_LINK_POINTER(AVFoundation, AVMediaTypeAudio, NSString *) SOFT_LINK_POINTER(AVFoundation, AVPlayerItemDidPlayToEndTimeNotification, NSString *) SOFT_LINK_POINTER(AVFoundation, AVAssetImageGeneratorApertureModeCleanAperture, NSString *) +SOFT_LINK_POINTER(AVFoundation, AVURLAssetReferenceRestrictionsKey, NSString *) SOFT_LINK_CONSTANT(CoreMedia, kCMTimeZero, CMTime) @@ -83,6 +85,7 @@ SOFT_LINK_CONSTANT(CoreMedia, kCMTimeZero, CMTime) #define AVMediaTypeAudio getAVMediaTypeAudio() #define AVPlayerItemDidPlayToEndTimeNotification getAVPlayerItemDidPlayToEndTimeNotification() #define AVAssetImageGeneratorApertureModeCleanAperture getAVAssetImageGeneratorApertureModeCleanAperture() +#define AVURLAssetReferenceRestrictionsKey getAVURLAssetReferenceRestrictionsKey() #define kCMTimeZero getkCMTimeZero() @@ -138,6 +141,8 @@ MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlay : MediaPlayerPrivateAVFoundation(player) , m_objcObserver(AdoptNS, [[WebCoreAVFMovieObserver alloc] initWithCallback:this]) , m_timeObserver(0) + , m_videoFrameHasDrawn(false) + , m_haveCheckedPlayability(false) { } @@ -218,6 +223,9 @@ void MediaPlayerPrivateAVFoundationObjC::createVideoLayer() if (!m_videoLayer) { m_videoLayer.adoptNS([[AVPlayerLayer alloc] init]); [m_videoLayer.get() setPlayer:m_avPlayer.get()]; +#ifndef NDEBUG + [m_videoLayer.get() setName:@"Video layer"]; +#endif LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createVideoLayer(%p) - returning %p", this, m_videoLayer.get()); } } @@ -234,77 +242,105 @@ void MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer() m_videoLayer = 0; } -bool MediaPlayerPrivateAVFoundationObjC::videoLayerIsReadyToDisplay() const +bool MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame() const { - return (m_videoLayer && [m_videoLayer.get() isReadyForDisplay]); + return (m_videoFrameHasDrawn || (m_videoLayer && [m_videoLayer.get() isReadyForDisplay])); } -void MediaPlayerPrivateAVFoundationObjC::createAVPlayerForURL(const String& url) +void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url) { + if (m_avAsset) + return; + + LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(%p)", this); + setDelayCallbacks(true); - if (!m_avAsset) { - NSURL *cocoaURL = KURL(ParsedURLString, url); - m_avAsset.adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:nil]); - } - - createAVPlayer(); + NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt:AVAssetReferenceRestrictionForbidRemoteReferenceToLocal | AVAssetReferenceRestrictionForbidLocalReferenceToRemote], AVURLAssetReferenceRestrictionsKey, + nil]; + NSURL *cocoaURL = KURL(ParsedURLString, url); + m_avAsset.adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:options]); + + m_haveCheckedPlayability = false; + + setDelayCallbacks(false); } #if ENABLE(OFFLINE_WEB_APPLICATIONS) -void MediaPlayerPrivateAVFoundationObjC::createAVPlayerForCacheResource(ApplicationCacheResource* resource) +void MediaPlayerPrivateAVFoundationObjC::createAVAssetForCacheResource(ApplicationCacheResource* resource) { - // AVFoundation can't open arbitrary data pointers, so if this ApplicationCacheResource doesn't - // have a valid local path, just open the resource's original URL. - if (resource->path().isEmpty()) { - createAVPlayerForURL(resource->url()); + if (m_avAsset) return; - } + + LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createAVAssetForCacheResource(%p)", this); + + // AVFoundation can't open arbitrary data pointers. + ASSERT(!resource->path().isEmpty()); setDelayCallbacks(true); - if (!m_avAsset) { - NSURL* localURL = [NSURL fileURLWithPath:resource->path()]; - m_avAsset.adoptNS([[AVURLAsset alloc] initWithURL:localURL options:nil]); - } + NSURL* localURL = [NSURL fileURLWithPath:resource->path()]; + m_avAsset.adoptNS([[AVURLAsset alloc] initWithURL:localURL options:nil]); + m_haveCheckedPlayability = false; - createAVPlayer(); + setDelayCallbacks(false); } #endif void MediaPlayerPrivateAVFoundationObjC::createAVPlayer() { - if (!m_avPlayer) { - m_avPlayer.adoptNS([[AVPlayer alloc] init]); - - [m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:@"rate" options:nil context:(void *)MediaPlayerAVFoundationObservationContextPlayer]; - - // Add a time observer, ask to be called infrequently because we don't really want periodic callbacks but - // our observer will also be called whenever a seek happens. - const double veryLongInterval = 60*60*60*24*30; - WebCoreAVFMovieObserver *observer = m_objcObserver.get(); - m_timeObserver = [m_avPlayer.get() addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(veryLongInterval, 10) queue:nil usingBlock:^(CMTime time){ - [observer timeChanged:CMTimeGetSeconds(time)]; - }]; - } + if (m_avPlayer) + return; - if (!m_avPlayerItem) { - // Create the player item so we can media data. - m_avPlayerItem.adoptNS([[AVPlayerItem alloc] initWithAsset:m_avAsset.get()]); - - [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get()selector:@selector(didEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:m_avPlayerItem.get()]; + LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createAVPlayer(%p)", this); - for (NSString *keyName in itemKVOProperties()) - [m_avPlayerItem.get() addObserver:m_objcObserver.get() forKeyPath:keyName options:nil context:(void *)MediaPlayerAVFoundationObservationContextPlayerItem]; + setDelayCallbacks(true); - [m_avPlayer.get() replaceCurrentItemWithPlayerItem:m_avPlayerItem.get()]; - } + m_avPlayer.adoptNS([[AVPlayer alloc] init]); + [m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:@"rate" options:nil context:(void *)MediaPlayerAVFoundationObservationContextPlayer]; + + // Add a time observer, ask to be called infrequently because we don't really want periodic callbacks but + // our observer will also be called whenever a seek happens. + const double veryLongInterval = 60 * 60 * 24 * 30; + WebCoreAVFMovieObserver *observer = m_objcObserver.get(); + m_timeObserver = [m_avPlayer.get() addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(veryLongInterval, 10) queue:nil usingBlock:^(CMTime time){ + [observer timeChanged:CMTimeGetSeconds(time)]; + }]; + + setDelayCallbacks(false); +} + +void MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem() +{ + if (m_avPlayerItem) + return; + + LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem(%p)", this); + + ASSERT(m_avPlayer); + + setDelayCallbacks(true); + + // Create the player item so we can load media data. + m_avPlayerItem.adoptNS([[AVPlayerItem alloc] initWithAsset:m_avAsset.get()]); + + [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(didEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:m_avPlayerItem.get()]; + + for (NSString *keyName in itemKVOProperties()) + [m_avPlayerItem.get() addObserver:m_objcObserver.get() forKeyPath:keyName options:nil context:(void *)MediaPlayerAVFoundationObservationContextPlayerItem]; + + [m_avPlayer.get() replaceCurrentItemWithPlayerItem:m_avPlayerItem.get()]; setDelayCallbacks(false); } void MediaPlayerPrivateAVFoundationObjC::checkPlayability() { + if (m_haveCheckedPlayability) + return; + m_haveCheckedPlayability = true; + LOG(Media, "MediaPlayerPrivateAVFoundationObjC::checkPlayability(%p)", this); [m_avAsset.get() loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:@"playable"] completionHandler:^{ @@ -314,7 +350,7 @@ void MediaPlayerPrivateAVFoundationObjC::checkPlayability() void MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata() { - LOG(Media, "MediaPlayerPrivateAVFoundationObjC::playabilityKnown(%p) - requesting metadata loading", this); + LOG(Media, "MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata(%p) - requesting metadata loading", this); [m_avAsset.get() loadValuesAsynchronouslyForKeys:[assetMetadataKeyNames() retain] completionHandler:^{ [m_objcObserver.get() metadataLoaded]; }]; @@ -323,7 +359,7 @@ void MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata() MediaPlayerPrivateAVFoundation::ItemStatus MediaPlayerPrivateAVFoundationObjC::playerItemStatus() const { if (!m_avPlayerItem) - return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusUnknown; + return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusDoesNotExist; AVPlayerItemStatus status = [m_avPlayerItem.get() status]; if (status == AVPlayerItemStatusUnknown) @@ -332,9 +368,9 @@ MediaPlayerPrivateAVFoundation::ItemStatus MediaPlayerPrivateAVFoundationObjC::p return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusFailed; if ([m_avPlayerItem.get() isPlaybackLikelyToKeepUp]) return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackLikelyToKeepUp; - if (buffered()->contain(duration())) + if ([m_avPlayerItem.get() isPlaybackBufferFull]) return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackBufferFull; - if (buffered()->contain(currentTime())) + if ([m_avPlayerItem.get() isPlaybackBufferEmpty]) return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackBufferEmpty; return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusReadyToPlay; @@ -385,21 +421,25 @@ void MediaPlayerPrivateAVFoundationObjC::platformPause() float MediaPlayerPrivateAVFoundationObjC::platformDuration() const { - if (!metaDataAvailable() || !m_avPlayerItem) - return 0; + if (!m_avAsset) + return invalidTime(); + + CMTime cmDuration; - float duration; - CMTime cmDuration = [m_avPlayerItem.get() duration]; + // Check the AVItem if we have one, some assets never report duration. + if (m_avPlayerItem) + cmDuration = [m_avPlayerItem.get() duration]; + else + cmDuration= [m_avAsset.get() duration]; + if (CMTIME_IS_NUMERIC(cmDuration)) - duration = narrowPrecisionToFloat(CMTimeGetSeconds(cmDuration)); - else if (CMTIME_IS_INDEFINITE(cmDuration)) - duration = numeric_limits<float>::infinity(); - else { - LOG(Media, "MediaPlayerPrivateAVFoundationObjC::duration(%p) - invalid duration, returning 0", this); - return 0; - } + return narrowPrecisionToFloat(CMTimeGetSeconds(cmDuration)); + + if (CMTIME_IS_INDEFINITE(cmDuration)) + return numeric_limits<float>::infinity(); - return duration; + LOG(Media, "MediaPlayerPrivateAVFoundationObjC::duration(%p) - invalid duration, returning %.0f", this, invalidTime()); + return invalidTime(); } float MediaPlayerPrivateAVFoundationObjC::currentTime() const @@ -535,10 +575,10 @@ void MediaPlayerPrivateAVFoundationObjC::setAsset(id asset) m_avAsset = asset; } -MediaPlayerPrivateAVFoundation::AVAssetStatus MediaPlayerPrivateAVFoundationObjC::assetStatus() const +MediaPlayerPrivateAVFoundation::AssetStatus MediaPlayerPrivateAVFoundationObjC::assetStatus() const { if (!m_avAsset) - return MediaPlayerAVAssetStatusUnknown; + return MediaPlayerAVAssetStatusDoesNotExist; for (NSString *keyName in assetMetadataKeyNames()) { AVKeyValueStatus keyStatus = [m_avAsset.get() statusOfValueForKey:keyName error:nil]; @@ -547,6 +587,7 @@ MediaPlayerPrivateAVFoundation::AVAssetStatus MediaPlayerPrivateAVFoundationObjC if (keyStatus == AVKeyValueStatusFailed) return MediaPlayerAVAssetStatusFailed; // At least one key could not be loaded. + if (keyStatus == AVKeyValueStatusCancelled) return MediaPlayerAVAssetStatusCancelled; // Loading of at least one key was cancelled. } @@ -587,7 +628,7 @@ void MediaPlayerPrivateAVFoundationObjC::paint(GraphicsContext* context, const I END_BLOCK_OBJC_EXCEPTIONS; setDelayCallbacks(false); - MediaPlayerPrivateAVFoundation::paint(context, rect); + m_videoFrameHasDrawn = true; } static HashSet<String> mimeTypeCache() @@ -662,37 +703,54 @@ float MediaPlayerPrivateAVFoundationObjC::mediaTimeForTimeValue(float timeValue) void MediaPlayerPrivateAVFoundationObjC::tracksChanged() { + if (!m_avAsset) + return; + // This is called whenever the tracks collection changes so cache hasVideo and hasAudio since we are // asked about those fairly fequently. - bool hasVideo = false; - bool hasAudio = false; - bool hasCaptions = false; - NSArray *tracks = [m_avPlayerItem.get() tracks]; - for (AVPlayerItemTrack *track in tracks) { - if ([track isEnabled]) { - AVAssetTrack *assetTrack = [track assetTrack]; - if ([[assetTrack mediaType] isEqualToString:AVMediaTypeVideo]) - hasVideo = true; - else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeAudio]) - hasAudio = true; - else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeClosedCaption]) - hasCaptions = true; + if (!m_avPlayerItem) { + // We don't have a player item yet, so check with the asset because some assets support inspection + // prior to becoming ready to play. + setHasVideo([[m_avAsset.get() tracksWithMediaCharacteristic:AVMediaCharacteristicVisual] count]); + setHasAudio([[m_avAsset.get() tracksWithMediaCharacteristic:AVMediaCharacteristicAudible] count]); + setHasClosedCaptions([[m_avAsset.get() tracksWithMediaType:AVMediaTypeClosedCaption] count]); + } else { + bool hasVideo = false; + bool hasAudio = false; + bool hasCaptions = false; + NSArray *tracks = [m_avPlayerItem.get() tracks]; + for (AVPlayerItemTrack *track in tracks) { + if ([track isEnabled]) { + AVAssetTrack *assetTrack = [track assetTrack]; + if ([[assetTrack mediaType] isEqualToString:AVMediaTypeVideo]) + hasVideo = true; + else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeAudio]) + hasAudio = true; + else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeClosedCaption]) + hasCaptions = true; + } } + setHasVideo(hasVideo); + setHasAudio(hasAudio); + setHasClosedCaptions(hasCaptions); } - setHasVideo(hasVideo); - setHasAudio(hasAudio); - setHasClosedCaptions(hasCaptions); + + LOG(Media, "WebCoreAVFMovieObserver:tracksChanged(%p) - hasVideo = %s, hasAudio = %s, hasCaptions = %s", + this, boolString(hasVideo()), boolString(hasAudio()), boolString(hasClosedCaptions())); sizeChanged(); } void MediaPlayerPrivateAVFoundationObjC::sizeChanged() { + if (!m_avAsset) + return; + NSArray *tracks = [m_avAsset.get() tracks]; // Some assets don't report track properties until they are completely ready to play, but we // want to report a size as early as possible so use presentationSize when an asset has no tracks. - if (![tracks count]) { + if (m_avPlayerItem && ![tracks count]) { setNaturalSize(IntSize([m_avPlayerItem.get() presentationSize])); return; } @@ -716,6 +774,16 @@ void MediaPlayerPrivateAVFoundationObjC::sizeChanged() setNaturalSize(IntSize(naturalSize)); } +bool MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin() const +{ + if (!m_avAsset) + return false; + + RefPtr<SecurityOrigin> resolvedOrigin = SecurityOrigin::create(KURL(wkAVAssetResolvedURL(m_avAsset.get()))); + RefPtr<SecurityOrigin> requestedOrigin = SecurityOrigin::createFromString(assetURL()); + return resolvedOrigin->isSameSchemeHostPort(requestedOrigin.get()); +} + NSArray* assetMetadataKeyNames() { static NSArray* keys; diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/FloatSizeCG.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/FloatSizeCG.cpp index a035c7a..475ebc0 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/FloatSizeCG.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/FloatSizeCG.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "FloatSize.h" -#if USE(CG) || USE(SKIA_ON_MAC_CHROME) +#if USE(CG) || USE(SKIA_ON_MAC_CHROME) || (PLATFORM(QT) && USE(QTKIT)) #include <ApplicationServices/ApplicationServices.h> diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/IntRectCG.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/IntRectCG.cpp index 18edeb0..ebd9655 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/IntRectCG.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/cg/IntRectCG.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "IntRect.h" -#if USE(CG) || USE(SKIA_ON_MAC_CHROME) +#if USE(CG) || USE(SKIA_ON_MAC_CHROME) || (PLATFORM(QT) && USE(QTKIT)) #include <ApplicationServices/ApplicationServices.h> diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp index a4b20be..d5a612a 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp @@ -178,6 +178,9 @@ void GStreamerGWorld::exitFullscreen() GstPad* srcPad = gst_element_get_static_pad(tee, m_dynamicPadName); GstPad* sinkPad = gst_element_get_static_pad(queue, "sink"); + // Block data flow towards the pipeline branch to remove. + gst_pad_set_blocked(srcPad, true); + // Unlink and release request pad. gst_pad_unlink(srcPad, sinkPad); gst_element_release_request_pad(tee, srcPad); diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h b/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h index a926160..a41946a 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h @@ -41,6 +41,8 @@ @class QTVideoRendererWebKitOnly; @class WebCoreMovieObserver; #else +class NSDictionary; +class NSMutableDictionary; class QTMovie; class QTMovieView; class QTTime; @@ -68,6 +70,9 @@ public: void sizeChanged(); void timeChanged(); void didEnd(); +#if USE(ACCELERATED_COMPOSITING) + void layerHostChanged(PlatformLayer* rootLayer); +#endif private: MediaPlayerPrivateQTKit(MediaPlayer*); @@ -82,7 +87,7 @@ private: static bool isAvailable(); PlatformMedia platformMedia() const; -#if USE(ACCELERATED_COMPOSITING) +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) PlatformLayer* platformLayer() const; #endif @@ -134,7 +139,7 @@ private: virtual void prepareForRendering(); -#if USE(ACCELERATED_COMPOSITING) +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) bool supportsAcceleratedRendering() const; void acceleratedRenderingStateChanged(); #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index ba9fe06..f88dce7 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -39,9 +39,11 @@ #import "BlockExceptions.h" #import "DocumentLoader.h" #import "FrameView.h" +#import "HostWindow.h" #import "GraphicsContext.h" #import "KURL.h" #import "MIMETypeRegistry.h" +#import "SecurityOrigin.h" #import "SoftLinking.h" #import "TimeRanges.h" #import "WebCoreSystemInterface.h" @@ -61,7 +63,6 @@ #import "RenderStyle.h" #endif - SOFT_LINK_FRAMEWORK(QTKit) SOFT_LINK(QTKit, QTMakeTime, QTTime, (long long timeValue, long timeScale), (timeValue, timeScale)) @@ -98,6 +99,8 @@ SOFT_LINK_POINTER(QTKit, QTMovieTimeScaleAttribute, NSString *) SOFT_LINK_POINTER(QTKit, QTMovieURLAttribute, NSString *) SOFT_LINK_POINTER(QTKit, QTMovieVolumeDidChangeNotification, NSString *) SOFT_LINK_POINTER(QTKit, QTSecurityPolicyNoCrossSiteAttribute, NSString *) +SOFT_LINK_POINTER(QTKit, QTSecurityPolicyNoLocalToRemoteSiteAttribute, NSString *) +SOFT_LINK_POINTER(QTKit, QTSecurityPolicyNoRemoteToLocalSiteAttribute, NSString *) SOFT_LINK_POINTER(QTKit, QTVideoRendererWebKitOnlyNewImageAvailableNotification, NSString *) SOFT_LINK_POINTER(QTKit, QTMovieApertureModeClean, NSString *) SOFT_LINK_POINTER(QTKit, QTMovieApertureModeAttribute, NSString *) @@ -134,6 +137,8 @@ SOFT_LINK_POINTER(QTKit, QTMovieApertureModeAttribute, NSString *) #define QTMovieURLAttribute getQTMovieURLAttribute() #define QTMovieVolumeDidChangeNotification getQTMovieVolumeDidChangeNotification() #define QTSecurityPolicyNoCrossSiteAttribute getQTSecurityPolicyNoCrossSiteAttribute() +#define QTSecurityPolicyNoLocalToRemoteSiteAttribute getQTSecurityPolicyNoLocalToRemoteSiteAttribute() +#define QTSecurityPolicyNoRemoteToLocalSiteAttribute getQTSecurityPolicyNoRemoteToLocalSiteAttribute() #define QTVideoRendererWebKitOnlyNewImageAvailableNotification getQTVideoRendererWebKitOnlyNewImageAvailableNotification() #define QTMovieApertureModeClean getQTMovieApertureModeClean() #define QTMovieApertureModeAttribute getQTMovieApertureModeAttribute() @@ -172,6 +177,7 @@ using namespace std; -(void)sizeChanged:(NSNotification *)notification; -(void)timeChanged:(NSNotification *)notification; -(void)didEnd:(NSNotification *)notification; +-(void)layerHostChanged:(NSNotification *)notification; @end @protocol WebKitVideoRenderingDetails @@ -235,7 +241,9 @@ NSMutableDictionary *MediaPlayerPrivateQTKit::commonMovieAttributes() NSMutableDictionary *movieAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:m_player->preservesPitch()], QTMovieRateChangesPreservePitchAttribute, [NSNumber numberWithBool:YES], QTMoviePreventExternalURLLinksAttribute, - [NSNumber numberWithBool:YES], QTSecurityPolicyNoCrossSiteAttribute, + [NSNumber numberWithBool:NO], QTSecurityPolicyNoCrossSiteAttribute, + [NSNumber numberWithBool:YES], QTSecurityPolicyNoRemoteToLocalSiteAttribute, + [NSNumber numberWithBool:YES], QTSecurityPolicyNoLocalToRemoteSiteAttribute, [NSNumber numberWithBool:NO], QTMovieAskUnresolvedDataRefsAttribute, [NSNumber numberWithBool:NO], QTMovieLoopsAttribute, [NSNumber numberWithBool:!m_privateBrowsing], @"QTMovieAllowPersistentCacheAttribute", @@ -405,6 +413,12 @@ void MediaPlayerPrivateQTKit::createQTMovie(NSURL *url, NSDictionary *movieAttri selector:@selector(didEnd:) name:QTMovieDidEndNotification object:m_qtMovie.get()]; +#if defined(BUILDING_ON_SNOW_LEOPARD) + [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() + selector:@selector(layerHostChanged:) + name:@"WebKitLayerHostChanged" + object:nil]; +#endif } static void mainThreadSetNeedsDisplay(id self, SEL) @@ -450,8 +464,11 @@ void MediaPlayerPrivateQTKit::createQTMovieView() m_qtMovieView.adoptNS([[QTMovieView alloc] init]); setSize(m_player->size()); - NSView* parentView = m_player->frameView()->documentView(); + NSView* parentView = 0; +#if PLATFORM(MAC) + parentView = m_player->frameView()->documentView(); [parentView addSubview:m_qtMovieView.get()]; +#endif [m_qtMovieView.get() setDelegate:m_objcObserver.get()]; [m_objcObserver.get() setView:m_qtMovieView.get()]; [m_qtMovieView.get() setMovie:m_qtMovie.get()]; @@ -488,7 +505,7 @@ void MediaPlayerPrivateQTKit::createQTVideoRenderer(QTVideoRendererMode renderer return; // associate our movie with our instance of QTVideoRendererWebKitOnly - [(id<WebKitVideoRenderingDetails>)m_qtVideoRenderer.get() setMovie:m_qtMovie.get()]; + [(id<WebKitVideoRenderingDetails>)m_qtVideoRenderer.get() setMovie:m_qtMovie.get()]; if (rendererMode == QTVideoRendererModeListensForNewImages) { // listen to QTVideoRendererWebKitOnly's QTVideoRendererWebKitOnlyNewImageDidBecomeAvailableNotification @@ -517,7 +534,7 @@ void MediaPlayerPrivateQTKit::destroyQTVideoRenderer() void MediaPlayerPrivateQTKit::createQTMovieLayer() { -#if USE(ACCELERATED_COMPOSITING) +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) if (!m_qtMovie) return; @@ -568,7 +585,7 @@ MediaPlayerPrivateQTKit::MediaRenderingMode MediaPlayerPrivateQTKit::preferredRe if (!m_player->frameView() || !m_qtMovie) return MediaRenderingNone; -#if USE(ACCELERATED_COMPOSITING) +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) if (supportsAcceleratedRendering() && m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player)) return MediaRenderingMovieLayer; #endif @@ -694,7 +711,7 @@ PlatformMedia MediaPlayerPrivateQTKit::platformMedia() const return pm; } -#if USE(ACCELERATED_COMPOSITING) +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) PlatformLayer* MediaPlayerPrivateQTKit::platformLayer() const { return m_qtVideoLayer.get(); @@ -1207,6 +1224,42 @@ void MediaPlayerPrivateQTKit::didEnd() m_player->timeChanged(); } +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) +#if defined(BUILDING_ON_SNOW_LEOPARD) +static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent) +{ + if (!child || !descendent) + return false; + + do { + if (child == descendent) + return true; + } while((child = [child superlayer])); + + return false; +} +#endif + +void MediaPlayerPrivateQTKit::layerHostChanged(PlatformLayer* rootLayer) +{ +#if defined(BUILDING_ON_SNOW_LEOPARD) + if (!rootLayer) + return; + + if (layerIsDescendentOf(m_qtVideoLayer.get(), rootLayer)) { + // We own a child layer of a layer which has switched contexts. + // Tear down our layer, and set m_visible to false, so that the + // next time setVisible(true) is called, the layer will be re- + // created in the correct context. + tearDownVideoRendering(); + m_visible = false; + } +#else + UNUSED_PARAM(rootLayer); +#endif +} +#endif + void MediaPlayerPrivateQTKit::setSize(const IntSize&) { // Don't resize the view now because [view setFrame] also resizes the movie itself, and because @@ -1286,14 +1339,28 @@ void MediaPlayerPrivateQTKit::paint(GraphicsContext* context, const IntRect& r) [m_objcObserver.get() setDelayCallbacks:YES]; BEGIN_BLOCK_OBJC_EXCEPTIONS; + NSGraphicsContext* newContext; + FloatSize scaleFactor(1.0f, -1.0f); + IntRect paintRect(IntPoint(0, 0), IntSize(r.width(), r.height())); + +#if PLATFORM(QT) && USE(QTKIT) + // In Qt, GraphicsContext is a QPainter so every transformations applied on it won't matter because here + // the video is rendered by QuickTime not by Qt. + CGContextRef cgContext = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); + CGContextSaveGState(cgContext); + CGContextSetInterpolationQuality(cgContext, kCGInterpolationLow); + CGContextTranslateCTM(cgContext, r.x(), r.y() + r.height()); + CGContextScaleCTM(cgContext, scaleFactor.width(), scaleFactor.height()); + + newContext = [NSGraphicsContext currentContext]; +#else GraphicsContextStateSaver stateSaver(*context); context->translate(r.x(), r.y() + r.height()); - context->scale(FloatSize(1.0f, -1.0f)); + context->scale(scaleFactor); context->setImageInterpolationQuality(InterpolationLow); - IntRect paintRect(IntPoint(0, 0), IntSize(r.width(), r.height())); - - NSGraphicsContext* newContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context->platformContext() flipped:NO]; + newContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context->platformContext() flipped:NO]; +#endif // draw the current video frame if (qtVideoRenderer) { [NSGraphicsContext saveGraphicsState]; @@ -1347,7 +1414,9 @@ void MediaPlayerPrivateQTKit::paint(GraphicsContext* context, const IntRect& r) } } #endif - +#if PLATFORM(QT) && USE(QTKIT) + CGContextRestoreGState(cgContext); +#endif END_BLOCK_OBJC_EXCEPTIONS; [m_objcObserver.get() setDelayCallbacks:NO]; } @@ -1552,7 +1621,7 @@ void MediaPlayerPrivateQTKit::sawUnsupportedTracks() m_player->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_player); } -#if USE(ACCELERATED_COMPOSITING) +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) bool MediaPlayerPrivateQTKit::supportsAcceleratedRendering() const { return isReadyForVideoSetup() && getQTMovieLayerClass() != Nil; @@ -1567,9 +1636,12 @@ void MediaPlayerPrivateQTKit::acceleratedRenderingStateChanged() bool MediaPlayerPrivateQTKit::hasSingleSecurityOrigin() const { - // We tell quicktime to disallow resources that come from different origins - // so we know all media is single origin. - return true; + if (!m_qtMovie) + return false; + + RefPtr<SecurityOrigin> resolvedOrigin = SecurityOrigin::create(KURL(wkQTMovieResolvedURL(m_qtMovie.get()))); + RefPtr<SecurityOrigin> requestedOrigin = SecurityOrigin::createFromString(m_movieURL); + return resolvedOrigin->isSameSchemeHostPort(requestedOrigin.get()); } MediaPlayer::MovieLoadType MediaPlayerPrivateQTKit::movieLoadType() const @@ -1701,6 +1773,16 @@ void MediaPlayerPrivateQTKit::setPrivateBrowsingMode(bool privateBrowsing) [self repaint]; } +- (void)layerHostChanged:(NSNotification *)notification +{ +#if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) + CALayer* rootLayer = static_cast<CALayer*>([notification object]); + m_callback->layerHostChanged(rootLayer); +#else + UNUSED_PARAM(notification); +#endif +} + - (void)setDelayCallbacks:(BOOL)shouldDelay { m_delayCallbacks = shouldDelay; diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp index 4e3969e..50ee0f1 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp @@ -350,17 +350,21 @@ void MediaPlayerPrivatePhonon::setMuted(bool muted) MediaPlayer::NetworkState MediaPlayerPrivatePhonon::networkState() const { +#if !LOG_DISABLED const QMetaObject* metaObj = this->metaObject(); QMetaEnum networkStates = metaObj->enumerator(metaObj->indexOfEnumerator("NetworkState")); LOG(Media, "MediaPlayerPrivatePhonon::networkState() --> %s", networkStates.valueToKey(m_networkState)); +#endif return m_networkState; } MediaPlayer::ReadyState MediaPlayerPrivatePhonon::readyState() const { +#if !LOG_DISABLED const QMetaObject* metaObj = this->metaObject(); QMetaEnum readyStates = metaObj->enumerator(metaObj->indexOfEnumerator("ReadyState")); LOG(Media, "MediaPlayerPrivatePhonon::readyState() --> %s", readyStates.valueToKey(m_readyState)); +#endif return m_readyState; } @@ -394,20 +398,24 @@ void MediaPlayerPrivatePhonon::updateStates() m_readyState = MediaPlayer::HaveNothing; if (m_networkState != oldNetworkState) { +#if !LOG_DISABLED const QMetaObject* metaObj = this->metaObject(); QMetaEnum networkStates = metaObj->enumerator(metaObj->indexOfEnumerator("NetworkState")); LOG(Media, "Network state changed from '%s' to '%s'", networkStates.valueToKey(oldNetworkState), networkStates.valueToKey(m_networkState)); +#endif m_player->networkStateChanged(); } if (m_readyState != oldReadyState) { +#if !LOG_DISABLED const QMetaObject* metaObj = this->metaObject(); QMetaEnum readyStates = metaObj->enumerator(metaObj->indexOfEnumerator("ReadyState")); LOG(Media, "Ready state changed from '%s' to '%s'", readyStates.valueToKey(oldReadyState), readyStates.valueToKey(m_readyState)); +#endif m_player->readyStateChanged(); } } @@ -483,10 +491,12 @@ void MediaPlayerPrivatePhonon::paint(GraphicsContext* graphicsContect, const Int void MediaPlayerPrivatePhonon::stateChanged(Phonon::State newState, Phonon::State oldState) { +#if !LOG_DISABLED const QMetaObject* metaObj = this->metaObject(); QMetaEnum phononStates = metaObj->enumerator(metaObj->indexOfEnumerator("PhononState")); LOG(Media, "MediaPlayerPrivatePhonon::stateChanged(newState=%s, oldState=%s)", phononStates.valueToKey(newState), phononStates.valueToKey(oldState)); +#endif updateStates(); } diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/KURLMac.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/KURLMac.mm index c913ab4..e6feec1 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/mac/KURLMac.mm +++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/KURLMac.mm @@ -27,6 +27,7 @@ #import "KURL.h" #import "FoundationExtras.h" +#import <CoreFoundation/CFURL.h> namespace WebCore { diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/SharedBufferMac.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/SharedBufferMac.mm index 70eca27..eb5cf2c 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/mac/SharedBufferMac.mm +++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/SharedBufferMac.mm @@ -47,7 +47,11 @@ using namespace WebCore; + (void)initialize { JSC::initializeThreading(); +#if PLATFORM(QT) && USE(QTKIT) + WTF::initializeMainThread(); +#else WTF::initializeMainThreadToProcessMainThread(); +#endif WebCoreObjCFinalizeOnMainThread(self); } @@ -107,7 +111,7 @@ CFDataRef SharedBuffer::createCFData() return (CFDataRef)RetainPtr<WebCoreSharedBufferData>(AdoptNS, [[WebCoreSharedBufferData alloc] initWithSharedBuffer:this]).releaseRef(); } - +#if !(PLATFORM(QT) && USE(QTKIT)) PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& filePath) { NSData *resourceData = [NSData dataWithContentsOfFile:filePath]; @@ -115,6 +119,6 @@ PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fi return SharedBuffer::wrapNSData(resourceData); return 0; } - +#endif } diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreObjCExtras.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreObjCExtras.mm index 82afbf0..41b5ec5 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreObjCExtras.mm +++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreObjCExtras.mm @@ -36,6 +36,7 @@ #include <objc/objc-auto.h> #include <objc/objc-runtime.h> +#include <utility> #include <wtf/Assertions.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.h index f683580..7ebfaab 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.h @@ -67,6 +67,7 @@ typedef struct _NSRect NSRect; #endif #ifdef __OBJC__ +@class AVAsset; @class NSArray; @class NSButtonCell; @class NSData; @@ -87,6 +88,7 @@ typedef struct _NSRect NSRect; @class QTMovie; @class QTMovieView; #else +class AVAsset; class NSArray; class NSButtonCell; class NSData; @@ -159,6 +161,7 @@ extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*); extern int (*wkQTMovieGetType)(QTMovie*); extern BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*); +extern NSURL *(*wkQTMovieResolvedURL)(QTMovie*); extern void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL); extern void (*wkQTMovieSelectPreferredAlternates)(QTMovie*); extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); @@ -258,6 +261,8 @@ extern void (*wkDidBeginScrollGesture)(WKScrollbarPainterControllerRef); extern void (*wkDidEndScrollGesture)(WKScrollbarPainterControllerRef); extern bool (*wkScrollbarPainterUsesOverlayScrollers)(void); + +extern NSURL *(*wkAVAssetResolvedURL)(AVAsset*); #endif extern void (*wkUnregisterUniqueIdForElement)(id element); @@ -287,7 +292,6 @@ extern CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef); extern CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef); extern CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef); extern void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType); - } #endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.mm index 9ef157a..9cc6677 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -64,6 +64,7 @@ NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); float (*wkQTMovieMaxTimeSeekable)(QTMovie*); int (*wkQTMovieGetType)(QTMovie*); BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*); +NSURL *(*wkQTMovieResolvedURL)(QTMovie*); void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL); void (*wkQTMovieSelectPreferredAlternates)(QTMovie*); void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); @@ -154,6 +155,8 @@ void (*wkDidBeginScrollGesture)(WKScrollbarPainterControllerRef); void (*wkDidEndScrollGesture)(WKScrollbarPainterControllerRef); bool (*wkScrollbarPainterUsesOverlayScrollers)(void); + +NSURL *(*wkAVAssetResolvedURL)(AVAsset*); #endif void (*wkUnregisterUniqueIdForElement)(id element); diff --git a/src/3rdparty/webkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.h b/src/3rdparty/webkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.h index 5424906..814f8cc 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.h +++ b/src/3rdparty/webkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.h @@ -23,7 +23,9 @@ #include "MIMESniffing.h" #include <QObject> +QT_BEGIN_NAMESPACE class QNetworkReply; +QT_END_NAMESPACE class QtMIMETypeSniffer : public QObject { Q_OBJECT diff --git a/src/3rdparty/webkit/Source/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/Source/WebCore/platform/qt/RenderThemeQt.cpp index 78befd5..f98df88 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/qt/RenderThemeQt.cpp @@ -446,7 +446,7 @@ Color RenderThemeQt::systemColor(int cssValueId) const int RenderThemeQt::minimumMenuListSize(RenderStyle*) const { const QFontMetrics &fm = QApplication::fontMetrics(); - return 7 * fm.width(QLatin1Char('x')); + return fm.width(QLatin1Char('x')); } void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const diff --git a/src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.h b/src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.h new file mode 100644 index 0000000..bd530de --- /dev/null +++ b/src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.h @@ -0,0 +1,74 @@ +/* + * Copyright 2006, 2007, 2008, 2009, 2010 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 WebCoreSystemInterface_h +#define WebCoreSystemInterface_h + +#include <objc/objc.h> + +#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES +typedef struct CGPoint NSPoint; +typedef struct CGRect NSRect; +#else +typedef struct _NSPoint NSPoint; +typedef struct _NSRect NSRect; +#endif + +#ifdef __OBJC__ +@class NSArray; +@class NSString; +@class NSURL; +@class QTMovie; +@class QTMovieView; +#else +class NSArray; +class NSString; +class NSURL; +class QTMovie; +class QTMovieView; +#endif + +extern "C" { + +// In alphabetical order. +extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void); +extern int (*wkQTMovieDataRate)(QTMovie*); +extern void (*wkQTMovieDisableComponent)(uint32_t[5]); +extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*); +extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); +extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*); +extern int (*wkQTMovieGetType)(QTMovie*); +extern BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*); +extern NSURL *(*wkQTMovieResolvedURL)(QTMovie*); +extern void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL); +extern void (*wkQTMovieSelectPreferredAlternates)(QTMovie*); +extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); +extern NSArray *(*wkQTGetSitesInMediaDownloadCache)(); +extern void (*wkQTClearMediaDownloadCacheForSite)(NSString *site); +extern void (*wkQTClearMediaDownloadCache)(); + +} + +#endif diff --git a/src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.mm b/src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.mm new file mode 100644 index 0000000..3e26671 --- /dev/null +++ b/src/3rdparty/webkit/Source/WebCore/platform/qt/WebCoreSystemInterface.mm @@ -0,0 +1,45 @@ +/* + * Copyright 2006, 2007, 2008, 2009, 2010 Apple Computer, 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" +#import "WebCoreSystemInterface.h" +#import <Foundation/Foundation.h> + +unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void); +int (*wkQTMovieDataRate)(QTMovie*); +void (*wkQTMovieDisableComponent)(uint32_t[5]); +float (*wkQTMovieMaxTimeLoaded)(QTMovie*); +NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); +float (*wkQTMovieMaxTimeSeekable)(QTMovie*); +int (*wkQTMovieGetType)(QTMovie*); +BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*); +NSURL *(*wkQTMovieResolvedURL)(QTMovie*); +void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL); +void (*wkQTMovieSelectPreferredAlternates)(QTMovie*); +void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); +NSArray *(*wkQTGetSitesInMediaDownloadCache)(); +void (*wkQTClearMediaDownloadCacheForSite)(NSString *site); +void (*wkQTClearMediaDownloadCache)(); + diff --git a/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp index 23e1eb4..5b70360 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp @@ -109,6 +109,9 @@ #endif // Q_OS_WIN32 #include "TextIterator.h" #include "WebPlatformStrategies.h" +#if USE(QTKIT) +#include "WebSystemInterface.h" +#endif #include "WindowFeatures.h" #include "WorkerThread.h" #include "runtime/InitializeThreading.h" @@ -320,6 +323,10 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) WebPlatformStrategies::initialize(); +#if USE(QTKIT) + InitWebCoreSystemInterface(); +#endif + Page::PageClients pageClients; pageClients.chromeClient = new ChromeClientQt(q); pageClients.contextMenuClient = new ContextMenuClientQt(); @@ -1105,6 +1112,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) } break; } + default: + break; } } @@ -1168,7 +1177,7 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev }; QString p = q->property("_q_RepaintThrottlingPreset").toString(); - for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) { + for (size_t i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) { if (p == QLatin1String(presets[i].name)) { FrameView::setRepaintThrottlingDeferredRepaintDelay( presets[i].deferredRepaintDelay); @@ -2961,9 +2970,10 @@ QAction *QWebPage::action(WebAction action) const case AlignRight: text = tr("Align Right"); break; - case NoWebAction: return 0; + default: + break; } if (text.isEmpty()) diff --git a/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog b/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog index 2c2ca87..18a555b 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/Source/WebKit/qt/ChangeLog @@ -1,3 +1,64 @@ +2011-06-03 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Andreas Kling. + + To support building namespaced Qt, we require that forward-declarations + of Qt classes be wrapped in QT_BEGIN_NAMESPACE and QT_END_NAMESPACE. + + * WebCoreSupport/FrameLoaderClientQt.h: + +2011-06-03 Alexis Menard <alexis.menard@openbossa.org> + + Unreviewed build fix after r87902. + + To support building namespaced Qt, we require that forward-declarations + of Qt classes be wrapped in QT_BEGIN_NAMESPACE and QT_END_NAMESPACE but + only on classes inside Qt. + + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2011-06-03 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Benjamin Poulain. + + Some warning fixes. Values in switch not handled, and + a comparison between a signed and an unsigned. + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + (QWebPagePrivate::dynamicPropertyChangeEvent): + (QWebPage::action): + +2011-05-26 Alexis Menard <alexis.menard@openbossa.org> + + Unreviewed build fix for Qt and QuickTime backend. + + r87328 added a new system interface, we need to add it too. + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2011-05-25 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Eric Carlson. + + [Qt] Enable usage of QuickTime mediaplayer for the Qt port on Mac. + https://bugs.webkit.org/show_bug.cgi?id=61279 + + Enable the usage of QuickTime backend for the Qt port. It can be enabled by + passing DEFINES+=USE_QTKIT=1 when calling build-webkit. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * QtWebKit.pro: + * WebCoreSupport/FullScreenVideoQt.cpp: + (WebCore::FullScreenVideoQt::enterFullScreenForNode): + (WebCore::FullScreenVideoQt::requiresFullScreenForVideoPlayback): + (WebCore::FullScreenVideoQt::isValid): + * WebCoreSupport/WebSystemInterface.h: Added. + * WebCoreSupport/WebSystemInterface.mm: Added. + (InitWebCoreSystemInterface): + 2011-06-02 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed by Andreas Kling. diff --git a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro index 6c8246e..105a124 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro +++ b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro @@ -208,7 +208,7 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { } contains(DEFINES, ENABLE_VIDEO=1) { - !contains(DEFINES, USE_GSTREAMER=1):contains(MOBILITY_CONFIG, multimedia) { + !contains(DEFINES, USE_QTKIT=1):!contains(DEFINES, USE_GSTREAMER=1):contains(MOBILITY_CONFIG, multimedia) { HEADERS += $$PWD/WebCoreSupport/FullScreenVideoWidget.h SOURCES += $$PWD/WebCoreSupport/FullScreenVideoWidget.cpp } @@ -217,6 +217,24 @@ contains(DEFINES, ENABLE_VIDEO=1) { HEADERS += $$PWD/WebCoreSupport/FullScreenVideoQt.h SOURCES += $$PWD/WebCoreSupport/FullScreenVideoQt.cpp } + + contains(DEFINES, USE_QTKIT=1) { + INCLUDEPATH += $$SOURCE_DIR/WebCore/platform/qt/ + INCLUDEPATH += $$SOURCE_DIR/../WebKitLibraries/ + DEFINES+=NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES + HEADERS += $$PWD/WebCoreSupport/WebSystemInterface.h + SOURCES += $$PWD/WebCoreSupport/WebSystemInterface.mm + # We can know the Mac OS version by using the Darwin major version + DARWIN_VERSION = $$split(QMAKE_HOST.version, ".") + DARWIN_MAJOR_VERSION = $$first(DARWIN_VERSION) + equals(DARWIN_MAJOR_VERSION, "10") { + LIBS+= $$SOURCE_DIR/../WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a -framework Security + } else { + equals(DARWIN_MAJOR_VERSION, "9") { + LIBS+= $$SOURCE_DIR/../WebKitLibraries/libWebKitSystemInterfaceLeopard.a -framework Security + } + } + } } contains(DEFINES, ENABLE_ICONDATABASE=1) { diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 82e5539..e235ee2 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -46,12 +46,13 @@ class QtDRTNodeRuntime; } #endif -QT_BEGIN_NAMESPACE class QWebElement; class QWebFrame; class QWebPage; class QWebHistoryItem; class QWebScriptWorld; + +QT_BEGIN_NAMESPACE class QUrl; QT_END_NAMESPACE diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index bf7821b..6cfd9c1 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -44,7 +44,10 @@ #include <qobject.h> #include <wtf/Forward.h> +QT_BEGIN_NAMESPACE class QNetworkReply; +QT_END_NAMESPACE + class QWebFrame; namespace WebCore { diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp index 7939370..ef97f3a 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp @@ -162,11 +162,10 @@ FullScreenVideoQt::~FullScreenVideoQt() void FullScreenVideoQt::enterFullScreenForNode(Node* node) { Q_ASSERT(node); - Q_ASSERT(m_FullScreenVideoHandler); - m_videoElement = static_cast<HTMLVideoElement*>(node); #if USE(QT_MULTIMEDIA) + Q_ASSERT(m_FullScreenVideoHandler); HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node); PlatformMedia platformMedia = videoElement->platformMedia(); @@ -236,6 +235,8 @@ bool FullScreenVideoQt::requiresFullScreenForVideoPlayback() #endif #if USE(GSTREAMER) return false; +#else + return false; #endif } @@ -246,6 +247,8 @@ bool FullScreenVideoQt::isValid() const #endif #if USE(GSTREAMER) return m_FullScreenVideoHandlerGStreamer; +#else + return 0; #endif } diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h new file mode 100644 index 0000000..467b5ba --- /dev/null +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h @@ -0,0 +1,31 @@ +/* + * Copyright 2006 Apple Computer, 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS 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 <stdint.h> + +void InitWebCoreSystemInterface(); diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.mm b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.mm new file mode 100644 index 0000000..7ff2ec8 --- /dev/null +++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.mm @@ -0,0 +1,62 @@ +/* + * Copyright 2006, 2007, 2008, 2009, 2010 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS 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 "WebSystemInterface.h" + +// Needed for builds not using PCH to expose BUILDING_ macros, see bug 32753. +#include <wtf/Platform.h> + +#import <WebCoreSystemInterface.h> +#import <WebKitSystemInterface.h> + +#define INIT(function) wk##function = WK##function + +void InitWebCoreSystemInterface(void) +{ + static bool didInit; + if (didInit) + return; + + INIT(QTIncludeOnlyModernMediaFileTypes); + INIT(QTMovieDataRate); + INIT(QTMovieDisableComponent); + INIT(QTMovieMaxTimeLoaded); + INIT(QTMovieMaxTimeLoadedChangeNotification); + INIT(QTMovieMaxTimeSeekable); + INIT(QTMovieGetType); + INIT(QTMovieHasClosedCaptions); + INIT(QTMovieResolvedURL); + INIT(QTMovieSetShowClosedCaptions); + INIT(QTMovieSelectPreferredAlternates); + INIT(QTMovieViewSetDrawSynchronously); + INIT(QTGetSitesInMediaDownloadCache); + INIT(QTClearMediaDownloadCacheForSite); + INIT(QTClearMediaDownloadCache); + + didInit = true; +} diff --git a/src/3rdparty/webkit/Source/WebKit2/ChangeLog b/src/3rdparty/webkit/Source/WebKit2/ChangeLog index 453003b..f25333d 100644 --- a/src/3rdparty/webkit/Source/WebKit2/ChangeLog +++ b/src/3rdparty/webkit/Source/WebKit2/ChangeLog @@ -1,3 +1,55 @@ +2011-05-24 Jer Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + Video fails to play on Vimeo + https://bugs.webkit.org/show_bug.cgi?id=61403 + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Added support for wkAVAssetResolvedURL and + wkQTMovieResolvedURL. + +2011-05-13 Jer Noble <jer.noble@apple.com> + + Reviewed by Simon Fraser. + + Video is blank, controller is misplaced on trailers.apple.com movie in fullscreen (with two screens) + https://bugs.webkit.org/show_bug.cgi?id=60826 + + Emit a notification when moving a CALayer from the WebProcess's main + layer host to a new context. This allows listeners to invalidate their + layers which may not support moving between different CAContexts (as is + the case with QTMovieLayer). In order to allow listeners to determine if they + are affected, the notification will pass the root CALayer in a userInfo + dictionary. + + In WebFullScreenManagerMac, move from storing a pointer to a non-refcounted + class (GraphicsLayer) to a retainable class (PlatformLayer). + + * WebProcess/FullScreen/mac/WebFullScreenManagerMac.h: + * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm: + (WebKit::WebFullScreenManagerMac::WebFullScreenManagerMac): No need to initialize + m_fullScreenRootLayer now that it is a RetainPtr<>. + (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer): Emit a notification + after either creating or destroying the full screen layer host. + (WebKit::WebFullScreenManagerMac::beginEnterFullScreenAnimation): + (WebKit::WebFullScreenManagerMac::beginExitFullScreenAnimation): + +2011-05-09 Jeremy Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + Command-~/Exposé to another window while <video> is in full screen, breaks Safari, eventually leading to crash + https://bugs.webkit.org/show_bug.cgi?id=60496 + + When animating into and out of full screen, order out and back in the original webView window, + disabling animations when necessary. The beganExitFullScreenAnimation method was targeting the wrong window, + as the webView is hosted in the full screen window when we ask for it's parent window. + + * UIProcess/mac/WKFullScreenWindowController.mm: + (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): + (-[WKFullScreenWindowController beganExitFullScreenAnimation]): + 2011-05-05 Carlos Garcia Campos <cgarcia@igalia.com> Reviewed by Martin Robinson. diff --git a/src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm b/src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm index f7259aa..eab8e40 100644 --- a/src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm +++ b/src/3rdparty/webkit/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm @@ -251,9 +251,17 @@ using namespace WebCore; [[[self _fullScreenWindow] backgroundLayer] setHidden:YES]; [CATransaction commit]; - // FIXME: In Barolo, orderIn will animate, which is not what we want. Find a way - // to work around this behavior. - //[[_webViewPlaceholder.get() window] orderOut:self]; + NSWindow *webWindow = [_webViewPlaceholder.get() window]; +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that + // behavior here, making sure to reset the animation behavior afterward. + NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; + [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone]; +#endif + [webWindow orderOut:self]; +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + [webWindow setAnimationBehavior:animationBehavior]; +#endif [[self window] makeKeyAndOrderFront:self]; } @@ -282,17 +290,26 @@ using namespace WebCore; [self _updateMenuAndDockForFullScreen]; [self _updatePowerAssertions]; - // The user may have moved the fullScreen window in Spaces, so temporarily change - // the collectionBehavior of the webView's window: - NSWindow* webWindow = [[self webView] window]; - NSWindowCollectionBehavior behavior = [webWindow collectionBehavior]; - [webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces]; - [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]]; - [webWindow setCollectionBehavior:behavior]; - // Swap the webView back into its original position: - if ([_webView window] == [self window]) + if ([_webView window] == [self window]) { [self _swapView:_webViewPlaceholder.get() with:_webView]; + NSWindow* webWindow = [_webView window]; +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that + // behavior here, making sure to reset the animation behavior afterward. + NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; + [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone]; +#endif + // The user may have moved the fullScreen window in Spaces, so temporarily change + // the collectionBehavior of the webView's window: + NSWindowCollectionBehavior behavior = [webWindow collectionBehavior]; + [webWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces]; + [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]]; + [webWindow setCollectionBehavior:behavior]; +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + [webWindow setAnimationBehavior:animationBehavior]; +#endif + } [CATransaction begin]; [CATransaction setAnimationDuration:[self _animationDuration]]; diff --git a/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.h b/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.h index e247eb5..805b129 100644 --- a/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.h +++ b/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.h @@ -31,6 +31,7 @@ #import "LayerTreeContext.h" #import "WebFullScreenManager.h" +#import <WebCore/GraphicsLayer.h> #import <WebCore/IntRect.h> #import <wtf/RetainPtr.h> @@ -53,7 +54,7 @@ private: virtual void beginExitFullScreenAnimation(float duration); OwnPtr<WebCore::GraphicsLayer> m_rootLayer; - WebCore::GraphicsLayer* m_fullScreenRootLayer; + RetainPtr<PlatformLayer> m_fullScreenRootLayer; LayerTreeContext m_layerTreeContext; RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient; RetainPtr<id> m_enterFullScreenListener; diff --git a/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm b/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm index 62a0ffe..4ca225a 100644 --- a/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm +++ b/src/3rdparty/webkit/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm @@ -117,7 +117,6 @@ PassRefPtr<WebFullScreenManagerMac> WebFullScreenManagerMac::create(WebPage* pag WebFullScreenManagerMac::WebFullScreenManagerMac(WebPage* page) : WebFullScreenManager(page) - , m_fullScreenRootLayer(0) { m_enterFullScreenListener.adoptNS([[WebFullScreenManagerAnimationListener alloc] initWithManager:this began:&WebFullScreenManagerMac::beganEnterFullScreenAnimation finished:&WebFullScreenManagerMac::finishedEnterFullScreenAnimation]); m_exitFullScreenListener.adoptNS([[WebFullScreenManagerAnimationListener alloc] initWithManager:this began:&WebFullScreenManagerMac::beganExitFullScreenAnimation finished:&WebFullScreenManagerMac::finishedExitFullScreenAnimation]); @@ -132,19 +131,21 @@ WebFullScreenManagerMac::~WebFullScreenManagerMac() void WebFullScreenManagerMac::setRootFullScreenLayer(WebCore::GraphicsLayer* layer) { - if (m_fullScreenRootLayer == layer) + if (m_fullScreenRootLayer == (layer ? layer->platformLayer() : 0)) return; - m_fullScreenRootLayer = layer; - if (!m_fullScreenRootLayer) { + if (!layer) { m_page->send(Messages::WebFullScreenManagerProxy::ExitAcceleratedCompositingMode()); if (m_rootLayer) { m_rootLayer->removeAllChildren(); m_rootLayer = nullptr; } + + [[NSNotificationCenter defaultCenter] postNotificationName:@"WebKitLayerHostChanged" object:m_fullScreenRootLayer.get() userInfo:nil]; + m_fullScreenRootLayer = 0; return; } - + if (!m_rootLayer) { mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort(); m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort); @@ -163,12 +164,14 @@ void WebFullScreenManagerMac::setRootFullScreenLayer(WebCore::GraphicsLayer* lay } m_rootLayer->removeAllChildren(); - - if (m_fullScreenRootLayer) - m_rootLayer->addChild(m_fullScreenRootLayer); + m_rootLayer->addChild(layer); m_rootLayer->syncCompositingStateForThisLayerOnly(); m_page->corePage()->mainFrame()->view()->syncCompositingStateIncludingSubframes(); + m_fullScreenRootLayer = layer->platformLayer(); + layer->syncCompositingState(); + + [[NSNotificationCenter defaultCenter] postNotificationName:@"WebKitLayerHostChanged" object:m_fullScreenRootLayer.get() userInfo:nil]; } void WebFullScreenManagerMac::beginEnterFullScreenAnimation(float duration) @@ -190,7 +193,7 @@ void WebFullScreenManagerMac::beginEnterFullScreenAnimation(float duration) // FIXME: Once we gain the ability to do native WebKit animations of generated // content, this can change to use them. Meanwhile, we'll have to animate the // CALayer directly: - CALayer* caLayer = m_fullScreenRootLayer->platformLayer(); + CALayer* caLayer = m_fullScreenRootLayer.get(); // Create a transformation matrix that will transform the renderer layer such that // the fullscreen element appears to move from its starting position and size to its @@ -245,7 +248,7 @@ void WebFullScreenManagerMac::beginExitFullScreenAnimation(float duration) // FIXME: Once we gain the ability to do native WebKit animations of generated // content, this can change to use them. Meanwhile, we'll have to animate the // CALayer directly: - CALayer* caLayer = m_fullScreenRootLayer->platformLayer(); + CALayer* caLayer = m_fullScreenRootLayer.get(); // Create a transformation matrix that will transform the renderer layer such that // the fullscreen element appears to move from its starting position and size to its diff --git a/src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index 06cf6c5..eed8fab 100644 --- a/src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/src/3rdparty/webkit/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -76,6 +76,7 @@ void InitWebCoreSystemInterface(void) INIT(QTMovieMaxTimeLoaded); INIT(QTMovieMaxTimeLoadedChangeNotification); INIT(QTMovieMaxTimeSeekable); + INIT(QTMovieResolvedURL); INIT(QTMovieSelectPreferredAlternates); INIT(QTMovieSetShowClosedCaptions); INIT(QTMovieViewSetDrawSynchronously); @@ -144,6 +145,7 @@ void InitWebCoreSystemInterface(void) INIT(DidBeginScrollGesture); INIT(DidEndScrollGesture); INIT(ScrollbarPainterUsesOverlayScrollers); + INIT(AVAssetResolvedURL); #else INIT(GetHyphenationLocationBeforeIndex); INIT(GetNSEventMomentumPhase); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index c04db56..5f803b4 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - dbda3e9596b836ab6eb88c500766dba6745759be + 4e7dfbab30278b0427e699baaadbf3e5aab88203 diff --git a/src/3rdparty/webkit/WebKitLibraries/ChangeLog b/src/3rdparty/webkit/WebKitLibraries/ChangeLog index 7fd8370..9b61400 100644 --- a/src/3rdparty/webkit/WebKitLibraries/ChangeLog +++ b/src/3rdparty/webkit/WebKitLibraries/ChangeLog @@ -1,3 +1,18 @@ +2011-05-25 Jer Noble <jer.noble@apple.com> + + Reviewed by Darin Adler. + + Video fails to play on Vimeo + https://bugs.webkit.org/show_bug.cgi?id=61403 + + Added functions to retrieve the resolved URL for media types supported on + mac. + + * WebKitSystemInterface.h: + * WebKitSystemInterface.m: + (WKAVAssetResolvedURL): Added. + (WKQTMovieResolvedURL): Added. + 2011-04-29 Jer Noble <jer.noble@apple.com> Reviewed by Eric Seidel. diff --git a/src/3rdparty/webkit/WebKitLibraries/WebKitSystemInterface.h b/src/3rdparty/webkit/WebKitLibraries/WebKitSystemInterface.h index 64c387a..5ca5a8c 100644 --- a/src/3rdparty/webkit/WebKitLibraries/WebKitSystemInterface.h +++ b/src/3rdparty/webkit/WebKitLibraries/WebKitSystemInterface.h @@ -10,6 +10,7 @@ @class QTMovie; @class QTMovieView; +@class AVAsset; #ifdef __cplusplus extern "C" { @@ -206,6 +207,7 @@ float WKQTMovieMaxTimeSeekable(QTMovie* movie); NSString *WKQTMovieMaxTimeLoadedChangeNotification(void); void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync); void WKQTMovieDisableComponent(uint32_t[5]); +NSURL *WKQTMovieResolvedURL(QTMovie* movie); CFStringRef WKCopyFoundationCacheDirectory(void); @@ -452,6 +454,7 @@ NSRange WKExtractWordDefinitionTokenRangeFromContextualString(NSString *contextS void WKShowWordDefinitionWindow(NSAttributedString *term, NSPoint screenPoint, NSDictionary *options); void WKHideWordDefinitionWindow(void); +NSURL* WKAVAssetResolvedURL(AVAsset*); #endif #ifdef __cplusplus |