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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | FractionConversion>(style, rootStyle, zoom) | 238 ? primitiveValue->convertToLength<FixedFloatConversion | Percent
Conversion>(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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 | 783 |
784 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; | 784 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; |
785 } | 785 } |
786 | 786 |
787 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) | 787 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, ValueRange range) |
788 { | 788 { |
789 return adoptRef(new CSSCalcValue(expression, range)); | 789 return adoptRef(new CSSCalcValue(expression, range)); |
790 } | 790 } |
791 | 791 |
792 } // namespace WebCore | 792 } // namespace WebCore |
OLD | NEW |