Bug 42973 - (color:8) media query does not evaluate to true for 32bpp displays on Windows
Summary: (color:8) media query does not evaluate to true for 32bpp displays on Windows
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar, PlatformOnly
Depends on:
Blocks:
 
Reported: 2010-07-26 06:32 PDT by Adam Roben (:aroben)
Modified: 2010-10-01 05:09 PDT (History)
6 users (show)

See Also:


Attachments
test case (244 bytes, text/html)
2010-07-26 06:32 PDT, Adam Roben (:aroben)
no flags Details
LayoutTests-compatible test case (726 bytes, text/html)
2010-09-29 15:37 PDT, Adam Roben (:aroben)
no flags Details
Fix color media queries on Windows (3.81 KB, patch)
2010-09-29 15:44 PDT, Adam Roben (:aroben)
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2010-07-26 06:32:28 PDT
Created attachment 62566 [details]
test case

To reproduce:

1. Load attached test case

The box in the test case should be green, but is red. On Mac it is green.

The problem is that the (color:8) media query is evaluating to false. Surprisingly, (color:10) evaluates to true on Windows.
Comment 1 Adam Roben (:aroben) 2010-07-26 06:35:14 PDT
The screenDepthPerComponent function is what is used to evaluate this media query: <http://trac.webkit.org/browser/trunk/WebCore/platform/win/PlatformScreenWin.cpp?rev=52791#L74>

The problem (as in bug 42972) is that deviceInfo.bmBitsPerPel is returning 32, rather than 24. 32 / 3 == 10 (with integer truncation), which is why (color:10) is evaluating to true.

Once we fix bug 42972, we could change screenDepthPerComponent to call through to screenDepth, rather than calling deviceInfoForWidget directly.
Comment 2 Adam Roben (:aroben) 2010-07-26 06:36:34 PDT
<rdar://problem/8234072>
Comment 3 Adam Roben (:aroben) 2010-09-29 15:37:06 PDT
Created attachment 69262 [details]
LayoutTests-compatible test case
Comment 4 Adam Roben (:aroben) 2010-09-29 15:44:57 PDT
Created attachment 69264 [details]
Fix color media queries on Windows
Comment 5 Adam Roben (:aroben) 2010-09-29 15:45:27 PDT
Comment on attachment 69264 [details]
Fix color media queries on Windows

View in context: https://bugs.webkit.org/attachment.cgi?id=69264&action=review

> LayoutTests/fast/media/color-does-not-include-alpha.html:12
> +    @media (color:8) {
> +        #test {
> +            background-color: green;
> +        }
> +    }

This test requires that all testers have 24bpp displays. Is this OK?
Comment 6 Adam Roben (:aroben) 2010-09-30 11:31:39 PDT
Committed r68809: <http://trac.webkit.org/changeset/68809>
Comment 7 Csaba Osztrogonác 2010-10-01 01:23:03 PDT
(In reply to comment #6)
> Committed r68809: <http://trac.webkit.org/changeset/68809>

The new test fails on Qt, I filed a new bug to track it:
https://bugs.webkit.org/show_bug.cgi?id=46966
Comment 8 Adam Roben (:aroben) 2010-10-01 05:09:11 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > Committed r68809: <http://trac.webkit.org/changeset/68809>
> 
> The new test fails on Qt, I filed a new bug to track it:
> https://bugs.webkit.org/show_bug.cgi?id=46966

Sorry about that, and thanks!