[webkit-changes] [WebKit/WebKit] 1ffb2f: [HDR] Ensure HDR layers and IOSurfaces are created...
Said Abou-Hallawa
noreply at github.com
Mon Feb 17 14:43:04 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1ffb2f06c35a2fa0af0654a8c9de49197b19fa07
https://github.com/WebKit/WebKit/commit/1ffb2f06c35a2fa0af0654a8c9de49197b19fa07
Author: Said Abou-Hallawa <said at apple.com>
Date: 2025-02-17 (Mon, 17 Feb 2025)
Changed paths:
M LayoutTests/TestExpectations
A LayoutTests/compositing/hdr/hdr-basic-canvas.html
M LayoutTests/platform/ios/TestExpectations
A LayoutTests/platform/ios/compositing/hdr/hdr-basic-canvas-expected.txt
M LayoutTests/platform/mac-wk2/TestExpectations
A LayoutTests/platform/mac-wk2/compositing/hdr/hdr-basic-canvas-expected.txt
M Source/WebCore/html/canvas/CanvasRenderingContext.h
M Source/WebCore/loader/cache/CachedImage.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/page/PageOverlayController.cpp
M Source/WebCore/platform/PlatformScreen.cpp
M Source/WebCore/platform/PlatformScreen.h
M Source/WebCore/platform/ScreenProperties.h
M Source/WebCore/platform/graphics/GraphicsLayer.cpp
M Source/WebCore/platform/graphics/GraphicsLayer.h
M Source/WebCore/platform/graphics/GraphicsLayerClient.h
M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
M Source/WebCore/platform/graphics/ca/PlatformCALayer.mm
M Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h
M Source/WebCore/platform/ios/PlatformScreenIOS.mm
M Source/WebCore/platform/mac/PlatformScreenMac.mm
M Source/WebCore/rendering/RenderLayer.cpp
M Source/WebCore/rendering/RenderLayer.h
M Source/WebCore/rendering/RenderLayerBacking.cpp
M Source/WebCore/rendering/RenderLayerBacking.h
M Source/WebCore/rendering/RenderLayerCompositor.cpp
M Source/WebCore/rendering/RenderLayerCompositor.h
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
Log Message:
-----------
[HDR] Ensure HDR layers and IOSurfaces are created only when they contain HDR contents
https://bugs.webkit.org/show_bug.cgi?id=282298
rdar://138877325
Reviewed by Simon Fraser.
Each layer will decide whether it needs to draw HDR content or not. The renderer
of the RenderLayer and its sub-tree will be inspected for any HDR image or canvas.
RenderLayer::isReplacedElementWithHDR() will return true if the renderer of the
layer itself needs to draw HDR content. The image of the ImageDocument will be
handled as a special case.
PaintedContentsInfo::isReplacedElementWithHDR() will return whether the renderer
of the layer itself will need to draw HDR content or not.
All the virtual methods hdrForImagesEnabled() will be deleted and replaced by
drawsHDRContent(). drawsHDRContent() will be set to true only if the layer will
need to draw HDR contents and settings.hdrForImagesEnabled() is true.
Since determineNonLayerDescendantsPaintedContent() traverses the render tree of
layer to set hasPaintedContent, it will be used also to set hasPaintedHDRContent
of PaintedContentRequest.
Since RenderLayerBacking::updateDrawsContent() sets GraphicsLayer::setDrawsContent
from the renderer of the layer itself, this function will be used also to set
GraphicsLayer::setDrawsHDRContent() by calling
PaintedContentsInfo::isReplacedElementWithHDR().
PlatformCALayer::contentsFormatForLayer() will call GraphicsLayerCA::drawsHDRContent()
instead of calling hdrForImagesEnabled() to know whether to return RGBA16F for
this layer or not.
For testing support the internal API setScreenContentsFormatsForTesting() is added
to force the screen supported ContentsFormats to certain values.
* LayoutTests/TestExpectations:
* LayoutTests/compositing/hdr/hdr-basic-canvas.html: Added.
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/ios/compositing/hdr/hdr-basic-canvas-expected.txt: Added.
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/platform/mac-wk2/compositing/hdr/hdr-basic-canvas-expected.txt: Added.
* Source/WebCore/html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::isHDR const):
(WebCore::CanvasRenderingContext::drawsHDRContent const): Deleted.
* Source/WebCore/loader/cache/CachedImage.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::canDrawHDRContents const):
* Source/WebCore/page/Page.h:
* Source/WebCore/page/PageOverlayController.cpp:
(WebCore::PageOverlayController::updateSettingsForLayer):
* Source/WebCore/platform/PlatformScreen.cpp:
(WebCore::setScreenContentsFormatsForTesting):
(WebCore::screenContentsFormatsForTesting):
* Source/WebCore/platform/PlatformScreen.h:
* Source/WebCore/platform/ScreenProperties.h:
* Source/WebCore/platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setDrawsHDRContent):
(WebCore::GraphicsLayer::dumpProperties const):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::drawsHDRContent const):
(WebCore::GraphicsLayer::setHDRForImagesEnabled): Deleted.
(WebCore::GraphicsLayer::hdrForImagesEnabled const): Deleted.
* Source/WebCore/platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::hdrForImagesEnabled const): Deleted.
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setDrawsHDRContent):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.mm:
(WebCore::PlatformCALayer::drawRepaintIndicator):
(WebCore::PlatformCALayer::contentsFormatForLayer):
* Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h:
(WebCore::PlatformCALayerClient::drawsHDRContent const):
(WebCore::PlatformCALayerClient::hdrForImagesEnabled const): Deleted.
* Source/WebCore/platform/ios/PlatformScreenIOS.mm:
(WebCore::screenSupportsExtendedColor):
(WebCore::screenSupportsHighDynamicRange):
* Source/WebCore/platform/mac/PlatformScreenMac.mm:
(WebCore::screenSupportsExtendedColor):
(WebCore::screenSupportsHighDynamicRange):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::PaintedContentRequest::PaintedContentRequest):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::PaintedContentsInfo::PaintedContentsInfo):
(WebCore::PaintedContentsInfo::isPaintsContentSatisfied const):
(WebCore::PaintedContentsInfo::paintsHDRContent):
(WebCore::PaintedContentsInfo::isContentsTypeSatisfied const):
(WebCore::PaintedContentsInfo::isSimpleContainer):
(WebCore::PaintedContentsInfo::isDirectlyCompositedImage):
(WebCore::PaintedContentsInfo::isUnscaledBitmapOnly):
(WebCore::PaintedContentsInfo::isReplacedElementWithHDR):
(WebCore::PaintedContentsInfo::determinePaintsContent):
(WebCore::PaintedContentsInfo::determineContentsType):
(WebCore::RenderLayerBacking::updateDrawsContent):
(WebCore::RenderLayerBacking::determineNonCompositedLayerDescendantsPaintedContent const):
(WebCore::RenderLayerBacking::isReplacedElementWithHDR const):
(WebCore::PaintedContentsInfo::contentsTypeDetermination): Deleted.
(WebCore::RenderLayerBacking::hdrForImagesEnabled const): Deleted.
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::hdrForImagesEnabled const): Deleted.
* Source/WebCore/rendering/RenderLayerCompositor.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::setScreenContentsFormatsForTesting):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::hdrForImagesEnabled const): Deleted.
Canonical link: https://commits.webkit.org/290503@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list