Bug 22300 - Use of NSCalibratedRGBColorSpace for CSS system colors causes layout tests to fail due to screen calibration
Summary: Use of NSCalibratedRGBColorSpace for CSS system colors causes layout tests to...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-16 20:07 PST by Simon Fraser (smfr)
Modified: 2009-03-02 11:51 PST (History)
1 user (show)

See Also:


Attachments
Patch v1 (12.58 KB, patch)
2008-11-20 19:00 PST, Pierre-Olivier Latour
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2008-11-16 20:07:25 PST
The following layout tests:

fast/forms/disabled-select-change-index.html
fast/forms/file-input-disabled.html
fast/forms/input-text-maxlength.html
fast/forms/input-text-paste-maxlength.html

always fail for me at home because the disabled text control color differs from the expected:

-            RenderButton {INPUT} at (0,0) size 78x18 [color=#808080] [bgcolor=#C0C0C0]
+            RenderButton {INPUT} at (0,0) size 78x18 [color=#6D6D6D] [bgcolor=#C0C0C0]

Deugging shows that for me, 
[[NSColor disabledControlTextColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]

returns #6d6d6d, not #808080.

Maybe NSCalibratedRGBColorSpace is the wrong color space to use?
Comment 1 Simon Fraser (smfr) 2008-11-16 20:07:51 PST
This change was landed in https://bugs.webkit.org/show_bug.cgi?id=6129.
Comment 2 mitz 2008-11-16 20:08:22 PST
(In reply to comment #0)
> Maybe NSCalibratedRGBColorSpace is the wrong color space to use?

I think you're right.
Comment 3 Pierre-Olivier Latour 2008-11-20 17:49:22 PST
This failure is pretty easy to reproduce: just set your display profile to sRGB for instance.

Note that it won't reproduce if you run with --pixel as this temporarily changes the display profile to Generic RGB.
Comment 4 Pierre-Olivier Latour 2008-11-20 18:11:02 PST
I had a look at the webcore and webkit source, and it seems that:
1) CG colorspace are always device except for one case (in CreateCGColorIfDifferent())
2) AppKit colorspace can be device or calibrated and I don't see a clear pattern

Comment 5 Pierre-Olivier Latour 2008-11-20 19:00:08 PST
Created attachment 25329 [details]
Patch v1

The way to fix this issue and other potential ones is to ensure WebKit is always using Device RGB colorspace internally, which is mostly the case today.

Note that I replaced calls to +[NSColor whiteColor] as well since these return colors in calibrated colorspace.

I ran all layout tests with pixel tests enabled and disabled and no regressions were reported, except for platform/mac/fast/text/attributed-substring-from-range-001.html which needs to be updated.
Comment 6 mitz 2008-11-21 10:23:21 PST
Comment on attachment 25329 [details]
Patch v1

r=me
Comment 7 Dean Jackson 2008-11-21 12:02:31 PST
Committed r38671
	M	WebKit/mac/ChangeLog
	M	WebKit/mac/WebView/WebHTMLView.mm
	M	WebCore/ChangeLog
	M	WebCore/page/mac/AccessibilityObjectWrapper.mm
	M	WebCore/platform/graphics/mac/ColorMac.h
	M	WebCore/platform/graphics/mac/ColorMac.mm
	M	WebCore/rendering/RenderThemeMac.mm
	M	LayoutTests/platform/mac/fast/text/attributed-substring-from-range-001-expected.txt
	M	LayoutTests/ChangeLog