Index: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp |
index 560d971671948399be37b02732835171d124d411..bd2f11ecec252e1ef9dc36921a8c15e8d4fefbf2 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp |
@@ -34,7 +34,13 @@ SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const Font& font, |
float SVGTextLayoutEngineBaseline::calculateBaselineShift( |
const ComputedStyle& style) const { |
const SVGComputedStyle& svgStyle = style.svgStyle(); |
- const SimpleFontData* fontData = m_font.primaryFont(); |
+ // If font size is smaller than 3, rounding ascent and descent values in |
+ // SimpleFontData sets the baseline shifts for superscript and subscript to |
+ // zero. In this case, we use subpixel ascent and descent. |
+ const SimpleFontData* fontData = |
+ m_font.getFontDescription().getSize().value < 3.0 |
+ ? m_font.primaryFont()->subpixelAscentDescentFontData().get() |
+ : m_font.primaryFont(); |
DCHECK(fontData); |
if (!fontData) |
return 0; |