OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebFontImpl_h | 31 #ifndef WebFontImpl_h |
32 #define WebFontImpl_h | 32 #define WebFontImpl_h |
33 | 33 |
34 #include "platform/fonts/Font.h" | 34 #include "platform/fonts/Font.h" |
35 #include "platform/graphics/paint/DisplayItemClient.h" | 35 #include "platform/graphics/paint/DisplayItemClient.h" |
36 #include "public/web/WebFont.h" | 36 #include "public/web/WebFont.h" |
| 37 #include "wtf/FastAllocBase.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 class FontDescription; | 41 class FontDescription; |
41 | 42 |
42 class WebFontImpl final : public WebFont { | 43 class WebFontImpl final : public WebFont { |
| 44 WTF_MAKE_FAST_ALLOCATED(WebFontImpl); |
43 public: | 45 public: |
44 explicit WebFontImpl(const FontDescription&); | 46 explicit WebFontImpl(const FontDescription&); |
45 | 47 |
46 WebFontDescription fontDescription() const override; | 48 WebFontDescription fontDescription() const override; |
47 | 49 |
48 int ascent() const override; | 50 int ascent() const override; |
49 int descent() const override; | 51 int descent() const override; |
50 int height() const override; | 52 int height() const override; |
51 int lineSpacing() const override; | 53 int lineSpacing() const override; |
52 float xHeight() const override; | 54 float xHeight() const override; |
53 | 55 |
54 void drawText(WebCanvas*, const WebTextRun&, const WebFloatPoint& leftBaseli
ne, WebColor, | 56 void drawText(WebCanvas*, const WebTextRun&, const WebFloatPoint& leftBaseli
ne, WebColor, |
55 const WebRect& clip) const override; | 57 const WebRect& clip) const override; |
56 | 58 |
57 int calculateWidth(const WebTextRun&) const override; | 59 int calculateWidth(const WebTextRun&) const override; |
58 int offsetForPosition(const WebTextRun&, float position) const override; | 60 int offsetForPosition(const WebTextRun&, float position) const override; |
59 WebFloatRect selectionRectForText(const WebTextRun&, const WebFloatPoint& le
ftBaseline, | 61 WebFloatRect selectionRectForText(const WebTextRun&, const WebFloatPoint& le
ftBaseline, |
60 int height, int from = 0, int to = -1) const override; | 62 int height, int from = 0, int to = -1) const override; |
61 | 63 |
62 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } | 64 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } |
63 String debugName() const { return "WebFontImpl"; } | 65 String debugName() const { return "WebFontImpl"; } |
64 | 66 |
65 private: | 67 private: |
66 Font m_font; | 68 Font m_font; |
67 }; | 69 }; |
68 | 70 |
69 } // namespace blink | 71 } // namespace blink |
70 | 72 |
71 #endif | 73 #endif |
OLD | NEW |