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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/fonts/shaping/ShapeResultBuffer.h" 5 #include "platform/fonts/shaping/ShapeResultBuffer.h"
6 6
7 #include "platform/fonts/CharacterRange.h" 7 #include "platform/fonts/CharacterRange.h"
8 #include "platform/fonts/GlyphBuffer.h" 8 #include "platform/fonts/GlyphBuffer.h"
9 #include "platform/fonts/SimpleFontData.h" 9 #include "platform/fonts/SimpleFontData.h"
10 #include "platform/fonts/shaping/ShapeResultInlineHeaders.h" 10 #include "platform/fonts/shaping/ShapeResultInlineHeaders.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 characterWidths[glyph.characterIndex] += glyph.advance; 408 characterWidths[glyph.characterIndex] += glyph.advance;
409 409
410 for (unsigned characterIndex = 0; characterIndex < runInfo.m_numCharacters; 410 for (unsigned characterIndex = 0; characterIndex < runInfo.m_numCharacters;
411 characterIndex++) { 411 characterIndex++) {
412 float start = offset; 412 float start = offset;
413 offset += characterWidths[characterIndex]; 413 offset += characterWidths[characterIndex];
414 float end = offset; 414 float end = offset;
415 415
416 // To match getCharacterRange we flip ranges to ensure start <= end. 416 // To match getCharacterRange we flip ranges to ensure start <= end.
417 if (end < start) 417 if (end < start)
418 ranges.append(CharacterRange(end, start)); 418 ranges.push_back(CharacterRange(end, start));
419 else 419 else
420 ranges.append(CharacterRange(start, end)); 420 ranges.push_back(CharacterRange(start, end));
421 } 421 }
422 } 422 }
423 423
424 Vector<CharacterRange> ShapeResultBuffer::individualCharacterRanges( 424 Vector<CharacterRange> ShapeResultBuffer::individualCharacterRanges(
425 TextDirection direction, 425 TextDirection direction,
426 float totalWidth) const { 426 float totalWidth) const {
427 Vector<CharacterRange> ranges; 427 Vector<CharacterRange> ranges;
428 float currentX = direction == TextDirection::Rtl ? totalWidth : 0; 428 float currentX = direction == TextDirection::Rtl ? totalWidth : 0;
429 for (const RefPtr<const ShapeResult> result : m_results) { 429 for (const RefPtr<const ShapeResult> result : m_results) {
430 if (direction == TextDirection::Rtl) 430 if (direction == TextDirection::Rtl)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 totalOffset += offsetForWord; 471 totalOffset += offsetForWord;
472 if (targetX >= 0 && targetX <= wordResult->width()) 472 if (targetX >= 0 && targetX <= wordResult->width())
473 return totalOffset; 473 return totalOffset;
474 targetX -= wordResult->width(); 474 targetX -= wordResult->width();
475 } 475 }
476 } 476 }
477 return totalOffset; 477 return totalOffset;
478 } 478 }
479 479
480 } // namespace blink 480 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698