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

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

Issue 11535014: Replace StyleRange with BreakList; update RenderText, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_LINUX_H_ 5 #ifndef UI_GFX_RENDER_TEXT_LINUX_H_
6 #define UI_GFX_RENDER_TEXT_LINUX_H_ 6 #define UI_GFX_RENDER_TEXT_LINUX_H_
7 7
8 #include <pango/pango.h> 8 #include <pango/pango.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 int* height) OVERRIDE; 38 int* height) OVERRIDE;
39 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE; 39 virtual std::vector<Rect> GetSubstringBounds(const ui::Range& range) OVERRIDE;
40 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; 40 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE;
41 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; 41 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE;
42 virtual bool IsCursorablePosition(size_t position) OVERRIDE; 42 virtual bool IsCursorablePosition(size_t position) OVERRIDE;
43 virtual void ResetLayout() OVERRIDE; 43 virtual void ResetLayout() OVERRIDE;
44 virtual void EnsureLayout() OVERRIDE; 44 virtual void EnsureLayout() OVERRIDE;
45 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; 45 virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
46 46
47 private: 47 private:
48 friend class RenderTextTest;
49 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes);
50
48 // Returns the run that contains the character attached to the caret in the 51 // Returns the run that contains the character attached to the caret in the
49 // given selection model. Return NULL if not found. 52 // given selection model. Return NULL if not found.
50 GSList* GetRunContainingCaret(const SelectionModel& caret) const; 53 GSList* GetRunContainingCaret(const SelectionModel& caret) const;
51 54
52 // Given a |run|, returns the SelectionModel that contains the logical first 55 // Given a |run|, returns the SelectionModel that contains the logical first
53 // or last caret position inside (not at a boundary of) the run. 56 // or last caret position inside (not at a boundary of) the run.
54 // The returned value represents a cursor/caret position without a selection. 57 // The returned value represents a cursor/caret position without a selection.
55 SelectionModel FirstSelectionModelInsideRun(const PangoItem* run); 58 SelectionModel FirstSelectionModelInsideRun(const PangoItem* run);
56 SelectionModel LastSelectionModelInsideRun(const PangoItem* run); 59 SelectionModel LastSelectionModelInsideRun(const PangoItem* run);
57 60
58 // Setup pango attribute: foreground, background, font, strike. 61 // Setup pango attribute: foreground, background, font, strike.
59 void SetupPangoAttributes(PangoLayout* layout); 62 void SetupPangoAttributes(PangoLayout* layout);
60 63
61 // Append one pango attribute |pango_attr| into pango attribute list |attrs|. 64 // Append one pango attribute |pango_attr| into pango attribute list |attrs|.
62 void AppendPangoAttribute(size_t start, 65 void AppendPangoAttribute(size_t start,
63 size_t end, 66 size_t end,
64 PangoAttribute* pango_attr, 67 PangoAttribute* pango_attr,
65 PangoAttrList* attrs); 68 PangoAttrList* attrs);
66 69
67 // Calculate the visual bounds containing the logical substring within the 70 // Calculate the visual bounds containing the logical substring within the
68 // given range. 71 // given range.
69 std::vector<Rect> CalculateSubstringBounds(ui::Range range); 72 std::vector<Rect> CalculateSubstringBounds(ui::Range range);
70 73
71 // Get the visual bounds of the logical selection. 74 // Get the visual bounds of the logical selection.
72 std::vector<Rect> GetSelectionBounds(); 75 std::vector<Rect> GetSelectionBounds();
73 76
77 // Get the text index corresponding to the |run|'s |glyph_index|.
78 size_t GetGlyphTextIndex(PangoLayoutRun* run, int glyph_index) const;
79
74 // Pango Layout. 80 // Pango Layout.
75 PangoLayout* layout_; 81 PangoLayout* layout_;
76 // A single line layout resulting from laying out via |layout_|. 82 // A single line layout resulting from laying out via |layout_|.
77 PangoLayoutLine* current_line_; 83 PangoLayoutLine* current_line_;
78 84
79 // Information about character attributes. 85 // Information about character attributes.
80 PangoLogAttr* log_attrs_; 86 PangoLogAttr* log_attrs_;
81 // Number of attributes in |log_attrs_|. 87 // Number of attributes in |log_attrs_|.
82 int num_log_attrs_; 88 int num_log_attrs_;
83 89
84 // Vector of the visual bounds containing the logical substring of selection. 90 // Vector of the visual bounds containing the logical substring of selection.
85 std::vector<Rect> selection_visual_bounds_; 91 std::vector<Rect> selection_visual_bounds_;
86 92
87 // The text in the |layout_|. 93 // The text in the |layout_|.
88 const char* layout_text_; 94 const char* layout_text_;
89 // The text length. 95 // The text length.
90 size_t layout_text_len_; 96 size_t layout_text_len_;
91 97
92 DISALLOW_COPY_AND_ASSIGN(RenderTextLinux); 98 DISALLOW_COPY_AND_ASSIGN(RenderTextLinux);
93 }; 99 };
94 100
95 } // namespace gfx 101 } // namespace gfx
96 102
97 #endif // UI_GFX_RENDER_TEXT_LINUX_H_ 103 #endif // UI_GFX_RENDER_TEXT_LINUX_H_
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698