Closed Bug 522149 Opened 15 years ago Closed 15 years ago

Add CSS media queries for all features supported in :-moz-system-metric()

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1
Tracking Status
status1.9.2 --- beta2-fixed

People

(Reporter: Felipe, Assigned: dbaron)

References

Details

(Keywords: dev-doc-complete)

Attachments

(5 files)

We should build a CSS media query for the touch features. We could use a simple one that just tests for the touch support or not, or more advanced queries for checking capabilities, e.g. number of touch points, type (pen vs finger), etc.

I took a look at the media query spec but couldn't tell from it if the current media features list is a definitive one or if browsers are encouraged to have their own queries. Can we implement it now and then try to move it to the spec, or do we use a moz extension by now?
We are allowed to add our own -moz values. And yes, we should then propose them as additions to the spec.
I think the thing to do here is support everything we support as :-moz-system-metric() values as individual media features (much like 'grid').

I can write up a patch for this, unless you've already started.
I'm working on this.
Assignee: nobody → dbaron
Priority: -- → P2
Hardware: x86 → All
Attachment #406310 - Flags: review?(bzbarsky) → review+
Attachment #406313 - Flags: review?(bzbarsky) → review+
Attachment #406311 - Flags: review?(bzbarsky) → review+
Comment on attachment 406311 [details] [diff] [review]
patch 2: turn mKeywordList into more generic mData so I can reuse it

I would prefer something like:

union {
  const PRInt32* mKeywordTable;
  nsIAtom * const * mMetric;
} mData;

or something.  Initialization should still work, and the consumer code can be a bit more readable...

r=bzbarsky with that.
Comment on attachment 406314 [details] [diff] [review]
patch 4: implement -moz-prefixed media features for system metrics

r=bzbarsky if you add asserts on mValueType in GetSystemMetric.
Attachment #406314 - Flags: review?(bzbarsky) → review+
(In reply to comment #9)
> or something.  Initialization should still work, and the consumer code can be a
> bit more readable...

It would?  I did what I did on the assumption that it wouldn't; I suppose I'll give it a try.  (Do you happen to know of other code that does this?)
Luke Wagner explained it to me: brace it, and it will initialize the first member of the union.  (So I'll add a void* for initialization.)
Summary: Add a CSS media query for touch features → Add CSS media queries for all features supported in :-moz-system-metric()
Attachment #406310 - Flags: approval1.9.2? → approval1.9.2+
Attachment #406311 - Flags: approval1.9.2? → approval1.9.2+
Attachment #406313 - Flags: approval1.9.2? → approval1.9.2+
Attachment #406314 - Flags: approval1.9.2? → approval1.9.2+
What are the moz-windows-compositor, moz-windows-classic, and moz-maemo-classic queries for exactly? These metrics have not previously been documented, so I have nothing to easily reference.

Also, is there a bug to add a media query for orientation?

The rest of these have been added here:

https://developer.mozilla.org/En/CSS/Media_queries#Mozilla-specific_media_features
(In reply to comment #16)
> What are the moz-windows-compositor, moz-windows-classic, and moz-maemo-classic
> queries for exactly? These metrics have not previously been documented, so I
> have nothing to easily reference.

Probably the best documentation for them is in:
http://hg.mozilla.org/mozilla-central/annotate/a6273493eab4/widget/public/nsILookAndFeel.h#l238
(and there should be links to bugs if you follow the changeset links in the blame on the left side, too).

> 
> Also, is there a bug to add a media query for orientation?

We already support 'orientation' as defined in http://dev.w3.org/csswg/css3-mediaqueries/#orientation
Duh, I even already had orientation documented. Sheesh.

OK, these are now all documented.
Blocks: 548100
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: