Chromium Code Reviews| 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: |