Chromium Code Reviews| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 void SVGTextLayoutEngine::beginTextPathLayout(SVGInlineFlowBox* flowBox) | 165 void SVGTextLayoutEngine::beginTextPathLayout(SVGInlineFlowBox* flowBox) |
| 166 { | 166 { |
| 167 // Build text chunks for all <textPath> children, using the line layout algo rithm. | 167 // Build text chunks for all <textPath> children, using the line layout algo rithm. |
| 168 // This is needeed as text-anchor is just an additional startOffset for text paths. | 168 // This is needeed as text-anchor is just an additional startOffset for text paths. |
| 169 SVGTextLayoutEngine lineLayout(m_layoutAttributes); | 169 SVGTextLayoutEngine lineLayout(m_layoutAttributes); |
| 170 lineLayout.m_textLengthSpacingInEffect = m_textLengthSpacingInEffect; | 170 lineLayout.m_textLengthSpacingInEffect = m_textLengthSpacingInEffect; |
| 171 lineLayout.layoutCharactersInTextBoxes(flowBox); | 171 lineLayout.layoutCharactersInTextBoxes(flowBox); |
| 172 | 172 |
| 173 m_inPathLayout = true; | 173 m_inPathLayout = true; |
| 174 LayoutSVGTextPath* textPath = &toLayoutSVGTextPath(flowBox->layoutObject()); | 174 LayoutSVGTextPath* textPath = &toLayoutSVGTextPath(flowBox->layoutObject()); |
| 175 | |
| 176 Path path = textPath->layoutPath(); | 175 Path path = textPath->layoutPath(); |
| 177 if (path.isEmpty()) | 176 if (path.isEmpty()) |
| 178 return; | 177 return; |
| 179 m_textPathCalculator = new Path::PositionCalculator(path); | 178 m_textPathCalculator = new Path::PositionCalculator(path); |
| 180 m_textPathStartOffset = textPath->startOffset(); | 179 m_textPathStartOffset = textPath->startOffset(); |
| 181 m_textPathLength = path.length(); | 180 m_textPathLength = path.length(); |
| 182 if (m_textPathStartOffset > 0 && m_textPathStartOffset <= 1) | 181 if (textPath->isPercentageForStartOffset() |
|
fs
2016/01/18 12:57:49
I'd suggest that you instead pass m_textPathLength
| |
| 182 && m_textPathStartOffset > 0 && m_textPathStartOffset <= 1) | |
| 183 m_textPathStartOffset *= m_textPathLength; | 183 m_textPathStartOffset *= m_textPathLength; |
| 184 | 184 |
| 185 SVGTextPathChunkBuilder textPathChunkLayoutBuilder; | 185 SVGTextPathChunkBuilder textPathChunkLayoutBuilder; |
| 186 textPathChunkLayoutBuilder.processTextChunks(lineLayout.m_lineLayoutBoxes); | 186 textPathChunkLayoutBuilder.processTextChunks(lineLayout.m_lineLayoutBoxes); |
| 187 | 187 |
| 188 m_textPathStartOffset += textPathChunkLayoutBuilder.totalTextAnchorShift(); | 188 m_textPathStartOffset += textPathChunkLayoutBuilder.totalTextAnchorShift(); |
| 189 m_textPathCurrentOffset = m_textPathStartOffset; | 189 m_textPathCurrentOffset = m_textPathStartOffset; |
| 190 | 190 |
| 191 // Eventually handle textLength adjustments. | 191 // Eventually handle textLength adjustments. |
| 192 SVGLengthAdjustType lengthAdjust = SVGLengthAdjustUnknown; | 192 SVGLengthAdjustType lengthAdjust = SVGLengthAdjustUnknown; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 } | 552 } |
| 553 | 553 |
| 554 if (!didStartTextFragment) | 554 if (!didStartTextFragment) |
| 555 return; | 555 return; |
| 556 | 556 |
| 557 // Close last open fragment, if needed. | 557 // Close last open fragment, if needed. |
| 558 recordTextFragment(textBox); | 558 recordTextFragment(textBox); |
| 559 } | 559 } |
| 560 | 560 |
| 561 } | 561 } |
| OLD | NEW |