Diff
Modified: trunk/Source/WebCore/ChangeLog (197460 => 197461)
--- trunk/Source/WebCore/ChangeLog 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/ChangeLog 2016-03-02 20:59:28 UTC (rev 197461)
@@ -1,3 +1,60 @@
+2016-03-02 Beth Dakin <[email protected]>
+
+ Add support for playbackControlsManager
+ https://bugs.webkit.org/show_bug.cgi?id=154742
+ -and corresponding-
+ rdar://problem/23833753
+
+ Reviewed by Jer Noble.
+
+ Make AVKitSPI.h private so that it can be used from other projects.
+ * WebCore.xcodeproj/project.pbxproj:
+
+ Right now, set up a controls manager for a video when it starts playing. In
+ the future, this is something that should be handled by the
+ PlatformMediaSessionManager since we only want a controls for the
+ currentSession.
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::playInternal):
+
+ New function setUpVideoControlsManager.
+ * page/ChromeClient.h:
+
+ Make these CoreMedia functions available on Mac and iOS instead of just iOS.
+ * platform/cf/CoreMediaSoftLink.cpp:
+ * platform/cf/CoreMediaSoftLink.h:
+
+ This patch fleshes out an implementation for a bunch of these interface
+ functions since they need to communicate to the playbackControlsManager. This
+ is also where the playbackControlsManager lives.
+ * platform/mac/WebVideoFullscreenInterfaceMac.h:
+
+ Define an interface and implementation for WebPlaybackControlsManager.
+ * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+ (-[WebPlaybackControlsManager initWithWebVideoFullscreenInterfaceMac:]):
+ (-[WebPlaybackControlsManager isSeeking]):
+ (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
+ (-[WebPlaybackControlsManager audioMediaSelectionOptions]):
+ (-[WebPlaybackControlsManager currentAudioMediaSelectionOption]):
+ (-[WebPlaybackControlsManager setCurrentAudioMediaSelectionOption:]):
+ (-[WebPlaybackControlsManager legibleMediaSelectionOptions]):
+ (-[WebPlaybackControlsManager currentLegibleMediaSelectionOption]):
+ (-[WebPlaybackControlsManager setCurrentLegibleMediaSelectionOption:]):
+ (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):
+
+ Relay this information to the playbackControlsManager.
+ (WebCore::WebVideoFullscreenInterfaceMac::setDuration):
+ (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime):
+ (WebCore::WebVideoFullscreenInterfaceMac::setRate):
+ (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges):
+ (WebCore::WebVideoFullscreenInterfaceMac::ensureControlsManager):
+ (WebCore::WebVideoFullscreenInterfaceMac::playBackControlsManager):
+ (WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):
+
+ New SPI needed.
+ * platform/spi/cocoa/AVKitSPI.h:
+ * platform/spi/mac/AVFoundationSPI.h:
+
2016-03-02 Gavin Barraclough <[email protected]>
Add Page::TimerThrottlingState
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (197460 => 197461)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-03-02 20:59:28 UTC (rev 197461)
@@ -329,7 +329,7 @@
07EE76EC1BE96DB000F89133 /* MockRealtimeVideoSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76EA1BE96DB000F89133 /* MockRealtimeVideoSource.h */; };
07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */; };
07EE76F01BEA619800F89133 /* MockRealtimeVideoSourceMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07EE76EE1BEA619800F89133 /* MockRealtimeVideoSourceMac.mm */; };
- 07F0B97A1AC5DB3300E535D9 /* AVKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B9791AC5DB3300E535D9 /* AVKitSPI.h */; };
+ 07F0B97A1AC5DB3300E535D9 /* AVKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B9791AC5DB3300E535D9 /* AVKitSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
07F0B97C1AC5DB4600E535D9 /* AVFoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
07F944161864D046005D31CB /* PlatformMediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAE8C081746B95700532D78 /* PlatformMediaSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (197460 => 197461)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-03-02 20:59:28 UTC (rev 197461)
@@ -2959,6 +2959,14 @@
return;
}
+ // FIXME: rdar://problem/23833752 We need to be more strategic about when we set up the video controls manager.
+ // It's really something that should be handled by the PlatformMediaSessionManager since we only want a controls
+ // manager for the currentSession.
+ if (document().page() && is<HTMLVideoElement>(*this)) {
+ HTMLVideoElement& asVideo = downcast<HTMLVideoElement>(*this);
+ document().page()->chrome().client().setUpVideoControlsManager(asVideo);
+ }
+
// 4.8.10.9. Playing the media resource
if (!m_player || m_networkState == NETWORK_EMPTY)
scheduleDelayedAction(LoadMediaResource);
Modified: trunk/Source/WebCore/page/ChromeClient.h (197460 => 197461)
--- trunk/Source/WebCore/page/ChromeClient.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/page/ChromeClient.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -341,6 +341,7 @@
virtual bool supportsVideoFullscreen(HTMLMediaElementEnums::VideoFullscreenMode) { return false; }
#if ENABLE(VIDEO)
virtual void enterVideoFullscreenForVideoElement(HTMLVideoElement&, HTMLMediaElementEnums::VideoFullscreenMode) { }
+ virtual void setUpVideoControlsManager(HTMLVideoElement&) { }
#endif
virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) { }
virtual bool requiresFullscreenForVideoPlayback() { return false; }
Modified: trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp (197460 => 197461)
--- trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp 2016-03-02 20:59:28 UTC (rev 197461)
@@ -45,6 +45,7 @@
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMake, CMTime, (int64_t value, int32_t timescale), (value, timescale))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMakeWithSeconds, CMTime, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeGetEnd, CMTime, (CMTimeRange range), (range))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreMedia, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, CFStringRef)
SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreMedia, kCMTextMarkupAlignmentType_End, CFStringRef)
@@ -113,7 +114,6 @@
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMaximum, CMTime, (CMTime time1, CMTime time2), (time1, time2))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMinimum, CMTime, (CMTime time1, CMTime time2), (time1, time2))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeContainsTime, Boolean, (CMTimeRange range, CMTime time), (range, time))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeSubtract, CMTime, (CMTime minuend, CMTime subtrahend), (minuend, subtrahend))
SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreMedia, kCMTimeIndefinite, CMTime)
Modified: trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h (197460 => 197461)
--- trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -59,6 +59,8 @@
#define CMTimeMakeWithSeconds softLink_CoreMedia_CMTimeMakeWithSeconds
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeGetEnd, CMTime, (CMTimeRange range), (range))
#define CMTimeRangeGetEnd softLink_CoreMedia_CMTimeRangeGetEnd
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
+#define CMTimeRangeMake softLink_CoreMedia_CMTimeRangeMake
SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreMedia, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, CFStringRef)
#define kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms get_CoreMedia_kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms()
@@ -191,8 +193,6 @@
#define CMTimeMinimum softLink_CoreMedia_CMTimeMinimum
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeContainsTime, Boolean, (CMTimeRange range, CMTime time), (range, time))
#define CMTimeRangeContainsTime softLink_CoreMedia_CMTimeRangeContainsTime
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
-#define CMTimeRangeMake softLink_CoreMedia_CMTimeRangeMake
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeSubtract, CMTime, (CMTime minuend, CMTime subtrahend), (minuend, subtrahend))
#define CMTimeSubtract softLink_CoreMedia_CMTimeSubtract
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h (197460 => 197461)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -35,6 +35,7 @@
#include <wtf/text/WTFString.h>
OBJC_CLASS NSWindow;
+OBJC_CLASS WebPlaybackControlsManager;
#if USE(APPLE_INTERNAL_SDK)
OBJC_CLASS WebVideoFullscreenInterfaceMacObjC;
@@ -61,12 +62,12 @@
WEBCORE_EXPORT void setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver*);
WEBCORE_EXPORT void resetMediaState() override { }
- WEBCORE_EXPORT void setDuration(double) override { }
- WEBCORE_EXPORT void setCurrentTime(double /*currentTime*/, double /*anchorTime*/) override { }
+ WEBCORE_EXPORT void setDuration(double) override;
+ WEBCORE_EXPORT void setCurrentTime(double /*currentTime*/, double /*anchorTime*/) override;
WEBCORE_EXPORT void setBufferedTime(double) override { }
- WEBCORE_EXPORT void setRate(bool /*isPlaying*/, float /*playbackRate*/) override { }
+ WEBCORE_EXPORT void setRate(bool /*isPlaying*/, float /*playbackRate*/) override;
WEBCORE_EXPORT void setVideoDimensions(bool /*hasVideo*/, float /*width*/, float /*height*/) override { }
- WEBCORE_EXPORT void setSeekableRanges(const TimeRanges&) override { }
+ WEBCORE_EXPORT void setSeekableRanges(const TimeRanges&) override;
WEBCORE_EXPORT void setCanPlayFastReverse(bool) override { }
WEBCORE_EXPORT void setAudioMediaSelectionOptions(const Vector<WTF::String>& /*options*/, uint64_t /*selectedIndex*/) override { }
WEBCORE_EXPORT void setLegibleMediaSelectionOptions(const Vector<WTF::String>& /*options*/, uint64_t /*selectedIndex*/) override { }
@@ -80,6 +81,7 @@
WEBCORE_EXPORT void invalidate();
WEBCORE_EXPORT void requestHideAndExitFullscreen() { }
WEBCORE_EXPORT void preparedToReturnToInline(bool visible, const IntRect& inlineRect, NSWindow *parentWindow);
+ WEBCORE_EXPORT void ensureControlsManager();
HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
bool hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode & mode; }
@@ -90,6 +92,8 @@
WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const { return false; }
void applicationDidBecomeActive() { }
+ WEBCORE_EXPORT WebPlaybackControlsManager *playBackControlsManager();
+
private:
WebVideoFullscreenModel* m_videoFullscreenModel { nullptr };
WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr };
@@ -98,6 +102,7 @@
#if USE(APPLE_INTERNAL_SDK)
RetainPtr<WebVideoFullscreenInterfaceMacObjC> m_webVideoFullscreenInterfaceObjC;
#endif
+ RetainPtr<WebPlaybackControlsManager> m_playbackControlsManager;
};
}
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (197460 => 197461)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm 2016-03-02 20:59:28 UTC (rev 197461)
@@ -28,14 +28,128 @@
#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#import "AVKitSPI.h"
+#import "CoreMediaSoftLink.h"
#import "IntRect.h"
+#import "MediaTimeAVFoundation.h"
+#import "TimeRanges.h"
#import "WebVideoFullscreenChangeObserver.h"
#import "WebVideoFullscreenModel.h"
+#import <AVFoundation/AVTime.h>
+#import "SoftLinking.h"
+
+SOFT_LINK_FRAMEWORK(AVKit)
+SOFT_LINK_CLASS(AVKit, AVValueTiming)
+
#if USE(APPLE_INTERNAL_SDK)
#include <WebKitAdditions/WebVideoFullscreenInterfaceMacAdditions.mm>
#endif
+using namespace WebCore;
+
+@interface WebPlaybackControlsManager : NSObject {
+ NSTimeInterval _contentDuration;
+ AVValueTiming *_timing;
+ NSTimeInterval _seekToTime;
+ NSArray *_seekableTimeRanges;
+ BOOL _hasEnabledAudio;
+ BOOL _hasEnabledVideo;
+ float _rate;
+
+@private
+ WebCore::WebVideoFullscreenInterfaceMac* _webVideoFullscreenInterfaceMac;
+}
+
+@property (readwrite) NSTimeInterval contentDuration;
+@property (nonatomic, retain, readwrite) AVValueTiming *timing;
+@property NSTimeInterval seekToTime;
+@property (nonatomic, retain, readwrite) NSArray *seekableTimeRanges;
+@property (readwrite) BOOL hasEnabledAudio;
+@property (readwrite) BOOL hasEnabledVideo;
+
+@property (nonatomic) float rate;
+
+- (instancetype)initWithWebVideoFullscreenInterfaceMac:(WebCore::WebVideoFullscreenInterfaceMac*)webVideoFullscreenInterfaceMac;
+
+@end
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.mm>
+#endif
+
+@implementation WebPlaybackControlsManager
+
+@synthesize contentDuration=_contentDuration;
+@synthesize timing=_timing;
+@synthesize seekToTime=_seekToTime;
+@synthesize seekableTimeRanges=_seekableTimeRanges;
+@synthesize hasEnabledAudio=_hasEnabledAudio;
+@synthesize hasEnabledVideo=_hasEnabledVideo;
+@synthesize rate=_rate;
+
+- (instancetype)initWithWebVideoFullscreenInterfaceMac:(WebCore::WebVideoFullscreenInterfaceMac*)webVideoFullscreenInterfaceMac
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _webVideoFullscreenInterfaceMac = webVideoFullscreenInterfaceMac;
+
+ return self;
+}
+
+- (BOOL)isSeeking
+{
+ return NO;
+}
+
+- (void)seekToTime:(NSTimeInterval)time toleranceBefore:(NSTimeInterval)toleranceBefore toleranceAfter:(NSTimeInterval)toleranceAfter
+{
+ UNUSED_PARAM(toleranceBefore);
+ UNUSED_PARAM(toleranceAfter);
+ _webVideoFullscreenInterfaceMac->webVideoFullscreenModel()->seekToTime(time);
+}
+
+- (NSArray *)audioMediaSelectionOptions
+{
+ return @[];
+}
+
+- (AVMediaSelectionOption *)currentAudioMediaSelectionOption
+{
+ return nil;
+}
+
+- (void)setCurrentAudioMediaSelectionOption:(AVMediaSelectionOption *)audioMediaSelectionOption
+{
+ UNUSED_PARAM(audioMediaSelectionOption);
+}
+
+- (NSArray *)legibleMediaSelectionOptions
+{
+ return @[];
+}
+
+- (AVMediaSelectionOption *)currentLegibleMediaSelectionOption
+{
+ return nil;
+}
+
+- (void)setCurrentLegibleMediaSelectionOption:(AVMediaSelectionOption *)legibleMediaSelectionOption
+{
+ UNUSED_PARAM(legibleMediaSelectionOption);
+}
+
+- (void)cancelThumbnailAndAudioAmplitudeSampleGeneration
+{
+}
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WebPlaybackControlsControllerThumbnailAdditions.mm>
+#endif
+
+@end
+
namespace WebCore {
WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac()
@@ -74,6 +188,66 @@
m_videoFullscreenModel->fullscreenModeChanged(m_mode);
}
+void WebVideoFullscreenInterfaceMac::setDuration(double duration)
+{
+ WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+ controlsManager.contentDuration = duration;
+
+ // FIXME: We take this as an indication that playback is ready, but that is not necessarily true.
+ controlsManager.hasEnabledAudio = YES;
+ controlsManager.hasEnabledVideo = YES;
+}
+
+void WebVideoFullscreenInterfaceMac::setCurrentTime(double currentTime, double anchorTime)
+{
+ WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+ NSTimeInterval anchorTimeStamp = ![controlsManager rate] ? NAN : anchorTime;
+ AVValueTiming *timing = [getAVValueTimingClass() valueTimingWithAnchorValue:currentTime
+ anchorTimeStamp:anchorTimeStamp rate:0];
+
+ [controlsManager setTiming:timing];
+}
+
+void WebVideoFullscreenInterfaceMac::setRate(bool isPlaying, float playbackRate)
+{
+ WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+ [controlsManager setRate:isPlaying ? playbackRate : 0.];
+}
+
+void WebVideoFullscreenInterfaceMac::setSeekableRanges(const TimeRanges& timeRanges)
+{
+ WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+ RetainPtr<NSMutableArray> seekableRanges = adoptNS([[NSMutableArray alloc] init]);
+
+ for (unsigned i = 0; i < timeRanges.length(); i++) {
+ const PlatformTimeRanges& ranges = timeRanges.ranges();
+ CMTimeRange range = CMTimeRangeMake(toCMTime(ranges.start(i)), toCMTime(ranges.end(i)));
+ [seekableRanges addObject:[NSValue valueWithCMTimeRange:range]];
+ }
+
+ [controlsManager setSeekableTimeRanges:seekableRanges.get()];
+}
+
+void WebVideoFullscreenInterfaceMac::ensureControlsManager()
+{
+ playBackControlsManager();
+}
+
+WebPlaybackControlsManager *WebVideoFullscreenInterfaceMac::playBackControlsManager()
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ if (!m_playbackControlsManager)
+ m_playbackControlsManager = adoptNS([[WebPlaybackControlsManager alloc] initWithWebVideoFullscreenInterfaceMac:this]);
+ return m_playbackControlsManager.get();
+#else
+ return nil;
+#endif
+}
+
#if !USE(APPLE_INTERNAL_SDK)
void WebVideoFullscreenInterfaceMac::setupFullscreen(NSView&, const IntRect&, NSWindow *, HTMLMediaElementEnums::VideoFullscreenMode, bool)
{
Modified: trunk/Source/WebCore/platform/spi/cocoa/AVKitSPI.h (197460 => 197461)
--- trunk/Source/WebCore/platform/spi/cocoa/AVKitSPI.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/spi/cocoa/AVKitSPI.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -101,15 +101,6 @@
@end
#endif // USE(APPLE_INTERNAL_SDK)
-
-@interface AVValueTiming : NSObject <NSCoding, NSCopying, NSMutableCopying>
-@end
-
-@interface AVValueTiming ()
-+ (AVValueTiming *)valueTimingWithAnchorValue:(double)anchorValue anchorTimeStamp:(NSTimeInterval)timeStamp rate:(double)rate;
-@property (NS_NONATOMIC_IOSONLY, readonly) double currentValue;
-@end
-
#endif // PLATFORM(IOS)
#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
@@ -144,6 +135,14 @@
@end
-#endif
+#endif // USE(APPLE_INTERNAL_SDK)
-#endif
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+
+@interface AVValueTiming : NSObject <NSCoding, NSCopying, NSMutableCopying>
+@end
+
+@interface AVValueTiming ()
++ (AVValueTiming *)valueTimingWithAnchorValue:(double)anchorValue anchorTimeStamp:(NSTimeInterval)timeStamp rate:(double)rate;
+@property (NS_NONATOMIC_IOSONLY, readonly) double currentValue;
+@end
Modified: trunk/Source/WebKit2/ChangeLog (197460 => 197461)
--- trunk/Source/WebKit2/ChangeLog 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-02 20:59:28 UTC (rev 197461)
@@ -1,3 +1,48 @@
+2016-03-02 Beth Dakin <[email protected]>
+
+ Add support for playbackControlsManager
+ https://bugs.webkit.org/show_bug.cgi?id=154742
+ -and corresponding-
+ rdar://problem/23833753
+
+ Reviewed by Jer Noble.
+
+ WebVideoFullscreenManagerProxy ensures the model and interface for the
+ UIProcess side of the playbackControlsManager. It also caches the
+ m_controlsManagerContextId so that it can return the
+ controlsManagerInterface.
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+ (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
+ (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
+
+ Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to
+ update WebViewImplAdditions.
+ * UIProcess/Cocoa/WebViewImpl.h:
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::isPlayingMediaDidChange):
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::isPlayingMediaDidChange):
+ (WebKit::WebPageProxy::isPlayingVideoWithAudio):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::isPlayingAudio):
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::isPlayingMediaDidChange):
+
+ Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::setUpVideoControlsManager):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+
+ Ensure the model an interface for the playbackControlsManager on the
+ WebProcess side and pass the message to the UIProcess to do the same.
+ * WebProcess/cocoa/WebVideoFullscreenManager.h:
+ * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+ (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
+
2016-03-02 Carlos Garcia Campos <[email protected]>
REGRESSION(r197409): [GTK] Web process always crashes on WebPage construction after r197409
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -119,6 +119,8 @@
void applicationDidBecomeActive();
bool isVisible() const;
+ PlatformWebVideoFullscreenInterface& controlsManagerInterface();
+
private:
friend class WebVideoFullscreenModelContext;
@@ -133,6 +135,7 @@
// Messages from WebVideoFullscreenManager
void setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture);
+ void setUpVideoControlsManagerWithID(uint64_t contextId);
void resetMediaState(uint64_t contextId);
void setCurrentTime(uint64_t contextId, double currentTime, double hostTime);
void setBufferedTime(uint64_t contextId, double bufferedTime);
@@ -175,6 +178,7 @@
WebPageProxy* m_page;
HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
+ uint64_t m_controlsManagerContextId { 0 };
};
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in 2016-03-02 20:59:28 UTC (rev 197461)
@@ -39,5 +39,6 @@
ExitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
CleanupFullscreen(uint64_t contextId)
PreparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
+ SetUpVideoControlsManagerWithID(uint64_t contextId)
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm 2016-03-02 20:59:28 UTC (rev 197461)
@@ -374,6 +374,24 @@
#endif
}
+void WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID(uint64_t contextId)
+{
+#if PLATFORM(MAC)
+ // If there is an existing controls manager, clean it up.
+ if (m_controlsManagerContextId)
+ m_contextMap.remove(m_controlsManagerContextId);
+
+ RefPtr<WebVideoFullscreenModelContext> model;
+ RefPtr<PlatformWebVideoFullscreenInterface> interface;
+
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ m_controlsManagerContextId = contextId;
+ interface->ensureControlsManager();
+#else
+ UNUSED_PARAM(contextId);
+#endif
+}
+
void WebVideoFullscreenManagerProxy::resetMediaState(uint64_t contextId)
{
ensureInterface(contextId).resetMediaState();
@@ -615,6 +633,11 @@
return m_page->isViewVisible() && m_page->isInWindow();
}
+PlatformWebVideoFullscreenInterface& WebVideoFullscreenManagerProxy::controlsManagerInterface()
+{
+ return ensureInterface(m_controlsManagerContextId);
+}
+
void WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline(uint64_t contextId)
{
bool isViewVisible = m_page->isViewVisible();
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -324,6 +324,7 @@
void completeImmediateActionAnimation();
void didChangeContentSize(CGSize);
void didHandleAcceptedCandidate();
+ void isPlayingMediaDidChange();
void setIgnoresNonWheelEvents(bool);
bool ignoresNonWheelEvents() const { return m_ignoresNonWheelEvents; }
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm 2016-03-02 20:59:28 UTC (rev 197461)
@@ -2371,6 +2371,13 @@
m_isHandlingAcceptedCandidate = false;
}
+void WebViewImpl::isPlayingMediaDidChange()
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ updateWebViewImplAdditions();
+#endif
+}
+
void WebViewImpl::setIgnoresNonWheelEvents(bool ignoresNonWheelEvents)
{
if (m_ignoresNonWheelEvents == ignoresNonWheelEvents)
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -350,6 +350,8 @@
virtual void* immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) = 0;
virtual void didHandleAcceptedCandidate() = 0;
+
+ virtual void isPlayingMediaDidChange() = 0;
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-03-02 20:59:28 UTC (rev 197461)
@@ -5994,9 +5994,17 @@
if ((oldState & MediaProducer::IsPlayingAudio) == (m_mediaState & MediaProducer::IsPlayingAudio))
return;
+#if PLATFORM(MAC)
+ m_pageClient.isPlayingMediaDidChange();
+#endif
m_uiClient->isPlayingAudioDidChange(*this);
}
+bool WebPageProxy::isPlayingVideoWithAudio() const
+{
+ return m_mediaState & MediaProducer::IsPlayingAudio && m_mediaState & MediaProducer::IsPlayingVideo;
+}
+
#if ENABLE(MEDIA_SESSION)
void WebPageProxy::hasMediaSessionWithActiveMediaElementsDidChange(bool state)
{
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -1014,6 +1014,8 @@
bool isPlayingAudio() const { return !!(m_mediaState & WebCore::MediaProducer::IsPlayingAudio); }
void isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags, uint64_t);
+ bool isPlayingVideoWithAudio() const;
+
#if ENABLE(MEDIA_SESSION)
void hasMediaSessionWithActiveMediaElementsDidChange(bool);
void mediaSessionMetadataDidChange(const WebCore::MediaSessionMetadata&);
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -214,6 +214,8 @@
virtual void didHandleAcceptedCandidate() override;
+ void isPlayingMediaDidChange() override;
+
virtual void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) override;
virtual void didChangeBackgroundColor() override;
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (197460 => 197461)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2016-03-02 20:59:28 UTC (rev 197461)
@@ -794,6 +794,11 @@
m_impl->didHandleAcceptedCandidate();
}
+void PageClientImpl::isPlayingMediaDidChange()
+{
+ m_impl->isPlayingMediaDidChange();
+}
+
void PageClientImpl::showPlatformContextMenu(NSMenu *menu, IntPoint location)
{
[menu popUpMenuPositioningItem:nil atLocation:location inView:m_view];
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (197460 => 197461)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-03-02 20:59:28 UTC (rev 197461)
@@ -855,6 +855,11 @@
return m_page->videoFullscreenManager()->supportsVideoFullscreen(mode);
}
+void WebChromeClient::setUpVideoControlsManager(WebCore::HTMLVideoElement& videoElement)
+{
+ m_page->videoFullscreenManager()->setUpVideoControlsManager(videoElement);
+}
+
void WebChromeClient::enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
{
ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone);
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (197460 => 197461)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -244,6 +244,7 @@
#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
virtual bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
+ virtual void setUpVideoControlsManager(WebCore::HTMLVideoElement&) override;
virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) override;
#endif
Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h (197460 => 197461)
--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h 2016-03-02 20:59:28 UTC (rev 197461)
@@ -116,6 +116,7 @@
bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&);
+ void setUpVideoControlsManager(WebCore::HTMLVideoElement&);
protected:
friend class WebVideoFullscreenInterfaceContext;
@@ -168,6 +169,7 @@
WebPage* m_page;
HashMap<WebCore::HTMLVideoElement*, uint64_t> m_videoElements;
HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
+ uint64_t m_controlsManagerContextId { 0 };
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (197460 => 197461)
--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm 2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm 2016-03-02 20:59:28 UTC (rev 197461)
@@ -279,6 +279,34 @@
m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, clientRectForElement(&videoElement)), m_page->pageID());
}
+void WebVideoFullscreenManager::setUpVideoControlsManager(WebCore::HTMLVideoElement& videoElement)
+{
+ // If there is an existing controls manager, clean it up.
+ if (m_controlsManagerContextId) {
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(m_controlsManagerContextId);
+
+ RefPtr<HTMLVideoElement> videoElement = model->videoElement();
+ model->setVideoElement(nullptr);
+ model->setWebVideoFullscreenInterface(nullptr);
+ interface->invalidate();
+ m_videoElements.remove(videoElement.get());
+ m_contextMap.remove(m_controlsManagerContextId);
+ }
+
+ auto addResult = m_videoElements.ensure(&videoElement, [&] { return nextContextId(); });
+ auto contextId = addResult.iterator->value;
+ m_controlsManagerContextId = contextId;
+
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setVideoElement(&videoElement);
+
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetUpVideoControlsManagerWithID(contextId), m_page->pageID());
+}
+
#pragma mark Interface to WebVideoFullscreenInterfaceContext:
void WebVideoFullscreenManager::resetMediaState(uint64_t contextId)