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

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

Issue 2400783002: Reformat comments in core/layout/svg (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 desiredTextLength = 0; 192 desiredTextLength = 0;
193 } 193 }
194 194
195 bool processTextLength = desiredTextLength > 0; 195 bool processTextLength = desiredTextLength > 0;
196 bool processTextAnchor = needsTextAnchorAdjustment(style); 196 bool processTextAnchor = needsTextAnchorAdjustment(style);
197 if (!processTextAnchor && !processTextLength) 197 if (!processTextAnchor && !processTextLength)
198 return; 198 return;
199 199
200 bool isVerticalText = !style.isHorizontalWritingMode(); 200 bool isVerticalText = !style.isHorizontalWritingMode();
201 201
202 // Calculate absolute length of whole text chunk (starting from text box 'star t', spanning 'length' text boxes). 202 // Calculate absolute length of whole text chunk (starting from text box
203 // 'start', spanning 'length' text boxes).
203 ChunkLengthAccumulator lengthAccumulator(isVerticalText); 204 ChunkLengthAccumulator lengthAccumulator(isVerticalText);
204 lengthAccumulator.processRange(boxStart, boxEnd); 205 lengthAccumulator.processRange(boxStart, boxEnd);
205 206
206 if (processTextLength) { 207 if (processTextLength) {
207 float chunkLength = lengthAccumulator.length(); 208 float chunkLength = lengthAccumulator.length();
208 if (lengthAdjust == SVGLengthAdjustSpacing) { 209 if (lengthAdjust == SVGLengthAdjustSpacing) {
209 float textLengthShift = 210 float textLengthShift =
210 (desiredTextLength - chunkLength) / lengthAccumulator.numCharacters(); 211 (desiredTextLength - chunkLength) / lengthAccumulator.numCharacters();
211 unsigned atCharacter = 0; 212 unsigned atCharacter = 0;
212 for (auto boxIter = boxStart; boxIter != boxEnd; ++boxIter) { 213 for (auto boxIter = boxStart; boxIter != boxEnd; ++boxIter) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 Vector<SVGTextFragment>& fragments) { 293 Vector<SVGTextFragment>& fragments) {
293 for (SVGTextFragment& fragment : fragments) { 294 for (SVGTextFragment& fragment : fragments) {
294 if (isVerticalText) 295 if (isVerticalText)
295 fragment.y += textAnchorShift; 296 fragment.y += textAnchorShift;
296 else 297 else
297 fragment.x += textAnchorShift; 298 fragment.x += textAnchorShift;
298 } 299 }
299 } 300 }
300 301
301 } // namespace blink 302 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698