Bug 228313

Summary: LayoutTestHelper does not correctly restore color profiles for some devices
Product: WebKit Reporter: Cameron McCormack (:heycam) <heycam>
Component: Tools / TestsAssignee: Cameron McCormack (:heycam) <heycam>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, jbedard, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 188320    
Attachments:
Description Flags
Patch none

Description Cameron McCormack (:heycam) 2021-07-26 22:07:50 PDT
LayoutTestHelper only looks for profiles named "1", which is a default profile name.  Some devices have multiple profile names, such as my external monitor, which has this device info dictionary:

(lldb) po deviceInfo
{
    CustomProfiles =     {
        "HDMI HD" = "file:///System/Library/ColorSync/Profiles/sRGB%20Profile.icc";
    };
    DeviceClass = mntr;
    DeviceDescription = "ASUS PB27U";
    DeviceHostScope = kCFPreferencesCurrentHost;
    DeviceID = "<CFUUID 0x6000037cc3e0> 4261DDFA-A1B4-1E80-AD62-026351A927F0";
    DeviceUserScope = kCFPreferencesAnyUser;
    FactoryProfiles =     {
        DeviceDefaultProfileID = "HDMI HD";
        "HDMI HD" =         {
            DeviceModeDescription = "HDMI HD";
            DeviceProfileURL = "file:///Library/ColorSync/Profiles/Displays/ASUS%20PB27U-4261DDFA-A1B4-1E80-AD62-026351A927F0.icc";
        };
        "HDMI SD" =         {
            DeviceModeDescription = "HDMI SD";
            DeviceProfileURL = "file:///System/Library/CoreServices/Resources/Profiles/SD%20170M-A.icc";
        };
    };
}

We should look at the DeviceDefaultProfileID and use that as the profile name.
Comment 1 Cameron McCormack (:heycam) 2021-07-26 22:10:51 PDT
s/profile name/mode/, maybe.
Comment 2 Radar WebKit Bug Importer 2021-07-26 22:11:04 PDT
<rdar://problem/81146417>
Comment 3 Cameron McCormack (:heycam) 2021-07-26 22:34:38 PDT
Created attachment 434270 [details]
Patch
Comment 4 EWS 2021-08-10 16:51:46 PDT
Committed r280871 (240410@main): <https://commits.webkit.org/240410@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 434270 [details].