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

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

Issue 2610253004: Migrate WTF::Vector::append() to ::push_back() [part 9 of N] (Closed)
Patch Set: rebase Created 3 years, 11 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) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * Copyright (C) 2006 Apple Computer Inc. 3 * Copyright (C) 2006 Apple Computer Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) 2008 Rob Buis <buis@kde.org> 5 * Copyright (C) 2008 Rob Buis <buis@kde.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const bool preserveWhiteSpace = styleRef().whiteSpace() == EWhiteSpace::kPre; 302 const bool preserveWhiteSpace = styleRef().whiteSpace() == EWhiteSpace::kPre;
303 const unsigned runLength = run.length(); 303 const unsigned runLength = run.length();
304 304
305 // TODO(pdr): Character-based iteration is ambiguous and error-prone. It 305 // TODO(pdr): Character-based iteration is ambiguous and error-prone. It
306 // should be unified under a single concept. See: https://crbug.com/593570 306 // should be unified under a single concept. See: https://crbug.com/593570
307 unsigned characterIndex = 0; 307 unsigned characterIndex = 0;
308 while (characterIndex < runLength) { 308 while (characterIndex < runLength) {
309 bool currentCharacterIsWhiteSpace = run[characterIndex] == ' '; 309 bool currentCharacterIsWhiteSpace = run[characterIndex] == ' ';
310 if (!preserveWhiteSpace && lastCharacterWasWhiteSpace && 310 if (!preserveWhiteSpace && lastCharacterWasWhiteSpace &&
311 currentCharacterIsWhiteSpace) { 311 currentCharacterIsWhiteSpace) {
312 m_metrics.append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics)); 312 m_metrics.push_back(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics));
313 characterIndex++; 313 characterIndex++;
314 continue; 314 continue;
315 } 315 }
316 316
317 unsigned length = isValidSurrogatePair(run, characterIndex) ? 2 : 1; 317 unsigned length = isValidSurrogatePair(run, characterIndex) ? 2 : 1;
318 float width = charRanges[characterIndex].width() / m_scalingFactor; 318 float width = charRanges[characterIndex].width() / m_scalingFactor;
319 319
320 m_metrics.append(SVGTextMetrics(length, width, cachedFontHeight)); 320 m_metrics.push_back(SVGTextMetrics(length, width, cachedFontHeight));
321 321
322 lastCharacterWasWhiteSpace = currentCharacterIsWhiteSpace; 322 lastCharacterWasWhiteSpace = currentCharacterIsWhiteSpace;
323 characterIndex += length; 323 characterIndex += length;
324 } 324 }
325 } 325 }
326 326
327 void LayoutSVGInlineText::updateMetricsList(bool& lastCharacterWasWhiteSpace) { 327 void LayoutSVGInlineText::updateMetricsList(bool& lastCharacterWasWhiteSpace) {
328 m_metrics.clear(); 328 m_metrics.clear();
329 329
330 if (!textLength()) 330 if (!textLength())
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 415 }
416 416
417 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { 417 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const {
418 RefPtr<StringImpl> result = LayoutText::originalText(); 418 RefPtr<StringImpl> result = LayoutText::originalText();
419 if (!result) 419 if (!result)
420 return nullptr; 420 return nullptr;
421 return normalizeWhitespace(result); 421 return normalizeWhitespace(result);
422 } 422 }
423 423
424 } // namespace blink 424 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698