Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp

Issue 2868413003: Fix textPath textLength position adjustment for the spacing case (Closed)
Patch Set: Updated baselines Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/svg/batik/text/textOnPathSpaces-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/svg/batik/text/textOnPathSpaces-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698