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

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

Issue 1545443002: Helper for checking if an SVGTextFragment is transformed (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 28a92740836ac17c2ca95bf73294a00775f26239..6becb2f105e6a0ce21247605e55bccf948639723 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
@@ -331,11 +331,11 @@ static FloatPoint calculateGlyphPositionWithoutTransform(const QueryData* queryD
static FloatPoint calculateGlyphPosition(const QueryData* queryData, const SVGTextFragment& fragment, int offsetInFragment)
{
FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, offsetInFragment);
- AffineTransform fragmentTransform;
- fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
- if (!fragmentTransform.isIdentity())
+ if (fragment.isTransformed()) {
+ AffineTransform fragmentTransform;
+ fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
glyphPosition = fragmentTransform.mapPoint(glyphPosition);
-
+ }
return glyphPosition;
}
@@ -414,11 +414,11 @@ static bool rotationOfCharacterCallback(QueryData* queryData, const SVGTextFragm
if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
return false;
- AffineTransform fragmentTransform;
- fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
- if (fragmentTransform.isIdentity()) {
+ if (!fragment.isTransformed()) {
data->rotation = 0;
} else {
+ AffineTransform fragmentTransform;
+ fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
fragmentTransform.scale(1 / fragmentTransform.xScale(), 1 / fragmentTransform.yScale());
data->rotation = narrowPrecisionToFloat(rad2deg(atan2(fragmentTransform.b(), fragmentTransform.a())));
}
@@ -487,10 +487,11 @@ static inline void calculateGlyphBoundaries(const QueryData* queryData, const SV
extent.move(-glyphSize.width(), 0);
}
- AffineTransform fragmentTransform;
- fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
-
- extent = fragmentTransform.mapRect(extent);
+ if (fragment.isTransformed()) {
+ AffineTransform fragmentTransform;
+ fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
+ extent = fragmentTransform.mapRect(extent);
+ }
}
static inline FloatRect calculateFragmentBoundaries(LineLayoutSVGInlineText textLineLayout, const SVGTextFragment& fragment)

Powered by Google App Engine
This is Rietveld 408576698