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

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 lifetime issues with BorderView's widget_ and address review comments. Created 4 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
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 bool cursor_visible() const { return cursor_visible_; } 250 bool cursor_visible() const { return cursor_visible_; }
251 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } 251 void set_cursor_visible(bool visible) { cursor_visible_ = visible; }
252 252
253 SkColor cursor_color() const { return cursor_color_; } 253 SkColor cursor_color() const { return cursor_color_; }
254 void set_cursor_color(SkColor color) { cursor_color_ = color; } 254 void set_cursor_color(SkColor color) { cursor_color_ = color; }
255 255
256 SkColor selection_color() const { return selection_color_; } 256 SkColor selection_color() const { return selection_color_; }
257 void set_selection_color(SkColor color) { selection_color_ = color; } 257 void set_selection_color(SkColor color) { selection_color_ = color; }
258 258
259 SkColor selection_background_focused_color() const { 259 SkColor selection_background_color() const {
260 return selection_background_focused_color_; 260 return selection_background_color_;
261 } 261 }
262 void set_selection_background_focused_color(SkColor color) { 262 void set_selection_background_color(SkColor color) {
263 selection_background_focused_color_ = color; 263 selection_background_color_ = color;
264 } 264 }
265 265
266 void set_draw_text_selection(bool draw) { draw_text_selection_ = draw; }
267
266 bool focused() const { return focused_; } 268 bool focused() const { return focused_; }
267 void set_focused(bool focused) { focused_ = focused; } 269 void set_focused(bool focused) { focused_ = focused; }
268 270
269 bool clip_to_display_rect() const { return clip_to_display_rect_; } 271 bool clip_to_display_rect() const { return clip_to_display_rect_; }
270 void set_clip_to_display_rect(bool clip) { clip_to_display_rect_ = clip; } 272 void set_clip_to_display_rect(bool clip) { clip_to_display_rect_ = clip; }
271 273
272 // In an obscured (password) field, all text is drawn as asterisks or bullets. 274 // In an obscured (password) field, all text is drawn as asterisks or bullets.
273 bool obscured() const { return obscured_; } 275 bool obscured() const { return obscured_; }
274 void SetObscured(bool obscured); 276 void SetObscured(bool obscured);
275 277
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 // The cursor visibility. 753 // The cursor visibility.
752 bool cursor_visible_; 754 bool cursor_visible_;
753 755
754 // The color used for the cursor. 756 // The color used for the cursor.
755 SkColor cursor_color_; 757 SkColor cursor_color_;
756 758
757 // The color used for drawing selected text. 759 // The color used for drawing selected text.
758 SkColor selection_color_; 760 SkColor selection_color_;
759 761
760 // The background color used for drawing the selection when focused. 762 // The background color used for drawing the selection when focused.
761 SkColor selection_background_focused_color_; 763 SkColor selection_background_color_;
764
765 // Whether to draw the selected text regardless of focus.
msw 2016/11/09 02:08:53 nit: "Whether to draw the unfocused text selection
766 bool draw_text_selection_;
msw 2016/11/09 02:08:53 nit: Consider renaming this for clarity, since it
762 767
763 // The focus state of the text. 768 // The focus state of the text.
764 bool focused_; 769 bool focused_;
765 770
766 // Composition text range. 771 // Composition text range.
767 Range composition_range_; 772 Range composition_range_;
768 773
769 // Color, baseline, and style breaks, used to modify ranges of text. 774 // Color, baseline, and style breaks, used to modify ranges of text.
770 // BreakList positions are stored with text indices, not display indices. 775 // BreakList positions are stored with text indices, not display indices.
771 // TODO(msw): Expand to support cursor, selection, background, etc. colors. 776 // TODO(msw): Expand to support cursor, selection, background, etc. colors.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 // Lines computed by EnsureLayout. These should be invalidated upon 863 // Lines computed by EnsureLayout. These should be invalidated upon
859 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 864 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
860 std::vector<internal::Line> lines_; 865 std::vector<internal::Line> lines_;
861 866
862 DISALLOW_COPY_AND_ASSIGN(RenderText); 867 DISALLOW_COPY_AND_ASSIGN(RenderText);
863 }; 868 };
864 869
865 } // namespace gfx 870 } // namespace gfx
866 871
867 #endif // UI_GFX_RENDER_TEXT_H_ 872 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698