From ceb8727d80e9ddd671577494ddeb1c182645833e Mon Sep 17 00:00:00 2001 From: Christopher Cameron Date: Thu, 7 Sep 2017 23:53:16 +0000 Subject: [PATCH] Add about:flags to force color profile Add an about:flag to force a specific color profile, and add some common options to this flag. In particular: * sRGB, since it's the standard color space * Display P3, since it is a common wide gamut profile * scRGB Linear, since that will force HDR mode on Windows 10 * A color spin non-standard gamma space, for testing Some users who have wide color gamut monitors want the over-saturated that non-color-correct rendering provided. For these users, on Chrome 61, they must either disable the color correct rendering feature, or remove their system-installed color profile. These users who want oversaturated colors on Windows and Linux will have the option of forcing sRGB as their color profile in about:flags in Chrome 62 and beyond. R=hubbe TBR=holte Bug: 755747 Change-Id: I80b37432ca42bd0500b443b892bc754727c3f7b7 Reviewed-on: https://chromium-review.googlesource.com/655802 Reviewed-by: ccameron chromium Reviewed-by: Fredrik Hubinette Commit-Queue: ccameron chromium Cr-Commit-Position: refs/heads/master@{#500439} --- chrome/browser/about_flags.cc | 16 ++++++++++++++++ chrome/browser/flag_descriptions.cc | 10 ++++++++++ chrome/browser/flag_descriptions.h | 8 ++++++++ tools/metrics/histograms/enums.xml | 1 + ui/display/display.cc | 2 ++ 5 files changed, 37 insertions(+) diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 1b5c44a54d505..482516a3f220a 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -793,6 +793,18 @@ const FeatureEntry::Choice kEnableAudioFocusChoices[] = { }; #endif // !defined(OS_ANDROID) +const FeatureEntry::Choice kForceColorProfileChoices[] = { + {flags_ui::kGenericExperimentChoiceDefault, "", ""}, + {flag_descriptions::kForceColorProfileSRGB, switches::kForceColorProfile, + "srgb"}, + {flag_descriptions::kForceColorProfileP3, switches::kForceColorProfile, + "display-p3-d65"}, + {flag_descriptions::kForceColorProfileColorSpin, + switches::kForceColorProfile, "color-spin-gamma24"}, + {flag_descriptions::kForceColorProfileHdr, switches::kForceColorProfile, + "scrgb-linear"}, +}; + const FeatureEntry::Choice kAutoplayPolicyChoices[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flag_descriptions::kAutoplayPolicyNoUserGestureRequired, @@ -3096,6 +3108,10 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kColorCorrectRenderingDescription, kOsAll, FEATURE_VALUE_TYPE(features::kColorCorrectRendering)}, + {"force-color-profile", flag_descriptions::kForceColorProfileName, + flag_descriptions::kForceColorProfileDescription, kOsAll, + MULTI_VALUE_TYPE(kForceColorProfileChoices)}, + #if defined(OS_CHROMEOS) {"quick-unlock-pin-signin", flag_descriptions::kQuickUnlockPinSignin, flag_descriptions::kQuickUnlockPinSigninDescription, kOsCrOS, diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 28336331b396a..ec2c14f4922dd 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc @@ -115,6 +115,16 @@ const char kColorCorrectRenderingName[] = "Color correct rendering"; const char kColorCorrectRenderingDescription[] = "Enables color correct rendering of web content."; +const char kForceColorProfileSRGB[] = "sRGB"; +const char kForceColorProfileP3[] = "Display P3 D65"; +const char kForceColorProfileColorSpin[] = "Color spin with gamma 2.4"; +const char kForceColorProfileHdr[] = "scRGB linear (HDR where available)"; + +const char kForceColorProfileName[] = "Force color profile"; +const char kForceColorProfileDescription[] = + "Forces Chrome to use a specific color profile instead of the color " + "of the window's current monitor, as specified by the operating system."; + const char kCompositedLayerBordersName[] = "Composited render layer borders"; const char kCompositedLayerBordersDescription[] = "Renders a border around composited Render Layers to help debug and study " diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 98a4b0e52df81..2399ae42165b5 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h @@ -95,6 +95,14 @@ extern const char kCloudImportDescription[]; extern const char kColorCorrectRenderingName[]; extern const char kColorCorrectRenderingDescription[]; +extern const char kForceColorProfileSRGB[]; +extern const char kForceColorProfileP3[]; +extern const char kForceColorProfileColorSpin[]; +extern const char kForceColorProfileHdr[]; + +extern const char kForceColorProfileName[]; +extern const char kForceColorProfileDescription[]; + extern const char kCompositedLayerBordersName[]; extern const char kCompositedLayerBordersDescription[]; diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index e073916f5e924..9219e44e4c397 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml @@ -23883,6 +23883,7 @@ from previous Chrome versions. + diff --git a/ui/display/display.cc b/ui/display/display.cc index fd5852e20fd25..c090191661500 100644 --- a/ui/display/display.cc +++ b/ui/display/display.cc @@ -110,6 +110,8 @@ gfx::ColorSpace Display::GetForcedColorProfile() { switches::kForceColorProfile); if (value == "srgb") { return gfx::ColorSpace::CreateSRGB(); + } else if (value == "display-p3-d65") { + return gfx::ColorSpace::CreateDisplayP3D65(); } else if (value == "scrgb-linear") { return gfx::ColorSpace::CreateSCRGBLinear(); } else if (value == "extended-srgb") {