Title: [183155] trunk/Source/WebCore
- Revision
- 183155
- Author
- [email protected]
- Date
- 2015-04-22 16:28:48 -0700 (Wed, 22 Apr 2015)
Log Message
Add new optimized fullscreen delegate methods
https://bugs.webkit.org/show_bug.cgi?id=144071
Reviewed by Eric Carlson.
AVPlayerViewController requires three new delegate methods to be implemented by WebKit which
notify the delegates exactly when the owning view will enter and leave fullscreen mode. One
of the delegate methods (-enterOptimizedFullScreenModeRedirectingVideoToLayer:) gives the
delegate an opportunity to move the video sublayer into a new CALayer. The matching delegate
(-leaveOptimizedFullScreenMode), allows us to return our sublayer back to its original parent.
The third delegate (-isOptimizedFullscreenPossible) is required so the AVPlayerViewController
knows whether to allow a standard -> optimized fullscreen transition.
Drive-by fix: initialize ivars at declaration time.
* platform/ios/WebVideoFullscreenInterfaceAVKit.h:
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerController isOptimizedFullscreenPossible]):
(-[WebAVVideoLayer enterOptimizedFullScreenModeRedirectingVideoToLayer:]):
(-[WebAVVideoLayer leaveOptimizedFullScreenMode]):
(WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit):
(WebVideoFullscreenInterfaceAVKit::setupFullscreenInternal):
(+[WebAVPlayerController keyPathsForValuesAffectingPlayingOnExternalScreen]): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (183154 => 183155)
--- trunk/Source/WebCore/ChangeLog 2015-04-22 23:23:14 UTC (rev 183154)
+++ trunk/Source/WebCore/ChangeLog 2015-04-22 23:28:48 UTC (rev 183155)
@@ -1,3 +1,29 @@
+2015-04-22 Jer Noble <[email protected]>
+
+ Add new optimized fullscreen delegate methods
+ https://bugs.webkit.org/show_bug.cgi?id=144071
+
+ Reviewed by Eric Carlson.
+
+ AVPlayerViewController requires three new delegate methods to be implemented by WebKit which
+ notify the delegates exactly when the owning view will enter and leave fullscreen mode. One
+ of the delegate methods (-enterOptimizedFullScreenModeRedirectingVideoToLayer:) gives the
+ delegate an opportunity to move the video sublayer into a new CALayer. The matching delegate
+ (-leaveOptimizedFullScreenMode), allows us to return our sublayer back to its original parent.
+ The third delegate (-isOptimizedFullscreenPossible) is required so the AVPlayerViewController
+ knows whether to allow a standard -> optimized fullscreen transition.
+
+ Drive-by fix: initialize ivars at declaration time.
+
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (-[WebAVPlayerController isOptimizedFullscreenPossible]):
+ (-[WebAVVideoLayer enterOptimizedFullScreenModeRedirectingVideoToLayer:]):
+ (-[WebAVVideoLayer leaveOptimizedFullScreenMode]):
+ (WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit):
+ (WebVideoFullscreenInterfaceAVKit::setupFullscreenInternal):
+ (+[WebAVPlayerController keyPathsForValuesAffectingPlayingOnExternalScreen]): Deleted.
+
2015-04-22 Myles C. Maxfield <[email protected]>
[iOS] Caret does not line up with text when using the system font
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (183154 => 183155)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2015-04-22 23:23:14 UTC (rev 183154)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2015-04-22 23:28:48 UTC (rev 183155)
@@ -97,6 +97,7 @@
WEBCORE_EXPORT virtual void preparedToReturnToInline(bool visible, const IntRect& inlineRect);
HTMLMediaElement::VideoFullscreenMode mode() const { return m_mode; }
+ bool allowOptimizedFullscreen() const { return m_allowOptimizedFullscreen; }
void setIsOptimized(bool);
WEBCORE_EXPORT bool mayAutomaticallyShowVideoOptimized() const;
void fullscreenMayReturnToInline(std::function<void(bool)> callback);
@@ -127,19 +128,20 @@
RetainPtr<AVPlayerViewController> m_playerViewController;
RetainPtr<CALayer> m_videoLayer;
RetainPtr<WebAVVideoLayer> m_videoLayerContainer;
- WebVideoFullscreenModel* m_videoFullscreenModel;
- WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver;
+ WebVideoFullscreenModel* m_videoFullscreenModel { nullptr };
+ WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr };
// These are only used when fullscreen is presented in a separate window.
RetainPtr<UIWindow> m_window;
RetainPtr<UIViewController> m_viewController;
RetainPtr<UIView> m_parentView;
RetainPtr<UIWindow> m_parentWindow;
- HTMLMediaElement::VideoFullscreenMode m_mode;
+ HTMLMediaElement::VideoFullscreenMode m_mode { HTMLMediaElement::VideoFullscreenModeNone };
std::function<void(bool)> m_prepareToInlineCallback;
- bool m_exitRequested;
- bool m_exitCompleted;
- bool m_enterRequested;
+ bool m_allowOptimizedFullscreen { false };
+ bool m_exitRequested { false };
+ bool m_exitCompleted { false };
+ bool m_enterRequested { false };
void doEnterFullscreen();
};
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (183154 => 183155)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2015-04-22 23:23:14 UTC (rev 183154)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2015-04-22 23:28:48 UTC (rev 183155)
@@ -552,6 +552,11 @@
{
return [NSSet setWithObjects:@"externalPlaybackActive", nil];
}
+
+- (BOOL)isOptimizedFullscreenPossible
+{
+ return self.fullscreenInterface->allowOptimizedFullscreen();
+}
@end
@interface WebAVMediaSelectionOption : NSObject
@@ -691,16 +696,21 @@
return _videoLayerGravity;
}
+- (void)enterOptimizedFullScreenModeRedirectingVideoToLayer:(CALayer *)layer
+{
+ [_videoSublayer removeFromSuperlayer];
+ [layer addSublayer:_videoSublayer.get()];
+}
+
+- (void)leaveOptimizedFullScreenMode
+{
+ [_videoSublayer removeFromSuperlayer];
+ [self addSublayer:_videoSublayer.get()];
+}
@end
WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit()
: m_playerController(adoptNS([[WebAVPlayerController alloc] init]))
- , m_videoFullscreenModel(nullptr)
- , m_fullscreenChangeObserver(nullptr)
- , m_mode(HTMLMediaElement::VideoFullscreenModeNone)
- , m_exitRequested(false)
- , m_exitCompleted(false)
- , m_enterRequested(false)
{
[m_playerController setFullscreenInterface:this];
}
@@ -904,6 +914,8 @@
UNUSED_PARAM(videoLayer);
UNUSED_PARAM(mode);
+ m_allowOptimizedFullscreen = allowOptimizedFullscreen;
+
[CATransaction begin];
[CATransaction setDisableActions:YES];
m_parentView = parentView;
@@ -1323,5 +1335,4 @@
m_videoFullscreenModel->fullscreenModeChanged(m_mode);
}
-
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes