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

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

Issue 7350005: Merge 90166 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 5 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
« no previous file with comments | « Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 21 matching lines...) Expand all
32 namespace WebCore { 32 namespace WebCore {
33 33
34 SVGTextLayoutAttributesBuilder::SVGTextLayoutAttributesBuilder() 34 SVGTextLayoutAttributesBuilder::SVGTextLayoutAttributesBuilder()
35 { 35 {
36 } 36 }
37 37
38 void SVGTextLayoutAttributesBuilder::buildLayoutAttributesForTextSubtree(RenderS VGText* textRoot) 38 void SVGTextLayoutAttributesBuilder::buildLayoutAttributesForTextSubtree(RenderS VGText* textRoot)
39 { 39 {
40 ASSERT(textRoot); 40 ASSERT(textRoot);
41 41
42 // Build list of x/y/dx/dy/rotate values for each subtree element that may d efine these values (tspan/textPath etc). 42 // We always clear our current attribute as we don't want to keep any stale ones that could survive DOM modification.
43 Vector<SVGTextLayoutAttributes>& allAttributes = textRoot->layoutAttributes( );
44 allAttributes.clear();
45
46 // Build list of x/y/dx/dy/rotate values for each subtree element that may define these values (tspan/textPath etc).
43 unsigned atCharacter = 0; 47 unsigned atCharacter = 0;
44 UChar lastCharacter = '\0'; 48 UChar lastCharacter = '\0';
45 collectTextPositioningElements(textRoot, atCharacter, lastCharacter); 49 collectTextPositioningElements(textRoot, atCharacter, lastCharacter);
46 50
47 if (!atCharacter) 51 if (!atCharacter)
48 return; 52 return;
49 53
50 // Collect x/y/dx/dy/rotate values for each character, stored in the m_posit ioningLists.xValues()/etc. lists. 54 // Collect x/y/dx/dy/rotate values for each character, stored in the m_posit ioningLists.xValues()/etc. lists.
51 buildLayoutAttributesForAllCharacters(textRoot, atCharacter); 55 buildLayoutAttributesForAllCharacters(textRoot, atCharacter);
52 56
53 // Propagate layout attributes to each RenderSVGInlineText object, and the w hole list to the RenderSVGText root. 57 // Propagate layout attributes to each RenderSVGInlineText object, and the w hole list to the RenderSVGText root.
54 Vector<SVGTextLayoutAttributes>& allAttributes = textRoot->layoutAttributes( );
55 allAttributes.clear();
56 atCharacter = 0; 58 atCharacter = 0;
57 lastCharacter = '\0'; 59 lastCharacter = '\0';
58 propagateLayoutAttributes(textRoot, allAttributes, atCharacter, lastCharacte r); 60 propagateLayoutAttributes(textRoot, allAttributes, atCharacter, lastCharacte r);
59 } 61 }
60 62
61 static inline void extractFloatValuesFromSVGLengthList(SVGElement* lengthContext , const SVGLengthList& list, Vector<float>& floatValues, unsigned textContentLen gth) 63 static inline void extractFloatValuesFromSVGLengthList(SVGElement* lengthContext , const SVGLengthList& list, Vector<float>& floatValues, unsigned textContentLen gth)
62 { 64 {
63 ASSERT(lengthContext); 65 ASSERT(lengthContext);
64 66
65 unsigned length = list.size(); 67 unsigned length = list.size();
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 return; 289 return;
288 290
289 float lastValue = values.last(); 291 float lastValue = values.last();
290 for (unsigned i = values.size(); i < position.length; ++i) 292 for (unsigned i = values.size(); i < position.length; ++i)
291 m_positioningLists.rotateValues[position.start + i] = lastValue; 293 m_positioningLists.rotateValues[position.start + i] = lastValue;
292 } 294 }
293 295
294 } 296 }
295 297
296 #endif // ENABLE(SVG) 298 #endif // ENABLE(SVG)
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698