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

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

Issue 1233363002: CSSValue Immediates: Replace CSSPrimitiveValue usage with const references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_4_attempt_2
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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 { 180 {
181 return clampToPermittedRange(m_expression->computeLengthPx(conversionData)); 181 return clampToPermittedRange(m_expression->computeLengthPx(conversionData));
182 } 182 }
183 183
184 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CSSCalcExpressionNode) 184 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CSSCalcExpressionNode)
185 185
186 class CSSCalcPrimitiveValue final : public CSSCalcExpressionNode { 186 class CSSCalcPrimitiveValue final : public CSSCalcExpressionNode {
187 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSCalcPrimitiveValue); 187 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSCalcPrimitiveValue);
188 public: 188 public:
189 189
190 static PassRefPtrWillBeRawPtr<CSSCalcPrimitiveValue> create(CSSPrimitiveValu e value, bool isInteger) 190 static PassRefPtrWillBeRawPtr<CSSCalcPrimitiveValue> create(const CSSPrimiti veValue& value, bool isInteger)
191 { 191 {
192 return adoptRefWillBeNoop(new CSSCalcPrimitiveValue(value, isInteger)); 192 return adoptRefWillBeNoop(new CSSCalcPrimitiveValue(value, isInteger));
193 } 193 }
194 194
195 static PassRefPtrWillBeRawPtr<CSSCalcPrimitiveValue> create(double value, CS SPrimitiveValue::UnitType type, bool isInteger) 195 static PassRefPtrWillBeRawPtr<CSSCalcPrimitiveValue> create(double value, CS SPrimitiveValue::UnitType type, bool isInteger)
196 { 196 {
197 if (std::isnan(value) || std::isinf(value)) 197 if (std::isnan(value) || std::isinf(value))
198 return nullptr; 198 return nullptr;
199 return adoptRefWillBeNoop(new CSSCalcPrimitiveValue(CSSPrimitiveValue::c reate(value, type), isInteger)); 199 return adoptRefWillBeNoop(new CSSCalcPrimitiveValue(CSSPrimitiveValue::c reate(value, type), isInteger));
200 } 200 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 274 }
275 275
276 276
277 DEFINE_INLINE_VIRTUAL_TRACE() 277 DEFINE_INLINE_VIRTUAL_TRACE()
278 { 278 {
279 visitor->trace(m_value); 279 visitor->trace(m_value);
280 CSSCalcExpressionNode::trace(visitor); 280 CSSCalcExpressionNode::trace(visitor);
281 } 281 }
282 282
283 private: 283 private:
284 CSSCalcPrimitiveValue(CSSPrimitiveValue value, bool isInteger) 284 CSSCalcPrimitiveValue(const CSSPrimitiveValue& value, bool isInteger)
285 : CSSCalcExpressionNode(unitCategory(value.primitiveType()), isInteger) 285 : CSSCalcExpressionNode(unitCategory(value.primitiveType()), isInteger)
286 , m_value(value) 286 , m_value(value)
287 { 287 {
288 } 288 }
289 289
290 CSSValue m_value; 290 CSSValue m_value;
291 }; 291 };
292 292
293 static const CalculationCategory addSubtractResult[CalcOther][CalcOther] = { 293 static const CalculationCategory addSubtractResult[CalcOther][CalcOther] = {
294 // CalcNumber CalcLength CalcPercent CalcPercentNumber CalcPercentLength CalcAngle CalcTime CalcFrequency 294 // CalcNumber CalcLength CalcPercent CalcPercentNumber CalcPercentLength CalcAngle CalcTime CalcFrequency
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 return adoptRefWillBeNoop(new CSSCalcValue(expression, range)); 761 return adoptRefWillBeNoop(new CSSCalcValue(expression, range));
762 } 762 }
763 763
764 DEFINE_TRACE_AFTER_DISPATCH(CSSCalcValue) 764 DEFINE_TRACE_AFTER_DISPATCH(CSSCalcValue)
765 { 765 {
766 visitor->trace(m_expression); 766 visitor->trace(m_expression);
767 CSSValueObject::traceAfterDispatch(visitor); 767 CSSValueObject::traceAfterDispatch(visitor);
768 } 768 }
769 769
770 } // namespace blink 770 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSBorderImageSliceValue.cpp ('k') | Source/core/css/CSSComputedStyleDeclaration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698