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

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

Issue 8536047: Separate selection highlight from pango layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix an lint error Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <usp10.h> 9 #include <usp10.h>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } // namespace internal 51 } // namespace internal
52 52
53 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. 53 // RenderTextWin is the Windows implementation of RenderText using Uniscribe.
54 class RenderTextWin : public RenderText { 54 class RenderTextWin : public RenderText {
55 public: 55 public:
56 RenderTextWin(); 56 RenderTextWin();
57 virtual ~RenderTextWin(); 57 virtual ~RenderTextWin();
58 58
59 // Overridden from RenderText: 59 // Overridden from RenderText:
60 virtual int GetStringWidth() OVERRIDE; 60 virtual int GetStringWidth() OVERRIDE;
61 virtual void Draw(Canvas* canvas) OVERRIDE;
62 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; 61 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE;
63 virtual Rect GetCursorBounds(const SelectionModel& selection, 62 virtual Rect GetCursorBounds(const SelectionModel& selection,
64 bool insert_mode) OVERRIDE; 63 bool insert_mode) OVERRIDE;
65 64
66 protected: 65 protected:
67 // Overridden from RenderText: 66 // Overridden from RenderText:
68 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, 67 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current,
69 BreakType break_type) OVERRIDE; 68 BreakType break_type) OVERRIDE;
70 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, 69 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current,
71 BreakType break_type) OVERRIDE; 70 BreakType break_type) OVERRIDE;
72 virtual SelectionModel LeftEndSelectionModel() OVERRIDE; 71 virtual SelectionModel LeftEndSelectionModel() OVERRIDE;
73 virtual SelectionModel RightEndSelectionModel() OVERRIDE; 72 virtual SelectionModel RightEndSelectionModel() OVERRIDE;
74 virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to) OVERRIDE; 73 virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to) OVERRIDE;
75 virtual bool IsCursorablePosition(size_t position) OVERRIDE; 74 virtual bool IsCursorablePosition(size_t position) OVERRIDE;
76 virtual void UpdateLayout() OVERRIDE; 75 virtual void UpdateLayout() OVERRIDE;
76 virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
77 77
78 private: 78 private:
79 virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) OVERRIDE; 79 virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) OVERRIDE;
80 80
81 void ItemizeLogicalText(); 81 void ItemizeLogicalText();
82 void LayoutVisualText(HDC hdc); 82 void LayoutVisualText(HDC hdc);
83 83
84 // Return the run index that contains the argument; or the length of the 84 // Return the run index that contains the argument; or the length of the
85 // |runs_| vector if argument exceeds the text length or width. 85 // |runs_| vector if argument exceeds the text length or width.
86 size_t GetRunContainingPosition(size_t position) const; 86 size_t GetRunContainingPosition(size_t position) const;
87 size_t GetRunContainingPoint(const Point& point) const; 87 size_t GetRunContainingPoint(const Point& point) const;
88 88
89 // Given a |run|, returns the SelectionModel that contains the logical first 89 // Given a |run|, returns the SelectionModel that contains the logical first
90 // or last caret position inside (not at a boundary of) the run. 90 // or last caret position inside (not at a boundary of) the run.
91 // The returned value represents a cursor/caret position without a selection. 91 // The returned value represents a cursor/caret position without a selection.
92 SelectionModel FirstSelectionModelInsideRun(internal::TextRun*); 92 SelectionModel FirstSelectionModelInsideRun(internal::TextRun*);
93 SelectionModel LastSelectionModelInsideRun(internal::TextRun*); 93 SelectionModel LastSelectionModelInsideRun(internal::TextRun*);
94 94
95 // Get the selection model visually left/right of |selection| by one grapheme. 95 // Get the selection model visually left/right of |selection| by one grapheme.
96 // The returned value represents a cursor/caret position without a selection. 96 // The returned value represents a cursor/caret position without a selection.
97 SelectionModel LeftSelectionModel(const SelectionModel& selection); 97 SelectionModel LeftSelectionModel(const SelectionModel& selection);
98 SelectionModel RightSelectionModel(const SelectionModel& selection); 98 SelectionModel RightSelectionModel(const SelectionModel& selection);
99 99
100 // Draw the text, cursor, and selection.
101 void DrawSelection(Canvas* canvas);
102 void DrawVisualText(Canvas* canvas);
103 void DrawCursor(Canvas* canvas);
104
105 bool text_is_dirty_; 100 bool text_is_dirty_;
106 bool style_is_dirty_; 101 bool style_is_dirty_;
107 102
108 // National Language Support native digit and digit substitution settings. 103 // National Language Support native digit and digit substitution settings.
109 SCRIPT_DIGITSUBSTITUTE digit_substitute_; 104 SCRIPT_DIGITSUBSTITUTE digit_substitute_;
110 105
111 SCRIPT_CONTROL script_control_; 106 SCRIPT_CONTROL script_control_;
112 SCRIPT_STATE script_state_; 107 SCRIPT_STATE script_state_;
113 108
114 SCRIPT_CACHE script_cache_; 109 SCRIPT_CACHE script_cache_;
115 110
116 std::vector<internal::TextRun*> runs_; 111 std::vector<internal::TextRun*> runs_;
117 int string_width_; 112 int string_width_;
118 113
119 scoped_array<int> visual_to_logical_; 114 scoped_array<int> visual_to_logical_;
120 scoped_array<int> logical_to_visual_; 115 scoped_array<int> logical_to_visual_;
121 116
122 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); 117 DISALLOW_COPY_AND_ASSIGN(RenderTextWin);
123 }; 118 };
124 119
125 } // namespace gfx 120 } // namespace gfx
126 121
127 #endif // UI_GFX_RENDER_TEXT_WIN_H_ 122 #endif // UI_GFX_RENDER_TEXT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698