| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void SVGTextLayoutEngine::recordTextFragment(SVGInlineTextBox* textBox) { | 148 void SVGTextLayoutEngine::recordTextFragment(SVGInlineTextBox* textBox) { |
| 149 ASSERT(!m_currentTextFragment.length); | 149 ASSERT(!m_currentTextFragment.length); |
| 150 | 150 |
| 151 // Figure out length of fragment. | 151 // Figure out length of fragment. |
| 152 m_currentTextFragment.length = m_visualMetricsIterator.characterOffset() - | 152 m_currentTextFragment.length = m_visualMetricsIterator.characterOffset() - |
| 153 m_currentTextFragment.characterOffset; | 153 m_currentTextFragment.characterOffset; |
| 154 | 154 |
| 155 // Figure out fragment metrics. | 155 // Figure out fragment metrics. |
| 156 computeCurrentFragmentMetrics(textBox); | 156 computeCurrentFragmentMetrics(textBox); |
| 157 | 157 |
| 158 textBox->textFragments().append(m_currentTextFragment); | 158 textBox->textFragments().push_back(m_currentTextFragment); |
| 159 m_currentTextFragment = SVGTextFragment(); | 159 m_currentTextFragment = SVGTextFragment(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void SVGTextLayoutEngine::beginTextPathLayout(SVGInlineFlowBox* flowBox) { | 162 void SVGTextLayoutEngine::beginTextPathLayout(SVGInlineFlowBox* flowBox) { |
| 163 // Build text chunks for all <textPath> children, using the line layout | 163 // Build text chunks for all <textPath> children, using the line layout |
| 164 // algorithm. This is needeed as text-anchor is just an additional startOffset | 164 // algorithm. This is needeed as text-anchor is just an additional startOffset |
| 165 // for text paths. | 165 // for text paths. |
| 166 SVGTextLayoutEngine lineLayout(m_descendantTextNodes); | 166 SVGTextLayoutEngine lineLayout(m_descendantTextNodes); |
| 167 lineLayout.m_textLengthSpacingInEffect = m_textLengthSpacingInEffect; | 167 lineLayout.m_textLengthSpacingInEffect = m_textLengthSpacingInEffect; |
| 168 lineLayout.layoutCharactersInTextBoxes(flowBox); | 168 lineLayout.layoutCharactersInTextBoxes(flowBox); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 const ComputedStyle& style = textLineLayout.styleRef(); | 231 const ComputedStyle& style = textLineLayout.styleRef(); |
| 232 | 232 |
| 233 textBox->clearTextFragments(); | 233 textBox->clearTextFragments(); |
| 234 m_isVerticalText = !style.isHorizontalWritingMode(); | 234 m_isVerticalText = !style.isHorizontalWritingMode(); |
| 235 layoutTextOnLineOrPath(textBox, textLineLayout, style); | 235 layoutTextOnLineOrPath(textBox, textLineLayout, style); |
| 236 | 236 |
| 237 if (m_inPathLayout) | 237 if (m_inPathLayout) |
| 238 return; | 238 return; |
| 239 | 239 |
| 240 m_lineLayoutBoxes.append(textBox); | 240 m_lineLayoutBoxes.push_back(textBox); |
| 241 } | 241 } |
| 242 | 242 |
| 243 static bool definesTextLengthWithSpacing(const InlineFlowBox* start) { | 243 static bool definesTextLengthWithSpacing(const InlineFlowBox* start) { |
| 244 SVGTextContentElement* textContentElement = | 244 SVGTextContentElement* textContentElement = |
| 245 SVGTextContentElement::elementFromLineLayoutItem( | 245 SVGTextContentElement::elementFromLineLayoutItem( |
| 246 start->getLineLayoutItem()); | 246 start->getLineLayoutItem()); |
| 247 return textContentElement && | 247 return textContentElement && |
| 248 textContentElement->lengthAdjust()->currentValue()->enumValue() == | 248 textContentElement->lengthAdjust()->currentValue()->enumValue() == |
| 249 SVGLengthAdjustSpacing && | 249 SVGLengthAdjustSpacing && |
| 250 textContentElement->textLengthIsSpecifiedByUser(); | 250 textContentElement->textLengthIsSpecifiedByUser(); |
| (...skipping 285 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 } // namespace blink | 545 } // namespace blink |
| OLD | NEW |