diff --git a/Userland/Libraries/LibGfx/ICC/Profile.cpp b/Userland/Libraries/LibGfx/ICC/Profile.cpp index 22b731a54ba..102ce31e802 100644 --- a/Userland/Libraries/LibGfx/ICC/Profile.cpp +++ b/Userland/Libraries/LibGfx/ICC/Profile.cpp @@ -869,6 +869,10 @@ ErrorOr Profile::check_tag_types() // Profile ID of /System/Library/ColorSync/Profiles/ITU-2020.icc on macOS 13.1. static constexpr Crypto::Hash::MD5::DigestType apple_itu_2020_id = { 0x57, 0x0b, 0x1b, 0x76, 0xc6, 0xa0, 0x50, 0xaa, 0x9f, 0x6c, 0x53, 0x8d, 0xbe, 0x2d, 0x3e, 0xf0 }; + // Profile ID of the "Display P3" profiles embedded in the images on https://webkit.org/blog-files/color-gamut/comparison.html + // (The macOS 13.1 /System/Library/ColorSync/Profiles/Display\ P3.icc file no longer has this quirk.) + static constexpr Crypto::Hash::MD5::DigestType apple_p3_2015_id = { 0xe5, 0xbb, 0x0e, 0x98, 0x67, 0xbd, 0x46, 0xcd, 0x4b, 0xbe, 0x44, 0x6e, 0xbd, 0x1b, 0x75, 0x98 }; + auto has_type = [&](auto tag, std::initializer_list types, std::initializer_list v4_types) { if (auto type = m_tag_table.get(tag); type.has_value()) { auto type_matches = [&](auto wanted_type) { return type.value()->type() == wanted_type; }; @@ -1005,7 +1009,7 @@ ErrorOr Profile::check_tag_types() // The v4 spec requires multiLocalizedUnicodeType for this, but I'm aware of a single file // that still uses the v2 'text' type here: /System/Library/ColorSync/Profiles/ITU-2020.icc on macOS 13.1. // https://openradar.appspot.com/radar?id=5529765549178880 - bool has_v2_cprt_type_in_v4_file_quirk = id() == apple_itu_2020_id; + bool has_v2_cprt_type_in_v4_file_quirk = id() == apple_itu_2020_id || id() == apple_p3_2015_id; if (is_v4() && type.value()->type() != MultiLocalizedUnicodeTagData::Type && (!has_v2_cprt_type_in_v4_file_quirk || type.value()->type() != TextTagData::Type)) return Error::from_string_literal("ICC::Profile: copyrightTag has unexpected v4 type"); if (is_v2() && type.value()->type() != TextTagData::Type) @@ -1189,7 +1193,7 @@ ErrorOr Profile::check_tag_types() // The v4 spec requires multiLocalizedUnicodeType for this, but I'm aware of a single file // that still uses the v2 'desc' type here: /System/Library/ColorSync/Profiles/ITU-2020.icc on macOS 13.1. // https://openradar.appspot.com/radar?id=5529765549178880 - bool has_v2_desc_type_in_v4_file_quirk = id() == apple_itu_2020_id; + bool has_v2_desc_type_in_v4_file_quirk = id() == apple_itu_2020_id || id() == apple_p3_2015_id; if (is_v4() && type.value()->type() != MultiLocalizedUnicodeTagData::Type && (!has_v2_desc_type_in_v4_file_quirk || type.value()->type() != TextDescriptionTagData::Type)) return Error::from_string_literal("ICC::Profile: profileDescriptionTag has unexpected v4 type"); if (is_v2() && type.value()->type() != TextDescriptionTagData::Type)