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 12 matching lines...) Expand all Loading... |
23 #include "core/layout/svg/LayoutSVGInlineText.h" | 23 #include "core/layout/svg/LayoutSVGInlineText.h" |
24 #include "core/layout/svg/LayoutSVGText.h" | 24 #include "core/layout/svg/LayoutSVGText.h" |
25 #include "core/svg/SVGTextPositioningElement.h" | 25 #include "core/svg/SVGTextPositioningElement.h" |
26 | 26 |
27 namespace blink { | 27 namespace blink { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 void updateLayoutAttributes(LayoutSVGInlineText& text, unsigned& valueListPositi
on, const SVGCharacterDataMap& allCharactersMap) | 31 void updateLayoutAttributes(LayoutSVGInlineText& text, unsigned& valueListPositi
on, const SVGCharacterDataMap& allCharactersMap) |
32 { | 32 { |
33 SVGTextLayoutAttributes& attributes = *text.layoutAttributes(); | 33 SVGCharacterDataMap& characterDataMap = text.characterDataMap(); |
34 attributes.clear(); | 34 characterDataMap.clear(); |
35 | 35 |
36 const Vector<SVGTextMetrics>& metricsList = text.metricsList(); | 36 const Vector<SVGTextMetrics>& metricsList = text.metricsList(); |
37 auto metricsEnd = metricsList.end(); | 37 auto metricsEnd = metricsList.end(); |
38 unsigned currentPosition = 0; | 38 unsigned currentPosition = 0; |
39 for (auto metrics = metricsList.begin(); metrics != metricsEnd; currentPosit
ion += metrics->length(), ++metrics) { | 39 for (auto metrics = metricsList.begin(); metrics != metricsEnd; currentPosit
ion += metrics->length(), ++metrics) { |
40 if (metrics->isEmpty()) | 40 if (metrics->isEmpty()) |
41 continue; | 41 continue; |
42 | 42 |
43 auto it = allCharactersMap.find(valueListPosition + 1); | 43 auto it = allCharactersMap.find(valueListPosition + 1); |
44 if (it != allCharactersMap.end()) | 44 if (it != allCharactersMap.end()) |
45 attributes.characterDataMap().set(currentPosition + 1, it->value); | 45 characterDataMap.set(currentPosition + 1, it->value); |
46 | 46 |
47 // Increase the position in the value/attribute list with one for each | 47 // Increase the position in the value/attribute list with one for each |
48 // "character unit" (that will be displayed.) | 48 // "character unit" (that will be displayed.) |
49 valueListPosition++; | 49 valueListPosition++; |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 SVGTextLayoutAttributesBuilder::SVGTextLayoutAttributesBuilder(LayoutSVGText& te
xtRoot) | 55 SVGTextLayoutAttributesBuilder::SVGTextLayoutAttributesBuilder(LayoutSVGText& te
xtRoot) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 attrLists.updateCharacterData(i, data); | 233 attrLists.updateCharacterData(i, data); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 DEFINE_TRACE(SVGTextLayoutAttributesBuilder::TextPosition) | 237 DEFINE_TRACE(SVGTextLayoutAttributesBuilder::TextPosition) |
238 { | 238 { |
239 visitor->trace(element); | 239 visitor->trace(element); |
240 } | 240 } |
241 | 241 |
242 } // namespace blink | 242 } // namespace blink |
OLD | NEW |