Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: Source/core/rendering/svg/SVGTextLayoutAttributesBuilder.cpp

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert aggressive svgAttributeChanged, add NeedsRebaseline Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 // Fill character data map using child text positioning elements in top-down order. 157 // Fill character data map using child text positioning elements in top-down order.
158 unsigned size = m_textPositions.size(); 158 unsigned size = m_textPositions.size();
159 for (unsigned i = 0; i < size; ++i) 159 for (unsigned i = 0; i < size; ++i)
160 fillCharacterDataMap(m_textPositions[i]); 160 fillCharacterDataMap(m_textPositions[i]);
161 } 161 }
162 162
163 static inline void updateCharacterData(unsigned i, float& lastRotation, SVGChara cterData& data, const SVGLengthContext& lengthContext, const SVGLengthList* xLis t, const SVGLengthList* yList, const SVGLengthList* dxList, const SVGLengthList* dyList, const SVGNumberList* rotateList) 163 static inline void updateCharacterData(unsigned i, float& lastRotation, SVGChara cterData& data, const SVGLengthContext& lengthContext, const SVGLengthList* xLis t, const SVGLengthList* yList, const SVGLengthList* dxList, const SVGLengthList* dyList, const SVGNumberList* rotateList)
164 { 164 {
165 if (xList) 165 if (xList)
166 data.x = xList->at(i).value(lengthContext); 166 data.x = xList->at(i)->value(lengthContext);
167 if (yList) 167 if (yList)
168 data.y = yList->at(i).value(lengthContext); 168 data.y = yList->at(i)->value(lengthContext);
169 if (dxList) 169 if (dxList)
170 data.dx = dxList->at(i).value(lengthContext); 170 data.dx = dxList->at(i)->value(lengthContext);
171 if (dyList) 171 if (dyList)
172 data.dy = dyList->at(i).value(lengthContext); 172 data.dy = dyList->at(i)->value(lengthContext);
173 if (rotateList) { 173 if (rotateList) {
174 data.rotate = rotateList->at(i).value(); 174 data.rotate = rotateList->at(i).value();
175 lastRotation = data.rotate; 175 lastRotation = data.rotate;
176 } 176 }
177 } 177 }
178 178
179 void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po sition) 179 void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po sition)
180 { 180 {
181 const SVGLengthList& xList = position.element->xCurrentValue(); 181 RefPtr<SVGLengthList> xList = position.element->x()->currentValue();
182 const SVGLengthList& yList = position.element->yCurrentValue(); 182 RefPtr<SVGLengthList> yList = position.element->y()->currentValue();
183 const SVGLengthList& dxList = position.element->dxCurrentValue(); 183 RefPtr<SVGLengthList> dxList = position.element->dx()->currentValue();
184 const SVGLengthList& dyList = position.element->dyCurrentValue(); 184 RefPtr<SVGLengthList> dyList = position.element->dy()->currentValue();
185 const SVGNumberList& rotateList = position.element->rotateCurrentValue(); 185 const SVGNumberList& rotateList = position.element->rotateCurrentValue();
186 186
187 unsigned xListSize = xList.size(); 187 unsigned xListSize = xList->numberOfItems();
188 unsigned yListSize = yList.size(); 188 unsigned yListSize = yList->numberOfItems();
189 unsigned dxListSize = dxList.size(); 189 unsigned dxListSize = dxList->numberOfItems();
190 unsigned dyListSize = dyList.size(); 190 unsigned dyListSize = dyList->numberOfItems();
191 unsigned rotateListSize = rotateList.size(); 191 unsigned rotateListSize = rotateList.size();
192 if (!xListSize && !yListSize && !dxListSize && !dyListSize && !rotateListSiz e) 192 if (!xListSize && !yListSize && !dxListSize && !dyListSize && !rotateListSiz e)
193 return; 193 return;
194 194
195 float lastRotation = SVGTextLayoutAttributes::emptyValue(); 195 float lastRotation = SVGTextLayoutAttributes::emptyValue();
196 SVGLengthContext lengthContext(position.element); 196 SVGLengthContext lengthContext(position.element);
197 for (unsigned i = 0; i < position.length; ++i) { 197 for (unsigned i = 0; i < position.length; ++i) {
198 const SVGLengthList* xListPtr = i < xListSize ? &xList : 0; 198 const SVGLengthList* xListPtr = i < xListSize ? xList.get() : 0;
199 const SVGLengthList* yListPtr = i < yListSize ? &yList : 0; 199 const SVGLengthList* yListPtr = i < yListSize ? yList.get() : 0;
200 const SVGLengthList* dxListPtr = i < dxListSize ? &dxList : 0; 200 const SVGLengthList* dxListPtr = i < dxListSize ? dxList.get() : 0;
201 const SVGLengthList* dyListPtr = i < dyListSize ? &dyList : 0; 201 const SVGLengthList* dyListPtr = i < dyListSize ? dyList.get() : 0;
202 const SVGNumberList* rotateListPtr = i < rotateListSize ? &rotateList : 0; 202 const SVGNumberList* rotateListPtr = i < rotateListSize ? &rotateList : 0;
203 if (!xListPtr && !yListPtr && !dxListPtr && !dyListPtr && !rotateListPtr ) 203 if (!xListPtr && !yListPtr && !dxListPtr && !dyListPtr && !rotateListPtr )
204 break; 204 break;
205 205
206 SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.star t + i + 1); 206 SVGCharacterDataMap::iterator it = m_characterDataMap.find(position.star t + i + 1);
207 if (it == m_characterDataMap.end()) { 207 if (it == m_characterDataMap.end()) {
208 SVGCharacterData data; 208 SVGCharacterData data;
209 updateCharacterData(i, lastRotation, data, lengthContext, xListPtr, yListPtr, dxListPtr, dyListPtr, rotateListPtr); 209 updateCharacterData(i, lastRotation, data, lengthContext, xListPtr, yListPtr, dxListPtr, dyListPtr, rotateListPtr);
210 m_characterDataMap.set(position.start + i + 1, data); 210 m_characterDataMap.set(position.start + i + 1, data);
211 continue; 211 continue;
(...skipping 13 matching lines...) Expand all
225 data.rotate = lastRotation; 225 data.rotate = lastRotation;
226 m_characterDataMap.set(position.start + i + 1, data); 226 m_characterDataMap.set(position.start + i + 1, data);
227 continue; 227 continue;
228 } 228 }
229 229
230 it->value.rotate = lastRotation; 230 it->value.rotate = lastRotation;
231 } 231 }
232 } 232 }
233 233
234 } 234 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextChunkBuilder.cpp ('k') | Source/core/rendering/svg/SVGTextLayoutEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698