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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 { | 70 { |
71 return m_unitMode == other.m_unitMode && m_value == other.m_value; | 71 return m_unitMode == other.m_unitMode && m_value == other.m_value; |
72 } | 72 } |
73 | 73 |
74 float SVGLength::value(const SVGLengthContext& context) const | 74 float SVGLength::value(const SVGLengthContext& context) const |
75 { | 75 { |
76 return context.convertValueToUserUnits( | 76 return context.convertValueToUserUnits( |
77 m_value->getFloatValue(), unitMode(), m_value->typeWithCalcResolved()); | 77 m_value->getFloatValue(), unitMode(), m_value->typeWithCalcResolved()); |
78 } | 78 } |
79 | 79 |
80 void SVGLength::setValueAsNumber(float value) | |
81 { | |
82 m_value = CSSPrimitiveValue::create(value, CSSPrimitiveValue::UnitType::User
Units); | |
83 } | |
84 | |
85 void SVGLength::setValue(float value, const SVGLengthContext& context) | 80 void SVGLength::setValue(float value, const SVGLengthContext& context) |
86 { | 81 { |
87 m_value = CSSPrimitiveValue::create( | 82 m_value = CSSPrimitiveValue::create( |
88 context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCa
lcResolved()), | 83 context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCa
lcResolved()), |
89 m_value->typeWithCalcResolved()); | 84 m_value->typeWithCalcResolved()); |
90 } | 85 } |
91 | 86 |
92 bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) | 87 bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) |
93 { | 88 { |
94 return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::Unit
Type::Number || type == CSSPrimitiveValue::UnitType::Percentage) | 89 return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::Unit
Type::Number || type == CSSPrimitiveValue::UnitType::Percentage) |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 253 |
259 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context
Element) | 254 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context
Element) |
260 { | 255 { |
261 SVGLengthContext lengthContext(contextElement); | 256 SVGLengthContext lengthContext(contextElement); |
262 SVGLength* toLength = toSVGLength(toValue); | 257 SVGLength* toLength = toSVGLength(toValue); |
263 | 258 |
264 return fabsf(toLength->value(lengthContext) - value(lengthContext)); | 259 return fabsf(toLength->value(lengthContext) - value(lengthContext)); |
265 } | 260 } |
266 | 261 |
267 } // namespace blink | 262 } // namespace blink |
OLD | NEW |