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

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

Issue 2018253002: Change TextRun's length() and charactersLength() to return an unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove one static_cast added in r396668 Created 4 years, 6 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 ASSERT(!glyphBuffer->hasVerticalOffsets()); 199 ASSERT(!glyphBuffer->hasVerticalOffsets());
200 200
201 return advance; 201 return advance;
202 } 202 }
203 203
204 float ShapeResultBuffer::fillGlyphBuffer(GlyphBuffer* glyphBuffer, const TextRun & textRun, 204 float ShapeResultBuffer::fillGlyphBuffer(GlyphBuffer* glyphBuffer, const TextRun & textRun,
205 unsigned from, unsigned to) const 205 unsigned from, unsigned to) const
206 { 206 {
207 // Fast path: full run with no vertical offsets 207 // Fast path: full run with no vertical offsets
208 if (!from && to == static_cast<unsigned>(textRun.length()) && !hasVerticalOf fsets()) 208 if (!from && to == textRun.length() && !hasVerticalOffsets())
209 return fillFastHorizontalGlyphBuffer(glyphBuffer, textRun.direction()); 209 return fillFastHorizontalGlyphBuffer(glyphBuffer, textRun.direction());
210 210
211 float advance = 0; 211 float advance = 0;
212 212
213 if (textRun.rtl()) { 213 if (textRun.rtl()) {
214 unsigned wordOffset = textRun.length(); 214 unsigned wordOffset = textRun.length();
215 for (unsigned j = 0; j < m_results.size(); j++) { 215 for (unsigned j = 0; j < m_results.size(); j++) {
216 unsigned resolvedIndex = m_results.size() - 1 - j; 216 unsigned resolvedIndex = m_results.size() - 1 - j;
217 const RefPtr<const ShapeResult>& wordResult = m_results[resolvedInde x]; 217 const RefPtr<const ShapeResult>& wordResult = m_results[resolvedInde x];
218 for (unsigned i = 0; i < wordResult->m_runs.size(); i++) { 218 for (unsigned i = 0; i < wordResult->m_runs.size(); i++) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 totalOffset += offsetForWord; 405 totalOffset += offsetForWord;
406 if (targetX >= 0 && targetX <= wordResult->width()) 406 if (targetX >= 0 && targetX <= wordResult->width())
407 return totalOffset; 407 return totalOffset;
408 targetX -= wordResult->width(); 408 targetX -= wordResult->width();
409 } 409 }
410 } 410 }
411 return totalOffset; 411 return totalOffset;
412 } 412 }
413 413
414 } // namespace blink 414 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698