| 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 28 matching lines...) Expand all Loading... |
| 39 class CachingWordShapeIterator final { | 39 class CachingWordShapeIterator final { |
| 40 STACK_ALLOCATED(); | 40 STACK_ALLOCATED(); |
| 41 WTF_MAKE_NONCOPYABLE(CachingWordShapeIterator); | 41 WTF_MAKE_NONCOPYABLE(CachingWordShapeIterator); |
| 42 public: | 42 public: |
| 43 CachingWordShapeIterator(ShapeCache* cache, const TextRun& run, | 43 CachingWordShapeIterator(ShapeCache* cache, const TextRun& run, |
| 44 const Font* font) | 44 const Font* font) |
| 45 : m_shapeCache(cache), m_textRun(run), m_font(font) | 45 : m_shapeCache(cache), m_textRun(run), m_font(font) |
| 46 , m_widthSoFar(0), m_startIndex(0) | 46 , m_widthSoFar(0), m_startIndex(0) |
| 47 { | 47 { |
| 48 ASSERT(font); | 48 ASSERT(font); |
| 49 const FontDescription& fontDescription = font->fontDescription(); | 49 const FontDescription& fontDescription = font->getFontDescription(); |
| 50 | 50 |
| 51 // Word and letter spacing can change the width of a word, as can tabs | 51 // Word and letter spacing can change the width of a word, as can tabs |
| 52 // as we segment solely based on on space characters. | 52 // as we segment solely based on on space characters. |
| 53 // If expansion is used (for justified text) the spacing between words | 53 // If expansion is used (for justified text) the spacing between words |
| 54 // change and thus we need to shape the entire run. | 54 // change and thus we need to shape the entire run. |
| 55 m_wordResultCachable = !fontDescription.wordSpacing() | 55 m_wordResultCachable = !fontDescription.wordSpacing() |
| 56 && !fontDescription.letterSpacing() | 56 && !fontDescription.letterSpacing() |
| 57 && m_textRun.expansion() == 0.0f; | 57 && m_textRun.expansion() == 0.0f; |
| 58 | 58 |
| 59 // Shaping word by word is faster as each word is cached. If we cannot | 59 // Shaping word by word is faster as each word is cached. If we cannot |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 const Font* m_font; | 219 const Font* m_font; |
| 220 float m_widthSoFar; // Used only when allowTabs() | 220 float m_widthSoFar; // Used only when allowTabs() |
| 221 unsigned m_startIndex : 30; | 221 unsigned m_startIndex : 30; |
| 222 unsigned m_wordResultCachable : 1; | 222 unsigned m_wordResultCachable : 1; |
| 223 unsigned m_shapeByWord : 1; | 223 unsigned m_shapeByWord : 1; |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 } // namespace blink | 226 } // namespace blink |
| 227 | 227 |
| 228 #endif // CachingWordShapeIterator_h | 228 #endif // CachingWordShapeIterator_h |
| OLD | NEW |