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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 2313123002: Harmony - set correct textfield placeholder text color (Closed)
Patch Set: 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
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | no next file » | 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 #include "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 } 1822 }
1823 1823
1824 void Textfield::PaintTextAndCursor(gfx::Canvas* canvas) { 1824 void Textfield::PaintTextAndCursor(gfx::Canvas* canvas) {
1825 TRACE_EVENT0("views", "Textfield::PaintTextAndCursor"); 1825 TRACE_EVENT0("views", "Textfield::PaintTextAndCursor");
1826 canvas->Save(); 1826 canvas->Save();
1827 1827
1828 // Draw placeholder text if needed. 1828 // Draw placeholder text if needed.
1829 gfx::RenderText* render_text = GetRenderText(); 1829 gfx::RenderText* render_text = GetRenderText();
1830 if (text().empty() && !GetPlaceholderText().empty()) { 1830 if (text().empty() && !GetPlaceholderText().empty()) {
1831 canvas->DrawStringRect(GetPlaceholderText(), GetFontList(), 1831 canvas->DrawStringRect(GetPlaceholderText(), GetFontList(),
1832 placeholder_text_color(), render_text->display_rect()); 1832 ui::MaterialDesignController::IsSecondaryUiMaterial()
1833 ? SkColorSetA(GetTextColor(), 0x83)
1834 : placeholder_text_color_,
1835 render_text->display_rect());
1833 } 1836 }
1834 1837
1835 // Draw the text, cursor, and selection. 1838 // Draw the text, cursor, and selection.
1836 render_text->set_cursor_visible(cursor_visible_ && !drop_cursor_visible_ && 1839 render_text->set_cursor_visible(cursor_visible_ && !drop_cursor_visible_ &&
1837 !HasSelection()); 1840 !HasSelection());
1838 render_text->Draw(canvas); 1841 render_text->Draw(canvas);
1839 1842
1840 // Draw the detached drop cursor that marks where the text will be dropped. 1843 // Draw the detached drop cursor that marks where the text will be dropped.
1841 if (drop_cursor_visible_) 1844 if (drop_cursor_visible_)
1842 render_text->DrawCursor(canvas, drop_cursor_position_); 1845 render_text->DrawCursor(canvas, drop_cursor_position_);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 RequestFocus(); 2027 RequestFocus();
2025 model_->MoveCursorTo(mouse); 2028 model_->MoveCursorTo(mouse);
2026 if (!selection_clipboard_text.empty()) { 2029 if (!selection_clipboard_text.empty()) {
2027 model_->InsertText(selection_clipboard_text); 2030 model_->InsertText(selection_clipboard_text);
2028 UpdateAfterChange(true, true); 2031 UpdateAfterChange(true, true);
2029 } 2032 }
2030 OnAfterUserAction(); 2033 OnAfterUserAction();
2031 } 2034 }
2032 2035
2033 } // namespace views 2036 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698