Last Comment Bug 810399 - Add a CSS Media Query for Windows 8 Desktop theme
: Add a CSS Media Query for Windows 8 Desktop theme
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: General (show other bugs)
: unspecified
: All Windows 8
: -- normal (vote)
: mozilla25
Assigned To: Jim Mathies [:jimm]
:
:
Mentors:
: 873116 (view as bug list)
Depends on: 907373 965961
Blocks: 855998
  Show dependency treegraph
 
Reported: 2012-11-09 10:50 PST by Richard Marti (:Paenglab)
Modified: 2014-02-18 03:31 PST (History)
17 users (show)
ryanvm: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
wip (14.62 KB, patch)
2013-05-16 13:28 PDT, Jim Mathies [:jimm]
no flags Details | Diff | Splinter Review
test css queries (1.24 KB, text/html)
2013-05-16 13:52 PDT, Jim Mathies [:jimm]
no flags Details
csspatch v.1 (7.96 KB, patch)
2013-05-20 01:15 PDT, Jim Mathies [:jimm]
bzbarsky: review+
Details | Diff | Splinter Review
widget patch v.1 (6.61 KB, patch)
2013-05-20 01:16 PDT, Jim Mathies [:jimm]
roc: review+
Details | Diff | Splinter Review
test css queries (1.25 KB, text/html)
2013-07-01 08:59 PDT, Jim Mathies [:jimm]
no flags Details
test css queries (981 bytes, text/html)
2014-02-18 03:31 PST, Jim Mathies [:jimm]
no flags Details

Description Richard Marti (:Paenglab) 2012-11-09 10:50:18 PST
For the Mozilla desktop applications it would be helpful when a Media Query would exist that detects the Windows 8 standard theme. Now it uses also -moz-windows-compositor which is optimized for Vista/Win7 with gradients, transparency etc.
Comment 1 Jim Mathies [:jimm] 2013-05-16 11:40:58 PDT
*** Bug 873116 has been marked as a duplicate of this bug. ***
Comment 2 Jim Mathies [:jimm] 2013-05-16 11:43:06 PDT
I'm not adding a theme related metric since the default theme in Win8 is aero, despite the differences between aero on win7 and win8. So I'm going to add a -moz-windows-version selector/query instead to help clear up the ambiguity.
Comment 3 Peter Henkel [:Terepin] 2013-05-16 11:53:12 PDT
Aero was removed in Windows 8. The only resemblance is semi-transparent taskbar, but that's pretty much everything. The design was changed to the point where every app designed for Aero Glass doesn't fit the rest of the system in Win8.
Comment 4 Jim Mathies [:jimm] 2013-05-16 12:07:11 PDT
(In reply to Peter Henkel [:Terepin] from comment #3)
> Aero was removed in Windows 8. The only resemblance is semi-transparent
> taskbar, but that's pretty much everything. The design was changed to the
> point where every app designed for Aero Glass doesn't fit the rest of the
> system in Win8.

The desktop renders differently but the theme is still stored in aero.msstyles. We use the theme name for theme detection, so -moz-windows-theme on win8 is still aero.
Comment 5 Richard Marti (:Paenglab) 2013-05-16 12:34:18 PDT
In Bug 855998 I used this media query construct to apply only on default Win8 theme:

@media (-moz-windows-compositor) {
  @media not all and (-moz-windows-glass) {
  }
}

A simpler solution would be helpful.
Comment 6 Jim Mathies [:jimm] 2013-05-16 13:02:43 PDT
like - 

@media (-moz-windows-version: xp,vista,win7,win8, ..) {
..
}

in addition we still have the theme selectors for xp, default theme detection for all win os, and the recently added glass detection.

We're also going to try to get bug 578780 fixed too.
Comment 7 Jim Mathies [:jimm] 2013-05-16 13:28:25 PDT
Created attachment 750648 [details] [diff] [review]
wip
Comment 8 Jim Mathies [:jimm] 2013-05-16 13:52:17 PDT
Created attachment 750674 [details]
test css queries
Comment 9 Jim Mathies [:jimm] 2013-05-16 13:55:48 PDT
https://tbpl.mozilla.org/?tree=Try&rev=2b1d2d6640a2
Comment 10 Jim Mathies [:jimm] 2013-05-20 01:15:43 PDT
Created attachment 751599 [details] [diff] [review]
csspatch v.1
Comment 11 Jim Mathies [:jimm] 2013-05-20 01:16:12 PDT
Created attachment 751600 [details] [diff] [review]
widget patch v.1
Comment 12 Matthew N. [:MattN] (PM me if requests are blocking you) 2013-05-20 19:19:08 PDT
Comment on attachment 751599 [details] [diff] [review]
csspatch v.1

Review of attachment 751599 [details] [diff] [review]:
-----------------------------------------------------------------

Have we considered implementing this as a cross-platform selector (e.g. -moz-os-version) that we could also use for OS X or Linux in the future?

::: layout/style/nsMediaFeatures.cpp
@@ +53,5 @@
> +// Windows version identities used in the -moz-windows-version media query.
> +const WindowsVersionName winVersionStrings[] = {
> +    { LookAndFeel::eWindowsVersion_XP,       L"xp" },
> +    { LookAndFeel::eWindowsVersion_Vista,    L"vista" },
> +    { LookAndFeel::eWindowsVersion_Win7,     L"win7" },

Driveby naming nit: I would prefer that we used "windows" as the prefix instead of "win" as it's more descriptive and more common in for existing Windows selectors.
I also think that we should use the prefix consistently instead of leaving the prefix off of xp and vista especially with a cross-platform selector. e.g. windows-xp, windows-vista, windows-7.
Comment 13 Jim Mathies [:jimm] 2013-05-21 04:47:41 PDT
(In reply to Matthew N. [:MattN] from comment #12)
> Comment on attachment 751599 [details] [diff] [review]
> csspatch v.1
> 
> Review of attachment 751599 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Have we considered implementing this as a cross-platform selector (e.g.
> -moz-os-version) that we could also use for OS X or Linux in the future?

Not sure how useful that would be on Linux. On OSX we already have the theme 
selectors, from my understanding those are specific to os versions.

We could make the name more generic if you like so that we can add versions on other platforms down the road.
Comment 14 Boris Zbarsky [:bz] (still a bit busy) 2013-06-06 00:14:01 PDT
Do we end up exposing these to untrusted content?  If so, do we want to?
Comment 15 Jim Mathies [:jimm] 2013-06-06 04:15:45 PDT
(In reply to Boris Zbarsky (:bz) from comment #14)
> Do we end up exposing these to untrusted content?

Yes.

>  If so, do we want to?

Interesting question. I'm not sure what the right answer is here. My personal preference would be that all os specific css that we want in chrome should not since it might be useful to someone for malicious purposes.

On the flip side of this we currently expose other os specific queries to content, including glass, win and osx theme info, and theme related os configuration. So it seems we are not too worried about this in general.

If it's easy to flip these so they are chrome only, maybe we should file a bug on itemizing everything we currently expose (including these) and flip the switch on anything we don't feel content should know about.
Comment 16 Boris Zbarsky [:bz] (still a bit busy) 2013-06-06 08:58:33 PDT
The question is whether we're ok with the fingerprinting aspects of this....
Comment 17 Boris Zbarsky [:bz] (still a bit busy) 2013-06-17 20:18:09 PDT
Comment on attachment 751599 [details] [diff] [review]
csspatch v.1

OK, I guess while waiting on dbaron here...

Why did we need to add these to sSystemMetrics?
Comment 18 David Baron :dbaron: ⌚️UTC-10 2013-06-17 20:23:00 PDT
So what's the fingerprinting information that would be gained?  If there's data here that's not already detectable by the sizes of form controls, what is it?  Which version of the OS the user is running (I think it's probably pointless to even try protecting that)?  Or configuration choices that they've made?  (Merely default vs. non-default, or more than that?)

My inclination is probably not to worry about fingerprinting aspects here, though that might depend on answers to the above.
Comment 19 Jim Mathies [:jimm] 2013-06-18 03:03:28 PDT
(In reply to Boris Zbarsky (:bz) from comment #17)
> Comment on attachment 751599 [details] [diff] [review]
> csspatch v.1
> 
> OK, I guess while waiting on dbaron here...
> 
> Why did we need to add these to sSystemMetrics?

So that these work with moz-system-metric support.
Comment 20 Jim Mathies [:jimm] 2013-06-18 03:09:34 PDT
(In reply to David Baron [:dbaron] (don't cc:, use needinfo? instead) from comment #18)
> So what's the fingerprinting information that would be gained?  If there's
> data here that's not already detectable by the sizes of form controls, what
> is it?  Which version of the OS the user is running (I think it's probably
> pointless to even try protecting that)?  Or configuration choices that
> they've made?  (Merely default vs. non-default, or more than that?)

General os version (xp, win7, win8, ..) without any guesswork. That's it.
Comment 21 Boris Zbarsky [:bz] (still a bit busy) 2013-06-18 05:46:37 PDT
Comment on attachment 751599 [details] [diff] [review]
csspatch v.1

Ah, you want both that _and_ the media query?

OK, I guess that works.  r=me modulo the fingerprinting concerns, which you should discuss with dbaron.
Comment 22 Jim Mathies [:jimm] 2013-06-18 05:52:28 PDT
(In reply to Boris Zbarsky (:bz) from comment #21)
> Comment on attachment 751599 [details] [diff] [review]
> csspatch v.1
> 
> Ah, you want both that _and_ the media query?

That seems to be standard practice with these? I'll default to your judgement on this.
Comment 23 Boris Zbarsky [:bz] (still a bit busy) 2013-06-18 07:19:09 PDT
Makes sense to do the thing other cases are already doing, yeah.
Comment 24 Mike Conley (:mconley) 2013-06-26 13:46:07 PDT
Gentle review ping on Neil.
Comment 25 Jim Mathies [:jimm] 2013-07-01 08:59:05 PDT
Created attachment 769699 [details]
test css queries

Updated test page to use more generalized media query constants requested in comment 12.
Comment 27 neil@parkwaycc.co.uk 2013-07-01 16:43:08 PDT
(In reply to Mike Conley from comment #24)
> Gentle review ping on Neil.

So gentle that I never noticed the ping.

I did get the usual Bugzilla nag of course, but I was fighting a weird build error in NSS which is why I hadn't got around to doing the review. Sorry about that.
Comment 30 Matthew N. [:MattN] (PM me if requests are blocking you) 2013-07-04 03:35:35 PDT
(In reply to Jean-Yves Perrier [:teoli] from comment #29)

I corrected the property name (-moz-os-version) and values:
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#-moz-os-version
and 
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/25#CSS
Comment 31 Tim Nguyen :ntim (use needinfo?) 2013-08-20 13:13:02 PDT
The media query doesn't work on Windows 8.1. I'll fill a seperate bug soon.
Comment 32 Jim Mathies [:jimm] 2014-02-18 03:31:46 PST
Created attachment 8377499 [details]
test css queries

Note You need to log in before you can comment on or make changes to this bug.