| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 LayoutStyle& style) |
| 426 { | 426 { |
| 427 if (m_inPathLayout && !m_textPathCalculator) | 427 if (m_inPathLayout && !m_textPathCalculator) |
| 428 return; | 428 return; |
| 429 | 429 |
| 430 SVGElement* lengthContext = toSVGElement(text.parent()->node()); | |
| 431 | |
| 432 LayoutObject* textParent = text.parent(); | 430 LayoutObject* textParent = text.parent(); |
| 433 bool definesTextLength = textParent ? parentDefinesTextLength(textParent) :
false; | 431 bool definesTextLength = textParent ? parentDefinesTextLength(textParent) :
false; |
| 434 | 432 |
| 435 const SVGLayoutStyle& svgStyle = style.svgStyle(); | 433 const SVGLayoutStyle& svgStyle = style.svgStyle(); |
| 436 | 434 |
| 437 m_visualMetricsListOffset = 0; | 435 m_visualMetricsListOffset = 0; |
| 438 m_visualCharacterOffset = 0; | 436 m_visualCharacterOffset = 0; |
| 439 | 437 |
| 440 const Vector<SVGTextMetrics>& visualMetricsValues = text.layoutAttributes()-
>textMetricsValues(); | 438 const Vector<SVGTextMetrics>& visualMetricsValues = text.layoutAttributes()-
>textMetricsValues(); |
| 441 ASSERT(!visualMetricsValues.isEmpty()); | 439 ASSERT(!visualMetricsValues.isEmpty()); |
| 442 | 440 |
| 443 const Font& font = style.font(); | 441 const Font& font = style.font(); |
| 444 | 442 |
| 445 SVGTextLayoutEngineSpacing spacingLayout(font, style.effectiveZoom()); | 443 SVGTextLayoutEngineSpacing spacingLayout(font, style.effectiveZoom()); |
| 446 SVGTextLayoutEngineBaseline baselineLayout(font); | 444 SVGTextLayoutEngineBaseline baselineLayout(font); |
| 447 | 445 |
| 448 bool didStartTextFragment = false; | 446 bool didStartTextFragment = false; |
| 449 bool applySpacingToNextCharacter = false; | 447 bool applySpacingToNextCharacter = false; |
| 450 | 448 |
| 451 float lastAngle = 0; | 449 float lastAngle = 0; |
| 452 float baselineShift = baselineLayout.calculateBaselineShift(svgStyle, length
Context); | 450 float baselineShift = baselineLayout.calculateBaselineShift(style); |
| 453 baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVertical
Text, &text); | 451 baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVertical
Text, &text); |
| 454 | 452 |
| 455 // Main layout algorithm. | 453 // Main layout algorithm. |
| 456 while (true) { | 454 while (true) { |
| 457 // Find the start of the current text box in this list, respecting ligat
ures. | 455 // Find the start of the current text box in this list, respecting ligat
ures. |
| 458 SVGTextMetrics visualMetrics(SVGTextMetrics::SkippedSpaceMetrics); | 456 SVGTextMetrics visualMetrics(SVGTextMetrics::SkippedSpaceMetrics); |
| 459 if (!currentVisualCharacterMetrics(textBox, visualMetricsValues, visualM
etrics)) | 457 if (!currentVisualCharacterMetrics(textBox, visualMetricsValues, visualM
etrics)) |
| 460 break; | 458 break; |
| 461 | 459 |
| 462 if (visualMetrics.isEmpty()) { | 460 if (visualMetrics.isEmpty()) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 } | 634 } |
| 637 | 635 |
| 638 if (!didStartTextFragment) | 636 if (!didStartTextFragment) |
| 639 return; | 637 return; |
| 640 | 638 |
| 641 // Close last open fragment, if needed. | 639 // Close last open fragment, if needed. |
| 642 recordTextFragment(textBox, visualMetricsValues); | 640 recordTextFragment(textBox, visualMetricsValues); |
| 643 } | 641 } |
| 644 | 642 |
| 645 } | 643 } |
| OLD | NEW |