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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp

Issue 2870393002: Fix textLength position adjustment for the "adjust spacing" case (Closed)
Patch Set: Update 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/text/select-textLength-spacing-stretch-4-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
index 2aa34f70a4bf3c22f351e1a52572fffa320e0ee6..59387e98c321453416c465a0e61437c96abe0abf 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp
@@ -208,8 +208,11 @@ void SVGTextChunkBuilder::HandleTextChunk(BoxListConstIterator box_start,
if (process_text_length) {
float chunk_length = length_accumulator.length();
if (length_adjust == kSVGLengthAdjustSpacing) {
- float text_length_shift = (desired_text_length - chunk_length) /
- length_accumulator.NumCharacters();
fs 2017/05/10 16:06:10 When I had finished this I remembered/noticed that
+ float text_length_shift = 0;
+ if (length_accumulator.NumCharacters() > 1) {
+ text_length_shift = desired_text_length - chunk_length;
+ text_length_shift /= length_accumulator.NumCharacters() - 1;
+ }
unsigned at_character = 0;
for (auto box_iter = box_start; box_iter != box_end; ++box_iter) {
Vector<SVGTextFragment>& fragments = (*box_iter)->TextFragments();
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/text/select-textLength-spacing-stretch-4-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698