Bug 1639574 - Disable color management for CSS due to issues with canvas. r=jrmuizel, a=pascalc FIREFOX_77_0_BUILD2
authorAndrew Osmond <aosmond@mozilla.com>
Tue, 26 May 2020 21:20:18 +0000
changeset 2923124 6c4a098b52dc0a793b55f2fb2894b80892873e2f
parent 2923123 9ad767398b408a09b8ef9512b86fd3fc97832888
child 2923125 77ccbd694cbae7491909a34f90a916d0d81ba970
push id544992
push userryanvm@gmail.com
push dateThu, 28 May 2020 14:55:54 +0000
treeherdertry@ab628c074f84 [default view] [failures only]
reviewersjrmuizel, pascalc
bugs1639574
milestone77.0
Bug 1639574 - Disable color management for CSS due to issues with canvas. r=jrmuizel, a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D76859
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
image/test/gtest/Common.cpp
modules/libpref/init/StaticPrefList.yaml
testing/profiles/reftest/user.js
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2082,16 +2082,21 @@ eCMSMode gfxPlatform::GetCMSMode() {
       qcms_enable_neon();
     }
 #endif
     gCMSInitialized = true;
   }
   return gCMSMode;
 }
 
+void gfxPlatform::SetCMSModeOverride(eCMSMode aMode) {
+  MOZ_ASSERT(gCMSInitialized);
+  gCMSMode = aMode;
+}
+
 int gfxPlatform::GetRenderingIntent() {
   // StaticPrefList.yaml is using 0 as the default for the rendering
   // intent preference, based on that being the value for
   // QCMS_INTENT_DEFAULT.  Assert here to catch if that ever
   // changes and we can then figure out what to do about it.
   MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
 
   /* Try to query the pref system for a rendering intent. */
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -502,16 +502,21 @@ class gfxPlatform : public mozilla::laye
   static void DisableBufferRotation();
 
   /**
    * Are we going to try color management?
    */
   static eCMSMode GetCMSMode();
 
   /**
+   * Used only for testing. Override the pref setting.
+   */
+  static void SetCMSModeOverride(eCMSMode aMode);
+
+  /**
    * Determines the rendering intent for color management.
    *
    * If the value in the pref gfx.color_management.rendering_intent is a
    * valid rendering intent as defined in gfx/qcms/qcms.h, that
    * value is returned. Otherwise, -1 is returned and the embedded intent
    * should be used.
    *
    * See bug 444014 for details.
--- a/image/test/gtest/Common.cpp
+++ b/image/test/gtest/Common.cpp
@@ -47,16 +47,19 @@ AutoInitializeImageLib::AutoInitializeIm
   // Ensure that ImageLib services are initialized.
   nsCOMPtr<imgITools> imgTools =
       do_CreateInstance("@mozilla.org/image/tools;1");
   EXPECT_TRUE(imgTools != nullptr);
 
   // Ensure gfxPlatform is initialized.
   gfxPlatform::GetPlatform();
 
+  // Ensure we always color manage images with gtests.
+  gfxPlatform::SetCMSModeOverride(eCMSMode_All);
+
   // Depending on initialization order, it is possible that our pref changes
   // have not taken effect yet because there are pending gfx-related events on
   // the main thread.
   SpinPendingEvents();
 }
 
 void ImageBenchmarkBase::SetUp() {
   nsCOMPtr<nsIInputStream> inputStream = LoadFile(mTestCase.mPath);
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -3735,17 +3735,17 @@
   type: RelaxedAtomicBool
   value: false
   mirror: always
 
 # 0 = Off, 1 = Full, 2 = Tagged Images Only.
 # See eCMSMode in gfx/thebes/gfxPlatform.h.
 - name: gfx.color_management.mode
   type: RelaxedAtomicInt32
-  value: 1
+  value: 2
   mirror: always
 
 # The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
 - name: gfx.color_management.rendering_intent
   type: RelaxedAtomicInt32
   value: 0
   mirror: always
 
--- a/testing/profiles/reftest/user.js
+++ b/testing/profiles/reftest/user.js
@@ -36,17 +36,17 @@ user_pref("dom.ipc.tabs.shutdownTimeoutS
 user_pref("dom.use_xbl_scopes_for_remote_xul", false);
 user_pref("extensions.autoDisableScopes", 0);
 // Disable blocklist updates so we don't have them reported as leaks
 user_pref("extensions.blocklist.enabled", false);
 user_pref("extensions.getAddons.cache.enabled", false);
 user_pref("extensions.getAddons.get.url", "http://localhost/extensions-dummy/repositoryGetURL");
 user_pref("extensions.systemAddon.update.url", "http://localhost/dummy-system-addons.xml");
 user_pref("gfx.color_management.force_srgb", true);
-user_pref("gfx.color_management.mode", 1);
+user_pref("gfx.color_management.mode", 2);
 user_pref("gfx.logging.level", 1);
 // Disable downscale-during-decode, since it makes reftests more difficult.
 user_pref("image.downscale-during-decode.enabled", false);
 // Disable interruptible reflow since (1) it's normally not going to
 // happen, but (2) it might happen if we somehow end up with both
 // pending user events and clock skew.  So to avoid having to change
 // MakeProgress to deal with waiting for interruptible reflows to
 // complete for a rare edge case, we just disable interruptible