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

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

Issue 2345183002: Views: Draw Textfield selected text in gray when top-level Widget loses focus.
Patch Set: Fix up diff & add colors to Windows/Mac. Created 4 years, 3 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 SkColor selection_color() const { return selection_color_; } 246 SkColor selection_color() const { return selection_color_; }
247 void set_selection_color(SkColor color) { selection_color_ = color; } 247 void set_selection_color(SkColor color) { selection_color_ = color; }
248 248
249 SkColor selection_background_focused_color() const { 249 SkColor selection_background_focused_color() const {
250 return selection_background_focused_color_; 250 return selection_background_focused_color_;
251 } 251 }
252 void set_selection_background_focused_color(SkColor color) { 252 void set_selection_background_focused_color(SkColor color) {
253 selection_background_focused_color_ = color; 253 selection_background_focused_color_ = color;
254 } 254 }
255 255
256 SkColor selection_background_unfocused_color() const {
257 return selection_background_unfocused_color_;
258 }
259 void set_selection_background_unfocused_color(SkColor color) {
260 selection_background_unfocused_color_ = color;
261 }
262
263 void set_draw_unfocused_selection(bool draw) {
264 draw_unfocused_selection_ = draw;
265 }
266
256 bool focused() const { return focused_; } 267 bool focused() const { return focused_; }
257 void set_focused(bool focused) { focused_ = focused; } 268 void set_focused(bool focused) { focused_ = focused; }
258 269
259 bool clip_to_display_rect() const { return clip_to_display_rect_; } 270 bool clip_to_display_rect() const { return clip_to_display_rect_; }
260 void set_clip_to_display_rect(bool clip) { clip_to_display_rect_ = clip; } 271 void set_clip_to_display_rect(bool clip) { clip_to_display_rect_ = clip; }
261 272
262 // In an obscured (password) field, all text is drawn as asterisks or bullets. 273 // In an obscured (password) field, all text is drawn as asterisks or bullets.
263 bool obscured() const { return obscured_; } 274 bool obscured() const { return obscured_; }
264 void SetObscured(bool obscured); 275 void SetObscured(bool obscured);
265 276
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 756
746 // The color used for the cursor. 757 // The color used for the cursor.
747 SkColor cursor_color_; 758 SkColor cursor_color_;
748 759
749 // The color used for drawing selected text. 760 // The color used for drawing selected text.
750 SkColor selection_color_; 761 SkColor selection_color_;
751 762
752 // The background color used for drawing the selection when focused. 763 // The background color used for drawing the selection when focused.
753 SkColor selection_background_focused_color_; 764 SkColor selection_background_focused_color_;
754 765
766 // The background color used for drawing the selection when not focused.
767 SkColor selection_background_unfocused_color_;
768
769 // Whether to draw the selected text regardless of focus.
770 bool draw_unfocused_selection_;
771
755 // The focus state of the text. 772 // The focus state of the text.
756 bool focused_; 773 bool focused_;
757 774
758 // Composition text range. 775 // Composition text range.
759 Range composition_range_; 776 Range composition_range_;
760 777
761 // Color, baseline, and style breaks, used to modify ranges of text. 778 // Color, baseline, and style breaks, used to modify ranges of text.
762 // BreakList positions are stored with text indices, not display indices. 779 // BreakList positions are stored with text indices, not display indices.
763 // TODO(msw): Expand to support cursor, selection, background, etc. colors. 780 // TODO(msw): Expand to support cursor, selection, background, etc. colors.
764 BreakList<SkColor> colors_; 781 BreakList<SkColor> colors_;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 // Lines computed by EnsureLayout. These should be invalidated upon 867 // Lines computed by EnsureLayout. These should be invalidated upon
851 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 868 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
852 std::vector<internal::Line> lines_; 869 std::vector<internal::Line> lines_;
853 870
854 DISALLOW_COPY_AND_ASSIGN(RenderText); 871 DISALLOW_COPY_AND_ASSIGN(RenderText);
855 }; 872 };
856 873
857 } // namespace gfx 874 } // namespace gfx
858 875
859 #endif // UI_GFX_RENDER_TEXT_H_ 876 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698