Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4bbe21c2de859693c1de05b4bd98fd0560704678
https://github.com/WebKit/WebKit/commit/4bbe21c2de859693c1de05b4bd98fd0560704678
Author: Alice Tang <[email protected]>
Date: 2026-08-06 (Thu, 06 Aug 2026)
Changed paths:
A
LayoutTests/compositing/video/video-object-view-box-dynamic-change-expected.txt
A LayoutTests/compositing/video/video-object-view-box-dynamic-change.html
A LayoutTests/compositing/video/video-object-view-box-no-poster-expected.txt
A LayoutTests/compositing/video/video-object-view-box-no-poster.html
A
LayoutTests/compositing/video/video-object-view-box-object-position-no-poster-expected.txt
A
LayoutTests/compositing/video/video-object-view-box-object-position-no-poster.html
A
LayoutTests/compositing/video/video-object-view-box-writing-mode-no-poster-expected.txt
A
LayoutTests/compositing/video/video-object-view-box-writing-mode-no-poster.html
M LayoutTests/platform/gtk/TestExpectations
A
LayoutTests/platform/ios/compositing/video/video-object-view-box-dynamic-change-expected.txt
A
LayoutTests/platform/ios/compositing/video/video-object-view-box-no-poster-expected.txt
A
LayoutTests/platform/ios/compositing/video/video-object-view-box-object-position-no-poster-expected.txt
A
LayoutTests/platform/ios/compositing/video/video-object-view-box-writing-mode-no-poster-expected.txt
M LayoutTests/platform/wpe/TestExpectations
M Source/WebCore/html/HTMLMediaElement.cpp
M Source/WebCore/html/HTMLMediaElement.h
M Source/WebCore/html/HTMLVideoElement.cpp
M Source/WebCore/platform/cocoa/VideoPresentationModel.h
M Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.h
M Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm
M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
M Source/WebCore/platform/mac/VideoPresentationInterfaceMac.h
M Source/WebCore/platform/mac/VideoPresentationInterfaceMac.mm
M Source/WebCore/rendering/RenderLayerBacking.cpp
M Source/WebCore/rendering/RenderLayerBacking.h
M Source/WebCore/rendering/RenderReplaced.cpp
M Source/WebCore/rendering/RenderReplaced.h
M Source/WebCore/rendering/RenderVideo.cpp
M Source/WebCore/rendering/RenderVideo.h
M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h
M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.messages.in
M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm
M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h
M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm
Log Message:
-----------
CSS object-view-box: implement rendering for video elements
https://bugs.webkit.org/show_bug.cgi?id=317766
rdar://180637489
Reviewed by Eric Carlson.
Extends object-view-box rendering (added for img/canvas in bug 316882) to video,
covering inline composited playback and the fullscreen/PiP presentation paths
RenderVideo/RenderLayerBacking:
- croppedVideoBoxForCompositing() and inlineVideoBox() apply the same view-box
crop to the composited video layer that the software paint path already used,
accounting for object-fit and poster-aware intrinsic size
- updateContentsRects() special-cases RenderVideo to set contents/clip rects
from
the cropped geometry instead of contentsBox()
- updateVideoGravity() skips object-fit-driven video gravity when
object-view-box is
set, since the cropped rect already bakes that in
- Bypasses the crop once a video enters Picture-in-Picture, so PiP always shows
the
full natural frame
Fullscreen/PiP (HTMLMediaElement, HTMLVideoElement,
VideoPresentationModelVideoElement, VideoPresentationManager(Proxy),
VideoPresentationInterfaceMac):
- New SetHasObjectViewBox IPC message plumbs whether a video has object-view-box
set from WebProcess to UIProcess, so fullscreen/PiP can react to it changing
mid-session,
not just at presentation-mode entry
- Transition-anchor rect for entering/exiting fullscreen/PiP now uses the
video's true
inline box instead of the cropped compositing geometry, so the zoom animation
originates from where the video actually is
Adds new compositing/video layout tests covering object-view-box with dynamic
style
changes, no-poster rendering, object-position, and vertical writing modes, with
iOS-specific baselines where rendering differs from the generic expectation.
Tested compositing/video, video-object-fit(-change), and the WKWebView
fullscreen/PiP
TestWebKitAPI suites; no regressions. Two failures turned out to be
pre-existing and
unrelated; confirmed by reproducing them on the tree without this patch
*
LayoutTests/compositing/video/video-object-view-box-dynamic-change-expected.txt:
Added.
* LayoutTests/compositing/video/video-object-view-box-dynamic-change.html:
Added.
* LayoutTests/compositing/video/video-object-view-box-no-poster-expected.txt:
Added.
* LayoutTests/compositing/video/video-object-view-box-no-poster.html: Added.
*
LayoutTests/compositing/video/video-object-view-box-object-position-no-poster-expected.txt:
Added.
*
LayoutTests/compositing/video/video-object-view-box-object-position-no-poster.html:
Added.
*
LayoutTests/compositing/video/video-object-view-box-writing-mode-no-poster-expected.txt:
Added.
*
LayoutTests/compositing/video/video-object-view-box-writing-mode-no-poster.html:
Added.
* LayoutTests/platform/gtk/TestExpectations:
*
LayoutTests/platform/ios/compositing/video/video-object-view-box-dynamic-change-expected.txt:
Added.
*
LayoutTests/platform/ios/compositing/video/video-object-view-box-no-poster-expected.txt:
Added.
*
LayoutTests/platform/ios/compositing/video/video-object-view-box-object-position-no-poster-expected.txt:
Added.
*
LayoutTests/platform/ios/compositing/video/video-object-view-box-writing-mode-no-poster-expected.txt:
Added.
* LayoutTests/platform/wpe/TestExpectations:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didBecomeFullscreenElement):
(WebCore::HTMLMediaElement::didStopBeingFullscreenElement):
(WebCore::HTMLMediaElement::hasObjectViewBoxChanged):
* Source/WebCore/html/HTMLMediaElement.h:
(WebCore::HTMLMediaElementClient::hasObjectViewBoxChanged):
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::didEnterFullscreenOrPictureInPicture):
(WebCore::HTMLVideoElement::didExitFullscreenOrPictureInPicture):
* Source/WebCore/platform/cocoa/VideoPresentationModel.h:
(WebCore::VideoPresentationModel::hasObjectViewBox const):
(WebCore::VideoPresentationModelClient::hasObjectViewBoxChanged):
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.h:
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm:
(WebCore::VideoPresentationModelVideoElement::updateForEventName):
(WebCore::VideoPresentationModelVideoElement::hasObjectViewBoxChanged):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
* Source/WebCore/platform/mac/VideoPresentationInterfaceMac.h:
* Source/WebCore/platform/mac/VideoPresentationInterfaceMac.mm:
(-[WebVideoPresentationInterfaceMacObjC
setUpPIPForVideoView:withFrame:inWindow:]):
(-[WebVideoPresentationInterfaceMacObjC exitPIP]):
(-[WebVideoPresentationInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
(-[WebVideoPresentationInterfaceMacObjC pipDidClose:]):
(-[WebVideoPresentationInterfaceMacObjC pipActionStop:]):
(WebCore::VideoPresentationInterfaceMac::setupFullscreen):
(WebCore::VideoPresentationInterfaceMac::hasObjectViewBoxChanged):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateVideoGravity):
(WebCore::RenderLayerBacking::updateContentsRects):
(WebCore::RenderLayerBacking::inlineVideoContentsBox const):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::hasObjectViewBoxSet const):
(WebCore::RenderReplaced::computePaintRectForObjectViewBox const):
* Source/WebCore/rendering/RenderReplaced.h:
(WebCore::RenderReplaced::computePaintRectForObjectViewBox const):
* Source/WebCore/rendering/RenderVideo.cpp:
(WebCore::RenderVideo::posterAwareIntrinsicSize const):
(WebCore::RenderVideo::videoBox const):
(WebCore::RenderVideo::isBypassingObjectViewBoxForPictureInPicture const):
(WebCore::RenderVideo::objectFitContentsRectForFullscreenCompositing const):
(WebCore::RenderVideo::croppedVideoBoxForCompositing const):
(WebCore::RenderVideo::inlineVideoBox const):
(WebCore::RenderVideo::paintReplaced):
(WebCore::RenderVideo::styleDidChange):
(WebCore::RenderVideo::updatePlayer):
* Source/WebCore/rendering/RenderVideo.h:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.messages.in:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm:
(WebKit::VideoPresentationModelContext::setHasObjectViewBox):
(WebKit::VideoPresentationManagerProxy::setupFullscreenWithID):
(WebKit::VideoPresentationManagerProxy::setHasObjectViewBox):
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.h:
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm:
(WebKit::inlineVideoFrame):
(WebKit::VideoPresentationInterfaceContext::hasObjectViewBoxChanged):
(WebKit::VideoPresentationManager::enterVideoFullscreenForVideoElement):
(WebKit::VideoPresentationManager::hasObjectViewBoxChanged):
Canonical link: https://commits.webkit.org/318714@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications