| 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 22 matching lines...) Expand all Loading... |
| 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 RefPtrWillBeRawPtr<SVGLength> baselineShiftValueLength = style.baselineS
hiftValue(); | 41 RefPtrWillBeRawPtr<SVGLength> baselineShiftValueLength = style.baselineS
hiftValue(); |
| 42 if (baselineShiftValueLength->unitType() == LengthTypePercentage) | 42 if (baselineShiftValueLength->unitType() == LengthTypePercentage) |
| 43 return baselineShiftValueLength->valueAsPercentage() * m_font.fontDe
scription().computedPixelSize(); | 43 return baselineShiftValueLength->scaleByPercentage(m_font.fontDescri
ption().computedPixelSize()); |
| 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; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 xOrientationShift = metrics.width(); | 222 xOrientationShift = metrics.width(); |
| 223 | 223 |
| 224 // Horizontal advance calculation. | 224 // Horizontal advance calculation. |
| 225 if (angle && !orientationIsMultiplyOf180Degrees) | 225 if (angle && !orientationIsMultiplyOf180Degrees) |
| 226 return metrics.height(); | 226 return metrics.height(); |
| 227 | 227 |
| 228 return metrics.width(); | 228 return metrics.width(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } | 231 } |
| OLD | NEW |