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

Unified Diff: Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp

Issue 331863014: Fix *-baseline computation for {text-,}after-edge/ideographic/baseline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 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 | « LayoutTests/svg/custom/alignment-baseline-modes.svg ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp
diff --git a/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp b/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp
index 95c3beb137c57eae1a3758b7aaf1003e9c000c99..e3066931f9918a972f3a6b9dfbb86685f544f75d 100644
--- a/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp
+++ b/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp
@@ -118,17 +118,15 @@ float SVGTextLayoutEngineBaseline::calculateAlignmentBaselineShift(bool isVertic
ASSERT(textRendererParent);
EAlignmentBaseline baseline = textRenderer->style()->svgStyle()->alignmentBaseline();
- if (baseline == AB_AUTO) {
+ if (baseline == AB_AUTO || baseline == AB_BASELINE) {
baseline = dominantBaselineToAlignmentBaseline(isVerticalText, textRendererParent);
- ASSERT(baseline != AB_AUTO);
+ ASSERT(baseline != AB_AUTO && baseline != AB_BASELINE);
}
const FontMetrics& fontMetrics = m_font.fontMetrics();
// Note: http://wiki.apache.org/xmlgraphics-fop/LineLayout/AlignmentHandling
switch (baseline) {
- case AB_BASELINE:
- return dominantBaselineToAlignmentBaseline(isVerticalText, textRendererParent);
case AB_BEFORE_EDGE:
case AB_TEXT_BEFORE_EDGE:
return fontMetrics.floatAscent();
@@ -139,13 +137,14 @@ float SVGTextLayoutEngineBaseline::calculateAlignmentBaselineShift(bool isVertic
case AB_AFTER_EDGE:
case AB_TEXT_AFTER_EDGE:
case AB_IDEOGRAPHIC:
- return fontMetrics.floatDescent();
+ return -fontMetrics.floatDescent();
case AB_ALPHABETIC:
return 0;
case AB_HANGING:
return fontMetrics.floatAscent() * 8 / 10.f;
case AB_MATHEMATICAL:
return fontMetrics.floatAscent() / 2;
+ case AB_BASELINE:
default:
ASSERT_NOT_REACHED();
return 0;
« no previous file with comments | « LayoutTests/svg/custom/alignment-baseline-modes.svg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698