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

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: Fix previous patch 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
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.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 * (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(UnitTypes type) { return type == CSS_DPI; }
218 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } 217 static bool isDotsPerPixel(UnitTypes type) { return type == CSS_DPPX; }
219 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } 218 static bool isDotsPerCentimeter(UnitTypes type) { return type == CSS_DPCM; }
220 bool isResolution() const 219 static bool isResolution(UnitTypes type) { return type >= CSS_DPPX && type < = 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 344
350 CSSBasicShape* getShapeValue() const { return m_primitiveUnitType != CSS_SHA PE ? 0 : m_value.shape; } 345 CSSBasicShape* getShapeValue() const { return m_primitiveUnitType != CSS_SHA PE ? 0 : m_value.shape; }
351 346
352 CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? 0 : m_value.calc; } 347 CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? 0 : m_value.calc; }
353 348
354 CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROP ERTY_ID ? m_value.propertyID : CSSPropertyInvalid; } 349 CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROP ERTY_ID ? m_value.propertyID : CSSPropertyInvalid; }
355 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; } 350 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
356 351
357 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h 352 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h
358 353
354 static const char* unitTypeToString(UnitTypes);
359 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const; 355 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const;
360 356
361 bool isQuirkValue() { return m_isQuirkValue; } 357 bool isQuirkValue() { return m_isQuirkValue; }
362 358
363 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> cloneForCSSOM() const; 359 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> cloneForCSSOM() const;
364 void setCSSOMSafe() { m_isCSSOMSafe = true; } 360 void setCSSOMSafe() { m_isCSSOMSafe = true; }
365 361
366 bool equals(const CSSPrimitiveValue&) const; 362 bool equals(const CSSPrimitiveValue&) const;
367 363
368 void traceAfterDispatch(Visitor*); 364 void traceAfterDispatch(Visitor*);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } m_value; 432 } m_value;
437 }; 433 };
438 434
439 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 435 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
440 436
441 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 437 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
442 438
443 } // namespace WebCore 439 } // namespace WebCore
444 440
445 #endif // CSSPrimitiveValue_h 441 #endif // CSSPrimitiveValue_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698