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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 processTextChunk(m_textChunks[i]); | 84 processTextChunk(m_textChunks[i]); |
85 | 85 |
86 m_textChunks.clear(); | 86 m_textChunks.clear(); |
87 } | 87 } |
88 | 88 |
89 void SVGTextChunkBuilder::addTextChunk(Vector<SVGInlineTextBox*>& lineLayoutBoxe
s, unsigned boxStart, unsigned boxCount) | 89 void SVGTextChunkBuilder::addTextChunk(Vector<SVGInlineTextBox*>& lineLayoutBoxe
s, unsigned boxStart, unsigned boxCount) |
90 { | 90 { |
91 SVGInlineTextBox* textBox = lineLayoutBoxes[boxStart]; | 91 SVGInlineTextBox* textBox = lineLayoutBoxes[boxStart]; |
92 ASSERT(textBox); | 92 ASSERT(textBox); |
93 | 93 |
94 RenderSVGInlineText* textRenderer = toRenderSVGInlineText(textBox->textRende
rer()); | 94 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(textBox->textRende
rer()); |
95 ASSERT(textRenderer); | |
96 | 95 |
97 const RenderStyle* style = textRenderer->style(); | 96 const RenderStyle* style = toRenderSVGInlineText(textBox->textRenderer()).st
yle(); |
98 ASSERT(style); | 97 ASSERT(style); |
99 | 98 |
100 const SVGRenderStyle* svgStyle = style->svgStyle(); | 99 const SVGRenderStyle* svgStyle = style->svgStyle(); |
101 ASSERT(svgStyle); | 100 ASSERT(svgStyle); |
102 | 101 |
103 // Build chunk style flags. | 102 // Build chunk style flags. |
104 unsigned chunkStyle = SVGTextChunk::DefaultStyle; | 103 unsigned chunkStyle = SVGTextChunk::DefaultStyle; |
105 | 104 |
106 // Handle 'direction' property. | 105 // Handle 'direction' property. |
107 if (!style->isLeftToRightDirection()) | 106 if (!style->isLeftToRightDirection()) |
(...skipping 10 matching lines...) Expand all Loading... |
118 case TA_MIDDLE: | 117 case TA_MIDDLE: |
119 chunkStyle |= SVGTextChunk::MiddleAnchor; | 118 chunkStyle |= SVGTextChunk::MiddleAnchor; |
120 break; | 119 break; |
121 case TA_END: | 120 case TA_END: |
122 chunkStyle |= SVGTextChunk::EndAnchor; | 121 chunkStyle |= SVGTextChunk::EndAnchor; |
123 break; | 122 break; |
124 }; | 123 }; |
125 | 124 |
126 // Handle 'lengthAdjust' property. | 125 // Handle 'lengthAdjust' property. |
127 float desiredTextLength = 0; | 126 float desiredTextLength = 0; |
128 if (SVGTextContentElement* textContentElement = SVGTextContentElement::eleme
ntFromRenderer(textRenderer->parent())) { | 127 if (SVGTextContentElement* textContentElement = SVGTextContentElement::eleme
ntFromRenderer(textRenderer.parent())) { |
129 SVGLengthContext lengthContext(textContentElement); | 128 SVGLengthContext lengthContext(textContentElement); |
130 if (textContentElement->textLengthIsSpecifiedByUser()) | 129 if (textContentElement->textLengthIsSpecifiedByUser()) |
131 desiredTextLength = textContentElement->textLength()->currentValue()
->value(lengthContext); | 130 desiredTextLength = textContentElement->textLength()->currentValue()
->value(lengthContext); |
132 else | 131 else |
133 desiredTextLength = 0; | 132 desiredTextLength = 0; |
134 | 133 |
135 switch (textContentElement->lengthAdjust()->currentValue()->enumValue())
{ | 134 switch (textContentElement->lengthAdjust()->currentValue()->enumValue())
{ |
136 case SVGLengthAdjustUnknown: | 135 case SVGLengthAdjustUnknown: |
137 break; | 136 break; |
138 case SVGLengthAdjustSpacing: | 137 case SVGLengthAdjustSpacing: |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 255 |
257 if (isVerticalText) | 256 if (isVerticalText) |
258 spacingAndGlyphsTransform.scaleNonUniform(1, scale); | 257 spacingAndGlyphsTransform.scaleNonUniform(1, scale); |
259 else | 258 else |
260 spacingAndGlyphsTransform.scaleNonUniform(scale, 1); | 259 spacingAndGlyphsTransform.scaleNonUniform(scale, 1); |
261 | 260 |
262 spacingAndGlyphsTransform.translate(-fragment.x, -fragment.y); | 261 spacingAndGlyphsTransform.translate(-fragment.x, -fragment.y); |
263 } | 262 } |
264 | 263 |
265 } | 264 } |
OLD | NEW |