Title: [220390] branches/safari-604-branch/Source/WebCore
- Revision
- 220390
- Author
- jmarc...@apple.com
- Date
- 2017-08-08 00:29:26 -0700 (Tue, 08 Aug 2017)
Log Message
Cherry-pick r220248. rdar://problem/33754458
Modified Paths
Diff
Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (220389 => 220390)
--- branches/safari-604-branch/Source/WebCore/ChangeLog 2017-08-08 07:29:22 UTC (rev 220389)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog 2017-08-08 07:29:26 UTC (rev 220390)
@@ -1,5 +1,29 @@
2017-08-08 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r220248. rdar://problem/33754458
+
+ 2017-08-03 Jeremy Jones <jere...@apple.com>
+
+ Improve WebKitLegacy video fullscreen animation begin and end rects.
+ https://bugs.webkit.org/show_bug.cgi?id=175152
+ rdar://problem/32840576
+
+ Reviewed by Eric Carlson.
+
+ No new tests, becuase this change has no effect on the DOM.
+
+ This change uses different rects for fullscreen animation to prevent the animation
+ from failing, and to improve the aesthetics of the animation.
+
+ * platform/mac/WebVideoFullscreenController.mm:
+ (frameExpandedToRatioOfFrame):
+ (-[WebVideoFullscreenController enterFullscreen:]):
+ (-[WebVideoFullscreenController exitFullscreen]):
+ (-[WebVideoFullscreenWindow animateFromRect:toRect:withSubAnimation:controllerAction:]):
+ (constrainFrameToRatioOfFrame): Deleted.
+
+2017-08-08 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r220247. rdar://problem/33754443
2017-08-03 Jer Noble <jer.no...@apple.com>
Modified: branches/safari-604-branch/Source/WebCore/platform/mac/WebVideoFullscreenController.mm (220389 => 220390)
--- branches/safari-604-branch/Source/WebCore/platform/mac/WebVideoFullscreenController.mm 2017-08-08 07:29:22 UTC (rev 220389)
+++ branches/safari-604-branch/Source/WebCore/platform/mac/WebVideoFullscreenController.mm 2017-08-08 07:29:26 UTC (rev 220390)
@@ -233,22 +233,24 @@
// MARK: -
// MARK: Exposed Interface
-static void constrainFrameToRatioOfFrame(NSRect *frameToConstrain, const NSRect *frame)
+static NSRect frameExpandedToRatioOfFrame(NSRect frameToExpand, NSRect frame)
{
// Keep a constrained aspect ratio for the destination window
- CGFloat originalRatio = frame->size.width / frame->size.height;
- CGFloat newRatio = frameToConstrain->size.width / frameToConstrain->size.height;
+ NSRect result = frameToExpand;
+ CGFloat newRatio = frame.size.width / frame.size.height;
+ CGFloat originalRatio = frameToExpand.size.width / frameToExpand.size.height;
if (newRatio > originalRatio) {
- CGFloat newWidth = originalRatio * frameToConstrain->size.height;
- CGFloat diff = frameToConstrain->size.width - newWidth;
- frameToConstrain->size.width = newWidth;
- frameToConstrain->origin.x += diff / 2;
+ CGFloat newWidth = newRatio * frameToExpand.size.height;
+ CGFloat diff = newWidth - frameToExpand.size.width;
+ result.size.width = newWidth;
+ result.origin.x -= diff / 2;
} else {
- CGFloat newHeight = frameToConstrain->size.width / originalRatio;
- CGFloat diff = frameToConstrain->size.height - newHeight;
- frameToConstrain->size.height = newHeight;
- frameToConstrain->origin.y += diff / 2;
- }
+ CGFloat newHeight = frameToExpand.size.width / newRatio;
+ CGFloat diff = newHeight - frameToExpand.size.height;
+ result.size.height = newHeight;
+ result.origin.y -= diff / 2;
+ }
+ return result;
}
static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level)
@@ -277,9 +279,8 @@
if (!screen)
screen = [NSScreen mainScreen];
- NSRect frame = [self videoElementRect];
NSRect endFrame = [screen frame];
- constrainFrameToRatioOfFrame(&endFrame, &frame);
+ NSRect frame = frameExpandedToRatioOfFrame([self videoElementRect], endFrame);
// Create a black window if needed
if (!_backgroundFullscreenWindow)
@@ -316,8 +317,11 @@
// If our owner releases us we could crash if this is not the case.
// Balanced in windowDidExitFullscreen
[self retain];
-
- [[self fullscreenWindow] animateFromRect:[[self window] frame] toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidExitFullscreen)];
+
+ NSRect startFrame = [[self window] frame];
+ endFrame = frameExpandedToRatioOfFrame(endFrame, startFrame);
+
+ [[self fullscreenWindow] animateFromRect:startFrame toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidExitFullscreen)];
}
- (void)applicationDidChangeScreenParameters:(NSNotification*)notification
@@ -504,7 +508,7 @@
if (!wasAnimating) {
// We'll downscale the window during the animation based on the higher resolution rect
BOOL higherResolutionIsEndRect = startRect.size.width < endRect.size.width && startRect.size.height < endRect.size.height;
- [self setFrame:higherResolutionIsEndRect ? endRect : startRect display:NO];
+ [self setFrame:higherResolutionIsEndRect ? endRect : startRect display:NO];
}
ASSERT(!_fullscreenAnimation);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes