To reproduce: 1. Load this URL: javascript:alert(screen.colorDepth + "\n" + screen.pixelDepth) Both values are 32. But according to CSSOM View [1], they should be 24. Firefox returns 24. WebKit returns 24 on Mac, too.
1. http://dev.w3.org/csswg/cssom-view/#dom-screen-colordepth
It looks like we should fix this in the screenDepth function in PlatformScreenWin.cpp. See <https://bugzilla.mozilla.org/show_bug.cgi?id=424386> and <https://bugzilla.mozilla.org/show_bug.cgi?id=466669> for Mozilla's discussion of this issue.
(In reply to comment #2) > It looks like we should fix this in the screenDepth function in PlatformScreenWin.cpp. Here's the screenDepth function: <http://trac.webkit.org/browser/trunk/WebCore/platform/win/PlatformScreenWin.cpp?rev=52791#L68>. The problem is that deviceInfo.dmBitsPerPel is 32 rather than 24 as we expect. We should notice this and return 24 instead.
See also <http://dbaron.org/log/20100725-colorDepth>
<rdar://problem/8234071>
Created attachment 69249 [details] Make sure screen.colorDepth/screen.pixelDepth don't include the bits used for alpha
Comment on attachment 69249 [details] Make sure screen.colorDepth/screen.pixelDepth don't include the bits used for alpha View in context: https://bugs.webkit.org/attachment.cgi?id=69249&action=review > LayoutTests/fast/dom/Window/window-screen-properties.html:6 > +if (depth == 16 || depth == 24) { > + document.write("PASS: window.screen.pixelDepth is either 16 or 24"); Hm, is 16 really an OK value? I guess that could mean 6+5+5 or something, but that seems strange.
(In reply to comment #7) > (From update of attachment 69249 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=69249&action=review > > > LayoutTests/fast/dom/Window/window-screen-properties.html:6 > > +if (depth == 16 || depth == 24) { > > + document.write("PASS: window.screen.pixelDepth is either 16 or 24"); > > Hm, is 16 really an OK value? I guess that could mean 6+5+5 or something, but that seems strange. http://en.wikipedia.org/wiki/Color_depth#HighColor says that is exactly what happens (6 bits for green, 5 for red, 5 for blue). That page also implies we should be allowing many more values.
Comment on attachment 69249 [details] Make sure screen.colorDepth/screen.pixelDepth don't include the bits used for alpha View in context: https://bugs.webkit.org/attachment.cgi?id=69249&action=review >>> LayoutTests/fast/dom/Window/window-screen-properties.html:6 >>> + document.write("PASS: window.screen.pixelDepth is either 16 or 24"); >> >> Hm, is 16 really an OK value? I guess that could mean 6+5+5 or something, but that seems strange. > > http://en.wikipedia.org/wiki/Color_depth#HighColor says that is exactly what happens (6 bits for green, 5 for red, 5 for blue). That page also implies we should be allowing many more values. Hyatt and I decided to change the test only to allow 24, since bug 42973 imposes that requirement, too.
Committed r68808: <http://trac.webkit.org/changeset/68808>