| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2011. 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 178 } |
| 179 | 179 |
| 180 void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po
sition) | 180 void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po
sition) |
| 181 { | 181 { |
| 182 RefPtr<SVGLengthList> xList = position.element->x()->currentValue(); | 182 RefPtr<SVGLengthList> xList = position.element->x()->currentValue(); |
| 183 RefPtr<SVGLengthList> yList = position.element->y()->currentValue(); | 183 RefPtr<SVGLengthList> yList = position.element->y()->currentValue(); |
| 184 RefPtr<SVGLengthList> dxList = position.element->dx()->currentValue(); | 184 RefPtr<SVGLengthList> dxList = position.element->dx()->currentValue(); |
| 185 RefPtr<SVGLengthList> dyList = position.element->dy()->currentValue(); | 185 RefPtr<SVGLengthList> dyList = position.element->dy()->currentValue(); |
| 186 RefPtr<SVGNumberList> rotateList = position.element->rotate()->currentValue(
); | 186 RefPtr<SVGNumberList> rotateList = position.element->rotate()->currentValue(
); |
| 187 | 187 |
| 188 unsigned xListSize = xList->numberOfItems(); | 188 unsigned xListSize = xList->length(); |
| 189 unsigned yListSize = yList->numberOfItems(); | 189 unsigned yListSize = yList->length(); |
| 190 unsigned dxListSize = dxList->numberOfItems(); | 190 unsigned dxListSize = dxList->length(); |
| 191 unsigned dyListSize = dyList->numberOfItems(); | 191 unsigned dyListSize = dyList->length(); |
| 192 unsigned rotateListSize = rotateList->numberOfItems(); | 192 unsigned rotateListSize = rotateList->length(); |
| 193 if (!xListSize && !yListSize && !dxListSize && !dyListSize && !rotateListSiz
e) | 193 if (!xListSize && !yListSize && !dxListSize && !dyListSize && !rotateListSiz
e) |
| 194 return; | 194 return; |
| 195 | 195 |
| 196 float lastRotation = SVGTextLayoutAttributes::emptyValue(); | 196 float lastRotation = SVGTextLayoutAttributes::emptyValue(); |
| 197 SVGLengthContext lengthContext(position.element); | 197 SVGLengthContext lengthContext(position.element); |
| 198 for (unsigned i = 0; i < position.length; ++i) { | 198 for (unsigned i = 0; i < position.length; ++i) { |
| 199 const SVGLengthList* xListPtr = i < xListSize ? xList.get() : 0; | 199 const SVGLengthList* xListPtr = i < xListSize ? xList.get() : 0; |
| 200 const SVGLengthList* yListPtr = i < yListSize ? yList.get() : 0; | 200 const SVGLengthList* yListPtr = i < yListSize ? yList.get() : 0; |
| 201 const SVGLengthList* dxListPtr = i < dxListSize ? dxList.get() : 0; | 201 const SVGLengthList* dxListPtr = i < dxListSize ? dxList.get() : 0; |
| 202 const SVGLengthList* dyListPtr = i < dyListSize ? dyList.get() : 0; | 202 const SVGLengthList* dyListPtr = i < dyListSize ? dyList.get() : 0; |
| 203 const SVGNumberList* rotateListPtr = i < rotateListSize ? rotateList.get
() : 0; | 203 const SVGNumberList* rotateListPtr = i < rotateListSize ? rotateList.get
() : 0; |
| 204 if (!xListPtr && !yListPtr && !dxListPtr && !dyListPtr && !rotateListPtr
) | 204 if (!xListPtr && !yListPtr && !dxListPtr && !dyListPtr && !rotateListPtr
) |
| 205 break; | 205 break; |
| 206 | 206 |
| 207 SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.star
t + i + 1); | 207 SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.star
t + i + 1); |
| 208 if (it == m_characterDataMap.end()) { | 208 if (it == m_characterDataMap.end()) { |
| 209 SVGCharacterData data; | 209 SVGCharacterData data; |
| 210 updateCharacterData(i, lastRotation, data, lengthContext, xListPtr,
yListPtr, dxListPtr, dyListPtr, rotateListPtr); | 210 updateCharacterData(i, lastRotation, data, lengthContext, xListPtr,
yListPtr, dxListPtr, dyListPtr, rotateListPtr); |
| 211 m_characterDataMap.set(position.start + i + 1, data); | 211 m_characterDataMap.set(position.start + i + 1, data); |
| 212 continue; | 212 continue; |
| 213 } | 213 } |
| 214 | 214 |
| 215 updateCharacterData(i, lastRotation, it->value, lengthContext, xListPtr,
yListPtr, dxListPtr, dyListPtr, rotateListPtr); | 215 updateCharacterData(i, lastRotation, it->value, lengthContext, xListPtr,
yListPtr, dxListPtr, dyListPtr, rotateListPtr); |
| 216 } | 216 } |
| 217 | 217 |
| 218 // The last rotation value always spans the whole scope. | 218 // The last rotation value always spans the whole scope. |
| 219 if (lastRotation == SVGTextLayoutAttributes::emptyValue()) | 219 if (lastRotation == SVGTextLayoutAttributes::emptyValue()) |
| 220 return; | 220 return; |
| 221 | 221 |
| 222 for (unsigned i = rotateList->numberOfItems(); i < position.length; ++i) { | 222 for (unsigned i = rotateList->length(); i < position.length; ++i) { |
| 223 SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.star
t + i + 1); | 223 SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.star
t + i + 1); |
| 224 if (it == m_characterDataMap.end()) { | 224 if (it == m_characterDataMap.end()) { |
| 225 SVGCharacterData data; | 225 SVGCharacterData data; |
| 226 data.rotate = lastRotation; | 226 data.rotate = lastRotation; |
| 227 m_characterDataMap.set(position.start + i + 1, data); | 227 m_characterDataMap.set(position.start + i + 1, data); |
| 228 continue; | 228 continue; |
| 229 } | 229 } |
| 230 | 230 |
| 231 it->value.rotate = lastRotation; | 231 it->value.rotate = lastRotation; |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 } | 235 } |
| OLD | NEW |