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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 default: | 50 default: |
51 ASSERT_NOT_REACHED(); | 51 ASSERT_NOT_REACHED(); |
52 return 0; | 52 return 0; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 EAlignmentBaseline SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBasel
ine(bool isVerticalText, const LayoutObject* textLayoutObject) const | 56 EAlignmentBaseline SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBasel
ine(bool isVerticalText, const LayoutObject* textLayoutObject) const |
57 { | 57 { |
58 ASSERT(textLayoutObject); | 58 ASSERT(textLayoutObject); |
59 ASSERT(textLayoutObject->style()); | 59 ASSERT(textLayoutObject->style()); |
60 ASSERT(textLayoutObject->parent()); | |
61 ASSERT(textLayoutObject->parent()->style()); | |
62 | 60 |
63 const SVGComputedStyle& style = textLayoutObject->style()->svgStyle(); | 61 const SVGComputedStyle& style = textLayoutObject->style()->svgStyle(); |
64 | 62 |
65 EDominantBaseline baseline = style.dominantBaseline(); | 63 EDominantBaseline baseline = style.dominantBaseline(); |
66 if (baseline == DB_AUTO) { | 64 if (baseline == DB_AUTO) { |
67 if (isVerticalText) | 65 if (isVerticalText) |
68 baseline = DB_CENTRAL; | 66 baseline = DB_CENTRAL; |
69 else | 67 else |
70 baseline = DB_ALPHABETIC; | 68 baseline = DB_ALPHABETIC; |
71 } | 69 } |
72 | 70 |
73 switch (baseline) { | 71 switch (baseline) { |
74 case DB_USE_SCRIPT: | 72 case DB_USE_SCRIPT: |
75 // FIXME: The dominant-baseline and the baseline-table components are se
t by determining the predominant script of the character data content. | 73 // TODO(fs): The dominant-baseline and the baseline-table components |
| 74 // are set by determining the predominant script of the character data |
| 75 // content. |
76 return AB_ALPHABETIC; | 76 return AB_ALPHABETIC; |
77 case DB_NO_CHANGE: | 77 case DB_NO_CHANGE: |
| 78 ASSERT(textLayoutObject->parent()); |
78 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj
ect->parent()); | 79 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj
ect->parent()); |
79 case DB_RESET_SIZE: | 80 case DB_RESET_SIZE: |
| 81 ASSERT(textLayoutObject->parent()); |
80 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj
ect->parent()); | 82 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj
ect->parent()); |
81 case DB_IDEOGRAPHIC: | 83 case DB_IDEOGRAPHIC: |
82 return AB_IDEOGRAPHIC; | 84 return AB_IDEOGRAPHIC; |
83 case DB_ALPHABETIC: | 85 case DB_ALPHABETIC: |
84 return AB_ALPHABETIC; | 86 return AB_ALPHABETIC; |
85 case DB_HANGING: | 87 case DB_HANGING: |
86 return AB_HANGING; | 88 return AB_HANGING; |
87 case DB_MATHEMATICAL: | 89 case DB_MATHEMATICAL: |
88 return AB_MATHEMATICAL; | 90 return AB_MATHEMATICAL; |
89 case DB_CENTRAL: | 91 case DB_CENTRAL: |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 226 } |
225 | 227 |
226 // Horizontal advance calculation. | 228 // Horizontal advance calculation. |
227 if (angle && !orientationIsMultiplyOf180Degrees) | 229 if (angle && !orientationIsMultiplyOf180Degrees) |
228 return metrics.height(); | 230 return metrics.height(); |
229 | 231 |
230 return metrics.width(); | 232 return metrics.width(); |
231 } | 233 } |
232 | 234 |
233 } | 235 } |
OLD | NEW |