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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 ASSERT(text.parent()); | 243 ASSERT(text.parent()); |
244 ASSERT(text.parent()->node()); | 244 ASSERT(text.parent()->node()); |
245 ASSERT(text.parent()->node()->isSVGElement()); | 245 ASSERT(text.parent()->node()->isSVGElement()); |
246 | 246 |
247 const ComputedStyle& style = text.styleRef(); | 247 const ComputedStyle& style = text.styleRef(); |
248 | 248 |
249 textBox->clearTextFragments(); | 249 textBox->clearTextFragments(); |
250 m_isVerticalText = style.svgStyle().isVerticalWritingMode(); | 250 m_isVerticalText = style.svgStyle().isVerticalWritingMode(); |
251 layoutTextOnLineOrPath(textBox, text, style); | 251 layoutTextOnLineOrPath(textBox, text, style); |
252 | 252 |
253 if (m_inPathLayout) { | 253 if (m_inPathLayout) |
254 m_pathLayoutBoxes.append(textBox); | |
255 return; | 254 return; |
256 } | |
257 | 255 |
258 m_lineLayoutBoxes.append(textBox); | 256 m_lineLayoutBoxes.append(textBox); |
259 } | 257 } |
260 | 258 |
261 void SVGTextLayoutEngine::finishLayout() | 259 void SVGTextLayoutEngine::finishLayout() |
262 { | 260 { |
263 // After all text fragments are stored in their correpsonding SVGInlineTextB
oxes, we can layout individual text chunks. | 261 // After all text fragments are stored in their correpsonding SVGInlineTextB
oxes, we can layout individual text chunks. |
264 // Chunk layouting is only performed for line layout boxes, not for path lay
out, where it has already been done. | 262 // Chunk layouting is only performed for line layout boxes, not for path lay
out, where it has already been done. |
265 SVGTextChunkBuilder chunkLayoutBuilder; | 263 SVGTextChunkBuilder chunkLayoutBuilder; |
266 chunkLayoutBuilder.layoutTextChunks(m_lineLayoutBoxes); | 264 chunkLayoutBuilder.layoutTextChunks(m_lineLayoutBoxes); |
267 | 265 |
268 // Finalize transform matrices, after the chunk layout corrections have been
applied, and all fragment x/y positions are finalized. | 266 // Finalize transform matrices, after the chunk layout corrections have been
applied, and all fragment x/y positions are finalized. |
269 if (!m_lineLayoutBoxes.isEmpty()) { | 267 if (!m_lineLayoutBoxes.isEmpty()) { |
270 chunkLayoutBuilder.finalizeTransformMatrices(m_lineLayoutBoxes); | 268 chunkLayoutBuilder.finalizeTransformMatrices(m_lineLayoutBoxes); |
271 m_lineLayoutBoxes.clear(); | 269 m_lineLayoutBoxes.clear(); |
272 } | 270 } |
273 | |
274 if (!m_pathLayoutBoxes.isEmpty()) { | |
275 chunkLayoutBuilder.finalizeTransformMatrices(m_pathLayoutBoxes); | |
276 m_pathLayoutBoxes.clear(); | |
277 } | |
278 } | 271 } |
279 | 272 |
280 bool SVGTextLayoutEngine::currentLogicalCharacterAttributes(SVGTextLayoutAttribu
tes*& logicalAttributes) | 273 bool SVGTextLayoutEngine::currentLogicalCharacterAttributes(SVGTextLayoutAttribu
tes*& logicalAttributes) |
281 { | 274 { |
282 if (m_layoutAttributesPosition == m_layoutAttributes.size()) | 275 if (m_layoutAttributesPosition == m_layoutAttributes.size()) |
283 return false; | 276 return false; |
284 | 277 |
285 logicalAttributes = m_layoutAttributes[m_layoutAttributesPosition]; | 278 logicalAttributes = m_layoutAttributes[m_layoutAttributesPosition]; |
286 ASSERT(logicalAttributes); | 279 ASSERT(logicalAttributes); |
287 | 280 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } | 570 } |
578 | 571 |
579 if (!didStartTextFragment) | 572 if (!didStartTextFragment) |
580 return; | 573 return; |
581 | 574 |
582 // Close last open fragment, if needed. | 575 // Close last open fragment, if needed. |
583 recordTextFragment(textBox, visualMetricsValues); | 576 recordTextFragment(textBox, visualMetricsValues); |
584 } | 577 } |
585 | 578 |
586 } | 579 } |
OLD | NEW |