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

Unified Diff: third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp

Issue 2513343005: Apply the font scale factor when generating stroke geometry for <text> (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-text-decoration-dashed-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
index 65adb292583644ee1d1ed4390f0113147d6a710d..4fa767d538038a247203a6ddbf96e9cffc067072 100644
--- a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
@@ -371,11 +371,16 @@ void SVGInlineTextBoxPainter::paintDecoration(const PaintInfo& paintInfo,
ApplyToStrokeMode, strokePaint))
break;
strokePaint.setAntiAlias(true);
+ float strokeScaleFactor =
+ svgDecorationStyle.vectorEffect() == VE_NON_SCALING_STROKE
+ ? 1 / scalingFactor
+ : 1;
StrokeData strokeData;
SVGLayoutSupport::applyStrokeStyleToStrokeData(
- strokeData, decorationStyle, *decorationLayoutObject, 1);
- if (svgDecorationStyle.vectorEffect() == VE_NON_SCALING_STROKE)
- strokeData.setThickness(strokeData.thickness() / scalingFactor);
+ strokeData, decorationStyle, *decorationLayoutObject,
+ strokeScaleFactor);
+ if (strokeScaleFactor != 1)
+ strokeData.setThickness(strokeData.thickness() * strokeScaleFactor);
strokeData.setupPaint(&strokePaint);
paintInfo.context.drawPath(path.getSkPath(), strokePaint);
}
@@ -419,11 +424,15 @@ bool SVGInlineTextBoxPainter::setupTextPaint(const PaintInfo& paintInfo,
}
if (resourceMode == ApplyToStrokeMode) {
+ // The stroke geometry needs be generated based on the scaled font.
+ float strokeScaleFactor =
+ style.svgStyle().vectorEffect() != VE_NON_SCALING_STROKE ? scalingFactor
+ : 1;
StrokeData strokeData;
SVGLayoutSupport::applyStrokeStyleToStrokeData(
- strokeData, style, parentInlineLayoutObject(), 1);
- if (style.svgStyle().vectorEffect() != VE_NON_SCALING_STROKE)
- strokeData.setThickness(strokeData.thickness() * scalingFactor);
+ strokeData, style, parentInlineLayoutObject(), strokeScaleFactor);
+ if (strokeScaleFactor != 1)
+ strokeData.setThickness(strokeData.thickness() * strokeScaleFactor);
strokeData.setupPaint(&paint);
}
return true;
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/stroke/non-scaling-stroke-text-decoration-dashed-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698