Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9f0beb45c5d7c4830cd579eb68cee6564172c01c
      
https://github.com/WebKit/WebKit/commit/9f0beb45c5d7c4830cd579eb68cee6564172c01c
  Author: Jer Noble <jer.no...@apple.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm
    M Source/WebCore/platform/graphics/GraphicsLayer.cpp
    M Source/WebCore/platform/graphics/GraphicsLayer.h
    M Source/WebCore/platform/graphics/MediaPlayer.cpp
    M Source/WebCore/platform/graphics/MediaPlayerEnums.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
    A Source/WebCore/platform/graphics/cocoa/MediaPlayerEnumsCocoa.h
    A Source/WebCore/platform/graphics/cocoa/MediaPlayerEnumsCocoa.mm
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerBacking.h
    M Source/WebCore/rendering/RenderMedia.h
    M Source/WebCore/rendering/RenderVideo.cpp
    M Source/WebCore/rendering/RenderVideo.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm

  Log Message:
  -----------
  REGRESSION(264795@main) media/video-object-fit.html test is failing
https://bugs.webkit.org/show_bug.cgi?id=257604
rdar://110117044

Reviewed by Eric Carlson.

In 264795@main, we now correctly lay out the contents of the media element when 
that element
recreates its media layer while in fullscreen or pip. This had the paradoxical 
effect of exposing
serious problems in our object-fit implementation for video elements.

The WebAVPlayerLayer class in the UI process is responsible for responding to 
layer-based layout
changes. These can happen both during normal page layout, and also when the 
video contents move
outside of the page and into fullscreen or pip. To correctly layout the video 
contents, it must
know what the effective videoGravity of the underlying video layer has been set 
to. However, this
information never leaves the WebContent process. This worked previously only 
accidentally.

Additionally, the RenderLayer is responsible for telling the MediaPlayer 
whether it should resize
respecting the underlying aspect ratio of the media, or whether it should 
ignore aspect ratio.
This code runs after layout, but changes to style that don't affect layout 
(like object-fit) are
never propogated into the media element.

And one final problem, WebAVPlayerLayer used pointer equality to check whether 
the passed in
string matches the values exposed by AVFoundation; it should use 
-isEqualToString:.

1. Notice that the object-fit style has changed in RenderVideo and push those 
changes into the
   MediaPlayer via updatePlayer().

2. Add a new videoGravity()/setVideoGravity() accessor to GraphicsLayer and 
GraphicsLayerCA, and
   to PlatformCALayer and PlatformCALayerCocoa.

3. Propogate these changes across the UIProcess boundary as part of the 
LayerProperties.

4. Fix WebAVPlayerLayer's -setVideoGravity: method.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/cocoa/WebAVPlayerLayer.mm:
(-[WebAVPlayerLayer setVideoGravity:]):
* Source/WebCore/platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::videoGravity const):
(WebCore::GraphicsLayer::setVideoGravity):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
* Source/WebCore/platform/graphics/MediaPlayer.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/graphics/MediaPlayerEnums.h:
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setVideoGravity):
(WebCore::GraphicsLayerCA::setContentsToVideoElement):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateVideoGravity):
(WebCore::GraphicsLayerCA::layerChangeAsString):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.h:
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::videoGravity const):
(WebCore::PlatformCALayerCocoa::setVideoGravity):
* Source/WebCore/platform/graphics/cocoa/MediaPlayerEnumsCocoa.h: Added.
* Source/WebCore/platform/graphics/cocoa/MediaPlayerEnumsCocoa.mm: Added.
(WebCore::convertAVLayerToMediaPlayerVideoGravity):
(WebCore::convertMediaPlayerToAVLayerVideoGravity):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
(WebCore::RenderLayerBacking::updateVideoGravity):
(WebCore::RenderLayerBacking::updateConfigurationAfterStyleChange):
(WebCore::RenderLayerBacking::updateGeometry):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderMedia.h:
* Source/WebCore/rendering/RenderVideo.cpp:
(WebCore::RenderVideo::styleDidChange):
* Source/WebCore/rendering/RenderVideo.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.mm:
(WebKit::PlatformCALayerRemote::updateClonedLayerProperties const):
(WebKit::PlatformCALayerRemote::videoGravity const):
(WebKit::PlatformCALayerRemote::setVideoGravity):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to