OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 20 matching lines...) Expand all Loading... |
31 namespace WebCore { | 31 namespace WebCore { |
32 | 32 |
33 SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const Font& font) | 33 SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const Font& font) |
34 : m_font(font) | 34 : m_font(font) |
35 { | 35 { |
36 } | 36 } |
37 | 37 |
38 float SVGTextLayoutEngineBaseline::calculateBaselineShift(const SVGRenderStyle*
style, SVGElement* contextElement) const | 38 float SVGTextLayoutEngineBaseline::calculateBaselineShift(const SVGRenderStyle*
style, SVGElement* contextElement) const |
39 { | 39 { |
40 if (style->baselineShift() == BS_LENGTH) { | 40 if (style->baselineShift() == BS_LENGTH) { |
41 SVGLength baselineShiftValueLength = style->baselineShiftValue(); | 41 RefPtr<SVGLength> baselineShiftValueLength = style->baselineShiftValue()
; |
42 if (baselineShiftValueLength.unitType() == LengthTypePercentage) | 42 if (baselineShiftValueLength->unitType() == LengthTypePercentage) |
43 return baselineShiftValueLength.valueAsPercentage() * m_font.pixelSi
ze(); | 43 return baselineShiftValueLength->valueAsPercentage() * m_font.pixelS
ize(); |
44 | 44 |
45 SVGLengthContext lengthContext(contextElement); | 45 SVGLengthContext lengthContext(contextElement); |
46 return baselineShiftValueLength.value(lengthContext); | 46 return baselineShiftValueLength->value(lengthContext); |
47 } | 47 } |
48 | 48 |
49 switch (style->baselineShift()) { | 49 switch (style->baselineShift()) { |
50 case BS_BASELINE: | 50 case BS_BASELINE: |
51 return 0; | 51 return 0; |
52 case BS_SUB: | 52 case BS_SUB: |
53 return -m_font.fontMetrics().floatHeight() / 2; | 53 return -m_font.fontMetrics().floatHeight() / 2; |
54 case BS_SUPER: | 54 case BS_SUPER: |
55 return m_font.fontMetrics().floatHeight() / 2; | 55 return m_font.fontMetrics().floatHeight() / 2; |
56 default: | 56 default: |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 xOrientationShift = metrics.width(); | 227 xOrientationShift = metrics.width(); |
228 | 228 |
229 // Horizontal advance calculation. | 229 // Horizontal advance calculation. |
230 if (angle && !orientationIsMultiplyOf180Degrees) | 230 if (angle && !orientationIsMultiplyOf180Degrees) |
231 return metrics.height(); | 231 return metrics.height(); |
232 | 232 |
233 return metrics.width(); | 233 return metrics.width(); |
234 } | 234 } |
235 | 235 |
236 } | 236 } |
OLD | NEW |