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 12 matching lines...) Expand all Loading... | |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef CachingWordShaper_h | 26 #ifndef CachingWordShaper_h |
27 #define CachingWordShaper_h | 27 #define CachingWordShaper_h |
28 | 28 |
29 #include "platform/geometry/FloatRect.h" | 29 #include "platform/geometry/FloatRect.h" |
30 #include "platform/text/TextRun.h" | 30 #include "platform/text/TextRun.h" |
31 #include "wtf/Allocator.h" | 31 #include "wtf/Allocator.h" |
32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
33 #include "wtf/Vector.h" | |
34 #include <tuple> | |
33 | 35 |
34 namespace blink { | 36 namespace blink { |
35 | 37 |
36 struct CharacterRange; | 38 struct CharacterRange; |
37 class Font; | 39 class Font; |
38 class GlyphBuffer; | 40 class GlyphBuffer; |
41 class ShapeCache; | |
39 class SimpleFontData; | 42 class SimpleFontData; |
40 class ShapeCache; | |
41 struct GlyphData; | 43 struct GlyphData; |
42 | 44 |
43 class PLATFORM_EXPORT CachingWordShaper final { | 45 class PLATFORM_EXPORT CachingWordShaper final { |
44 STACK_ALLOCATED(); | 46 STACK_ALLOCATED(); |
45 WTF_MAKE_NONCOPYABLE(CachingWordShaper); | 47 WTF_MAKE_NONCOPYABLE(CachingWordShaper); |
46 | 48 |
47 public: | 49 public: |
48 CachingWordShaper(ShapeCache* cache) : m_shapeCache(cache) {} | 50 explicit CachingWordShaper(const Font&); |
eae
2017/02/27 23:24:59
Now that all production code uses the new Font& co
f(malita)
2017/02/28 03:27:47
Done.
eae
2017/02/28 03:31:19
Thank you!
| |
51 CachingWordShaper(const Font& font, ShapeCache* shapeCache) | |
52 : m_font(font), m_shapeCache(shapeCache) {} | |
49 ~CachingWordShaper() {} | 53 ~CachingWordShaper() {} |
50 | 54 |
51 float width(const Font*, | 55 float width(const TextRun&, |
52 const TextRun&, | |
53 HashSet<const SimpleFontData*>* fallbackFonts, | 56 HashSet<const SimpleFontData*>* fallbackFonts, |
54 FloatRect* glyphBounds); | 57 FloatRect* glyphBounds); |
55 int offsetForPosition(const Font*, | 58 int offsetForPosition(const TextRun&, |
56 const TextRun&, | |
57 float targetX, | 59 float targetX, |
58 bool includePartialGlyphs); | 60 bool includePartialGlyphs); |
59 float fillGlyphBuffer(const Font*, | 61 float fillGlyphBuffer(const TextRun&, |
60 const TextRun&, | |
61 HashSet<const SimpleFontData*>*, | |
62 GlyphBuffer*, | 62 GlyphBuffer*, |
63 unsigned from, | 63 unsigned from, |
64 unsigned to); | 64 unsigned to); |
65 float fillGlyphBufferForTextEmphasis(const Font*, | 65 float fillGlyphBufferForTextEmphasis(const TextRun&, |
66 const TextRun&, | |
67 const GlyphData* emphasisData, | 66 const GlyphData* emphasisData, |
68 GlyphBuffer*, | 67 GlyphBuffer*, |
69 unsigned from, | 68 unsigned from, |
70 unsigned to); | 69 unsigned to); |
71 CharacterRange getCharacterRange(const Font*, | 70 CharacterRange getCharacterRange(const TextRun&, |
72 const TextRun&, | |
73 unsigned from, | 71 unsigned from, |
74 unsigned to); | 72 unsigned to); |
75 Vector<CharacterRange> individualCharacterRanges(const Font*, const TextRun&); | 73 Vector<CharacterRange> individualCharacterRanges(const TextRun&); |
74 | |
75 Vector<std::tuple<SimpleFontData*, size_t>> | |
eae
2017/02/27 23:24:59
Please use a struct instead of a tuple here, as is
f(malita)
2017/02/28 03:27:47
Done.
| |
76 getRunFontData(const TextRun&) const; | |
eae
2017/02/27 23:24:59
nit: How about fontDataForRun(TextRun) or even jus
f(malita)
2017/02/28 03:27:47
Done (fontData).
| |
76 | 77 |
77 private: | 78 private: |
79 const Font& m_font; | |
78 ShapeCache* m_shapeCache; | 80 ShapeCache* m_shapeCache; |
79 }; | 81 }; |
80 | 82 |
81 } // namespace blink | 83 } // namespace blink |
82 | 84 |
83 #endif // CachingWordShaper_h | 85 #endif // CachingWordShaper_h |
OLD | NEW |