OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2012. 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 textBox->textFragments().append(m_currentTextFragment); | 141 textBox->textFragments().append(m_currentTextFragment); |
142 m_currentTextFragment = SVGTextFragment(); | 142 m_currentTextFragment = SVGTextFragment(); |
143 } | 143 } |
144 | 144 |
145 bool SVGTextLayoutEngine::parentDefinesTextLength(RenderObject* parent) const | 145 bool SVGTextLayoutEngine::parentDefinesTextLength(RenderObject* parent) const |
146 { | 146 { |
147 RenderObject* currentParent = parent; | 147 RenderObject* currentParent = parent; |
148 while (currentParent) { | 148 while (currentParent) { |
149 if (SVGTextContentElement* textContentElement = SVGTextContentElement::e
lementFromRenderer(currentParent)) { | 149 if (SVGTextContentElement* textContentElement = SVGTextContentElement::e
lementFromRenderer(currentParent)) { |
150 SVGLengthContext lengthContext(textContentElement); | 150 SVGLengthContext lengthContext(textContentElement); |
151 if (textContentElement->lengthAdjust() == SVGLengthAdjustSpacing &&
textContentElement->specifiedTextLength().value(lengthContext) > 0) | 151 if (textContentElement->lengthAdjustCurrentValue() == SVGLengthAdjus
tSpacing && textContentElement->specifiedTextLength().value(lengthContext) > 0) |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 if (currentParent->isSVGText()) | 155 if (currentParent->isSVGText()) |
156 return false; | 156 return false; |
157 | 157 |
158 currentParent = currentParent->parent(); | 158 currentParent = currentParent->parent(); |
159 } | 159 } |
160 | 160 |
161 ASSERT_NOT_REACHED(); | 161 ASSERT_NOT_REACHED(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 199 } |
200 | 200 |
201 m_textPathCurrentOffset = m_textPathStartOffset; | 201 m_textPathCurrentOffset = m_textPathStartOffset; |
202 | 202 |
203 // Eventually handle textLength adjustments. | 203 // Eventually handle textLength adjustments. |
204 SVGLengthAdjustType lengthAdjust = SVGLengthAdjustUnknown; | 204 SVGLengthAdjustType lengthAdjust = SVGLengthAdjustUnknown; |
205 float desiredTextLength = 0; | 205 float desiredTextLength = 0; |
206 | 206 |
207 if (SVGTextContentElement* textContentElement = SVGTextContentElement::eleme
ntFromRenderer(textPath)) { | 207 if (SVGTextContentElement* textContentElement = SVGTextContentElement::eleme
ntFromRenderer(textPath)) { |
208 SVGLengthContext lengthContext(textContentElement); | 208 SVGLengthContext lengthContext(textContentElement); |
209 lengthAdjust = textContentElement->lengthAdjust(); | 209 lengthAdjust = textContentElement->lengthAdjustCurrentValue(); |
210 desiredTextLength = textContentElement->specifiedTextLength().value(leng
thContext); | 210 desiredTextLength = textContentElement->specifiedTextLength().value(leng
thContext); |
211 } | 211 } |
212 | 212 |
213 if (!desiredTextLength) | 213 if (!desiredTextLength) |
214 return; | 214 return; |
215 | 215 |
216 if (lengthAdjust == SVGLengthAdjustSpacing) | 216 if (lengthAdjust == SVGLengthAdjustSpacing) |
217 m_textPathSpacing = (desiredTextLength - totalLength) / totalCharacters; | 217 m_textPathSpacing = (desiredTextLength - totalLength) / totalCharacters; |
218 else | 218 else |
219 m_textPathScaling = desiredTextLength / totalLength; | 219 m_textPathScaling = desiredTextLength / totalLength; |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 647 } |
648 | 648 |
649 if (!didStartTextFragment) | 649 if (!didStartTextFragment) |
650 return; | 650 return; |
651 | 651 |
652 // Close last open fragment, if needed. | 652 // Close last open fragment, if needed. |
653 recordTextFragment(textBox, visualMetricsValues); | 653 recordTextFragment(textBox, visualMetricsValues); |
654 } | 654 } |
655 | 655 |
656 } | 656 } |
OLD | NEW |