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

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: fix ComputeLines and rects 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 scoped_ptr<int[]> advance_widths; 51 scoped_ptr<int[]> advance_widths;
52 scoped_ptr<GOFFSET[]> offsets; 52 scoped_ptr<GOFFSET[]> offsets;
53 ABC abc_widths; 53 ABC abc_widths;
54 SCRIPT_CACHE script_cache; 54 SCRIPT_CACHE script_cache;
55 55
56 private: 56 private:
57 DISALLOW_COPY_AND_ASSIGN(TextRun); 57 DISALLOW_COPY_AND_ASSIGN(TextRun);
58 }; 58 };
59 59
60 struct LineSegmentWin : LineSegment {
msw 2013/07/10 04:01:56 I think this can be declared in the .cc file.
ckocagil 2013/07/13 16:05:10 Done.
61 TextRun* run;
62 };
63
60 } // namespace internal 64 } // namespace internal
61 65
62 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. 66 // RenderTextWin is the Windows implementation of RenderText using Uniscribe.
63 class RenderTextWin : public RenderText { 67 class RenderTextWin : public RenderText {
64 public: 68 public:
65 RenderTextWin(); 69 RenderTextWin();
66 virtual ~RenderTextWin(); 70 virtual ~RenderTextWin();
67 71
68 // Overridden from RenderText: 72 // Overridden from RenderText:
69 virtual Size GetStringSize() OVERRIDE; 73 virtual Size GetStringSize() OVERRIDE;
74 virtual Size GetMultilineTextSize() OVERRIDE;
70 virtual int GetBaseline() OVERRIDE; 75 virtual int GetBaseline() OVERRIDE;
71 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; 76 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE;
72 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; 77 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE;
73 78
74 protected: 79 protected:
75 // Overridden from RenderText: 80 // Overridden from RenderText:
76 virtual SelectionModel AdjacentCharSelectionModel( 81 virtual SelectionModel AdjacentCharSelectionModel(
77 const SelectionModel& selection, 82 const SelectionModel& selection,
78 VisualCursorDirection direction) OVERRIDE; 83 VisualCursorDirection direction) OVERRIDE;
79 virtual SelectionModel AdjacentWordSelectionModel( 84 virtual SelectionModel AdjacentWordSelectionModel(
80 const SelectionModel& selection, 85 const SelectionModel& selection,
81 VisualCursorDirection direction) OVERRIDE; 86 VisualCursorDirection direction) OVERRIDE;
82 virtual void SetSelectionModel(const SelectionModel& model) OVERRIDE; 87 virtual void SetSelectionModel(const SelectionModel& model) OVERRIDE;
83 virtual ui::Range GetGlyphBounds(size_t index) OVERRIDE; 88 virtual ui::Range GetGlyphBounds(size_t index) OVERRIDE;
84 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE; 89 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE;
85 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; 90 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE;
86 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; 91 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE;
87 virtual bool IsCursorablePosition(size_t position) OVERRIDE; 92 virtual bool IsCursorablePosition(size_t position) OVERRIDE;
88 virtual void ResetLayout() OVERRIDE; 93 virtual void ResetLayout() OVERRIDE;
89 virtual void EnsureLayout() OVERRIDE; 94 virtual void EnsureLayout() OVERRIDE;
90 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; 95 virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
96 virtual void ComputeLines() OVERRIDE;
91 97
92 private: 98 private:
93 void ItemizeLogicalText(); 99 void ItemizeLogicalText();
94 void LayoutVisualText(); 100 void LayoutVisualText();
95 void LayoutTextRun(internal::TextRun* run); 101 void LayoutTextRun(internal::TextRun* run);
96 102
97 // Helper function that calls |ScriptShape()| on the run, which has logic to 103 // Helper function that calls |ScriptShape()| on the run, which has logic to
98 // handle E_OUTOFMEMORY return codes. 104 // handle E_OUTOFMEMORY return codes.
99 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font); 105 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font);
100 106
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 scoped_ptr<int[]> logical_to_visual_; 139 scoped_ptr<int[]> logical_to_visual_;
134 140
135 bool needs_layout_; 141 bool needs_layout_;
136 142
137 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); 143 DISALLOW_COPY_AND_ASSIGN(RenderTextWin);
138 }; 144 };
139 145
140 } // namespace gfx 146 } // namespace gfx
141 147
142 #endif // UI_GFX_RENDER_TEXT_WIN_H_ 148 #endif // UI_GFX_RENDER_TEXT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698