| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 m_value = CSSPrimitiveValue::create( | 95 m_value = CSSPrimitiveValue::create( |
| 96 context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCa
lcResolved()), | 96 context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCa
lcResolved()), |
| 97 m_value->typeWithCalcResolved()); | 97 m_value->typeWithCalcResolved()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) | 100 bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) |
| 101 { | 101 { |
| 102 return type != CSSPrimitiveValue::UnitType::Unknown | 102 return type != CSSPrimitiveValue::UnitType::Unknown |
| 103 && (type <= CSSPrimitiveValue::UnitType::UserUnits | 103 && (type <= CSSPrimitiveValue::UnitType::UserUnits |
| 104 || type == CSSPrimitiveValue::UnitType::Chs | 104 || type == CSSPrimitiveValue::UnitType::Chs |
| 105 || type == CSSPrimitiveValue::UnitType::Rems); | 105 || type == CSSPrimitiveValue::UnitType::Rems |
| 106 || (type >= CSSPrimitiveValue::UnitType::ViewportWidth && type <= CS
SPrimitiveValue::UnitType::ViewportMax)); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void SVGLength::setUnitType(CSSPrimitiveValue::UnitType type) | 109 void SVGLength::setUnitType(CSSPrimitiveValue::UnitType type) |
| 109 { | 110 { |
| 110 ASSERT(isSupportedCSSUnitType(type)); | 111 ASSERT(isSupportedCSSUnitType(type)); |
| 111 m_value = CSSPrimitiveValue::create(m_value->getFloatValue(), type); | 112 m_value = CSSPrimitiveValue::create(m_value->getFloatValue(), type); |
| 112 } | 113 } |
| 113 | 114 |
| 114 float SVGLength::valueAsPercentage() const | 115 float SVGLength::valueAsPercentage() const |
| 115 { | 116 { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 275 |
| 275 float SVGLength::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> toVal
ue, SVGElement* contextElement) | 276 float SVGLength::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> toVal
ue, SVGElement* contextElement) |
| 276 { | 277 { |
| 277 SVGLengthContext lengthContext(contextElement); | 278 SVGLengthContext lengthContext(contextElement); |
| 278 RefPtrWillBeRawPtr<SVGLength> toLength = toSVGLength(toValue); | 279 RefPtrWillBeRawPtr<SVGLength> toLength = toSVGLength(toValue); |
| 279 | 280 |
| 280 return fabsf(toLength->value(lengthContext) - value(lengthContext)); | 281 return fabsf(toLength->value(lengthContext) - value(lengthContext)); |
| 281 } | 282 } |
| 282 | 283 |
| 283 } | 284 } |
| OLD | NEW |