float SVGLength::value(const SVGLengthContext& context) const { if (isCalculated()) return context.resolveValue(asCSSPrimitiveValue(), unitMode()); return context.convertValueToUserUnits(m_value->getFloatValue(), unitMode(), m_value->typeWithCalcResolved()); }
SVGLength::SVGLength(SVGLengthMode mode) : SVGPropertyBase(classType()) , m_value(cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::UserUnits)) , m_unitMode(static_cast<unsigned>(mode)) { ASSERT(unitMode() == mode); }
void SVGLength::convertToSpecifiedUnits(CSSPrimitiveValue::UnitType type, const SVGLengthContext& context) { ASSERT(isSupportedCSSUnitType(type)); float valueInUserUnits = value(context); m_value = CSSPrimitiveValue::create( context.convertValueFromUserUnits(valueInUserUnits, unitMode(), type), type); }
void SVGLength::setValue(float value, const SVGLengthContext& context) { m_value = CSSPrimitiveValue::create( context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCalcResolved()), m_value->typeWithCalcResolved()); }
float SVGLength::value(const SVGLengthContext& context) const { return context.convertValueToUserUnits( m_value->getFloatValue(), unitMode(), m_value->typeWithCalcResolved()); }
SVGLength::SVGLength(SVGLengthMode mode) : m_value(CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::UserUnits)) , m_unitMode(static_cast<unsigned>(mode)) { ASSERT(unitMode() == mode); }