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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 { | 223 { |
224 return m_value->isVariableName(); | 224 return m_value->isVariableName(); |
225 } | 225 } |
226 | 226 |
227 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style,
const RenderStyle* rootStyle, double zoom) const | 227 virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style,
const RenderStyle* rootStyle, double zoom) const |
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 CalcExpressionNumber(m_value->computeLength<floa
t>(style, rootStyle, zoom))); | 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 | FractionConversion>(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: |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 | 784 |
785 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; | 785 return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0; |
786 } | 786 } |
787 | 787 |
788 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, CalculationPermittedValueRange range) | 788 PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode>
expression, CalculationPermittedValueRange range) |
789 { | 789 { |
790 return adoptRef(new CSSCalcValue(expression, range)); | 790 return adoptRef(new CSSCalcValue(expression, range)); |
791 } | 791 } |
792 | 792 |
793 } // namespace WebCore | 793 } // namespace WebCore |
OLD | NEW |