Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h

Issue 2718043003: Refactor InspectorCSSAgent to avoid an intermediate GlyphBuffer (Closed)
Patch Set: cleanup Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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/fonts/shaping/ShapeResultBuffer.h"
29 #include "platform/geometry/FloatRect.h" 30 #include "platform/geometry/FloatRect.h"
30 #include "platform/text/TextRun.h" 31 #include "platform/text/TextRun.h"
31 #include "wtf/Allocator.h" 32 #include "wtf/Allocator.h"
32 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
34 #include "wtf/Vector.h"
35 #include <tuple>
33 36
34 namespace blink { 37 namespace blink {
35 38
36 struct CharacterRange; 39 struct CharacterRange;
37 class Font; 40 class Font;
38 class GlyphBuffer; 41 class GlyphBuffer;
42 class ShapeCache;
39 class SimpleFontData; 43 class SimpleFontData;
40 class ShapeCache;
41 struct GlyphData; 44 struct GlyphData;
42 45
43 class PLATFORM_EXPORT CachingWordShaper final { 46 class PLATFORM_EXPORT CachingWordShaper final {
44 STACK_ALLOCATED(); 47 STACK_ALLOCATED();
45 WTF_MAKE_NONCOPYABLE(CachingWordShaper); 48 WTF_MAKE_NONCOPYABLE(CachingWordShaper);
46 49
47 public: 50 public:
48 CachingWordShaper(ShapeCache* cache) : m_shapeCache(cache) {} 51 explicit CachingWordShaper(const Font& font) : m_font(font) {}
49 ~CachingWordShaper() {} 52 ~CachingWordShaper() {}
50 53
51 float width(const Font*, 54 float width(const TextRun&,
52 const TextRun&,
53 HashSet<const SimpleFontData*>* fallbackFonts, 55 HashSet<const SimpleFontData*>* fallbackFonts,
54 FloatRect* glyphBounds); 56 FloatRect* glyphBounds);
55 int offsetForPosition(const Font*, 57 int offsetForPosition(const TextRun&,
56 const TextRun&,
57 float targetX, 58 float targetX,
58 bool includePartialGlyphs); 59 bool includePartialGlyphs);
59 float fillGlyphBuffer(const Font*, 60 float fillGlyphBuffer(const TextRun&,
60 const TextRun&,
61 HashSet<const SimpleFontData*>*,
62 GlyphBuffer*, 61 GlyphBuffer*,
63 unsigned from, 62 unsigned from,
64 unsigned to); 63 unsigned to);
65 float fillGlyphBufferForTextEmphasis(const Font*, 64 float fillGlyphBufferForTextEmphasis(const TextRun&,
66 const TextRun&,
67 const GlyphData* emphasisData, 65 const GlyphData* emphasisData,
68 GlyphBuffer*, 66 GlyphBuffer*,
69 unsigned from, 67 unsigned from,
70 unsigned to); 68 unsigned to);
71 CharacterRange getCharacterRange(const Font*, 69 CharacterRange getCharacterRange(const TextRun&,
72 const TextRun&,
73 unsigned from, 70 unsigned from,
74 unsigned to); 71 unsigned to);
75 Vector<CharacterRange> individualCharacterRanges(const Font*, const TextRun&); 72 Vector<CharacterRange> individualCharacterRanges(const TextRun&);
73
74 Vector<ShapeResultBuffer::RunFontData> runFontData(const TextRun&) const;
76 75
77 private: 76 private:
78 ShapeCache* m_shapeCache; 77 ShapeCache* shapeCache() const;
78
79 const Font& m_font;
79 }; 80 };
80 81
81 } // namespace blink 82 } // namespace blink
82 83
83 #endif // CachingWordShaper_h 84 #endif // CachingWordShaper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698