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->lengthAdjustCurrentValue() == SVGLengthAdjus tSpacing && textContentElement->specifiedTextLength().value(lengthContext) > 0) | 151 if (textContentElement->lengthAdjustCurrentValue() == SVGLengthAdjus tSpacing && textContentElement->textLengthIsSpecifiedByUser()) |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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->lengthAdjustCurrentValue(); | 209 lengthAdjust = textContentElement->lengthAdjustCurrentValue(); |
210 desiredTextLength = textContentElement->specifiedTextLength().value(leng thContext); | 210 if (textContentElement->textLengthIsSpecifiedByUser()) |
haraken
2014/01/09 00:58:53
Don't you need to add:
else {
desiredTextLe
kouhei (in TOK)
2014/01/09 02:24:51
Done.
| |
211 desiredTextLength = textContentElement->textLength()->currentValue() ->value(lengthContext); | |
211 } | 212 } |
212 | 213 |
213 if (!desiredTextLength) | 214 if (!desiredTextLength) |
214 return; | 215 return; |
215 | 216 |
216 if (lengthAdjust == SVGLengthAdjustSpacing) | 217 if (lengthAdjust == SVGLengthAdjustSpacing) |
217 m_textPathSpacing = (desiredTextLength - totalLength) / totalCharacters; | 218 m_textPathSpacing = (desiredTextLength - totalLength) / totalCharacters; |
218 else | 219 else |
219 m_textPathScaling = desiredTextLength / totalLength; | 220 m_textPathScaling = desiredTextLength / totalLength; |
220 } | 221 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 } | 644 } |
644 | 645 |
645 if (!didStartTextFragment) | 646 if (!didStartTextFragment) |
646 return; | 647 return; |
647 | 648 |
648 // Close last open fragment, if needed. | 649 // Close last open fragment, if needed. |
649 recordTextFragment(textBox, visualMetricsValues); | 650 recordTextFragment(textBox, visualMetricsValues); |
650 } | 651 } |
651 | 652 |
652 } | 653 } |
OLD | NEW |