コード例 #1
0
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);
}
コード例 #2
0
ファイル: SVGLength.cpp プロジェクト: Igalia/blink
void SVGLength::setValue(float value, const SVGLengthContext& context, ExceptionState& exceptionState)
{
    // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed
    if (extractType(m_unit) == LengthTypePercentage)
        value = value / 100;

    float convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit), exceptionState);
    if (!exceptionState.hadException())
        m_valueInSpecifiedUnits = convertedValue;
}
コード例 #3
0
ファイル: SVGLengthValue.cpp プロジェクト: ollie314/webkit
ExceptionOr<void> SVGLengthValue::setValue(float value, const SVGLengthContext& context)
{
    // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed
    if (extractType(m_unit) == LengthTypePercentage)
        value = value / 100;

    auto convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit));
    if (convertedValue.hasException())
        return convertedValue.releaseException();
    m_valueInSpecifiedUnits = convertedValue.releaseReturnValue();
    return { };
}
コード例 #4
0
void SVGLength::setValue(float value, const SVGLengthContext& context)
{
    m_value = CSSPrimitiveValue::create(
        context.convertValueFromUserUnits(value, unitMode(), m_value->typeWithCalcResolved()),
        m_value->typeWithCalcResolved());
}