| Index: Source/core/svg/SVGLengthContext.cpp | 
| diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp | 
| index 40c86bb6f21d2f797a8a86e063768fa856c38f13..39c41c2712dc87b656e83ce815a1e45c58db7ded 100644 | 
| --- a/Source/core/svg/SVGLengthContext.cpp | 
| +++ b/Source/core/svg/SVGLengthContext.cpp | 
| @@ -32,10 +32,25 @@ | 
| #include "core/rendering/svg/RenderSVGRoot.h" | 
| #include "core/rendering/svg/RenderSVGViewportContainer.h" | 
| #include "core/svg/SVGSVGElement.h" | 
| +#include "platform/LengthFunctions.h" | 
| #include "platform/fonts/FontMetrics.h" | 
|  | 
| namespace blink { | 
|  | 
| +static inline float dimensionForLengthMode(SVGLengthMode mode, const FloatSize& viewportSize) | 
| +{ | 
| +    switch (mode) { | 
| +    case LengthModeWidth: | 
| +        return viewportSize.width(); | 
| +    case LengthModeHeight: | 
| +        return viewportSize.height(); | 
| +    case LengthModeOther: | 
| +        return sqrtf(viewportSize.diagonalLengthSquared() / 2); | 
| +    } | 
| +    ASSERT_NOT_REACHED(); | 
| +    return 0; | 
| +} | 
| + | 
| SVGLengthContext::SVGLengthContext(const SVGElement* context) | 
| : m_context(context) | 
| { | 
| @@ -91,6 +106,20 @@ float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S | 
| return x->valueAsPercentage(); | 
| } | 
|  | 
| +float SVGLengthContext::valueForLength(const Length& length, SVGLengthMode mode) | 
| +{ | 
| +    if (length.isAuto()) | 
| +        return 0; | 
| + | 
| +    FloatSize viewportSize; | 
| +    determineViewport(viewportSize); | 
| + | 
| +    if (length.isPercent()) | 
| +        return convertValueFromPercentageToUserUnits(length.value(), mode, viewportSize) / 100; | 
| + | 
| +    return floatValueForLength(length, dimensionForLengthMode(mode, viewportSize)); | 
| +} | 
| + | 
| float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit, ExceptionState& exceptionState) const | 
| { | 
| switch (fromUnit) { | 
| @@ -155,20 +184,6 @@ float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mod | 
| return 0; | 
| } | 
|  | 
| -static inline float dimensionForLengthMode(SVGLengthMode mode, const FloatSize& viewportSize) | 
| -{ | 
| -    switch (mode) { | 
| -    case LengthModeWidth: | 
| -        return viewportSize.width(); | 
| -    case LengthModeHeight: | 
| -        return viewportSize.height(); | 
| -    case LengthModeOther: | 
| -        return sqrtf(viewportSize.diagonalLengthSquared() / 2); | 
| -    } | 
| -    ASSERT_NOT_REACHED(); | 
| -    return 0; | 
| -} | 
| - | 
| float SVGLengthContext::convertValueFromUserUnitsToPercentage(float value, SVGLengthMode mode, ExceptionState& exceptionState) const | 
| { | 
| FloatSize viewportSize; | 
|  |