Title: [220248] trunk/Source/WebCore
- Revision
- 220248
- Author
- [email protected]
- Date
- 2017-08-03 18:58:33 -0700 (Thu, 03 Aug 2017)
Log Message
Improve WebKitLegacy video fullscreen animation begin and end rects.
https://bugs.webkit.org/show_bug.cgi?id=175152
rdar://problem/32840576
Patch by Jeremy Jones <[email protected]> on 2017-08-03
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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (220247 => 220248)
--- trunk/Source/WebCore/ChangeLog 2017-08-04 01:13:03 UTC (rev 220247)
+++ trunk/Source/WebCore/ChangeLog 2017-08-04 01:58:33 UTC (rev 220248)
@@ -1,3 +1,23 @@
+2017-08-03 Jeremy Jones <[email protected]>
+
+ 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-03 Jer Noble <[email protected]>
[EME][Mac] SecureStop left on disk in Private Browsing mode.
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm (220247 => 220248)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm 2017-08-04 01:13:03 UTC (rev 220247)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm 2017-08-04 01:58:33 UTC (rev 220248)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes