| OLD | NEW |
| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 | 231 |
| 232 if (!data->allCharactersMap) | 232 if (!data->allCharactersMap) |
| 233 return; | 233 return; |
| 234 | 234 |
| 235 data->valueListPosition += textPosition - skippedCharacters; | 235 data->valueListPosition += textPosition - skippedCharacters; |
| 236 } | 236 } |
| 237 | 237 |
| 238 static void walkTree(RenderSVGText* start, RenderSVGInlineText* stopAtLeaf, Meas
ureTextData* data) | 238 static void walkTree(RenderSVGText* start, RenderSVGInlineText* stopAtLeaf, Meas
ureTextData* data) |
| 239 { | 239 { |
| 240 RenderObject* child = start->firstChild(); | 240 LayoutObject* child = start->firstChild(); |
| 241 while (child) { | 241 while (child) { |
| 242 if (child->isSVGInlineText()) { | 242 if (child->isSVGInlineText()) { |
| 243 RenderSVGInlineText* text = toRenderSVGInlineText(child); | 243 RenderSVGInlineText* text = toRenderSVGInlineText(child); |
| 244 measureTextRenderer(text, data, !stopAtLeaf || stopAtLeaf == text); | 244 measureTextRenderer(text, data, !stopAtLeaf || stopAtLeaf == text); |
| 245 if (stopAtLeaf && stopAtLeaf == text) | 245 if (stopAtLeaf && stopAtLeaf == text) |
| 246 return; | 246 return; |
| 247 } else if (child->isSVGInline()) { | 247 } else if (child->isSVGInline()) { |
| 248 // Visit children of text content elements. | 248 // Visit children of text content elements. |
| 249 if (RenderObject* inlineChild = toRenderSVGInline(child)->firstChild
()) { | 249 if (LayoutObject* inlineChild = toRenderSVGInline(child)->firstChild
()) { |
| 250 child = inlineChild; | 250 child = inlineChild; |
| 251 continue; | 251 continue; |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 child = child->nextInPreOrderAfterChildren(start); | 254 child = child->nextInPreOrderAfterChildren(start); |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 | 257 |
| 258 void SVGTextMetricsBuilder::measureTextRenderer(RenderSVGInlineText* text) | 258 void SVGTextMetricsBuilder::measureTextRenderer(RenderSVGInlineText* text) |
| 259 { | 259 { |
| 260 ASSERT(text); | 260 ASSERT(text); |
| 261 | 261 |
| 262 RenderSVGText* textRoot = RenderSVGText::locateRenderSVGTextAncestor(text); | 262 RenderSVGText* textRoot = RenderSVGText::locateRenderSVGTextAncestor(text); |
| 263 if (!textRoot) | 263 if (!textRoot) |
| 264 return; | 264 return; |
| 265 | 265 |
| 266 MeasureTextData data(0); | 266 MeasureTextData data(0); |
| 267 walkTree(textRoot, text, &data); | 267 walkTree(textRoot, text, &data); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR
oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) | 270 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR
oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) |
| 271 { | 271 { |
| 272 ASSERT(textRoot); | 272 ASSERT(textRoot); |
| 273 MeasureTextData data(&allCharactersMap); | 273 MeasureTextData data(&allCharactersMap); |
| 274 walkTree(textRoot, stopAtLeaf, &data); | 274 walkTree(textRoot, stopAtLeaf, &data); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } | 277 } |
| OLD | NEW |