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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 void SVGTextLayoutEngine::layoutInlineTextBox(SVGInlineTextBox* textBox) | 239 void SVGTextLayoutEngine::layoutInlineTextBox(SVGInlineTextBox* textBox) |
240 { | 240 { |
241 ASSERT(textBox); | 241 ASSERT(textBox); |
242 | 242 |
243 LayoutSVGInlineText& text = toLayoutSVGInlineText(textBox->layoutObject()); | 243 LayoutSVGInlineText& text = toLayoutSVGInlineText(textBox->layoutObject()); |
244 ASSERT(text.parent()); | 244 ASSERT(text.parent()); |
245 ASSERT(text.parent()->node()); | 245 ASSERT(text.parent()->node()); |
246 ASSERT(text.parent()->node()->isSVGElement()); | 246 ASSERT(text.parent()->node()->isSVGElement()); |
247 | 247 |
248 const LayoutStyle& style = text.styleRef(); | 248 const ComputedStyle& style = text.styleRef(); |
249 | 249 |
250 textBox->clearTextFragments(); | 250 textBox->clearTextFragments(); |
251 m_isVerticalText = style.svgStyle().isVerticalWritingMode(); | 251 m_isVerticalText = style.svgStyle().isVerticalWritingMode(); |
252 layoutTextOnLineOrPath(textBox, text, style); | 252 layoutTextOnLineOrPath(textBox, text, style); |
253 | 253 |
254 if (m_inPathLayout) { | 254 if (m_inPathLayout) { |
255 m_pathLayoutBoxes.append(textBox); | 255 m_pathLayoutBoxes.append(textBox); |
256 return; | 256 return; |
257 } | 257 } |
258 | 258 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 ++m_logicalMetricsListOffset; | 415 ++m_logicalMetricsListOffset; |
416 m_logicalCharacterOffset += logicalMetrics.length(); | 416 m_logicalCharacterOffset += logicalMetrics.length(); |
417 } | 417 } |
418 | 418 |
419 void SVGTextLayoutEngine::advanceToNextVisualCharacter(const SVGTextMetrics& vis
ualMetrics) | 419 void SVGTextLayoutEngine::advanceToNextVisualCharacter(const SVGTextMetrics& vis
ualMetrics) |
420 { | 420 { |
421 ++m_visualMetricsListOffset; | 421 ++m_visualMetricsListOffset; |
422 m_visualCharacterOffset += visualMetrics.length(); | 422 m_visualCharacterOffset += visualMetrics.length(); |
423 } | 423 } |
424 | 424 |
425 void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons
t LayoutSVGInlineText& text, const LayoutStyle& style) | 425 void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons
t LayoutSVGInlineText& text, const ComputedStyle& style) |
426 { | 426 { |
427 if (m_inPathLayout && !m_textPathCalculator) | 427 if (m_inPathLayout && !m_textPathCalculator) |
428 return; | 428 return; |
429 | 429 |
430 LayoutObject* textParent = text.parent(); | 430 LayoutObject* textParent = text.parent(); |
431 bool definesTextLength = textParent ? parentDefinesTextLength(textParent) :
false; | 431 bool definesTextLength = textParent ? parentDefinesTextLength(textParent) :
false; |
432 | 432 |
433 const SVGLayoutStyle& svgStyle = style.svgStyle(); | 433 const SVGComputedStyle& svgStyle = style.svgStyle(); |
434 | 434 |
435 m_visualMetricsListOffset = 0; | 435 m_visualMetricsListOffset = 0; |
436 m_visualCharacterOffset = 0; | 436 m_visualCharacterOffset = 0; |
437 | 437 |
438 const Vector<SVGTextMetrics>& visualMetricsValues = text.layoutAttributes()-
>textMetricsValues(); | 438 const Vector<SVGTextMetrics>& visualMetricsValues = text.layoutAttributes()-
>textMetricsValues(); |
439 ASSERT(!visualMetricsValues.isEmpty()); | 439 ASSERT(!visualMetricsValues.isEmpty()); |
440 | 440 |
441 const Font& font = style.font(); | 441 const Font& font = style.font(); |
442 | 442 |
443 SVGTextLayoutEngineSpacing spacingLayout(font, style.effectiveZoom()); | 443 SVGTextLayoutEngineSpacing spacingLayout(font, style.effectiveZoom()); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 } | 634 } |
635 | 635 |
636 if (!didStartTextFragment) | 636 if (!didStartTextFragment) |
637 return; | 637 return; |
638 | 638 |
639 // Close last open fragment, if needed. | 639 // Close last open fragment, if needed. |
640 recordTextFragment(textBox, visualMetricsValues); | 640 recordTextFragment(textBox, visualMetricsValues); |
641 } | 641 } |
642 | 642 |
643 } | 643 } |
OLD | NEW |