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

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

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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 | « Source/core/css/CSSPrimitiveValue.h ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('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, 2007, 2008, 2012 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return nullAtom; 211 return nullAtom;
212 212
213 static AtomicString* keywordStrings = new AtomicString[numCSSValueKeywords]; // Leaked intentionally. 213 static AtomicString* keywordStrings = new AtomicString[numCSSValueKeywords]; // Leaked intentionally.
214 AtomicString& keywordString = keywordStrings[valueID]; 214 AtomicString& keywordString = keywordStrings[valueID];
215 if (keywordString.isNull()) 215 if (keywordString.isNull())
216 keywordString = getValueName(valueID); 216 keywordString = getValueName(valueID);
217 return keywordString; 217 return keywordString;
218 } 218 }
219 219
220 CSSPrimitiveValue::CSSPrimitiveValue(CSSValueID valueID) 220 CSSPrimitiveValue::CSSPrimitiveValue(CSSValueID valueID)
221 : CSSValue(PrimitiveClass) 221 : CSSValueObject(PrimitiveClass)
222 { 222 {
223 m_primitiveUnitType = CSS_VALUE_ID; 223 m_primitiveUnitType = CSS_VALUE_ID;
224 m_value.valueID = valueID; 224 m_value.valueID = valueID;
225 } 225 }
226 226
227 CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID) 227 CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID)
228 : CSSValue(PrimitiveClass) 228 : CSSValueObject(PrimitiveClass)
229 { 229 {
230 m_primitiveUnitType = CSS_PROPERTY_ID; 230 m_primitiveUnitType = CSS_PROPERTY_ID;
231 m_value.propertyID = propertyID; 231 m_value.propertyID = propertyID;
232 } 232 }
233 233
234 CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitType type) 234 CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitType type)
235 : CSSValue(PrimitiveClass) 235 : CSSValueObject(PrimitiveClass)
236 { 236 {
237 m_primitiveUnitType = type; 237 m_primitiveUnitType = type;
238 ASSERT(std::isfinite(num)); 238 ASSERT(std::isfinite(num));
239 m_value.num = num; 239 m_value.num = num;
240 } 240 }
241 241
242 CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitType type) 242 CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitType type)
243 : CSSValue(PrimitiveClass) 243 : CSSValueObject(PrimitiveClass)
244 { 244 {
245 m_primitiveUnitType = type; 245 m_primitiveUnitType = type;
246 m_value.string = str.impl(); 246 m_value.string = str.impl();
247 if (m_value.string) 247 if (m_value.string)
248 m_value.string->ref(); 248 m_value.string->ref();
249 } 249 }
250 250
251 CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize, const Compute dStyle& style) 251 CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize, const Compute dStyle& style)
252 : CSSValue(PrimitiveClass) 252 : CSSValueObject(PrimitiveClass)
253 { 253 {
254 init(lengthSize, style); 254 init(lengthSize, style);
255 } 255 }
256 256
257 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color) 257 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color)
258 : CSSValue(PrimitiveClass) 258 : CSSValueObject(PrimitiveClass)
259 { 259 {
260 m_primitiveUnitType = CSS_RGBCOLOR; 260 m_primitiveUnitType = CSS_RGBCOLOR;
261 m_value.rgbcolor = color; 261 m_value.rgbcolor = color;
262 } 262 }
263 263
264 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom) 264 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom)
265 : CSSValue(PrimitiveClass) 265 : CSSValueObject(PrimitiveClass)
266 { 266 {
267 switch (length.type()) { 267 switch (length.type()) {
268 case Auto: 268 case Auto:
269 m_primitiveUnitType = CSS_VALUE_ID; 269 m_primitiveUnitType = CSS_VALUE_ID;
270 m_value.valueID = CSSValueAuto; 270 m_value.valueID = CSSValueAuto;
271 break; 271 break;
272 case Intrinsic: 272 case Intrinsic:
273 m_primitiveUnitType = CSS_VALUE_ID; 273 m_primitiveUnitType = CSS_VALUE_ID;
274 m_value.valueID = CSSValueIntrinsic; 274 m_value.valueID = CSSValueIntrinsic;
275 break; 275 break;
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 case CSS_CALC: 1139 case CSS_CALC:
1140 visitor->trace(m_value.calc); 1140 visitor->trace(m_value.calc);
1141 break; 1141 break;
1142 case CSS_SHAPE: 1142 case CSS_SHAPE:
1143 visitor->trace(m_value.shape); 1143 visitor->trace(m_value.shape);
1144 break; 1144 break;
1145 default: 1145 default:
1146 break; 1146 break;
1147 } 1147 }
1148 #endif 1148 #endif
1149 CSSValue::traceAfterDispatch(visitor); 1149 CSSValueObject::traceAfterDispatch(visitor);
1150 } 1150 }
1151 1151
1152 } // namespace blink 1152 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.h ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698