OLD | NEW |
1 /* | 1 /* |
2 * CSS Media Query | 2 * CSS Media Query |
3 * | 3 * |
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. | 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. |
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
6 * Copyright (C) 2013 Apple Inc. All rights reserved. | 6 * Copyright (C) 2013 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return ident == CSSValueNone || ident == CSSValueOnDemand || | 58 return ident == CSSValueNone || ident == CSSValueOnDemand || |
59 ident == CSSValueHover; | 59 ident == CSSValueHover; |
60 | 60 |
61 if (mediaFeature == scanMediaFeature) | 61 if (mediaFeature == scanMediaFeature) |
62 return ident == CSSValueInterlace || ident == CSSValueProgressive; | 62 return ident == CSSValueInterlace || ident == CSSValueProgressive; |
63 | 63 |
64 if (RuntimeEnabledFeatures::mediaQueryShapeEnabled()) { | 64 if (RuntimeEnabledFeatures::mediaQueryShapeEnabled()) { |
65 if (mediaFeature == shapeMediaFeature) | 65 if (mediaFeature == shapeMediaFeature) |
66 return ident == CSSValueRect || ident == CSSValueRound; | 66 return ident == CSSValueRect || ident == CSSValueRound; |
67 } | 67 } |
| 68 |
| 69 if (mediaFeature == colorGamutMediaFeature) { |
| 70 return ident == CSSValueSRGB || ident == CSSValueP3 || |
| 71 ident == CSSValueRec2020; |
| 72 } |
| 73 |
68 return false; | 74 return false; |
69 } | 75 } |
70 | 76 |
71 static inline bool featureWithValidPositiveLength(const String& mediaFeature, | 77 static inline bool featureWithValidPositiveLength(const String& mediaFeature, |
72 const CSSParserToken& token) { | 78 const CSSParserToken& token) { |
73 if (!(CSSPrimitiveValue::isLength(token.unitType()) || | 79 if (!(CSSPrimitiveValue::isLength(token.unitType()) || |
74 (token.type() == NumberToken && token.numericValue() == 0)) || | 80 (token.type() == NumberToken && token.numericValue() == 0)) || |
75 token.numericValue() < 0) | 81 token.numericValue() < 0) |
76 return false; | 82 return false; |
77 | 83 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 mediaFeature == aspectRatioMediaFeature || | 167 mediaFeature == aspectRatioMediaFeature || |
162 mediaFeature == deviceAspectRatioMediaFeature || | 168 mediaFeature == deviceAspectRatioMediaFeature || |
163 mediaFeature == hoverMediaFeature || | 169 mediaFeature == hoverMediaFeature || |
164 mediaFeature == anyHoverMediaFeature || | 170 mediaFeature == anyHoverMediaFeature || |
165 mediaFeature == transform3dMediaFeature || | 171 mediaFeature == transform3dMediaFeature || |
166 mediaFeature == pointerMediaFeature || | 172 mediaFeature == pointerMediaFeature || |
167 mediaFeature == anyPointerMediaFeature || | 173 mediaFeature == anyPointerMediaFeature || |
168 mediaFeature == devicePixelRatioMediaFeature || | 174 mediaFeature == devicePixelRatioMediaFeature || |
169 mediaFeature == resolutionMediaFeature || | 175 mediaFeature == resolutionMediaFeature || |
170 mediaFeature == displayModeMediaFeature || | 176 mediaFeature == displayModeMediaFeature || |
171 mediaFeature == scanMediaFeature || mediaFeature == shapeMediaFeature; | 177 mediaFeature == scanMediaFeature || |
| 178 mediaFeature == shapeMediaFeature || |
| 179 mediaFeature == colorGamutMediaFeature; |
172 } | 180 } |
173 | 181 |
174 bool MediaQueryExp::isViewportDependent() const { | 182 bool MediaQueryExp::isViewportDependent() const { |
175 return m_mediaFeature == widthMediaFeature || | 183 return m_mediaFeature == widthMediaFeature || |
176 m_mediaFeature == heightMediaFeature || | 184 m_mediaFeature == heightMediaFeature || |
177 m_mediaFeature == minWidthMediaFeature || | 185 m_mediaFeature == minWidthMediaFeature || |
178 m_mediaFeature == minHeightMediaFeature || | 186 m_mediaFeature == minHeightMediaFeature || |
179 m_mediaFeature == maxWidthMediaFeature || | 187 m_mediaFeature == maxWidthMediaFeature || |
180 m_mediaFeature == maxHeightMediaFeature || | 188 m_mediaFeature == maxHeightMediaFeature || |
181 m_mediaFeature == orientationMediaFeature || | 189 m_mediaFeature == orientationMediaFeature || |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 output.append('/'); | 325 output.append('/'); |
318 output.append(printNumber(denominator)); | 326 output.append(printNumber(denominator)); |
319 } else if (isID) { | 327 } else if (isID) { |
320 output.append(getValueName(id)); | 328 output.append(getValueName(id)); |
321 } | 329 } |
322 | 330 |
323 return output.toString(); | 331 return output.toString(); |
324 } | 332 } |
325 | 333 |
326 } // namespace blink | 334 } // namespace blink |
OLD | NEW |