| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 HashSet<const SimpleFontData*>* fallbackFonts, | 67 HashSet<const SimpleFontData*>* fallbackFonts, |
| 68 ShapeResultBuffer* resultsBuffer) { | 68 ShapeResultBuffer* resultsBuffer) { |
| 69 CachingWordShapeIterator iterator(shapeCache, run, font); | 69 CachingWordShapeIterator iterator(shapeCache, run, font); |
| 70 RefPtr<const ShapeResult> wordResult; | 70 RefPtr<const ShapeResult> wordResult; |
| 71 float totalWidth = 0; | 71 float totalWidth = 0; |
| 72 while (iterator.next(&wordResult)) { | 72 while (iterator.next(&wordResult)) { |
| 73 if (wordResult) { | 73 if (wordResult) { |
| 74 totalWidth += wordResult->width(); | 74 totalWidth += wordResult->width(); |
| 75 if (fallbackFonts) | 75 if (fallbackFonts) |
| 76 wordResult->fallbackFonts(fallbackFonts); | 76 wordResult->fallbackFonts(fallbackFonts); |
| 77 resultsBuffer->appendResult(wordResult.release()); | 77 resultsBuffer->appendResult(std::move(wordResult)); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 return totalWidth; | 80 return totalWidth; |
| 81 } | 81 } |
| 82 | 82 |
| 83 int CachingWordShaper::offsetForPosition(const Font* font, | 83 int CachingWordShaper::offsetForPosition(const Font* font, |
| 84 const TextRun& run, | 84 const TextRun& run, |
| 85 float targetX, | 85 float targetX, |
| 86 bool includePartialGlyphs) { | 86 bool includePartialGlyphs) { |
| 87 ShapeResultBuffer buffer; | 87 ShapeResultBuffer buffer; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 auto ranges = buffer.individualCharacterRanges(run.direction(), totalWidth); | 138 auto ranges = buffer.individualCharacterRanges(run.direction(), totalWidth); |
| 139 // The shaper can fail to return glyph metrics for all characters (see | 139 // The shaper can fail to return glyph metrics for all characters (see |
| 140 // crbug.com/613915 and crbug.com/615661) so add empty ranges to ensure all | 140 // crbug.com/613915 and crbug.com/615661) so add empty ranges to ensure all |
| 141 // characters have an associated range. | 141 // characters have an associated range. |
| 142 while (ranges.size() < static_cast<unsigned>(run.length())) | 142 while (ranges.size() < static_cast<unsigned>(run.length())) |
| 143 ranges.push_back(CharacterRange(0, 0)); | 143 ranges.push_back(CharacterRange(0, 0)); |
| 144 return ranges; | 144 return ranges; |
| 145 } | 145 } |
| 146 | 146 |
| 147 }; // namespace blink | 147 }; // namespace blink |
| OLD | NEW |