Title: [196252] trunk/Source/WebCore
- Revision
- 196252
- Author
- commit-qu...@webkit.org
- Date
- 2016-02-08 08:46:12 -0800 (Mon, 08 Feb 2016)
Log Message
WebVideoFullscreenInterface should handle video resizing.
https://bugs.webkit.org/show_bug.cgi?id=153982
rdar://problem/22031249
Patch by Jeremy Jones <jere...@apple.com> on 2016-02-08
Reviewed by Eric Carlson.
Video fullscreen can be initiated before video dimension are available.
Protect against an initial width or height of zero and observe resize events
to update once video dimensions become available or change.
* platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
(WebVideoFullscreenModelVideoElement::updateForEventName):
(WebVideoFullscreenModelVideoElement::observedEventNames):
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerLayer layoutSublayers]):
(-[WebAVPlayerLayer videoRect]):
(WebVideoFullscreenInterfaceAVKit::setVideoDimensions):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (196251 => 196252)
--- trunk/Source/WebCore/ChangeLog 2016-02-08 16:25:22 UTC (rev 196251)
+++ trunk/Source/WebCore/ChangeLog 2016-02-08 16:46:12 UTC (rev 196252)
@@ -1,3 +1,23 @@
+2016-02-08 Jeremy Jones <jere...@apple.com>
+
+ WebVideoFullscreenInterface should handle video resizing.
+ https://bugs.webkit.org/show_bug.cgi?id=153982
+ rdar://problem/22031249
+
+ Reviewed by Eric Carlson.
+
+ Video fullscreen can be initiated before video dimension are available.
+ Protect against an initial width or height of zero and observe resize events
+ to update once video dimensions become available or change.
+
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
+ (WebVideoFullscreenModelVideoElement::updateForEventName):
+ (WebVideoFullscreenModelVideoElement::observedEventNames):
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (-[WebAVPlayerLayer layoutSublayers]):
+ (-[WebAVPlayerLayer videoRect]):
+ (WebVideoFullscreenInterfaceAVKit::setVideoDimensions):
+
2016-02-08 Adrien Plazas <apla...@igalia.com>
Indent inline box test fails due to assertion in VisibleSelection::selectionFromContentsOfNode()
Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm (196251 => 196252)
--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm 2016-02-08 16:25:22 UTC (rev 196251)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm 2016-02-08 16:46:12 UTC (rev 196252)
@@ -147,6 +147,10 @@
|| eventName == eventNames().addtrackEvent
|| eventName == eventNames().removetrackEvent)
updateLegibleOptions();
+
+ if (all
+ || eventName == eventNames().resizeEvent)
+ m_videoFullscreenInterface->setVideoDimensions(true, m_videoElement->videoWidth(), m_videoElement->videoHeight());
if (all
|| eventName == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent) {
@@ -374,6 +378,7 @@
sEventNames.get().append(eventNames().timeupdateEvent);
sEventNames.get().append(eventNames().addtrackEvent);
sEventNames.get().append(eventNames().removetrackEvent);
+ sEventNames.get().append(eventNames().resizeEvent);
sEventNames.get().append(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
}
return sEventNames.get();
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (196251 => 196252)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2016-02-08 16:25:22 UTC (rev 196251)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2016-02-08 16:46:12 UTC (rev 196252)
@@ -687,6 +687,9 @@
[_videoSublayer setPosition:CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds))];
+ if (self.videoDimensions.height <= 0 || self.videoDimensions.width <= 0)
+ return;
+
FloatRect sourceVideoFrame;
FloatRect targetVideoFrame;
float videoAspectRatio = self.videoDimensions.width / self.videoDimensions.height;
@@ -711,7 +714,7 @@
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(resolveBounds) object:nil];
- if (!CGAffineTransformEqualToTransform(CGAffineTransformIdentity, transform))
+ if (!CGAffineTransformIsIdentity(transform))
[self performSelector:@selector(resolveBounds) withObject:nil afterDelay:[CATransaction animationDuration] + 0.1];
}
@@ -762,8 +765,11 @@
- (CGRect)videoRect
{
+ if (self.videoDimensions.width <= 0 || self.videoDimensions.height <= 0)
+ return self.bounds;
+
float videoAspectRatio = self.videoDimensions.width / self.videoDimensions.height;
-
+
if ([getAVLayerVideoGravityResizeAspect() isEqualToString:self.videoGravity])
return largestRectWithAspectRatioInsideRect(videoAspectRatio, self.bounds);
if ([getAVLayerVideoGravityResizeAspectFill() isEqualToString:self.videoGravity])
@@ -975,6 +981,7 @@
NSTimeInterval anchorTimeStamp = ![m_playerController rate] ? NAN : anchorTime;
AVValueTiming *timing = [getAVValueTimingClass() valueTimingWithAnchorValue:currentTime
anchorTimeStamp:anchorTimeStamp rate:0];
+
[m_playerController setTiming:timing];
}
@@ -1002,6 +1009,12 @@
[playerLayer setVideoDimensions:CGSizeMake(width, height)];
[m_playerController setHasEnabledVideo:hasVideo];
[m_playerController setContentDimensions:CGSizeMake(width, height)];
+ [m_playerLayerView setNeedsLayout];
+
+ WebAVPictureInPicturePlayerLayerView *pipView = (WebAVPictureInPicturePlayerLayerView *)[m_playerLayerView pictureInPicturePlayerLayerView];
+ WebAVPlayerLayer *pipPlayerLayer = (WebAVPlayerLayer *)[pipView layer];
+ [pipPlayerLayer setVideoDimensions:playerLayer.videoDimensions];
+ [pipView setNeedsLayout];
}
void WebVideoFullscreenInterfaceAVKit::setSeekableRanges(const TimeRanges& timeRanges)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes