Index: Source/core/svg/SVGLengthContext.cpp |
diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp |
index b64cfd4b81ad9e7f96af5aeb5536c1d5ebee22b1..34e30e9b366908804ec16f133a72d840e047500b 100644 |
--- a/Source/core/svg/SVGLengthContext.cpp |
+++ b/Source/core/svg/SVGLengthContext.cpp |
@@ -249,9 +249,12 @@ float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mod |
FloatSize viewportSize; |
if (!determineViewport(viewportSize)) |
return 0; |
+ float dimension = dimensionForLengthMode(mode, viewportSize); |
+ if (!dimension) |
+ return 0; |
// LengthTypePercentage is represented with 100% = 100.0. |
// Good for accuracy but could eventually be changed. |
- return value * 100 / dimensionForLengthMode(mode, viewportSize); |
+ return value * 100 / dimension; |
} |
case LengthTypeEMS: |
return convertValueFromUserUnitsToEMS(computedStyleForLengthResolving(m_context), value); |