| Index: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
|
| index 0e36470b531e96a7606c2db91c1a1ddbee5d4923..ff43950d1eb64cc72eec1ed29b1e8ffcc5df8e96 100644
|
| --- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
|
| @@ -20,6 +20,7 @@
|
| #include "config.h"
|
| #include "core/layout/svg/SVGTextLayoutEngine.h"
|
|
|
| +#include "core/layout/line/GlyphOverflow.h"
|
| #include "core/layout/svg/LayoutSVGInlineText.h"
|
| #include "core/layout/svg/LayoutSVGTextPath.h"
|
| #include "core/layout/svg/SVGTextChunkBuilder.h"
|
| @@ -110,6 +111,27 @@ void SVGTextLayoutEngine::updateRelativePositionAdjustmentsIfNeeded(float dx, fl
|
| m_dy = dy;
|
| }
|
|
|
| +// Computes the glyph overflow without integer clamping (see: GlyphOverflow.h).
|
| +static void computeGlyphOverflow(SVGInlineTextBox* textBox, SVGTextFragment& textFragment)
|
| +{
|
| + LineLayoutSVGInlineText textLineLayout = LineLayoutSVGInlineText(textBox->lineLayoutItem());
|
| + TextRun run = SVGTextMetrics::constructTextRun(textLineLayout, textFragment.characterOffset, textFragment.length, textLineLayout.styleRef().direction());
|
| +
|
| + float scalingFactor = textLineLayout.scalingFactor();
|
| + ASSERT(scalingFactor);
|
| + const Font& scaledFont = textLineLayout.scaledFont();
|
| + FloatRect glyphOverflowBounds;
|
| +
|
| + float width = scaledFont.width(run, nullptr, &glyphOverflowBounds);
|
| + float ascent = scaledFont.fontMetrics().floatAscent();
|
| + float descent = scaledFont.fontMetrics().floatDescent();
|
| +
|
| + textFragment.glyphOverflowTop = GlyphOverflow::topOverflow(glyphOverflowBounds, ascent) / scalingFactor;
|
| + textFragment.glyphOverflowBottom = GlyphOverflow::bottomOverflow(glyphOverflowBounds, descent) / scalingFactor;
|
| + textFragment.glyphOverflowLeft = GlyphOverflow::leftOverflow(glyphOverflowBounds) / scalingFactor;
|
| + textFragment.glyphOverflowRight = GlyphOverflow::rightOverflow(glyphOverflowBounds, width) / scalingFactor;
|
| +}
|
| +
|
| void SVGTextLayoutEngine::recordTextFragment(SVGInlineTextBox* textBox)
|
| {
|
| ASSERT(!m_currentTextFragment.length);
|
| @@ -138,6 +160,7 @@ void SVGTextLayoutEngine::recordTextFragment(SVGInlineTextBox* textBox)
|
| }
|
| }
|
|
|
| + computeGlyphOverflow(textBox, m_currentTextFragment);
|
| textBox->textFragments().append(m_currentTextFragment);
|
| m_currentTextFragment = SVGTextFragment();
|
| }
|
|
|