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

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: fit whole runs, remove single-line stuff Created 7 years, 5 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } // namespace internal 60 } // namespace internal
61 61
62 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. 62 // RenderTextWin is the Windows implementation of RenderText using Uniscribe.
63 class RenderTextWin : public RenderText { 63 class RenderTextWin : public RenderText {
64 public: 64 public:
65 RenderTextWin(); 65 RenderTextWin();
66 virtual ~RenderTextWin(); 66 virtual ~RenderTextWin();
67 67
68 // Overridden from RenderText: 68 // Overridden from RenderText:
69 virtual Size GetStringSize() OVERRIDE; 69 virtual Size GetStringSize() OVERRIDE;
70 virtual Size GetMultilineTextSize() OVERRIDE;
70 virtual int GetBaseline() OVERRIDE; 71 virtual int GetBaseline() OVERRIDE;
71 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; 72 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE;
72 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; 73 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE;
73 74
74 protected: 75 protected:
75 // Overridden from RenderText: 76 // Overridden from RenderText:
76 virtual SelectionModel AdjacentCharSelectionModel( 77 virtual SelectionModel AdjacentCharSelectionModel(
77 const SelectionModel& selection, 78 const SelectionModel& selection,
78 VisualCursorDirection direction) OVERRIDE; 79 VisualCursorDirection direction) OVERRIDE;
79 virtual SelectionModel AdjacentWordSelectionModel( 80 virtual SelectionModel AdjacentWordSelectionModel(
80 const SelectionModel& selection, 81 const SelectionModel& selection,
81 VisualCursorDirection direction) OVERRIDE; 82 VisualCursorDirection direction) OVERRIDE;
82 virtual void SetSelectionModel(const SelectionModel& model) OVERRIDE; 83 virtual void SetSelectionModel(const SelectionModel& model) OVERRIDE;
83 virtual ui::Range GetGlyphBounds(size_t index) OVERRIDE; 84 virtual ui::Range GetGlyphBounds(size_t index) OVERRIDE;
84 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE; 85 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE;
85 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; 86 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE;
86 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; 87 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE;
87 virtual bool IsCursorablePosition(size_t position) OVERRIDE; 88 virtual bool IsCursorablePosition(size_t position) OVERRIDE;
88 virtual void ResetLayout() OVERRIDE; 89 virtual void ResetLayout() OVERRIDE;
89 virtual void EnsureLayout() OVERRIDE; 90 virtual void EnsureLayout() OVERRIDE;
90 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; 91 virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
91 92
92 private: 93 private:
93 void ItemizeLogicalText(); 94 void ItemizeLogicalText();
94 void LayoutVisualText(); 95 void LayoutVisualText();
95 void LayoutTextRun(internal::TextRun* run); 96 void LayoutTextRun(internal::TextRun* run);
97 void ComputeLines();
96 98
97 // Helper function that calls |ScriptShape()| on the run, which has logic to 99 // Helper function that calls |ScriptShape()| on the run, which has logic to
98 // handle E_OUTOFMEMORY return codes. 100 // handle E_OUTOFMEMORY return codes.
99 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font); 101 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font);
100 102
101 // Returns the number of characters in |run| that have missing glyphs. 103 // Returns the number of characters in |run| that have missing glyphs.
102 int CountCharsWithMissingGlyphs(internal::TextRun* run) const; 104 int CountCharsWithMissingGlyphs(internal::TextRun* run) const;
103 105
104 // Return the run index that contains the argument; or the length of the 106 // Return the run index that contains the argument; or the length of the
105 // |runs_| vector if argument exceeds the text length or width. 107 // |runs_| vector if argument exceeds the text length or width.
(...skipping 27 matching lines...) Expand all
133 scoped_ptr<int[]> logical_to_visual_; 135 scoped_ptr<int[]> logical_to_visual_;
134 136
135 bool needs_layout_; 137 bool needs_layout_;
136 138
137 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); 139 DISALLOW_COPY_AND_ASSIGN(RenderTextWin);
138 }; 140 };
139 141
140 } // namespace gfx 142 } // namespace gfx
141 143
142 #endif // UI_GFX_RENDER_TEXT_WIN_H_ 144 #endif // UI_GFX_RENDER_TEXT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698