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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp

Issue 1549503002: Return AffineTransform from SVGTextFragment::buildFragmentTransform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
Index: third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
index 6becb2f105e6a0ce21247605e55bccf948639723..a8c5edc3fcfe672b3e7e3621eedce3f390e64800 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
@@ -332,8 +332,7 @@ static FloatPoint calculateGlyphPosition(const QueryData* queryData, const SVGTe
{
FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, offsetInFragment);
if (fragment.isTransformed()) {
- AffineTransform fragmentTransform;
- fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
+ AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGTextFragment::TransformIgnoringTextLength);
glyphPosition = fragmentTransform.mapPoint(glyphPosition);
}
return glyphPosition;
@@ -417,12 +416,10 @@ static bool rotationOfCharacterCallback(QueryData* queryData, const SVGTextFragm
if (!fragment.isTransformed()) {
data->rotation = 0;
} else {
- AffineTransform fragmentTransform;
- fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
+ AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGTextFragment::TransformIgnoringTextLength);
fragmentTransform.scale(1 / fragmentTransform.xScale(), 1 / fragmentTransform.yScale());
data->rotation = narrowPrecisionToFloat(rad2deg(atan2(fragmentTransform.b(), fragmentTransform.a())));
}
-
return true;
}
@@ -488,8 +485,7 @@ static inline void calculateGlyphBoundaries(const QueryData* queryData, const SV
}
if (fragment.isTransformed()) {
- AffineTransform fragmentTransform;
- fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
+ AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGTextFragment::TransformIgnoringTextLength);
extent = fragmentTransform.mapRect(extent);
}
}
@@ -499,11 +495,7 @@ static inline FloatRect calculateFragmentBoundaries(LineLayoutSVGInlineText text
float scalingFactor = textLineLayout.scalingFactor();
ASSERT(scalingFactor);
float baseline = textLineLayout.scaledFont().fontMetrics().floatAscent() / scalingFactor;
-
- AffineTransform fragmentTransform;
- FloatRect fragmentRect(fragment.x, fragment.y - baseline, fragment.width, fragment.height);
- fragment.buildFragmentTransform(fragmentTransform);
- return fragmentTransform.mapRect(fragmentRect);
+ return fragment.boundingBox(baseline);
}
static bool extentOfCharacterCallback(QueryData* queryData, const SVGTextFragment& fragment)

Powered by Google App Engine
This is Rietveld 408576698