Index: Source/core/svg/SVGLengthContext.cpp |
diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp |
index a37ddb11a53d53012ad56419fc5730e5ac6d01b0..e11f90e4d300dc929f9c3f74dea55e76964669ae 100644 |
--- a/Source/core/svg/SVGLengthContext.cpp |
+++ b/Source/core/svg/SVGLengthContext.cpp |
@@ -27,6 +27,7 @@ |
#include "core/layout/LayoutObject.h" |
#include "core/layout/style/LayoutStyle.h" |
#include "core/svg/SVGSVGElement.h" |
+#include "platform/LengthFunctions.h" |
#include "platform/fonts/FontMetrics.h" |
namespace blink { |
@@ -95,6 +96,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 length.value() * dimensionForLengthMode(mode, viewportSize) / 100; |
+ |
+ return floatValueForLength(length, dimensionForLengthMode(mode, viewportSize)); |
+} |
+ |
float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit) const |
{ |
switch (fromUnit) { |