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

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: (Hopefully) Builds with oilpan now Created 5 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
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return nullAtom; 210 return nullAtom;
211 211
212 static AtomicString* keywordStrings = new AtomicString[numCSSValueKeywords]; // Leaked intentionally. 212 static AtomicString* keywordStrings = new AtomicString[numCSSValueKeywords]; // Leaked intentionally.
213 AtomicString& keywordString = keywordStrings[valueID]; 213 AtomicString& keywordString = keywordStrings[valueID];
214 if (keywordString.isNull()) 214 if (keywordString.isNull())
215 keywordString = getValueName(valueID); 215 keywordString = getValueName(valueID);
216 return keywordString; 216 return keywordString;
217 } 217 }
218 218
219 CSSPrimitiveValue::CSSPrimitiveValue(CSSValueID valueID) 219 CSSPrimitiveValue::CSSPrimitiveValue(CSSValueID valueID)
220 : CSSValue(PrimitiveClass) 220 : CSSValueObject(PrimitiveClass)
221 { 221 {
222 m_primitiveUnitType = CSS_VALUE_ID; 222 m_primitiveUnitType = CSS_VALUE_ID;
223 m_value.valueID = valueID; 223 m_value.valueID = valueID;
224 } 224 }
225 225
226 CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID) 226 CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID)
227 : CSSValue(PrimitiveClass) 227 : CSSValueObject(PrimitiveClass)
228 { 228 {
229 m_primitiveUnitType = CSS_PROPERTY_ID; 229 m_primitiveUnitType = CSS_PROPERTY_ID;
230 m_value.propertyID = propertyID; 230 m_value.propertyID = propertyID;
231 } 231 }
232 232
233 CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitType type) 233 CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitType type)
234 : CSSValue(PrimitiveClass) 234 : CSSValueObject(PrimitiveClass)
235 { 235 {
236 m_primitiveUnitType = type; 236 m_primitiveUnitType = type;
237 ASSERT(std::isfinite(num)); 237 ASSERT(std::isfinite(num));
238 m_value.num = num; 238 m_value.num = num;
239 } 239 }
240 240
241 CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitType type) 241 CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitType type)
242 : CSSValue(PrimitiveClass) 242 : CSSValueObject(PrimitiveClass)
243 { 243 {
244 m_primitiveUnitType = type; 244 m_primitiveUnitType = type;
245 m_value.string = str.impl(); 245 m_value.string = str.impl();
246 if (m_value.string) 246 if (m_value.string)
247 m_value.string->ref(); 247 m_value.string->ref();
248 } 248 }
249 249
250 CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize, const Compute dStyle& style) 250 CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize, const Compute dStyle& style)
251 : CSSValue(PrimitiveClass) 251 : CSSValueObject(PrimitiveClass)
252 { 252 {
253 init(lengthSize, style); 253 init(lengthSize, style);
254 } 254 }
255 255
256 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color) 256 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color)
257 : CSSValue(PrimitiveClass) 257 : CSSValueObject(PrimitiveClass)
258 { 258 {
259 m_primitiveUnitType = CSS_RGBCOLOR; 259 m_primitiveUnitType = CSS_RGBCOLOR;
260 m_value.rgbcolor = color; 260 m_value.rgbcolor = color;
261 } 261 }
262 262
263 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom) 263 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom)
264 : CSSValue(PrimitiveClass) 264 : CSSValueObject(PrimitiveClass)
265 { 265 {
266 switch (length.type()) { 266 switch (length.type()) {
267 case Auto: 267 case Auto:
268 m_primitiveUnitType = CSS_VALUE_ID; 268 m_primitiveUnitType = CSS_VALUE_ID;
269 m_value.valueID = CSSValueAuto; 269 m_value.valueID = CSSValueAuto;
270 break; 270 break;
271 case Intrinsic: 271 case Intrinsic:
272 m_primitiveUnitType = CSS_VALUE_ID; 272 m_primitiveUnitType = CSS_VALUE_ID;
273 m_value.valueID = CSSValueIntrinsic; 273 m_value.valueID = CSSValueIntrinsic;
274 break; 274 break;
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 case CSS_CALC: 1131 case CSS_CALC:
1132 visitor->trace(m_value.calc); 1132 visitor->trace(m_value.calc);
1133 break; 1133 break;
1134 case CSS_SHAPE: 1134 case CSS_SHAPE:
1135 visitor->trace(m_value.shape); 1135 visitor->trace(m_value.shape);
1136 break; 1136 break;
1137 default: 1137 default:
1138 break; 1138 break;
1139 } 1139 }
1140 #endif 1140 #endif
1141 CSSValue::traceAfterDispatch(visitor); 1141 CSSValueObject::traceAfterDispatch(visitor);
1142 } 1142 }
1143 1143
1144 } // namespace blink 1144 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698