| OLD | NEW |
| 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 Loading... |
| 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(WTF::wrapUnique(new ShapeResult::RunInfo(*run))); | 171 m_runs.push_back(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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } else { | 364 } else { |
| 365 for (size_t pos = 0; pos < m_runs.size(); ++pos) { | 365 for (size_t pos = 0; pos < m_runs.size(); ++pos) { |
| 366 if (m_runs.at(pos)->m_startIndex < run->m_startIndex) { | 366 if (m_runs.at(pos)->m_startIndex < run->m_startIndex) { |
| 367 m_runs.insert(pos, std::move(run)); | 367 m_runs.insert(pos, std::move(run)); |
| 368 break; | 368 break; |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 // If we didn't find an existing slot to place it, append. | 372 // If we didn't find an existing slot to place it, append. |
| 373 if (run) | 373 if (run) |
| 374 m_runs.append(std::move(run)); | 374 m_runs.push_back(std::move(run)); |
| 375 } | 375 } |
| 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(). |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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.push_back(std::move(run)); |
| 407 return result.release(); | 407 return result.release(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 } // namespace blink | 410 } // namespace blink |
| OLD | NEW |