[webkit-changes] [WebKit/WebKit] 9d522e: [HDR] Disable HDR display for CSS images

Said Abou-Hallawa noreply at github.com
Fri Feb 21 09:48:14 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d522eb64cf21c3efa3513a850797e5a9718586c
      https://github.com/WebKit/WebKit/commit/9d522eb64cf21c3efa3513a850797e5a9718586c
  Author: Said Abou-Hallawa <said at apple.com>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/compositing/hdr/hdr-css-image.html
    M LayoutTests/fast/images/hdr-basic-image.html
    A LayoutTests/fast/images/hdr-css-image-expected.html
    A LayoutTests/fast/images/hdr-css-image.html
    M LayoutTests/platform/ios/TestExpectations
    A LayoutTests/platform/ios/compositing/hdr/hdr-css-image-expected.txt
    M LayoutTests/platform/mac-wk2/TestExpectations
    A LayoutTests/platform/mac-wk2/compositing/hdr/hdr-css-image-expected.txt
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/platform/graphics/BitmapImage.cpp
    M Source/WebCore/platform/graphics/Color.h
    M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
    M Source/WebCore/rendering/BackgroundPainter.cpp
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/style/NinePieceImage.cpp

  Log Message:
  -----------
  [HDR] Disable HDR display for CSS images
https://bugs.webkit.org/show_bug.cgi?id=287985#
rdar://145154746

Reviewed by Simon Fraser.

Currently only the headroom of HTMLImageElements are checked for setting the
GraphicsLayer::drawsHDRContent(). So a layer with an HDR <img> element, has to
show the CSS HDR image the same way if is displayed in a layer with no HDR <img>
element.

For now and to be consistent with HDR CSS images, the HDR display will be
disabled for CSS images.

* LayoutTests/TestExpectations:
* LayoutTests/compositing/hdr/hdr-css-image.html: Added.
* LayoutTests/fast/images/hdr-basic-image.html:
* LayoutTests/fast/images/hdr-css-image-expected.html: Added.
* LayoutTests/fast/images/hdr-css-image.html: Added.
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/ios/compositing/hdr/hdr-css-image-expected.txt: Added.
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/platform/mac-wk2/compositing/hdr/hdr-css-image-expected.txt: Added.
* Source/WebCore/page/Page.cpp:
(WebCore::Page::canDrawHDRContent const):
(WebCore::Page::canDrawHDRContents const): Deleted.
* Source/WebCore/page/Page.h:
Rename the method canDrawHDRContents() to canDrawHDRContent() to be consistent
with  GraphicsLayer::drawsHDRContent().

* Source/WebCore/platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::draw):
-- BitmapImage::headroomForTesting() will be respected first if it is set and
   ImagePaintingOptions::headroom is equal to Headroom::FromImage.
-- BitmapImage::headroom() will be respected second if ImagePaintingOptions::headroom
   is equal to Headroom::FromImage.
-- Otherwise ImagePaintingOptions::headroom will be used.

* Source/WebCore/platform/graphics/Color.h:
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImageInternal):
This part was missing. NativeImage can be drawn from places other than BitmapImage.

* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::paintFillLayer const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::PaintedContentRequest::PaintedContentRequest):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::PaintedContentsInfo::PaintedContentsInfo):
* Source/WebCore/rendering/style/NinePieceImage.cpp:
(WebCore::NinePieceImage::paint const):

Canonical link: https://commits.webkit.org/290804@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