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 |
80 void SVGLength::setValue(float value, const SVGLengthContext& context) | 85 void SVGLength::setValue(float value, const SVGLengthContext& context) |
81 { | 86 { |
82 m_value = CSSPrimitiveValue::create( | 87 m_value = CSSPrimitiveValue::create( |
83 context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCa
lcResolved()), | 88 context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCa
lcResolved()), |
84 m_value->typeWithCalcResolved()); | 89 m_value->typeWithCalcResolved()); |
85 } | 90 } |
86 | 91 |
87 bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) | 92 bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type) |
88 { | 93 { |
89 return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::Unit
Type::Number || type == CSSPrimitiveValue::UnitType::Percentage) | 94 return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::Unit
Type::Number || type == CSSPrimitiveValue::UnitType::Percentage) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 261 |
257 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context
Element) | 262 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context
Element) |
258 { | 263 { |
259 SVGLengthContext lengthContext(contextElement); | 264 SVGLengthContext lengthContext(contextElement); |
260 SVGLength* toLength = toSVGLength(toValue); | 265 SVGLength* toLength = toSVGLength(toValue); |
261 | 266 |
262 return fabsf(toLength->value(lengthContext) - value(lengthContext)); | 267 return fabsf(toLength->value(lengthContext) - value(lengthContext)); |
263 } | 268 } |
264 | 269 |
265 } // namespace blink | 270 } // namespace blink |
OLD | NEW |