RESOLVED FIXED Bug 42972
screen.colorDepth and screen.pixelDepth return 32 on Windows, but should return 24 (according to CSSOM View and Firefox)
https://bugs.webkit.org/show_bug.cgi?id=42972
Summary screen.colorDepth and screen.pixelDepth return 32 on Windows, but should retu...
Adam Roben (:aroben)
Reported 2010-07-26 06:22:33 PDT
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.
Attachments
Make sure screen.colorDepth/screen.pixelDepth don't include the bits used for alpha (4.50 KB, patch)
2010-09-29 14:26 PDT, Adam Roben (:aroben)
darin: review+
Adam Roben (:aroben)
Comment 1 2010-07-26 06:22:48 PDT
Adam Roben (:aroben)
Comment 2 2010-07-26 06:26:11 PDT
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.
Adam Roben (:aroben)
Comment 3 2010-07-26 06:33:30 PDT
(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.
Adam Roben (:aroben)
Comment 4 2010-07-26 06:35:37 PDT
Adam Roben (:aroben)
Comment 5 2010-07-26 06:36:16 PDT
Adam Roben (:aroben)
Comment 6 2010-09-29 14:26:10 PDT
Created attachment 69249 [details] Make sure screen.colorDepth/screen.pixelDepth don't include the bits used for alpha
Adam Roben (:aroben)
Comment 7 2010-09-29 14:33:51 PDT
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.
Adam Roben (:aroben)
Comment 8 2010-09-29 14:44:57 PDT
(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.
Adam Roben (:aroben)
Comment 9 2010-09-30 10:10:31 PDT
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.
Adam Roben (:aroben)
Comment 10 2010-09-30 11:30:56 PDT
Note You need to log in before you can comment on or make changes to this bug.