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

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

Issue 209353004: Remove mutation foot-gun from CSSPrimitiveValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed Created 6 years, 9 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/CSSPrimitiveValue.h ('k') | no next file » | 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 m_value.valueID = valueID; 261 m_value.valueID = valueID;
262 } 262 }
263 263
264 CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID) 264 CSSPrimitiveValue::CSSPrimitiveValue(CSSPropertyID propertyID)
265 : CSSValue(PrimitiveClass) 265 : CSSValue(PrimitiveClass)
266 { 266 {
267 m_primitiveUnitType = CSS_PROPERTY_ID; 267 m_primitiveUnitType = CSS_PROPERTY_ID;
268 m_value.propertyID = propertyID; 268 m_value.propertyID = propertyID;
269 } 269 }
270 270
271 CSSPrimitiveValue::CSSPrimitiveValue(int parserOperator) 271 CSSPrimitiveValue::CSSPrimitiveValue(int parserOperator, UnitTypes type)
272 : CSSValue(PrimitiveClass) 272 : CSSValue(PrimitiveClass)
273 { 273 {
274 ASSERT(type == CSS_PARSER_OPERATOR);
274 m_primitiveUnitType = CSS_PARSER_OPERATOR; 275 m_primitiveUnitType = CSS_PARSER_OPERATOR;
275 m_value.parserOperator = parserOperator; 276 m_value.parserOperator = parserOperator;
276 } 277 }
277 278
278 CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type) 279 CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type)
279 : CSSValue(PrimitiveClass) 280 : CSSValue(PrimitiveClass)
280 { 281 {
281 m_primitiveUnitType = type; 282 m_primitiveUnitType = type;
282 ASSERT(std::isfinite(num)); 283 ASSERT(std::isfinite(num));
283 m_value.num = num; 284 m_value.num = num;
284 } 285 }
285 286
286 CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type) 287 CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type)
287 : CSSValue(PrimitiveClass) 288 : CSSValue(PrimitiveClass)
288 { 289 {
289 m_primitiveUnitType = type; 290 m_primitiveUnitType = type;
290 if ((m_value.string = str.impl())) 291 if ((m_value.string = str.impl()))
291 m_value.string->ref(); 292 m_value.string->ref();
292 } 293 }
293 294
294 CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize) 295 CSSPrimitiveValue::CSSPrimitiveValue(const LengthSize& lengthSize)
295 : CSSValue(PrimitiveClass) 296 : CSSValue(PrimitiveClass)
296 { 297 {
297 init(lengthSize); 298 init(lengthSize);
298 } 299 }
299 300
300 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color) 301 CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color, UnitTypes type)
301 : CSSValue(PrimitiveClass) 302 : CSSValue(PrimitiveClass)
302 { 303 {
304 ASSERT(type == CSS_RGBCOLOR);
303 m_primitiveUnitType = CSS_RGBCOLOR; 305 m_primitiveUnitType = CSS_RGBCOLOR;
304 m_value.rgbcolor = color; 306 m_value.rgbcolor = color;
305 } 307 }
306 308
307 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom) 309 CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom)
308 : CSSValue(PrimitiveClass) 310 : CSSValue(PrimitiveClass)
309 { 311 {
310 switch (length.type()) { 312 switch (length.type()) {
311 case Auto: 313 case Auto:
312 case Intrinsic: 314 case Intrinsic:
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 case CSS_SHAPE: 1317 case CSS_SHAPE:
1316 visitor->trace(m_value.shape); 1318 visitor->trace(m_value.shape);
1317 break; 1319 break;
1318 default: 1320 default:
1319 break; 1321 break;
1320 } 1322 }
1321 CSSValue::traceAfterDispatch(visitor); 1323 CSSValue::traceAfterDispatch(visitor);
1322 } 1324 }
1323 1325
1324 } // namespace WebCore 1326 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698