| Index: third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
|
| diff --git a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
|
| index 2670221a4c2a590ac206e0a08d65c43cd50bd97d..bd4cf089796b580dc03810a7fd2d4dcd88b938b4 100644
|
| --- a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
|
| +++ b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
|
| @@ -373,11 +373,12 @@ float SVGLengthContext::convertValueFromUserUnits(
|
|
|
| float SVGLengthContext::convertValueFromUserUnitsToCHS(float value) const {
|
| const ComputedStyle* style = computedStyleForLengthResolving(m_context);
|
| - if (!style)
|
| + const SimpleFontData* fontData = style->font().primaryFont();
|
| + if (!style || !fontData)
|
| return 0;
|
|
|
| float zeroWidth =
|
| - style->getFontMetrics().zeroWidth() / style->effectiveZoom();
|
| + fontData->getFontMetrics().zeroWidth() / style->effectiveZoom();
|
| if (!zeroWidth)
|
| return 0;
|
|
|
| @@ -386,22 +387,25 @@ float SVGLengthContext::convertValueFromUserUnitsToCHS(float value) const {
|
|
|
| float SVGLengthContext::convertValueFromCHSToUserUnits(float value) const {
|
| const ComputedStyle* style = computedStyleForLengthResolving(m_context);
|
| - if (!style)
|
| + const SimpleFontData* fontData = style->font().primaryFont();
|
| + if (!style || !fontData)
|
| return 0;
|
|
|
| - return value * style->getFontMetrics().zeroWidth() / style->effectiveZoom();
|
| + return value * fontData->getFontMetrics().zeroWidth() /
|
| + style->effectiveZoom();
|
| }
|
|
|
| float SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const {
|
| const ComputedStyle* style = computedStyleForLengthResolving(m_context);
|
| - if (!style)
|
| + const SimpleFontData* fontData = style->font().primaryFont();
|
| + if (!style || !fontData)
|
| return 0;
|
|
|
| // Use of ceil allows a pixel match to the W3Cs expected output of
|
| // coords-units-03-b.svg, if this causes problems in real world cases maybe it
|
| // would be best to remove this.
|
| float xHeight =
|
| - ceilf(style->getFontMetrics().xHeight() / style->effectiveZoom());
|
| + ceilf(fontData->getFontMetrics().xHeight() / style->effectiveZoom());
|
| if (!xHeight)
|
| return 0;
|
|
|
| @@ -410,14 +414,15 @@ float SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const {
|
|
|
| float SVGLengthContext::convertValueFromEXSToUserUnits(float value) const {
|
| const ComputedStyle* style = computedStyleForLengthResolving(m_context);
|
| - if (!style)
|
| + const SimpleFontData* fontData = style->font().primaryFont();
|
| + if (!style || !fontData)
|
| return 0;
|
|
|
| // Use of ceil allows a pixel match to the W3Cs expected output of
|
| // coords-units-03-b.svg, if this causes problems in real world cases maybe it
|
| // would be best to remove this.
|
| return value *
|
| - ceilf(style->getFontMetrics().xHeight() / style->effectiveZoom());
|
| + ceilf(fontData->getFontMetrics().xHeight() / style->effectiveZoom());
|
| }
|
|
|
| bool SVGLengthContext::determineViewport(FloatSize& viewportSize) const {
|
|
|