Changeset 220390 in webkit
- Timestamp:
- Aug 8, 2017 12:29:26 AM (7 years ago)
- Location:
- branches/safari-604-branch/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-604-branch/Source/WebCore/ChangeLog
r220389 r220390 1 2017-08-08 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r220248. rdar://problem/33754458 4 5 2017-08-03 Jeremy Jones <jeremyj@apple.com> 6 7 Improve WebKitLegacy video fullscreen animation begin and end rects. 8 https://bugs.webkit.org/show_bug.cgi?id=175152 9 rdar://problem/32840576 10 11 Reviewed by Eric Carlson. 12 13 No new tests, becuase this change has no effect on the DOM. 14 15 This change uses different rects for fullscreen animation to prevent the animation 16 from failing, and to improve the aesthetics of the animation. 17 18 * platform/mac/WebVideoFullscreenController.mm: 19 (frameExpandedToRatioOfFrame): 20 (-[WebVideoFullscreenController enterFullscreen:]): 21 (-[WebVideoFullscreenController exitFullscreen]): 22 (-[WebVideoFullscreenWindow animateFromRect:toRect:withSubAnimation:controllerAction:]): 23 (constrainFrameToRatioOfFrame): Deleted. 24 1 25 2017-08-08 Jason Marcell <jmarcell@apple.com> 2 26 -
branches/safari-604-branch/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
r219191 r220390 234 234 // MARK: Exposed Interface 235 235 236 static void constrainFrameToRatioOfFrame(NSRect *frameToConstrain, const NSRect *frame)236 static NSRect frameExpandedToRatioOfFrame(NSRect frameToExpand, NSRect frame) 237 237 { 238 238 // Keep a constrained aspect ratio for the destination window 239 CGFloat originalRatio = frame->size.width / frame->size.height; 240 CGFloat newRatio = frameToConstrain->size.width / frameToConstrain->size.height; 239 NSRect result = frameToExpand; 240 CGFloat newRatio = frame.size.width / frame.size.height; 241 CGFloat originalRatio = frameToExpand.size.width / frameToExpand.size.height; 241 242 if (newRatio > originalRatio) { 242 CGFloat newWidth = originalRatio * frameToConstrain->size.height;243 CGFloat diff = frameToConstrain->size.width - newWidth;244 frameToConstrain->size.width = newWidth;245 frameToConstrain->origin.x += diff / 2;243 CGFloat newWidth = newRatio * frameToExpand.size.height; 244 CGFloat diff = newWidth - frameToExpand.size.width; 245 result.size.width = newWidth; 246 result.origin.x -= diff / 2; 246 247 } else { 247 CGFloat newHeight = frameToConstrain->size.width / originalRatio; 248 CGFloat diff = frameToConstrain->size.height - newHeight; 249 frameToConstrain->size.height = newHeight; 250 frameToConstrain->origin.y += diff / 2; 251 } 248 CGFloat newHeight = frameToExpand.size.width / newRatio; 249 CGFloat diff = newHeight - frameToExpand.size.height; 250 result.size.height = newHeight; 251 result.origin.y -= diff / 2; 252 } 253 return result; 252 254 } 253 255 … … 278 280 screen = [NSScreen mainScreen]; 279 281 280 NSRect frame = [self videoElementRect];281 282 NSRect endFrame = [screen frame]; 282 constrainFrameToRatioOfFrame(&endFrame, &frame);283 NSRect frame = frameExpandedToRatioOfFrame([self videoElementRect], endFrame); 283 284 284 285 // Create a black window if needed … … 317 318 // Balanced in windowDidExitFullscreen 318 319 [self retain]; 319 320 [[self fullscreenWindow] animateFromRect:[[self window] frame] toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidExitFullscreen)]; 320 321 NSRect startFrame = [[self window] frame]; 322 endFrame = frameExpandedToRatioOfFrame(endFrame, startFrame); 323 324 [[self fullscreenWindow] animateFromRect:startFrame toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidExitFullscreen)]; 321 325 } 322 326 … … 505 509 // We'll downscale the window during the animation based on the higher resolution rect 506 510 BOOL higherResolutionIsEndRect = startRect.size.width < endRect.size.width && startRect.size.height < endRect.size.height; 507 [self setFrame:higherResolutionIsEndRect ? endRect : startRect display:NO]; 511 [self setFrame:higherResolutionIsEndRect ? endRect : startRect display:NO]; 508 512 } 509 513
Note: See TracChangeset
for help on using the changeset viewer.