On to calc()
PPK complained
today that Firefox is buggy because it reports
window.screen.colorDepth
as 24
, whereas other
browsers report it as 32
. At first glance, it sounds like
Firefox is making the situation worse for authors.
However, the situation before the fix in Firefox that he's complaining about was that, for the same color depth as it affects everything that Web authors do, browsers would report:
24
on Mac24
on Linux24
for some video drivers on Windows32
for other video drivers on WindowsIt just so happens that PPK's machine has one of the video drivers that reports 32.
In this case, it's also quite clear that the
spec says that browsers should report 24
, since they
should return “number of bits allocated to colors in the output
device.”
This quirk used to be present across all browsers because the obvious Windows API for getting the color depth, GetDeviceCaps(dc, BITSPIXEL), exposed how the video card prefers to pack color data. This is relevant to C programmers, but it's not relevant to Web authors, so we shouldn't make Web authors have to check for 32 or 24 to see if there are 24 bits of color data per pixel.
I believe the Firefox behavior of reporting
screen.colorDepth
consistently across platforms and video
cards is better for authors. I hope other browser vendors will make the
same change (and I expect they will).