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

Unified Diff: ui/views/controls/label.cc

Issue 2345183002: Views: Draw Textfield selected text in gray when top-level Widget loses focus.
Patch Set: Refactor to use SelectionController(Delegate). Unfinished! 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/label.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.cc
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 3533ea6f267d18a52a57a5c26999d270c3fd088b..aabc36047272b0079238f32b1cae583e94a057ec 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -621,6 +621,25 @@ void Label::UpdateSelectionClipboard() {
#endif
}
+SkColor Label::GetSelectionTextColor() const {
+ return actual_selection_text_color_;
+}
+
+SkColor Label::GetSelectionBackgroundColor() const {
+ return selection_background_color_;
+}
+
+SkColor Label::GetSelectionBackgroundUnfocusedColor() const {
+ // TODO(patricialor): Put a proper colour here.
+ return SK_ColorBLUE;
+}
+
+void Label::OnWillChangeFocus(View* focused_before, View* focused_now) {
+ // TODO(patricialor): Test labels!
+ UpdateTextSelectionDrawState(this, focused_before, focused_now);
+ SchedulePaint();
+}
+
const gfx::RenderText* Label::GetRenderTextForSelectionController() const {
if (!selectable())
return nullptr;
@@ -824,8 +843,7 @@ void Label::ApplyTextColors() const {
for (size_t i = 0; i < lines_.size(); ++i) {
lines_[i]->SetColor(color);
lines_[i]->set_selection_color(actual_selection_text_color_);
- lines_[i]->set_selection_background_focused_color(
- selection_background_color_);
+ lines_[i]->set_selection_background_color(selection_background_color_);
lines_[i]->set_subpixel_rendering_suppressed(subpixel_rendering_suppressed);
}
}
« no previous file with comments | « ui/views/controls/label.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698