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

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

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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) 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ShapeResult::ShapeResult(const ShapeResult& other) 161 ShapeResult::ShapeResult(const ShapeResult& other)
162 : m_width(other.m_width), 162 : m_width(other.m_width),
163 m_glyphBoundingBox(other.m_glyphBoundingBox), 163 m_glyphBoundingBox(other.m_glyphBoundingBox),
164 m_primaryFont(other.m_primaryFont), 164 m_primaryFont(other.m_primaryFont),
165 m_numCharacters(other.m_numCharacters), 165 m_numCharacters(other.m_numCharacters),
166 m_numGlyphs(other.m_numGlyphs), 166 m_numGlyphs(other.m_numGlyphs),
167 m_direction(other.m_direction), 167 m_direction(other.m_direction),
168 m_hasVerticalOffsets(other.m_hasVerticalOffsets) { 168 m_hasVerticalOffsets(other.m_hasVerticalOffsets) {
169 m_runs.reserveCapacity(other.m_runs.size()); 169 m_runs.reserveCapacity(other.m_runs.size());
170 for (const auto& run : other.m_runs) 170 for (const auto& run : other.m_runs)
171 m_runs.append(wrapUnique(new ShapeResult::RunInfo(*run))); 171 m_runs.append(WTF::wrapUnique(new ShapeResult::RunInfo(*run)));
172 } 172 }
173 173
174 ShapeResult::~ShapeResult() {} 174 ShapeResult::~ShapeResult() {}
175 175
176 size_t ShapeResult::byteSize() const { 176 size_t ShapeResult::byteSize() const {
177 size_t selfByteSize = sizeof(this); 177 size_t selfByteSize = sizeof(this);
178 for (unsigned i = 0; i < m_runs.size(); ++i) { 178 for (unsigned i = 0; i < m_runs.size(); ++i) {
179 selfByteSize += m_runs[i]->byteSize(); 179 selfByteSize += m_runs[i]->byteSize();
180 } 180 }
181 return selfByteSize; 181 return selfByteSize;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 PassRefPtr<ShapeResult> ShapeResult::createForTabulationCharacters( 377 PassRefPtr<ShapeResult> ShapeResult::createForTabulationCharacters(
378 const Font* font, 378 const Font* font,
379 const TextRun& textRun, 379 const TextRun& textRun,
380 float positionOffset, 380 float positionOffset,
381 unsigned count) { 381 unsigned count) {
382 const SimpleFontData* fontData = font->primaryFont(); 382 const SimpleFontData* fontData = font->primaryFont();
383 // Tab characters are always LTR or RTL, not TTB, even when 383 // Tab characters are always LTR or RTL, not TTB, even when
384 // isVerticalAnyUpright(). 384 // isVerticalAnyUpright().
385 std::unique_ptr<ShapeResult::RunInfo> run = 385 std::unique_ptr<ShapeResult::RunInfo> run =
386 wrapUnique(new ShapeResult::RunInfo( 386 WTF::wrapUnique(new ShapeResult::RunInfo(
387 fontData, textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR, 387 fontData, textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR,
388 HB_SCRIPT_COMMON, 0, count, count)); 388 HB_SCRIPT_COMMON, 0, count, count));
389 float position = textRun.xPos() + positionOffset; 389 float position = textRun.xPos() + positionOffset;
390 float startPosition = position; 390 float startPosition = position;
391 for (unsigned i = 0; i < count; i++) { 391 for (unsigned i = 0; i < count; i++) {
392 float advance = font->tabWidth(fontData, textRun.getTabSize(), position); 392 float advance = font->tabWidth(fontData, textRun.getTabSize(), position);
393 run->m_glyphData[i].characterIndex = i; 393 run->m_glyphData[i].characterIndex = i;
394 run->setGlyphAndPositions(i, fontData->spaceGlyph(), advance, 0, 0); 394 run->setGlyphAndPositions(i, fontData->spaceGlyph(), advance, 0, 0);
395 position += advance; 395 position += advance;
396 } 396 }
397 run->m_width = position - startPosition; 397 run->m_width = position - startPosition;
398 398
399 RefPtr<ShapeResult> result = 399 RefPtr<ShapeResult> result =
400 ShapeResult::create(font, count, textRun.direction()); 400 ShapeResult::create(font, count, textRun.direction());
401 result->m_width = run->m_width; 401 result->m_width = run->m_width;
402 result->m_numGlyphs = count; 402 result->m_numGlyphs = count;
403 DCHECK_EQ(result->m_numGlyphs, count); // no overflow 403 DCHECK_EQ(result->m_numGlyphs, count); // no overflow
404 result->m_hasVerticalOffsets = 404 result->m_hasVerticalOffsets =
405 fontData->platformData().isVerticalAnyUpright(); 405 fontData->platformData().isVerticalAnyUpright();
406 result->m_runs.append(std::move(run)); 406 result->m_runs.append(std::move(run));
407 return result.release(); 407 return result.release();
408 } 408 }
409 409
410 } // namespace blink 410 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698