[webkit-changes] [WebKit/WebKit] fd1db0: [iOS] When entering PiP on trailers.apple.com, Web...

Jer Noble noreply at github.com
Sun May 21 17:37:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fd1db0137ba3653374f78c706b759ebee69b3748
      https://github.com/WebKit/WebKit/commit/fd1db0137ba3653374f78c706b759ebee69b3748
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-05-21 (Sun, 21 May 2023)

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

  Log Message:
  -----------
  [iOS] When entering PiP on trailers.apple.com, WebAVPlayerLayer has endless loop of -layoutSublayers, -resolveBounds
https://bugs.webkit.org/show_bug.cgi?id=257063
rdar://109588922

Reviewed by Eric Carlson.

CALayer's -frame is a function of its -position, -anchorPoint, -bounds, and -affineTransform
properties. Do to all this floating point math, sometimes the output of -frame is slightly
different than expected, and the existing equality checks will fail. Then, -resolveBounds will
trigger -layoutSublayers, and the cycle of layout & resolution will repeat ad-nauseum.

Add a utility method, areFramesEssentiallyEqualWithTolerance(), which will return true if the
frames dimensions are within a constant value of each other (0.01, or 1% of a pixel).

* Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm:
(-[WebAVPlayerLayer calculateTargetVideoFrame]):
(areFramesEssentiallyEqualWithTolerance):
(-[WebAVPlayerLayer layoutSublayers]):
(-[WebAVPlayerLayer resolveBounds]):

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




More information about the webkit-changes mailing list