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

Side by Side Diff: Source/core/css/CSSPrimitiveValue.h

Issue 240453010: Avoid use of CSSValue in MediaQueryExp and MediaQueryEvaluator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use the new CSSPrimitiveValue static funcs Created 6 years, 8 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 UPercent, 169 UPercent,
170 ULength, 170 ULength,
171 UAngle, 171 UAngle,
172 UTime, 172 UTime,
173 UFrequency, 173 UFrequency,
174 UResolution, 174 UResolution,
175 UOther 175 UOther
176 }; 176 };
177 static UnitCategory unitCategory(CSSPrimitiveValue::UnitTypes); 177 static UnitCategory unitCategory(CSSPrimitiveValue::UnitTypes);
178 178
179 typedef HashMap<String, CSSPrimitiveValue::UnitTypes> UnitTable;
180 static UnitTypes fromName(const String& unit); 179 static UnitTypes fromName(const String& unit);
181 180
182 bool isAngle() const 181 bool isAngle() const
183 { 182 {
184 return m_primitiveUnitType == CSS_DEG 183 return m_primitiveUnitType == CSS_DEG
185 || m_primitiveUnitType == CSS_RAD 184 || m_primitiveUnitType == CSS_RAD
186 || m_primitiveUnitType == CSS_GRAD 185 || m_primitiveUnitType == CSS_GRAD
187 || m_primitiveUnitType == CSS_TURN; 186 || m_primitiveUnitType == CSS_TURN;
188 } 187 }
189 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; } 188 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; }
(...skipping 17 matching lines...) Expand all
207 bool isPx() const { return primitiveType() == CSS_PX; } 206 bool isPx() const { return primitiveType() == CSS_PX; }
208 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } 207 bool isRect() const { return m_primitiveUnitType == CSS_RECT; }
209 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; } 208 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; }
210 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } 209 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; }
211 bool isString() const { return m_primitiveUnitType == CSS_STRING; } 210 bool isString() const { return m_primitiveUnitType == CSS_STRING; }
212 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; } 211 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; }
213 bool isURI() const { return m_primitiveUnitType == CSS_URI; } 212 bool isURI() const { return m_primitiveUnitType == CSS_URI; }
214 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; } 213 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; }
215 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_NUMBER; } 214 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_NUMBER; }
216 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_LENGTH; } 215 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_LENGTH; }
217 bool isDotsPerInch() const { return primitiveType() == CSS_DPI; } 216 static bool isDotsPerInch(unsigned short type) { return type == CSS_DPI; }
eseidel 2014/04/22 16:22:23 I wonder if we should make an internal enum mapped
218 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } 217 static bool isDotsPerPixel(unsigned short type) { return type == CSS_DPPX; }
219 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } 218 static bool isDotsPerCentimeter(unsigned short type) { return type == CSS_DP CM; }
220 bool isResolution() const 219 static bool isResolution(unsigned short type) { return type >= CSS_DPPX && t ype <= CSS_DPCM; }
221 {
222 unsigned short type = primitiveType();
223 return type >= CSS_DPPX && type <= CSS_DPCM;
224 }
225 bool isFlex() const { return primitiveType() == CSS_FR; } 220 bool isFlex() const { return primitiveType() == CSS_FR; }
226 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; } 221 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
227 bool colorIsDerivedFromElement() const; 222 bool colorIsDerivedFromElement() const;
228 223
229 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) 224 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID)
230 { 225 {
231 return adoptRefWillBeRefCountedGarbageCollected(new CSSPrimitiveValue(va lueID)); 226 return adoptRefWillBeRefCountedGarbageCollected(new CSSPrimitiveValue(va lueID));
232 } 227 }
233 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert yID propertyID) 228 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert yID propertyID)
234 { 229 {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } m_value; 431 } m_value;
437 }; 432 };
438 433
439 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 434 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
440 435
441 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 436 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
442 437
443 } // namespace WebCore 438 } // namespace WebCore
444 439
445 #endif // CSSPrimitiveValue_h 440 #endif // CSSPrimitiveValue_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.cpp » ('j') | Source/core/css/MediaQueryEvaluator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698