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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 bool didStartTextFragment = false; | 351 bool didStartTextFragment = false; |
352 bool applySpacingToNextCharacter = false; | 352 bool applySpacingToNextCharacter = false; |
353 | 353 |
354 float lastAngle = 0; | 354 float lastAngle = 0; |
355 float baselineShift = baselineLayout.calculateBaselineShift(style); | 355 float baselineShift = baselineLayout.calculateBaselineShift(style); |
356 baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVertical
Text, &text); | 356 baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVertical
Text, &text); |
357 | 357 |
358 // Main layout algorithm. | 358 // Main layout algorithm. |
359 const unsigned boxEndOffset = textBox->start() + textBox->len(); | 359 const unsigned boxEndOffset = textBox->start() + textBox->len(); |
360 while (m_visualMetricsIterator.characterOffset() < boxEndOffset) { | 360 while (!m_visualMetricsIterator.isAtEnd() && m_visualMetricsIterator.charact
erOffset() < boxEndOffset) { |
361 const SVGTextMetrics& visualMetrics = m_visualMetricsIterator.metrics(); | 361 const SVGTextMetrics& visualMetrics = m_visualMetricsIterator.metrics(); |
362 if (visualMetrics.isEmpty()) { | 362 if (visualMetrics.isEmpty()) { |
363 m_visualMetricsIterator.next(); | 363 m_visualMetricsIterator.next(); |
364 continue; | 364 continue; |
365 } | 365 } |
366 | 366 |
367 SVGTextLayoutAttributes* logicalAttributes = 0; | 367 SVGTextLayoutAttributes* logicalAttributes = 0; |
368 if (!currentLogicalCharacterAttributes(logicalAttributes)) | 368 if (!currentLogicalCharacterAttributes(logicalAttributes)) |
369 break; | 369 break; |
370 | 370 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 536 } |
537 | 537 |
538 if (!didStartTextFragment) | 538 if (!didStartTextFragment) |
539 return; | 539 return; |
540 | 540 |
541 // Close last open fragment, if needed. | 541 // Close last open fragment, if needed. |
542 recordTextFragment(textBox); | 542 recordTextFragment(textBox); |
543 } | 543 } |
544 | 544 |
545 } | 545 } |
OLD | NEW |