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

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

Issue 68203023: Merge FixedIntegerConversion and FixedFloatConversion for CSSPrimitiveValue::convertToLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 1 month 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/BasicShapeFunctions.cpp ('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 * 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 { 228 {
229 switch (m_category) { 229 switch (m_category) {
230 case CalcNumber: 230 case CalcNumber:
231 return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue())); 231 return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
232 case CalcLength: 232 case CalcLength:
233 return adoptPtr(new CalcExpressionLength(Length(m_value->computeLeng th<float>(style, rootStyle, zoom), WebCore::Fixed))); 233 return adoptPtr(new CalcExpressionLength(Length(m_value->computeLeng th<float>(style, rootStyle, zoom), WebCore::Fixed)));
234 case CalcPercent: 234 case CalcPercent:
235 case CalcPercentLength: { 235 case CalcPercentLength: {
236 CSSPrimitiveValue* primitiveValue = m_value.get(); 236 CSSPrimitiveValue* primitiveValue = m_value.get();
237 return adoptPtr(new CalcExpressionLength(primitiveValue 237 return adoptPtr(new CalcExpressionLength(primitiveValue
238 ? primitiveValue->convertToLength<FixedFloatConversion | Percent Conversion>(style, rootStyle, zoom) 238 ? primitiveValue->convertToLength<FixedConversion | PercentConve rsion>(style, rootStyle, zoom)
239 : Length(Undefined))); 239 : Length(Undefined)));
240 } 240 }
241 // Only types that could be part of a Length expression can be converted 241 // Only types that could be part of a Length expression can be converted
242 // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length . 242 // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length .
243 case CalcPercentNumber: 243 case CalcPercentNumber:
244 case CalcVariable: 244 case CalcVariable:
245 case CalcOther: 245 case CalcOther:
246 ASSERT_NOT_REACHED(); 246 ASSERT_NOT_REACHED();
247 } 247 }
248 return nullptr; 248 return nullptr;
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 782
783 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; 783 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0;
784 } 784 }
785 785
786 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode> expression, ValueRange range) 786 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode> expression, ValueRange range)
787 { 787 {
788 return adoptRef(new CSSCalcValue(expression, range)); 788 return adoptRef(new CSSCalcValue(expression, range));
789 } 789 }
790 790
791 } // namespace WebCore 791 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/BasicShapeFunctions.cpp ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698