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

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

Issue 191053002: Turn SVGTextMetricsBuilder into a namespace (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/svg/SVGTextMetricsBuilder.h ('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-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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 , lastCharacterWasWhiteSpace(true) 122 , lastCharacterWasWhiteSpace(true)
123 , valueListPosition(0) 123 , valueListPosition(0)
124 { 124 {
125 } 125 }
126 126
127 SVGCharacterDataMap* allCharactersMap; 127 SVGCharacterDataMap* allCharactersMap;
128 bool lastCharacterWasWhiteSpace; 128 bool lastCharacterWasWhiteSpace;
129 unsigned valueListPosition; 129 unsigned valueListPosition;
130 }; 130 };
131 131
132 void SVGTextMetricsBuilder::measureTextRenderer(RenderSVGInlineText* text, Measu reTextData* data, bool processRenderer) 132 static void measureTextRenderer(RenderSVGInlineText* text, MeasureTextData* data , bool processRenderer)
133 { 133 {
134 ASSERT(text); 134 ASSERT(text);
135 135
136 SVGTextLayoutAttributes* attributes = text->layoutAttributes(); 136 SVGTextLayoutAttributes* attributes = text->layoutAttributes();
137 Vector<SVGTextMetrics>* textMetricsValues = &attributes->textMetricsValues() ; 137 Vector<SVGTextMetrics>* textMetricsValues = &attributes->textMetricsValues() ;
138 if (processRenderer) { 138 if (processRenderer) {
139 if (data->allCharactersMap) 139 if (data->allCharactersMap)
140 attributes->clear(); 140 attributes->clear();
141 else 141 else
142 textMetricsValues->clear(); 142 textMetricsValues->clear();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 data->lastCharacterWasWhiteSpace = characterIsWhiteSpace; 179 data->lastCharacterWasWhiteSpace = characterIsWhiteSpace;
180 } 180 }
181 181
182 if (!data->allCharactersMap) 182 if (!data->allCharactersMap)
183 return; 183 return;
184 184
185 data->valueListPosition += textPosition - skippedCharacters; 185 data->valueListPosition += textPosition - skippedCharacters;
186 } 186 }
187 187
188 void SVGTextMetricsBuilder::walkTree(RenderObject* start, RenderSVGInlineText* s topAtLeaf, MeasureTextData* data) 188 static void walkTree(RenderObject* start, RenderSVGInlineText* stopAtLeaf, Measu reTextData* data)
189 { 189 {
190 RenderObject* child = start->firstChild(); 190 RenderObject* child = start->firstChild();
191 while (child) { 191 while (child) {
192 if (child->isSVGInlineText()) { 192 if (child->isSVGInlineText()) {
193 RenderSVGInlineText* text = toRenderSVGInlineText(child); 193 RenderSVGInlineText* text = toRenderSVGInlineText(child);
194 measureTextRenderer(text, data, !stopAtLeaf || stopAtLeaf == text); 194 measureTextRenderer(text, data, !stopAtLeaf || stopAtLeaf == text);
195 if (stopAtLeaf && stopAtLeaf == text) 195 if (stopAtLeaf && stopAtLeaf == text)
196 return; 196 return;
197 } else if (child->isSVGInline()) { 197 } else if (child->isSVGInline()) {
198 // Visit children of text content elements. 198 // Visit children of text content elements.
(...skipping 19 matching lines...) Expand all
218 } 218 }
219 219
220 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) 220 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap)
221 { 221 {
222 ASSERT(textRoot); 222 ASSERT(textRoot);
223 MeasureTextData data(&allCharactersMap); 223 MeasureTextData data(&allCharactersMap);
224 walkTree(textRoot, stopAtLeaf, &data); 224 walkTree(textRoot, stopAtLeaf, &data);
225 } 225 }
226 226
227 } 227 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextMetricsBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698