| Index: third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
|
| index 118c035efb9ecd32872e61f5bc8d50d7feeab76f..1ab8e02f768284ec68b9f183e9d814862c98b06a 100644
|
| --- a/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
|
| @@ -20,11 +20,9 @@
|
| #include "core/layout/svg/SVGTextChunkBuilder.h"
|
|
|
| #include "core/layout/api/LineLayoutSVGInlineText.h"
|
| -#include "core/layout/svg/LayoutSVGInlineText.h"
|
| #include "core/layout/svg/line/SVGInlineTextBox.h"
|
| #include "core/svg/SVGLengthContext.h"
|
| #include "core/svg/SVGTextContentElement.h"
|
| -#include "platform/transforms/AffineTransform.h"
|
|
|
| namespace blink {
|
|
|
| @@ -172,16 +170,10 @@ void SVGTextPathChunkBuilder::handleTextChunk(BoxListConstIterator boxStart, Box
|
| m_totalCharacters += lengthAccumulator.numCharacters();
|
| }
|
|
|
| -static void buildSpacingAndGlyphsTransform(bool isVerticalText, float scale, const SVGTextFragment& fragment, AffineTransform& spacingAndGlyphsTransform)
|
| +static float computeTextLengthBias(const SVGTextFragment& fragment, float scale)
|
| {
|
| - spacingAndGlyphsTransform.translate(fragment.x, fragment.y);
|
| -
|
| - if (isVerticalText)
|
| - spacingAndGlyphsTransform.scaleNonUniform(1, scale);
|
| - else
|
| - spacingAndGlyphsTransform.scaleNonUniform(scale, 1);
|
| -
|
| - spacingAndGlyphsTransform.translate(-fragment.x, -fragment.y);
|
| + float initialPosition = fragment.isVertical ? fragment.y : fragment.x;
|
| + return initialPosition + scale * -initialPosition;
|
| }
|
|
|
| void SVGTextChunkBuilder::handleTextChunk(BoxListConstIterator boxStart, BoxListConstIterator boxEnd)
|
| @@ -236,7 +228,7 @@ void SVGTextChunkBuilder::handleTextChunk(BoxListConstIterator boxStart, BoxList
|
| } else {
|
| ASSERT(lengthAdjust == SVGLengthAdjustSpacingAndGlyphs);
|
| float textLengthScale = desiredTextLength / chunkLength;
|
| - AffineTransform spacingAndGlyphsTransform;
|
| + float textLengthBias = 0;
|
|
|
| bool foundFirstFragment = false;
|
| for (auto boxIter = boxStart; boxIter != boxEnd; ++boxIter) {
|
| @@ -247,10 +239,10 @@ void SVGTextChunkBuilder::handleTextChunk(BoxListConstIterator boxStart, BoxList
|
|
|
| if (!foundFirstFragment) {
|
| foundFirstFragment = true;
|
| - buildSpacingAndGlyphsTransform(isVerticalText, textLengthScale, fragments.first(), spacingAndGlyphsTransform);
|
| + textLengthBias = computeTextLengthBias(fragments.first(), textLengthScale);
|
| }
|
|
|
| - applyTextLengthScaleAdjustment(spacingAndGlyphsTransform, fragments);
|
| + applyTextLengthScaleAdjustment(textLengthScale, textLengthBias, fragments);
|
| }
|
| }
|
| }
|
| @@ -279,11 +271,12 @@ void SVGTextChunkBuilder::processTextLengthSpacingCorrection(bool isVerticalText
|
| }
|
| }
|
|
|
| -void SVGTextChunkBuilder::applyTextLengthScaleAdjustment(const AffineTransform& spacingAndGlyphsTransform, Vector<SVGTextFragment>& fragments)
|
| +void SVGTextChunkBuilder::applyTextLengthScaleAdjustment(float textLengthScale, float textLengthBias, Vector<SVGTextFragment>& fragments)
|
| {
|
| for (SVGTextFragment& fragment : fragments) {
|
| - ASSERT(fragment.lengthAdjustTransform.isIdentity());
|
| - fragment.lengthAdjustTransform = spacingAndGlyphsTransform;
|
| + ASSERT(fragment.lengthAdjustScale == 1);
|
| + fragment.lengthAdjustScale = textLengthScale;
|
| + fragment.lengthAdjustBias = textLengthBias;
|
| }
|
| }
|
|
|
|
|