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

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

Issue 2660593002: Paint text cursor in LAYER_SOLID_COLOR (Closed)
Patch Set: comments Created 3 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
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_H_ 5 #ifndef UI_GFX_RENDER_TEXT_H_
6 #define UI_GFX_RENDER_TEXT_H_ 6 #define UI_GFX_RENDER_TEXT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return horizontal_alignment_; 243 return horizontal_alignment_;
244 } 244 }
245 void SetHorizontalAlignment(HorizontalAlignment alignment); 245 void SetHorizontalAlignment(HorizontalAlignment alignment);
246 246
247 const FontList& font_list() const { return font_list_; } 247 const FontList& font_list() const { return font_list_; }
248 void SetFontList(const FontList& font_list); 248 void SetFontList(const FontList& font_list);
249 249
250 bool cursor_enabled() const { return cursor_enabled_; } 250 bool cursor_enabled() const { return cursor_enabled_; }
251 void SetCursorEnabled(bool cursor_enabled); 251 void SetCursorEnabled(bool cursor_enabled);
252 252
253 bool cursor_visible() const { return cursor_visible_; }
254 void set_cursor_visible(bool visible) { cursor_visible_ = visible; }
255
256 SkColor cursor_color() const { return cursor_color_; }
257 void set_cursor_color(SkColor color) { cursor_color_ = color; }
258
259 SkColor selection_color() const { return selection_color_; } 253 SkColor selection_color() const { return selection_color_; }
260 void set_selection_color(SkColor color) { selection_color_ = color; } 254 void set_selection_color(SkColor color) { selection_color_ = color; }
261 255
262 SkColor selection_background_focused_color() const { 256 SkColor selection_background_focused_color() const {
263 return selection_background_focused_color_; 257 return selection_background_focused_color_;
264 } 258 }
265 void set_selection_background_focused_color(SkColor color) { 259 void set_selection_background_focused_color(SkColor color) {
266 selection_background_focused_color_ = color; 260 selection_background_focused_color_ = color;
267 } 261 }
268 262
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 int GetContentWidth(); 440 int GetContentWidth();
447 441
448 // Returns the common baseline of the text. The return value is the vertical 442 // Returns the common baseline of the text. The return value is the vertical
449 // offset from the top of |display_rect_| to the text baseline, in pixels. 443 // offset from the top of |display_rect_| to the text baseline, in pixels.
450 // The baseline is determined from the font list and display rect, and does 444 // The baseline is determined from the font list and display rect, and does
451 // not depend on the text. 445 // not depend on the text.
452 int GetBaseline(); 446 int GetBaseline();
453 447
454 void Draw(Canvas* canvas); 448 void Draw(Canvas* canvas);
455 449
456 // Draws a cursor at |position|.
457 void DrawCursor(Canvas* canvas, const SelectionModel& position);
458
459 // Gets the SelectionModel from a visual point in local coordinates. 450 // Gets the SelectionModel from a visual point in local coordinates.
460 virtual SelectionModel FindCursorPosition(const Point& point) = 0; 451 virtual SelectionModel FindCursorPosition(const Point& point) = 0;
461 452
462 // Returns true if the position is a valid logical index into text(), and is 453 // Returns true if the position is a valid logical index into text(), and is
463 // also a valid grapheme boundary, which may be used as a cursor position. 454 // also a valid grapheme boundary, which may be used as a cursor position.
464 virtual bool IsValidCursorIndex(size_t index) = 0; 455 virtual bool IsValidCursorIndex(size_t index) = 0;
465 456
466 // Returns true if the position is a valid logical index into text(). Indices 457 // Returns true if the position is a valid logical index into text(). Indices
467 // amid multi-character graphemes are allowed here, unlike IsValidCursorIndex. 458 // amid multi-character graphemes are allowed here, unlike IsValidCursorIndex.
468 virtual bool IsValidLogicalIndex(size_t index) const; 459 virtual bool IsValidLogicalIndex(size_t index) const;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // Logical selection range and visual cursor position. 749 // Logical selection range and visual cursor position.
759 SelectionModel selection_model_; 750 SelectionModel selection_model_;
760 751
761 // The cached cursor bounds; get these bounds with GetUpdatedCursorBounds. 752 // The cached cursor bounds; get these bounds with GetUpdatedCursorBounds.
762 Rect cursor_bounds_; 753 Rect cursor_bounds_;
763 754
764 // Specifies whether the cursor is enabled. If disabled, no space is reserved 755 // Specifies whether the cursor is enabled. If disabled, no space is reserved
765 // for the cursor when positioning text. 756 // for the cursor when positioning text.
766 bool cursor_enabled_; 757 bool cursor_enabled_;
767 758
768 // The cursor visibility.
769 bool cursor_visible_;
770
771 // The color used for the cursor.
772 SkColor cursor_color_;
773
774 // The color used for drawing selected text. 759 // The color used for drawing selected text.
775 SkColor selection_color_; 760 SkColor selection_color_;
776 761
777 // The background color used for drawing the selection when focused. 762 // The background color used for drawing the selection when focused.
778 SkColor selection_background_focused_color_; 763 SkColor selection_background_focused_color_;
779 764
780 // The focus state of the text. 765 // The focus state of the text.
781 bool focused_; 766 bool focused_;
782 767
783 // Composition text range. 768 // Composition text range.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 // Lines computed by EnsureLayout. These should be invalidated upon 860 // Lines computed by EnsureLayout. These should be invalidated upon
876 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 861 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
877 std::vector<internal::Line> lines_; 862 std::vector<internal::Line> lines_;
878 863
879 DISALLOW_COPY_AND_ASSIGN(RenderText); 864 DISALLOW_COPY_AND_ASSIGN(RenderText);
880 }; 865 };
881 866
882 } // namespace gfx 867 } // namespace gfx
883 868
884 #endif // UI_GFX_RENDER_TEXT_H_ 869 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/accessibility/ax_tree_source_aura_unittest.cc ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698