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

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

Issue 8747001: Reintroduce password support to NativeTextfieldViews (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for dcommit Created 8 years, 9 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 #pragma once 7 #pragma once
8 8
9 #include <pango/pango.h> 9 #include <pango/pango.h>
10 #include <vector> 10 #include <vector>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; 44 virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
45 45
46 private: 46 private:
47 virtual size_t IndexOfAdjacentGrapheme( 47 virtual size_t IndexOfAdjacentGrapheme(
48 size_t index, 48 size_t index,
49 LogicalCursorDirection direction) OVERRIDE; 49 LogicalCursorDirection direction) OVERRIDE;
50 50
51 // Returns the run that contains |position|. Return NULL if not found. 51 // Returns the run that contains |position|. Return NULL if not found.
52 GSList* GetRunContainingPosition(size_t position) const; 52 GSList* GetRunContainingPosition(size_t position) const;
53 53
54 // Given |utf8_index_of_current_grapheme|, returns the UTF-8 index of the 54 // Given |layout_index_of_current_grapheme|, returns the layout (UTF-8) index
55 // |next| or previous grapheme in logical order. Returns 0 if there is no 55 // of the |next| or previous grapheme in logical order. Returns 0 if there is
56 // previous grapheme, or the |text_| length if there is no next grapheme. 56 // no previous grapheme, or the |text_| length if there is no next grapheme.
57 size_t Utf8IndexOfAdjacentGrapheme(size_t utf8_index_of_current_grapheme, 57 size_t LayoutIndexOfAdjacentGrapheme(size_t layout_index_of_current_grapheme,
58 LogicalCursorDirection direction) const; 58 LogicalCursorDirection direction) const;
59 59
60 // Given a |run|, returns the SelectionModel that contains the logical first 60 // Given a |run|, returns the SelectionModel that contains the logical first
61 // or last caret position inside (not at a boundary of) the run. 61 // or last caret position inside (not at a boundary of) the run.
62 // The returned value represents a cursor/caret position without a selection. 62 // The returned value represents a cursor/caret position without a selection.
63 SelectionModel FirstSelectionModelInsideRun(const PangoItem* run) const; 63 SelectionModel FirstSelectionModelInsideRun(const PangoItem* run) const;
64 SelectionModel LastSelectionModelInsideRun(const PangoItem* run) const; 64 SelectionModel LastSelectionModelInsideRun(const PangoItem* run) const;
65 65
66 // Unref |layout_| and |pango_line_|. Set them to NULL. 66 // Unref |layout_| and |pango_line_|. Set them to NULL.
67 void ResetLayout(); 67 void ResetLayout();
68 68
69 // Setup pango attribute: foreground, background, font, strike. 69 // Setup pango attribute: foreground, background, font, strike.
70 void SetupPangoAttributes(PangoLayout* layout); 70 void SetupPangoAttributes(PangoLayout* layout);
71 71
72 // Append one pango attribute |pango_attr| into pango attribute list |attrs|. 72 // Append one pango attribute |pango_attr| into pango attribute list |attrs|.
73 void AppendPangoAttribute(size_t start, 73 void AppendPangoAttribute(size_t start,
74 size_t end, 74 size_t end,
75 PangoAttribute* pango_attr, 75 PangoAttribute* pango_attr,
76 PangoAttrList* attrs); 76 PangoAttrList* attrs);
77 77
78 size_t Utf16IndexToUtf8Index(size_t index) const; 78 // Convert between indices into text() and indices into |layout_text_|.
79 size_t Utf8IndexToUtf16Index(size_t index) const; 79 size_t TextIndexToLayoutIndex(size_t index) const;
80 size_t LayoutIndexToTextIndex(size_t index) const;
80 81
81 // Calculate the visual bounds containing the logical substring within |from| 82 // Calculate the visual bounds containing the logical substring within |from|
82 // to |to|. 83 // to |to|.
83 std::vector<Rect> CalculateSubstringBounds(size_t from, size_t to); 84 std::vector<Rect> CalculateSubstringBounds(size_t from, size_t to);
84 85
85 // Get the visual bounds of the logical selection. 86 // Get the visual bounds of the logical selection.
86 std::vector<Rect> GetSelectionBounds(); 87 std::vector<Rect> GetSelectionBounds();
87 88
88 // Pango Layout. 89 // Pango Layout.
89 PangoLayout* layout_; 90 PangoLayout* layout_;
(...skipping 12 matching lines...) Expand all
102 const char* layout_text_; 103 const char* layout_text_;
103 // The text length. 104 // The text length.
104 size_t layout_text_len_; 105 size_t layout_text_len_;
105 106
106 DISALLOW_COPY_AND_ASSIGN(RenderTextLinux); 107 DISALLOW_COPY_AND_ASSIGN(RenderTextLinux);
107 }; 108 };
108 109
109 } // namespace gfx 110 } // namespace gfx
110 111
111 #endif // UI_GFX_RENDER_TEXT_LINUX_H_ 112 #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