Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Unified Diff: Source/core/layout/svg/SVGTextChunkBuilder.cpp

Issue 1148323008: Eliminate SVGTextChunkBuilder::m_textBoxTransformations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/svg/SVGTextChunkBuilder.h ('k') | Source/core/layout/svg/SVGTextLayoutEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/svg/SVGTextChunkBuilder.cpp
diff --git a/Source/core/layout/svg/SVGTextChunkBuilder.cpp b/Source/core/layout/svg/SVGTextChunkBuilder.cpp
index 127fd4f5596b0a31abcbc313bc49be0a98eb52c8..c1e3c195c2eae10d42dec79f53a197e608b4e5fb 100644
--- a/Source/core/layout/svg/SVGTextChunkBuilder.cpp
+++ b/Source/core/layout/svg/SVGTextChunkBuilder.cpp
@@ -24,6 +24,7 @@
#include "core/layout/svg/line/SVGInlineTextBox.h"
#include "core/svg/SVGLengthContext.h"
#include "core/svg/SVGTextContentElement.h"
+#include "platform/transforms/AffineTransform.h"
namespace blink {
@@ -249,7 +250,7 @@ void SVGTextChunkBuilder::handleTextChunk(BoxListConstIterator boxStart, BoxList
buildSpacingAndGlyphsTransform(isVerticalText, textLengthScale, fragments.first(), spacingAndGlyphsTransform);
}
- m_textBoxTransformations.set(textBox, spacingAndGlyphsTransform);
+ applyTextLengthScaleAdjustment(spacingAndGlyphsTransform, fragments);
}
}
}
@@ -268,10 +269,7 @@ void SVGTextChunkBuilder::handleTextChunk(BoxListConstIterator boxStart, BoxList
void SVGTextChunkBuilder::processTextLengthSpacingCorrection(bool isVerticalText, float textLengthShift, Vector<SVGTextFragment>& fragments, unsigned& atCharacter)
{
- unsigned fragmentCount = fragments.size();
- for (unsigned i = 0; i < fragmentCount; ++i) {
- SVGTextFragment& fragment = fragments[i];
-
+ for (SVGTextFragment& fragment : fragments) {
if (isVerticalText)
fragment.y += textLengthShift * atCharacter;
else
@@ -281,12 +279,17 @@ void SVGTextChunkBuilder::processTextLengthSpacingCorrection(bool isVerticalText
}
}
-void SVGTextChunkBuilder::processTextAnchorCorrection(bool isVerticalText, float textAnchorShift, Vector<SVGTextFragment>& fragments)
+void SVGTextChunkBuilder::applyTextLengthScaleAdjustment(const AffineTransform& spacingAndGlyphsTransform, Vector<SVGTextFragment>& fragments)
{
- unsigned fragmentCount = fragments.size();
- for (unsigned i = 0; i < fragmentCount; ++i) {
- SVGTextFragment& fragment = fragments[i];
+ for (SVGTextFragment& fragment : fragments) {
+ ASSERT(fragment.lengthAdjustTransform.isIdentity());
+ fragment.lengthAdjustTransform = spacingAndGlyphsTransform;
+ }
+}
+void SVGTextChunkBuilder::processTextAnchorCorrection(bool isVerticalText, float textAnchorShift, Vector<SVGTextFragment>& fragments)
+{
+ for (SVGTextFragment& fragment : fragments) {
if (isVerticalText)
fragment.y += textAnchorShift;
else
@@ -294,21 +297,4 @@ void SVGTextChunkBuilder::processTextAnchorCorrection(bool isVerticalText, float
}
}
-void SVGTextChunkBuilder::finalizeTransformMatrices(const Vector<SVGInlineTextBox*>& boxes) const
-{
- if (m_textBoxTransformations.isEmpty())
- return;
-
- for (SVGInlineTextBox* textBox : boxes) {
- AffineTransform textBoxTransformation = m_textBoxTransformations.get(textBox);
- if (textBoxTransformation.isIdentity())
- continue;
-
- for (SVGTextFragment& fragment : textBox->textFragments()) {
- ASSERT(fragment.lengthAdjustTransform.isIdentity());
- fragment.lengthAdjustTransform = textBoxTransformation;
- }
- }
-}
-
}
« no previous file with comments | « Source/core/layout/svg/SVGTextChunkBuilder.h ('k') | Source/core/layout/svg/SVGTextLayoutEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698