Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f5b453a8e09bc6f143b330aec80c7da77c603d91
      
https://github.com/WebKit/WebKit/commit/f5b453a8e09bc6f143b330aec80c7da77c603d91
  Author: Said Abou-Hallawa <[email protected]>
  Date:   2025-06-26 (Thu, 26 Jun 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/images/resources/red-green-blue.mov
    A LayoutTests/fast/images/video-as-image-expected.html
    A LayoutTests/fast/images/video-as-image.html
    M LayoutTests/platform/ios/TestExpectations
    M LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/platform/graphics/ImageTypes.h
    M Source/WebCore/platform/graphics/ShareableBitmap.cpp
    M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
    M Source/WebCore/platform/graphics/cg/NativeImageCG.cpp
    M Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm
    M Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp

  Log Message:
  -----------
  REGRESSION(295899@main): Video as an image source does not display its frames
https://bugs.webkit.org/show_bug.cgi?id=295015
rdar://154358072

Reviewed by Simon Fraser.

Three bugs are the cause of this regression:

1. Headroom constructor is not explicit. So any numerical value including `bool`
   can construct a Headroom structure.

2. A new argument to ShareableBitmapConfiguration of type Headroom was added in
   295899@main. RemoteImageDecoderAVFProxy::createFrameImageAtIndex() was not
   modified to include a headroom when calling ShareableBitmap::create(). 
Instead
   a `bool` false was passed instead. This `bool` constructs a Headroom of type
   Headroom::FromImage which is very special value and should not be passed from
   WebProcess to GPUProcess or vice versa.

3. In 295899@main ShareableBitmap::createCGImage() was changed such that it 
calls
   CGImageCreateWithContentHeadroom() if m_configuration.headroom() != 
Headroom::None.
   This code is now hit in the video scenario because RemoteImageDecoderAVFProxy
   ::createFrameImageAtIndex() passes the wrong Headroom.

The fix is to:

1. Make the constructor of Headroom explicit so we do not hit this bug again.

2. Make RemoteImageDecoderAVFProxy::createFrameImageAtIndex() pass the headroom
   of the decoded image to ShareableBitmap::create().

3. Assert in ShareableBitmap and ShareableBitmapConfiguration that the passed
   headroom has a valid Headroom value.

* LayoutTests/TestExpectations:
* LayoutTests/fast/images/resources/red-green-blue.mov: Added.
* LayoutTests/fast/images/video-as-image-expected.html: Added.
* LayoutTests/fast/images/video-as-image.html: Added.
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateDisplayEDRHeadroom):
* Source/WebCore/platform/graphics/ImageTypes.h:
(WebCore::Headroom::Headroom):
* Source/WebCore/platform/graphics/ShareableBitmap.cpp:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
(WebCore::ShareableBitmap::create):
(WebCore::ShareableBitmap::ShareableBitmap):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImageInternal):
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::PlatformImageNativeImageBackend::headroom const):
* Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm:
(WebCore::ShareableBitmap::createCGImage const):
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::drawNativeImageInternal):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to