| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 | 315 |
| 316 if (calculator.currentCharacterStartsSurrogatePair()) | 316 if (calculator.currentCharacterStartsSurrogatePair()) |
| 317 surrogatePairCharacters++; | 317 surrogatePairCharacters++; |
| 318 textState.lastCharacterWasWhiteSpace = currentCharacterIsWhiteSpace; | 318 textState.lastCharacterWasWhiteSpace = currentCharacterIsWhiteSpace; |
| 319 } while (calculator.advancePosition()); | 319 } while (calculator.advancePosition()); |
| 320 | 320 |
| 321 textState.valueListPosition += calculator.currentPosition() - skippedWhitesp
ace; | 321 textState.valueListPosition += calculator.currentPosition() - skippedWhitesp
ace; |
| 322 } | 322 } |
| 323 | 323 |
| 324 void walkTree(LayoutSVGText* start, LayoutSVGInlineText* stopAtText, SVGCharacte
rDataMap* allCharactersMap = nullptr) | 324 void walkTree(LayoutSVGText& start, LayoutSVGInlineText* stopAtText, SVGCharacte
rDataMap* allCharactersMap = nullptr) |
| 325 { | 325 { |
| 326 TreeWalkTextState textState; | 326 TreeWalkTextState textState; |
| 327 LayoutObject* child = start->firstChild(); | 327 LayoutObject* child = start.firstChild(); |
| 328 while (child) { | 328 while (child) { |
| 329 if (child->isSVGInlineText()) { | 329 if (child->isSVGInlineText()) { |
| 330 LayoutSVGInlineText* text = toLayoutSVGInlineText(child); | 330 LayoutSVGInlineText* text = toLayoutSVGInlineText(child); |
| 331 OwnPtr<UpdateAttributes> attributesToUpdate = nullptr; | 331 OwnPtr<UpdateAttributes> attributesToUpdate = nullptr; |
| 332 if (!stopAtText || stopAtText == text) | 332 if (!stopAtText || stopAtText == text) |
| 333 attributesToUpdate = adoptPtr(new UpdateAttributes(*text->layout
Attributes(), text->metricsList(), allCharactersMap)); | 333 attributesToUpdate = adoptPtr(new UpdateAttributes(*text->layout
Attributes(), text->metricsList(), allCharactersMap)); |
| 334 walkInlineText(text, textState, attributesToUpdate.get()); | 334 walkInlineText(text, textState, attributesToUpdate.get()); |
| 335 if (stopAtText == text) | 335 if (stopAtText == text) |
| 336 return; | 336 return; |
| 337 } else if (child->isSVGInline()) { | 337 } else if (child->isSVGInline()) { |
| 338 // Visit children of text content elements. | 338 // Visit children of text content elements. |
| 339 if (LayoutObject* inlineChild = toLayoutSVGInline(child)->firstChild
()) { | 339 if (LayoutObject* inlineChild = toLayoutSVGInline(child)->firstChild
()) { |
| 340 child = inlineChild; | 340 child = inlineChild; |
| 341 continue; | 341 continue; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 child = child->nextInPreOrderAfterChildren(start); | 344 child = child->nextInPreOrderAfterChildren(&start); |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 | 347 |
| 348 } // namespace | 348 } // namespace |
| 349 | 349 |
| 350 void SVGTextMetricsBuilder::measureTextLayoutObject(LayoutSVGInlineText* text) | 350 void SVGTextMetricsBuilder::measureTextLayoutObject(LayoutSVGText& textRoot, Lay
outSVGInlineText& text) |
| 351 { | 351 { |
| 352 ASSERT(text); | 352 walkTree(textRoot, &text); |
| 353 if (LayoutSVGText* textRoot = LayoutSVGText::locateLayoutSVGTextAncestor(tex
t)) | |
| 354 walkTree(textRoot, text); | |
| 355 } | 353 } |
| 356 | 354 |
| 357 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText* textR
oot, LayoutSVGInlineText* stopAtText, SVGCharacterDataMap& allCharactersMap) | 355 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText& textR
oot, SVGCharacterDataMap& allCharactersMap) |
| 358 { | 356 { |
| 359 ASSERT(textRoot); | 357 walkTree(textRoot, nullptr, &allCharactersMap); |
| 360 walkTree(textRoot, stopAtText, &allCharactersMap); | |
| 361 } | 358 } |
| 362 | 359 |
| 363 } // namespace blink | 360 } // namespace blink |
| OLD | NEW |