[webkit-changes] [WebKit/WebKit] ae406c: [Cocoa] Sometimes a YouTube video is incorrectly s...

Jer Noble noreply at github.com
Fri Jun 2 09:24:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae406cb584f994b3ec3b5b6801573329422d9596
      https://github.com/WebKit/WebKit/commit/ae406cb584f994b3ec3b5b6801573329422d9596
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-06-02 (Fri, 02 Jun 2023)

  Changed paths:
    M Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm
    M Source/WebCore/platform/graphics/FloatPoint.cpp
    M Source/WebCore/platform/graphics/FloatPoint.h
    M Source/WebCore/platform/graphics/FloatRect.cpp
    M Source/WebCore/platform/graphics/FloatRect.h
    M Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm
    M Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm

  Log Message:
  -----------
  [Cocoa] Sometimes a YouTube video is incorrectly sized, and doesn't respond to window resize
https://bugs.webkit.org/show_bug.cgi?id=257628
rdar://109754524

Reviewed by Simon Fraser.

`-[WebAVPlayerLayer layoutSublayers]` will calculate a `targetVideoFrame` based on the current
videoLayer's bounds, the videoDimensions, and gravity. If this value matches the current video
frame, it bails out early without making any changes.

However, it doesn't save `targetVideoFrame` to `_targetVideoFrame`. If the gravity, videoDimensions,
or even the videoLayer's bounds change, and there's an existing pending call to `-resolveBounds`,
an incorrent frame will be set on the videoLayer (whatever the last successful call to
`-layoutSublayers` generated).

Rather than create a local `targetVideoFrame`, just save the results of calling
`-calculateTargetVideoFrame` to the `_targetVideoFrame` ivar. This ensures that subsequent calls to
`-resolveBounds` operate on the correct values.

Extensive drive-by fix: In investigating this bug, there were a number of times where logging which
included a frame's location would have been useful. But FloatPoint and FloatRect don't have logging
methods to convert their values to a String (only FloatSize does). So this patch adds those missing
logging methods and converts existing logging to log the whole rect.

* Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm:
(-[WebAVPlayerLayer layoutSublayers]):
(-[WebAVPlayerLayer resolveBounds]):
* Source/WebCore/platform/graphics/FloatPoint.cpp:
(WebCore::FloatPoint::toJSONObject const):
(WebCore::FloatPoint::toJSONString const):
* Source/WebCore/platform/graphics/FloatPoint.h:
(WTF::LogArgument<WebCore::FloatPoint>::toString):
* Source/WebCore/platform/graphics/FloatRect.cpp:
(WebCore::FloatRect::toJSONObject const):
(WebCore::FloatRect::toJSONString const):
* Source/WebCore/platform/graphics/FloatRect.h:
(WTF::LogArgument<WebCore::FloatRect>::toString):
* Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
(WebCore::VideoLayerManagerObjC::setVideoLayer):
* Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenModelContext::setVideoLayerFrame):

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




More information about the webkit-changes mailing list