| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 LineLayoutSVGInlineText textLineLayout = | 118 LineLayoutSVGInlineText textLineLayout = |
| 119 LineLayoutSVGInlineText(textBox->getLineLayoutItem()); | 119 LineLayoutSVGInlineText(textBox->getLineLayoutItem()); |
| 120 TextRun run = textBox->constructTextRun(textLineLayout.styleRef(), | 120 TextRun run = textBox->constructTextRun(textLineLayout.styleRef(), |
| 121 m_currentTextFragment); | 121 m_currentTextFragment); |
| 122 | 122 |
| 123 float scalingFactor = textLineLayout.scalingFactor(); | 123 float scalingFactor = textLineLayout.scalingFactor(); |
| 124 ASSERT(scalingFactor); | 124 ASSERT(scalingFactor); |
| 125 const Font& scaledFont = textLineLayout.scaledFont(); | 125 const Font& scaledFont = textLineLayout.scaledFont(); |
| 126 FloatRect glyphOverflowBounds; | 126 FloatRect glyphOverflowBounds; |
| 127 | 127 |
| 128 const SimpleFontData* fontData = scaledFont.primaryFont(); |
| 129 DCHECK(fontData); |
| 130 if (!fontData) |
| 131 return; |
| 132 |
| 128 float width = scaledFont.width(run, nullptr, &glyphOverflowBounds); | 133 float width = scaledFont.width(run, nullptr, &glyphOverflowBounds); |
| 129 float ascent = scaledFont.getFontMetrics().floatAscent(); | 134 float ascent = fontData->getFontMetrics().floatAscent(); |
| 130 float descent = scaledFont.getFontMetrics().floatDescent(); | 135 float descent = fontData->getFontMetrics().floatDescent(); |
| 131 m_currentTextFragment.glyphOverflow.setFromBounds(glyphOverflowBounds, ascent, | 136 m_currentTextFragment.glyphOverflow.setFromBounds(glyphOverflowBounds, ascent, |
| 132 descent, width); | 137 descent, width); |
| 133 m_currentTextFragment.glyphOverflow.top /= scalingFactor; | 138 m_currentTextFragment.glyphOverflow.top /= scalingFactor; |
| 134 m_currentTextFragment.glyphOverflow.left /= scalingFactor; | 139 m_currentTextFragment.glyphOverflow.left /= scalingFactor; |
| 135 m_currentTextFragment.glyphOverflow.right /= scalingFactor; | 140 m_currentTextFragment.glyphOverflow.right /= scalingFactor; |
| 136 m_currentTextFragment.glyphOverflow.bottom /= scalingFactor; | 141 m_currentTextFragment.glyphOverflow.bottom /= scalingFactor; |
| 137 | 142 |
| 138 float height = scaledFont.getFontMetrics().floatHeight(); | 143 float height = fontData->getFontMetrics().floatHeight(); |
| 139 m_currentTextFragment.height = height / scalingFactor; | 144 m_currentTextFragment.height = height / scalingFactor; |
| 140 m_currentTextFragment.width = width / scalingFactor; | 145 m_currentTextFragment.width = width / scalingFactor; |
| 141 } | 146 } |
| 142 | 147 |
| 143 void SVGTextLayoutEngine::recordTextFragment(SVGInlineTextBox* textBox) { | 148 void SVGTextLayoutEngine::recordTextFragment(SVGInlineTextBox* textBox) { |
| 144 ASSERT(!m_currentTextFragment.length); | 149 ASSERT(!m_currentTextFragment.length); |
| 145 | 150 |
| 146 // Figure out length of fragment. | 151 // Figure out length of fragment. |
| 147 m_currentTextFragment.length = m_visualMetricsIterator.characterOffset() - | 152 m_currentTextFragment.length = m_visualMetricsIterator.characterOffset() - |
| 148 m_currentTextFragment.characterOffset; | 153 m_currentTextFragment.characterOffset; |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 536 } |
| 532 | 537 |
| 533 if (!didStartTextFragment) | 538 if (!didStartTextFragment) |
| 534 return; | 539 return; |
| 535 | 540 |
| 536 // Close last open fragment, if needed. | 541 // Close last open fragment, if needed. |
| 537 recordTextFragment(textBox); | 542 recordTextFragment(textBox); |
| 538 } | 543 } |
| 539 | 544 |
| 540 } // namespace blink | 545 } // namespace blink |
| OLD | NEW |