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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 text_content_element->textLength()->CurrentValue()->Value( | 199 text_content_element->textLength()->CurrentValue()->Value( |
200 length_context); | 200 length_context); |
201 else | 201 else |
202 desired_text_length = 0; | 202 desired_text_length = 0; |
203 } | 203 } |
204 | 204 |
205 if (!desired_text_length) | 205 if (!desired_text_length) |
206 return; | 206 return; |
207 | 207 |
208 float total_length = text_path_chunk_layout_builder.TotalLength(); | 208 float total_length = text_path_chunk_layout_builder.TotalLength(); |
209 if (length_adjust == kSVGLengthAdjustSpacing) | 209 if (length_adjust == kSVGLengthAdjustSpacing) { |
210 text_path_spacing_ = (desired_text_length - total_length) / | 210 text_path_spacing_ = 0; |
211 text_path_chunk_layout_builder.TotalCharacters(); | 211 if (text_path_chunk_layout_builder.TotalCharacters() > 1) { |
212 else | 212 text_path_spacing_ = desired_text_length - total_length; |
| 213 text_path_spacing_ /= |
| 214 text_path_chunk_layout_builder.TotalCharacters() - 1; |
| 215 } |
| 216 } else { |
213 text_path_scaling_ = desired_text_length / total_length; | 217 text_path_scaling_ = desired_text_length / total_length; |
| 218 } |
214 } | 219 } |
215 | 220 |
216 void SVGTextLayoutEngine::EndTextPathLayout() { | 221 void SVGTextLayoutEngine::EndTextPathLayout() { |
217 in_path_layout_ = false; | 222 in_path_layout_ = false; |
218 text_path_ = nullptr; | 223 text_path_ = nullptr; |
219 text_path_start_offset_ = 0; | 224 text_path_start_offset_ = 0; |
220 text_path_current_offset_ = 0; | 225 text_path_current_offset_ = 0; |
221 text_path_spacing_ = 0; | 226 text_path_spacing_ = 0; |
222 text_path_scaling_ = 1; | 227 text_path_scaling_ = 1; |
223 } | 228 } |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } | 547 } |
543 | 548 |
544 if (!did_start_text_fragment) | 549 if (!did_start_text_fragment) |
545 return; | 550 return; |
546 | 551 |
547 // Close last open fragment, if needed. | 552 // Close last open fragment, if needed. |
548 RecordTextFragment(text_box); | 553 RecordTextFragment(text_box); |
549 } | 554 } |
550 | 555 |
551 } // namespace blink | 556 } // namespace blink |
OLD | NEW |