OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_GFX_RENDER_TEXT_MAC_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_MAC_H_ |
6 #define UI_GFX_RENDER_TEXT_MAC_H_ | 6 #define UI_GFX_RENDER_TEXT_MAC_H_ |
7 | 7 |
8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/gtest_prod_util.h" | |
16 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
17 #include "base/macros.h" | 16 #include "base/macros.h" |
18 #include "ui/gfx/gfx_export.h" | 17 #include "ui/gfx/gfx_export.h" |
19 #include "ui/gfx/render_text.h" | 18 #include "ui/gfx/render_text.h" |
20 | 19 |
21 namespace gfx { | 20 namespace gfx { |
22 | 21 |
23 // RenderTextMac is the Mac implementation of RenderText that uses CoreText for | 22 // RenderTextMac is the Mac implementation of RenderText that uses CoreText for |
24 // layout and Skia for drawing. | 23 // layout and Skia for drawing. |
25 // | 24 // |
(...skipping 27 matching lines...) Expand all Loading... |
53 size_t TextIndexToDisplayIndex(size_t index) override; | 52 size_t TextIndexToDisplayIndex(size_t index) override; |
54 size_t DisplayIndexToTextIndex(size_t index) override; | 53 size_t DisplayIndexToTextIndex(size_t index) override; |
55 bool IsValidCursorIndex(size_t index) override; | 54 bool IsValidCursorIndex(size_t index) override; |
56 void OnLayoutTextAttributeChanged(bool text_changed) override; | 55 void OnLayoutTextAttributeChanged(bool text_changed) override; |
57 void OnDisplayTextAttributeChanged() override; | 56 void OnDisplayTextAttributeChanged() override; |
58 void OnTextColorChanged() override; | 57 void OnTextColorChanged() override; |
59 void EnsureLayout() override; | 58 void EnsureLayout() override; |
60 void DrawVisualText(internal::SkiaTextRenderer* renderer) override; | 59 void DrawVisualText(internal::SkiaTextRenderer* renderer) override; |
61 | 60 |
62 private: | 61 private: |
63 FRIEND_TEST_ALL_PREFIXES(RenderTextMacTest, Mac_ElidedText); | 62 friend class RenderTextMacTest; |
64 | 63 |
65 struct TextRun { | 64 struct TextRun { |
66 CTRunRef ct_run; | 65 CTRunRef ct_run; |
67 SkPoint origin; | 66 SkPoint origin; |
68 std::vector<uint16_t> glyphs; | 67 std::vector<uint16_t> glyphs; |
69 std::vector<SkPoint> glyph_positions; | 68 std::vector<SkPoint> glyph_positions; |
70 SkScalar width; | 69 SkScalar width; |
71 base::ScopedCFTypeRef<CTFontRef> ct_font; | 70 base::ScopedCFTypeRef<CTFontRef> ct_font; |
72 sk_sp<SkTypeface> typeface; | 71 sk_sp<SkTypeface> typeface; |
73 SkColor foreground; | 72 SkColor foreground; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 127 |
129 // Indicates that |runs_| are valid, set by |ComputeRuns()|. | 128 // Indicates that |runs_| are valid, set by |ComputeRuns()|. |
130 bool runs_valid_; | 129 bool runs_valid_; |
131 | 130 |
132 DISALLOW_COPY_AND_ASSIGN(RenderTextMac); | 131 DISALLOW_COPY_AND_ASSIGN(RenderTextMac); |
133 }; | 132 }; |
134 | 133 |
135 } // namespace gfx | 134 } // namespace gfx |
136 | 135 |
137 #endif // UI_GFX_RENDER_TEXT_MAC_H_ | 136 #endif // UI_GFX_RENDER_TEXT_MAC_H_ |
OLD | NEW |