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

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

Issue 956553004: Use Length for baselineShiftValue in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: A few more TEs. Created 5 years, 10 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 | « Source/core/layout/svg/SVGTextLayoutEngineBaseline.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
diff --git a/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp b/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
index 113fc8d4e1d6c94dbcc62d021afe5763d32bc3e8..d40e9851017e70aecd460da0573853f80db00ce5 100644
--- a/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
+++ b/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
@@ -24,7 +24,7 @@
#include "core/layout/LayoutObject.h"
#include "core/layout/style/SVGLayoutStyle.h"
#include "core/layout/svg/SVGTextMetrics.h"
-#include "core/svg/SVGLengthContext.h"
+#include "platform/LengthFunctions.h"
#include "platform/fonts/Font.h"
#include "platform/text/UnicodeRange.h"
@@ -35,20 +35,15 @@ SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const Font& font)
{
}
-float SVGTextLayoutEngineBaseline::calculateBaselineShift(const SVGLayoutStyle& style, SVGElement* contextElement) const
+float SVGTextLayoutEngineBaseline::calculateBaselineShift(const LayoutStyle& style) const
{
- if (style.baselineShift() == BS_LENGTH) {
- RefPtrWillBeRawPtr<SVGLength> baselineShiftValueLength = style.baselineShiftValue();
- if (baselineShiftValueLength->unitType() == LengthTypePercentage)
- return baselineShiftValueLength->scaleByPercentage(m_font.fontDescription().computedPixelSize());
+ const SVGLayoutStyle& svgStyle = style.svgStyle();
- SVGLengthContext lengthContext(contextElement);
- return baselineShiftValueLength->value(lengthContext);
+ switch (svgStyle.baselineShift()) {
+ case BS_LENGTH: {
+ const float zoom = style.effectiveZoom();
+ return floatValueForLength(svgStyle.baselineShiftValue(), m_font.fontDescription().computedPixelSize() * zoom) / zoom;
pdr. 2015/02/25 19:21:15 What do you think about moving this zoom calculati
fs 2015/02/25 21:21:11 I didn't see much use for it, since AFAIK this is
}
-
- switch (style.baselineShift()) {
- case BS_BASELINE:
- return 0;
case BS_SUB:
return -m_font.fontMetrics().floatHeight() / 2;
case BS_SUPER:
« no previous file with comments | « Source/core/layout/svg/SVGTextLayoutEngineBaseline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698