Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: Source/core/css/MediaQueryExp.cpp

Issue 16415007: Cleanup usage of CSSPropertyID and CSSValueID inside Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/MediaQueryEvaluator.cpp ('k') | Source/core/css/SVGCSSParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 { 44 {
45 if (!value->id) 45 if (!value->id)
46 return false; 46 return false;
47 47
48 return mediaFeature == MediaFeatureNames::orientationMediaFeature 48 return mediaFeature == MediaFeatureNames::orientationMediaFeature
49 || mediaFeature == MediaFeatureNames::viewModeMediaFeature 49 || mediaFeature == MediaFeatureNames::viewModeMediaFeature
50 || mediaFeature == MediaFeatureNames::pointerMediaFeature 50 || mediaFeature == MediaFeatureNames::pointerMediaFeature
51 || mediaFeature == MediaFeatureNames::scanMediaFeature; 51 || mediaFeature == MediaFeatureNames::scanMediaFeature;
52 } 52 }
53 53
54 static inline bool featureWithValidIdent(const AtomicString& mediaFeature, int i dent) 54 static inline bool featureWithValidIdent(const AtomicString& mediaFeature, CSSVa lueID ident)
55 { 55 {
56 if (mediaFeature == MediaFeatureNames::orientationMediaFeature) 56 if (mediaFeature == MediaFeatureNames::orientationMediaFeature)
57 return ident == CSSValuePortrait || ident == CSSValueLandscape; 57 return ident == CSSValuePortrait || ident == CSSValueLandscape;
58 58
59 if (mediaFeature == MediaFeatureNames::viewModeMediaFeature) { 59 if (mediaFeature == MediaFeatureNames::viewModeMediaFeature) {
60 switch (ident) { 60 switch (ident) {
61 case CSSValueWindowed: 61 case CSSValueWindowed:
62 case CSSValueFloating: 62 case CSSValueFloating:
63 case CSSValueFullscreen: 63 case CSSValueFullscreen:
64 case CSSValueMaximized: 64 case CSSValueMaximized:
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 , m_isValid(false) 203 , m_isValid(false)
204 { 204 {
205 // Initialize media query expression that must have 1 or more values. 205 // Initialize media query expression that must have 1 or more values.
206 if (valueList) { 206 if (valueList) {
207 if (valueList->size() == 1) { 207 if (valueList->size() == 1) {
208 CSSParserValue* value = valueList->current(); 208 CSSParserValue* value = valueList->current();
209 209
210 // Media features that use CSSValueIDs. 210 // Media features that use CSSValueIDs.
211 if (featureWithCSSValueID(mediaFeature, value)) { 211 if (featureWithCSSValueID(mediaFeature, value)) {
212 m_value = CSSPrimitiveValue::createIdentifier(value->id); 212 m_value = CSSPrimitiveValue::createIdentifier(value->id);
213 if (!featureWithValidIdent(mediaFeature, toCSSPrimitiveValue(m_v alue.get())->getIdent())) 213 if (!featureWithValidIdent(mediaFeature, toCSSPrimitiveValue(m_v alue.get())->getValueID()))
214 m_value.clear(); 214 m_value.clear();
215 } 215 }
216 216
217 // Media features that must have non-negative <density>, ie. dppx, d pi or dpcm. 217 // Media features that must have non-negative <density>, ie. dppx, d pi or dpcm.
218 else if (featureWithValidDensity(mediaFeature, value)) 218 else if (featureWithValidDensity(mediaFeature, value))
219 m_value = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitTypes) value->unit); 219 m_value = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitTypes) value->unit);
220 220
221 // Media features that must have non-negative <lenght> or number val ue. 221 // Media features that must have non-negative <lenght> or number val ue.
222 else if (featureWithValidPositiveLenghtOrNumber(mediaFeature, value) ) 222 else if (featureWithValidPositiveLenghtOrNumber(mediaFeature, value) )
223 m_value = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitTypes) value->unit); 223 m_value = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitTypes) value->unit);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 292 }
293 293
294 void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 294 void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
295 { 295 {
296 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); 296 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
297 info.addMember(m_mediaFeature, "mediaFeature"); 297 info.addMember(m_mediaFeature, "mediaFeature");
298 info.addMember(m_value, "value"); 298 info.addMember(m_value, "value");
299 } 299 }
300 300
301 } // namespace 301 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/MediaQueryEvaluator.cpp ('k') | Source/core/css/SVGCSSParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698