[webkit-changes] [WebKit/WebKit] c819e7: Fullscreen video does not always match window size...

mwyrzykowski noreply at github.com
Fri Jun 30 15:36:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c819e77ac5671e6c2df6822462a0294871b492c5
      https://github.com/WebKit/WebKit/commit/c819e77ac5671e6c2df6822462a0294871b492c5
  Author: Mike Wyrzykowski <mwyrzykowski at apple.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm
    M Source/WebCore/rendering/RenderVideo.cpp

  Log Message:
  -----------
  Fullscreen video does not always match window size at certain resolutions
https://bugs.webkit.org/show_bug.cgi?id=258484
rdar://110724034

Reviewed by Jer Noble.

The video is using ObjectFit::Contain and UIKit is trying to preserve the initial aspect ratio
from when the video entered fullscreen during resizes. However, we requested the the window to
only resize to integral point values, so the aspect ratio can be off more after a resize than it was initially.

* Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm:
(-[WebAVPlayerLayer calculateTargetVideoFrame]):
Ensure the target video frame is integral values.

* Source/WebCore/rendering/RenderVideo.cpp:
(WebCore::areAspectRatiosEssentiallyEqual):
At most the difference is one point, i.e., deviceScaleFactor, so we can use this as a tolerance
value passed to WTF::areEssentiallyEqual.

(WebCore::RenderVideo::videoBox const):
(WebCore::RenderVideo::updatePlayer):
Make the video take up the entire area if the aspect ratio is almost identical and we are in fullscreen.

Canonical link: https://commits.webkit.org/265672@main




More information about the webkit-changes mailing list