1 /* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* the features that media queries can test */
8 #ifndef nsMediaFeatures_h_
9 #define nsMediaFeatures_h_
11 #include "nsCSSProps.h"
17 struct nsMediaFeature
;
19 (* nsMediaFeatureValueGetter
)(nsPresContext
* aPresContext
,
20 const nsMediaFeature
* aFeature
,
23 struct nsMediaFeature
{
24 nsIAtom
**mName
; // extra indirection to point to nsGkAtoms members
26 enum RangeType
{ eMinMaxAllowed
, eMinMaxNotAllowed
};
30 // All value types allow eCSSUnit_Null to indicate that no value
31 // was given (in addition to the types listed below).
32 eLength
, // values are such that nsCSSValue::IsLengthUnit() is true
33 eInteger
, // values are eCSSUnit_Integer
34 eFloat
, // values are eCSSUnit_Number
35 eBoolInteger
,// values are eCSSUnit_Integer (0, -0, or 1 only)
36 eIntRatio
, // values are eCSSUnit_Array of two eCSSUnit_Integer
37 eResolution
, // values are in eCSSUnit_Inch (for dpi),
38 // eCSSUnit_Pixel (for dppx), or
39 // eCSSUnit_Centimeter (for dpcm)
40 eEnumerated
, // values are eCSSUnit_Enumerated (uses keyword table)
41 eIdent
// values are eCSSUnit_Ident
42 // Note that a number of pieces of code (both for parsing and
43 // for matching of valueless expressions) assume that all numeric
44 // value types cannot be negative. The parsing code also does
45 // not allow zeros in eIntRatio types.
50 // In static arrays, it's the first member that's initialized. We
51 // need that to be void* so we can initialize both other types.
52 // This member should never be accessed by name.
53 const void* mInitializer_
;
54 // If mValueType == eEnumerated: const int32_t*: keyword table in
55 // the same format as the keyword tables in nsCSSProps.
56 const nsCSSProps::KTableValue
* mKeywordTable
;
57 // If mGetter == GetSystemMetric (which implies mValueType ==
58 // eBoolInteger): nsIAtom * const *, for the system metric.
59 nsIAtom
* const * mMetric
;
62 // A function that returns the current value for this feature for a
63 // given presentation. If it returns eCSSUnit_Null, the feature is
65 nsMediaFeatureValueGetter mGetter
;
68 class nsMediaFeatures
{
70 // Terminated with an entry whose mName is null.
71 static const nsMediaFeature features
[];
74 #endif /* !defined(nsMediaFeatures_h_) */