| OLD | NEW |
| 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/CachingWordShapeIterator.h" | 5 #include "platform/fonts/shaping/CachingWordShapeIterator.h" |
| 6 | 6 |
| 7 #include "platform/fonts/shaping/HarfBuzzShaper.h" | 7 #include "platform/fonts/shaping/HarfBuzzShaper.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 PassRefPtr<const ShapeResult> CachingWordShapeIterator::shapeWordWithoutSpacing( | 11 PassRefPtr<const ShapeResult> CachingWordShapeIterator::shapeWordWithoutSpacing( |
| 12 const TextRun& wordRun, | 12 const TextRun& wordRun, |
| 13 const Font* font) { | 13 const Font* font) { |
| 14 ShapeCacheEntry* cacheEntry = m_shapeCache->add(wordRun, ShapeCacheEntry()); | 14 ShapeCacheEntry* cacheEntry = m_shapeCache->add(wordRun, ShapeCacheEntry()); |
| 15 if (cacheEntry && cacheEntry->m_shapeResult) | 15 if (cacheEntry && cacheEntry->m_shapeResult) |
| 16 return cacheEntry->m_shapeResult; | 16 return cacheEntry->m_shapeResult; |
| 17 | 17 |
| 18 HarfBuzzShaper shaper(font, wordRun); | 18 HarfBuzzShaper shaper(wordRun); |
| 19 RefPtr<const ShapeResult> shapeResult = shaper.shapeResult(); | 19 RefPtr<const ShapeResult> shapeResult = shaper.shapeResult(font); |
| 20 if (!shapeResult) | 20 if (!shapeResult) |
| 21 return nullptr; | 21 return nullptr; |
| 22 | 22 |
| 23 if (cacheEntry) | 23 if (cacheEntry) |
| 24 cacheEntry->m_shapeResult = shapeResult; | 24 cacheEntry->m_shapeResult = shapeResult; |
| 25 | 25 |
| 26 return shapeResult.release(); | 26 return shapeResult.release(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace blink | 29 } // namespace blink |
| OLD | NEW |