diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-10-27 17:28:58 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-11-10 13:13:28 +0000 |
commit | 940e6c9d26246678b7fc6c79a8d957abb7d6dfa6 (patch) | |
tree | 00c3b75388f07196db9c3bccd79e7e9f00e6bacb /chromium/cc | |
parent | 3dce9b5818576f04ce21cec4b3686eda012e5b65 (diff) |
BASELINE: Update Chromium to 118.0.5993.68
Change-Id: I6e6d99002554d348799de08959e84e67a07d0dc0
Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/517433
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/cc')
-rw-r--r-- | chromium/cc/input/scroll_snap_data.cc | 11 | ||||
-rw-r--r-- | chromium/cc/tiles/software_image_decode_cache.cc | 9 | ||||
-rw-r--r-- | chromium/cc/tiles/software_image_decode_cache_unittest_combinations.cc | 63 |
3 files changed, 75 insertions, 8 deletions
diff --git a/chromium/cc/input/scroll_snap_data.cc b/chromium/cc/input/scroll_snap_data.cc index fffab0d24fe..4bb1fba8087 100644 --- a/chromium/cc/input/scroll_snap_data.cc +++ b/chromium/cc/input/scroll_snap_data.cc @@ -126,10 +126,13 @@ absl::optional<SnapSearchResult> SearchResultForDodgingRange( NOTREACHED(); } - // Make sure the snap area is still covering the snapport. - result.set_snap_offset( - std::clamp(offset, area_range.start() - scroll_padding, - area_range.end() - scroll_padding - snapport_size)); + min_offset = area_range.start() - scroll_padding; + max_offset = area_range.end() - scroll_padding - snapport_size; + if (max_offset < min_offset) { + return absl::nullopt; + } + + result.set_snap_offset(std::clamp(offset, min_offset, max_offset)); return result; } diff --git a/chromium/cc/tiles/software_image_decode_cache.cc b/chromium/cc/tiles/software_image_decode_cache.cc index e810a1599af..e6181461d05 100644 --- a/chromium/cc/tiles/software_image_decode_cache.cc +++ b/chromium/cc/tiles/software_image_decode_cache.cc @@ -741,15 +741,16 @@ SkColorType SoftwareImageDecodeCache::GetColorTypeForPaintImage( const TargetColorParams& target_color_params, const PaintImage& paint_image) { const gfx::ColorSpace& target_color_space = target_color_params.color_space; - // Decode HDR images to half float when targeting HDR. - // // TODO(crbug.com/1076568): Once we have access to the display's buffer format // via gfx::DisplayColorSpaces, we should also do this for HBD images. - if (paint_image.GetContentColorUsage() == gfx::ContentColorUsage::kHDR && + // Do not decode an image to F16 unless the PaintImage reports that its type + // is F16. Otherwise, image decode will fail. + // https://crbug.com/1488786 + if (paint_image.GetColorType() == kRGBA_F16_SkColorType && + paint_image.GetContentColorUsage() == gfx::ContentColorUsage::kHDR && target_color_space.IsHDR()) { return kRGBA_F16_SkColorType; } - return color_type_; } diff --git a/chromium/cc/tiles/software_image_decode_cache_unittest_combinations.cc b/chromium/cc/tiles/software_image_decode_cache_unittest_combinations.cc index f256fa70714..1e696fdb75f 100644 --- a/chromium/cc/tiles/software_image_decode_cache_unittest_combinations.cc +++ b/chromium/cc/tiles/software_image_decode_cache_unittest_combinations.cc @@ -195,6 +195,17 @@ class WideGamutCanvasColorSpace : public virtual BaseTest { gfx::ColorSpace::PrimaryID::P3, gfx::ColorSpace::TransferID::LINEAR)); } }; + +class HdrCanvasColorSpace : public virtual BaseTest { + protected: + TargetColorParams GetTargetColorParams() const override { + TargetColorParams result(gfx::ColorSpace( + gfx::ColorSpace::PrimaryID::P3, gfx::ColorSpace::TransferID::SRGB_HDR)); + result.hdr_max_luminance_relative = 4.f; + return result; + } +}; + class SoftwareImageDecodeCacheTest_Typical : public N32Cache, public Predecode, public NoDecodeToScaleSupport, @@ -501,5 +512,57 @@ TEST_F(SoftwareImageDecodeCacheTest_F16_WideGamutCanvasColorSpace, cache().UnrefImage(draw_image_125); } +class PaintImageN32HDR : public virtual BaseTest { + protected: + PaintImage CreatePaintImage(const gfx::Size& size) override { + PaintImage paint_image = CreateDiscardablePaintImage( + size, gfx::ColorSpace::CreateHDR10().ToSkColorSpace(), + true /*allocate_encoded_memory*/, PaintImage::kInvalidId, + kN32_SkColorType); + return paint_image; + } +}; + +class SoftwareImageDecodeCacheTest_N32HDR : public N32Cache, + public Predecode, + public PaintImageN32HDR, + public HdrCanvasColorSpace {}; + +TEST_F(SoftwareImageDecodeCacheTest_N32HDR, DontForceF16Decode) { + auto draw_image = CreateDrawImageForScale(1.f); + GenerateCacheEntry(draw_image); + VerifyEntryExists(__LINE__, draw_image, gfx::Size(512, 512)); + EXPECT_EQ(kN32_SkColorType, draw_image.paint_image().GetColorType()); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image); +} + +class PaintImageF16HDR : public virtual BaseTest { + protected: + PaintImage CreatePaintImage(const gfx::Size& size) override { + PaintImage paint_image = CreateDiscardablePaintImage( + size, gfx::ColorSpace::CreateHDR10().ToSkColorSpace(), + true /*allocate_encoded_memory*/, PaintImage::kInvalidId, + kRGBA_F16_SkColorType); + return paint_image; + } +}; + +class SoftwareImageDecodeCacheTest_F16HDR : public N32Cache, + public Predecode, + public PaintImageF16HDR, + public HdrCanvasColorSpace {}; + +TEST_F(SoftwareImageDecodeCacheTest_F16HDR, AllowF16Decode) { + auto draw_image = CreateDrawImageForScale(1.f); + GenerateCacheEntry(draw_image); + VerifyEntryExists(__LINE__, draw_image, gfx::Size(512, 512)); + EXPECT_EQ(kRGBA_F16_SkColorType, draw_image.paint_image().GetColorType()); + EXPECT_EQ(1u, cache().GetNumCacheEntriesForTesting()); + + cache().UnrefImage(draw_image); +} + } // namespace } // namespace cc |