| Index: Source/core/svg/SVGLengthContext.cpp
|
| diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp
|
| index 9c1a4d15c19902e297c787185e7235ac2ac2bef3..e559e889822dcc24a026de6f2cababcf0070044d 100644
|
| --- a/Source/core/svg/SVGLengthContext.cpp
|
| +++ b/Source/core/svg/SVGLengthContext.cpp
|
| @@ -32,6 +32,7 @@
|
| #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 {
|
| @@ -91,6 +92,27 @@ float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S
|
| return x->valueAsPercentage();
|
| }
|
|
|
| +float SVGLengthContext::valueForLength(const Length& length, SVGLengthMode mode)
|
| +{
|
| + if (length.isPercent())
|
| + return convertValueFromPercentageToUserUnits(length.value() / 100, mode, IGNORE_EXCEPTION);
|
| + if (length.isAuto())
|
| + return 0;
|
| +
|
| + FloatSize viewportSize;
|
| + determineViewport(viewportSize);
|
| +
|
| + switch (mode) {
|
| + case LengthModeWidth:
|
| + return floatValueForLength(length, viewportSize.width());
|
| + case LengthModeHeight:
|
| + return floatValueForLength(length, viewportSize.height());
|
| + case LengthModeOther:
|
| + return floatValueForLength(length, sqrtf(viewportSize.diagonalLengthSquared() / 2));
|
| + };
|
| + return 0;
|
| +}
|
| +
|
| float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit, ExceptionState& exceptionState) const
|
| {
|
| switch (fromUnit) {
|
|
|