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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGTextFragment.h

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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/SVGTextFragment.h
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextFragment.h b/third_party/WebKit/Source/core/layout/svg/SVGTextFragment.h
index 778a94ba4719c4fa15be5b8596515e86ead8f244..d03e43b242f85fd2f5aadace4405bb6cf458242a 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextFragment.h
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextFragment.h
@@ -59,6 +59,8 @@ struct SVGTextFragment {
buildTransformForTextOnLine(result);
}
+ bool isTransformed() const { return affectedByTextLength() || !transform.isIdentity(); }
+
// The first laid out character starts at LayoutSVGInlineText::characters() + characterOffset.
unsigned characterOffset;
unsigned metricsListOffset;
@@ -85,6 +87,8 @@ struct SVGTextFragment {
AffineTransform lengthAdjustTransform;
private:
+ bool affectedByTextLength() const { return lengthAdjustTransform.a() != 1 || lengthAdjustTransform.d() != 1; }
+
void transformAroundOrigin(AffineTransform& result) const
{
// Returns (translate(x, y) * result) * translate(-x, -y).
@@ -96,7 +100,7 @@ private:
void buildTransformForTextOnPath(AffineTransform& result) const
{
// For text-on-path layout, multiply the transform with the lengthAdjustTransform before orienting the resulting transform.
- result = lengthAdjustTransform.isIdentity() ? transform : transform * lengthAdjustTransform;
+ result = !affectedByTextLength() ? transform : transform * lengthAdjustTransform;
if (!result.isIdentity())
transformAroundOrigin(result);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698