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

Side by Side Diff: ui/gfx/render_text_win.h

Issue 16867016: Windows implementation of multiline RenderText (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed GetMultilineTextSize Created 7 years, 3 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 // 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_WIN_H_ 5 #ifndef UI_GFX_RENDER_TEXT_WIN_H_
6 #define UI_GFX_RENDER_TEXT_WIN_H_ 6 #define UI_GFX_RENDER_TEXT_WIN_H_
7 7
8 #include <usp10.h> 8 #include <usp10.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE; 80 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE;
81 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; 81 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE;
82 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; 82 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE;
83 virtual bool IsCursorablePosition(size_t position) OVERRIDE; 83 virtual bool IsCursorablePosition(size_t position) OVERRIDE;
84 virtual void ResetLayout() OVERRIDE; 84 virtual void ResetLayout() OVERRIDE;
85 virtual void EnsureLayout() OVERRIDE; 85 virtual void EnsureLayout() OVERRIDE;
86 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; 86 virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
87 87
88 private: 88 private:
89 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); 89 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters);
90 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_MinWidth);
91 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth);
90 92
91 void ItemizeLogicalText(); 93 void ItemizeLogicalText();
92 void LayoutVisualText(); 94 void LayoutVisualText();
93 void LayoutTextRun(internal::TextRun* run); 95 void LayoutTextRun(internal::TextRun* run);
94 96
95 // Helper function that calls |ScriptShape()| on the run, which has logic to 97 // Helper function that calls |ScriptShape()| on the run, which has logic to
96 // handle E_OUTOFMEMORY return codes. 98 // handle E_OUTOFMEMORY return codes.
97 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font); 99 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font);
98 100
99 // Returns the number of characters in |run| that have missing glyphs. 101 // Returns the number of characters in |run| that have missing glyphs.
(...skipping 15 matching lines...) Expand all
115 117
116 // Cached map from font name to the last successful substitute font used. 118 // Cached map from font name to the last successful substitute font used.
117 // TODO(asvitkine): Move the caching logic to font_fallback_win.cc. 119 // TODO(asvitkine): Move the caching logic to font_fallback_win.cc.
118 static std::map<std::string, Font> successful_substitute_fonts_; 120 static std::map<std::string, Font> successful_substitute_fonts_;
119 121
120 SCRIPT_CONTROL script_control_; 122 SCRIPT_CONTROL script_control_;
121 SCRIPT_STATE script_state_; 123 SCRIPT_STATE script_state_;
122 124
123 ScopedVector<internal::TextRun> runs_; 125 ScopedVector<internal::TextRun> runs_;
124 Size string_size_; 126 Size string_size_;
127 Size multiline_string_size_;
msw 2013/09/06 23:47:45 Disambiguate these two sizes in a comment, what do
ckocagil 2013/09/11 14:59:49 Done.
125 128
126 // A common vertical baseline for all the text runs. This is computed as the 129 // A common vertical baseline for all the text runs. This is computed as the
127 // largest baseline over all the runs' fonts. 130 // largest baseline over all the runs' fonts.
128 int common_baseline_; 131 int common_baseline_;
129 132
130 scoped_ptr<int[]> visual_to_logical_; 133 scoped_ptr<int[]> visual_to_logical_;
131 scoped_ptr<int[]> logical_to_visual_; 134 scoped_ptr<int[]> logical_to_visual_;
132 135
133 bool needs_layout_; 136 bool needs_layout_;
134 137
135 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); 138 DISALLOW_COPY_AND_ASSIGN(RenderTextWin);
136 }; 139 };
137 140
138 } // namespace gfx 141 } // namespace gfx
139 142
140 #endif // UI_GFX_RENDER_TEXT_WIN_H_ 143 #endif // UI_GFX_RENDER_TEXT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698