Title: [280871] trunk/Tools
Revision
280871
Author
[email protected]
Date
2021-08-10 16:51:39 -0700 (Tue, 10 Aug 2021)

Log Message

Restore color profiles correctly on displays with multiple named modes
https://bugs.webkit.org/show_bug.cgi?id=228313
<rdar://problem/81146417>

Reviewed by Alexey Proskuryakov.

Look up a device's current color profile by checking the default mode
rather than assuming it is "1".  The device info dictionary returned
by ColorSyncDeviceCopyDeviceInfo has this shape:

{
    CustomProfiles = {
        ModeName1 = "file:///path/to/custom/profile.ics";
    };
    FactoryProfiles = {
        DeviceDefaultProfileID = "ModeName1";
        ModeName1 = {
            DeviceModeDescription = "Mode Name 1";
            DeviceProfileURL = "file:///path/to/factory/profile1.ics";
        };
        ModeName2 = {
            DeviceModeDescription = "Mode Name 2";
            DeviceProfileURL = "file:///path/to/factory/profile2.ics";
        };
    };
}

where CustomProfiles is only present if a custom profile has been
selected, and the default mode name is "1".  Displays connected over
HDMI don't use the default mode name.

* DumpRenderTree/mac/LayoutTestHelper.m:
(colorProfileURLForDisplay):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (280870 => 280871)


--- trunk/Tools/ChangeLog	2021-08-10 23:19:03 UTC (rev 280870)
+++ trunk/Tools/ChangeLog	2021-08-10 23:51:39 UTC (rev 280871)
@@ -1,3 +1,39 @@
+2021-08-10  Cameron McCormack  <[email protected]>
+
+        Restore color profiles correctly on displays with multiple named modes
+        https://bugs.webkit.org/show_bug.cgi?id=228313
+        <rdar://problem/81146417>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Look up a device's current color profile by checking the default mode
+        rather than assuming it is "1".  The device info dictionary returned
+        by ColorSyncDeviceCopyDeviceInfo has this shape:
+
+        {
+            CustomProfiles = {
+                ModeName1 = "file:///path/to/custom/profile.ics";
+            };
+            FactoryProfiles = {
+                DeviceDefaultProfileID = "ModeName1";
+                ModeName1 = {
+                    DeviceModeDescription = "Mode Name 1";
+                    DeviceProfileURL = "file:///path/to/factory/profile1.ics";
+                };
+                ModeName2 = {
+                    DeviceModeDescription = "Mode Name 2";
+                    DeviceProfileURL = "file:///path/to/factory/profile2.ics";
+                };
+            };
+        }
+
+        where CustomProfiles is only present if a custom profile has been
+        selected, and the default mode name is "1".  Displays connected over
+        HDMI don't use the default mode name.
+
+        * DumpRenderTree/mac/LayoutTestHelper.m:
+        (colorProfileURLForDisplay):
+
 2021-08-09  Jonathan Bedard  <[email protected]>
 
         [resultsdbpy] Add results-summary API

Modified: trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m (280870 => 280871)


--- trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m	2021-08-10 23:19:03 UTC (rev 280870)
+++ trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m	2021-08-10 23:51:39 UTC (rev 280871)
@@ -79,15 +79,20 @@
         return nil;
     }
 
+    CFStringRef profileID = CFSTR("1");
     CFURLRef profileURL = nil;
-    CFDictionaryRef profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncCustomProfiles);
-    if (profileInfo)
-        profileURL = (CFURLRef)CFDictionaryGetValue(profileInfo, CFSTR("1"));
-    else {
-        profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncFactoryProfiles);
-        CFDictionaryRef factoryProfile = (CFDictionaryRef)CFDictionaryGetValue(profileInfo, CFSTR("1"));
-        if (factoryProfile)
-            profileURL = (CFURLRef)CFDictionaryGetValue(factoryProfile, kColorSyncDeviceProfileURL);
+
+    CFDictionaryRef factoryProfiles = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncFactoryProfiles);
+    if (factoryProfiles)
+        profileID = (CFStringRef)CFDictionaryGetValue(factoryProfiles, kColorSyncDeviceDefaultProfileID);
+
+    CFDictionaryRef customProfiles = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncCustomProfiles);
+    if (customProfiles)
+        profileURL = (CFURLRef)CFDictionaryGetValue(customProfiles, profileID);
+    if (!profileURL && factoryProfiles) {
+        CFDictionaryRef profile = "" profileID);
+        if (profile)
+            profileURL = (CFURLRef)CFDictionaryGetValue(profile, kColorSyncDeviceProfileURL);
     }
     
     if (!profileURL) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to