| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 unsigned distributeIndex = rangeIndex + distribute; | 155 unsigned distributeIndex = rangeIndex + distribute; |
| 156 float newStartPosition = m_subrunRanges[distributeIndex - 1]
.end; | 156 float newStartPosition = m_subrunRanges[distributeIndex - 1]
.end; |
| 157 m_subrunRanges[distributeIndex].start = newStartPosition; | 157 m_subrunRanges[distributeIndex].start = newStartPosition; |
| 158 m_subrunRanges[distributeIndex].end = newStartPosition + new
Width; | 158 m_subrunRanges[distributeIndex].end = newStartPosition + new
Width; |
| 159 } | 159 } |
| 160 distributeCount = 0; | 160 distributeCount = 0; |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 // TODO(pdr): m_subrunRanges can be too short in the presence of invalid |
| 166 // unicode characters (see: crbug.com/595960). This is a temporary |
| 167 // workaround to ensure the returned index is valid for m_subrunRages. |
| 168 if (positionInRun >= m_subrunRanges.size()) |
| 169 return 0; |
| 170 |
| 165 return positionInRun; | 171 return positionInRun; |
| 166 } | 172 } |
| 167 | 173 |
| 168 SVGTextMetrics SVGTextMetricsCalculator::currentCharacterMetrics() | 174 SVGTextMetrics SVGTextMetricsCalculator::currentCharacterMetrics() |
| 169 { | 175 { |
| 170 unsigned currentSubrunPosition = updateSubrunRangesForCurrentPosition(); | 176 unsigned currentSubrunPosition = updateSubrunRangesForCurrentPosition(); |
| 171 unsigned length = currentCharacterStartsSurrogatePair() ? 2 : 1; | 177 unsigned length = currentCharacterStartsSurrogatePair() ? 2 : 1; |
| 172 float width = m_subrunRanges[currentSubrunPosition].width(); | 178 float width = m_subrunRanges[currentSubrunPosition].width(); |
| 173 return SVGTextMetrics(m_text, length, width); | 179 return SVGTextMetrics(m_text, length, width); |
| 174 } | 180 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 280 } |
| 275 | 281 |
| 276 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText* textR
oot, LayoutSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) | 282 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText* textR
oot, LayoutSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) |
| 277 { | 283 { |
| 278 ASSERT(textRoot); | 284 ASSERT(textRoot); |
| 279 MeasureTextData data(&allCharactersMap); | 285 MeasureTextData data(&allCharactersMap); |
| 280 walkTree(textRoot, stopAtLeaf, &data); | 286 walkTree(textRoot, stopAtLeaf, &data); |
| 281 } | 287 } |
| 282 | 288 |
| 283 } // namespace blink | 289 } // namespace blink |
| OLD | NEW |