| OLD | NEW |
| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const CSSToLengthConversi
onData& conversionData) const | 226 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const CSSToLengthConversi
onData& conversionData) const |
| 227 { | 227 { |
| 228 switch (m_category) { | 228 switch (m_category) { |
| 229 case CalcNumber: | 229 case CalcNumber: |
| 230 return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue())); | 230 return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue())); |
| 231 case CalcLength: | 231 case CalcLength: |
| 232 return adoptPtr(new CalcExpressionLength(Length(m_value->computeLeng
th<float>(conversionData), WebCore::Fixed))); | 232 return adoptPtr(new CalcExpressionLength(Length(m_value->computeLeng
th<float>(conversionData), WebCore::Fixed))); |
| 233 case CalcPercent: | 233 case CalcPercent: |
| 234 case CalcPercentLength: { | 234 case CalcPercentLength: |
| 235 CSSPrimitiveValue* primitiveValue = m_value.get(); | 235 return adoptPtr(new CalcExpressionLength(m_value->convertToLength<Fi
xedConversion | PercentConversion>(conversionData))); |
| 236 return adoptPtr(new CalcExpressionLength(primitiveValue | |
| 237 ? primitiveValue->convertToLength<FixedConversion | PercentConve
rsion>(conversionData) | |
| 238 : Length(Undefined))); | |
| 239 } | |
| 240 // Only types that could be part of a Length expression can be converted | 236 // Only types that could be part of a Length expression can be converted |
| 241 // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length
. | 237 // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length
. |
| 242 case CalcPercentNumber: | 238 case CalcPercentNumber: |
| 243 case CalcVariable: | 239 case CalcVariable: |
| 244 case CalcOther: | 240 case CalcOther: |
| 245 ASSERT_NOT_REACHED(); | 241 ASSERT_NOT_REACHED(); |
| 246 } | 242 } |
| 247 return nullptr; | 243 return nullptr; |
| 248 } | 244 } |
| 249 | 245 |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 777 |
| 782 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; | 778 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; |
| 783 } | 779 } |
| 784 | 780 |
| 785 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) | 781 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) |
| 786 { | 782 { |
| 787 return adoptRef(new CSSCalcValue(expression, range)); | 783 return adoptRef(new CSSCalcValue(expression, range)); |
| 788 } | 784 } |
| 789 | 785 |
| 790 } // namespace WebCore | 786 } // namespace WebCore |
| OLD | NEW |