Index: ui/views/controls/textfield/textfield.cc |
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc |
index cb3e5423814432168664c60ec7a6ce84ce167ebc..6b945b3b2ebbd13d846221c1f99b0b60151bede7 100644 |
--- a/ui/views/controls/textfield/textfield.cc |
+++ b/ui/views/controls/textfield/textfield.cc |
@@ -268,6 +268,7 @@ Textfield::Textfield() |
performing_user_action_(false), |
skip_input_method_cancel_composition_(false), |
cursor_visible_(false), |
+ has_shadow_(false), |
drop_cursor_visible_(false), |
initiating_drag_(false), |
aggregated_clicks_(0), |
@@ -431,6 +432,11 @@ void Textfield::UseDefaultSelectionBackgroundColor() { |
SchedulePaint(); |
} |
+void Textfield::DisplayShadow(bool display_shadow) { |
+ has_shadow_ = display_shadow; |
+ SchedulePaint(); |
tdanderson
2014/06/25 15:48:23
It should be the responsibility of the caller to i
Nina
2014/06/26 15:20:18
Hmmm all the other setters call SchedulePaint(). I
|
+} |
+ |
bool Textfield::GetCursorEnabled() const { |
return GetRenderText()->cursor_enabled(); |
} |
@@ -1588,6 +1594,14 @@ void Textfield::PaintTextAndCursor(gfx::Canvas* canvas) { |
// Draw the text, cursor, and selection. |
render_text->set_cursor_visible(cursor_visible_ && !drop_cursor_visible_ && |
!HasSelection()); |
+ |
+ if (has_shadow_) { |
+ // Draw a basic shadow underneath the text. |
+ gfx::ShadowValues shadows; |
+ shadows.push_back(gfx::ShadowValue(gfx::Point(0, 1), 10, SK_ColorBLACK)); |
tdanderson
2014/06/25 15:48:23
I wonder if it's worthwhile defining constants for
Nina
2014/06/26 15:20:18
As we discussed off the patch, we might want to ch
|
+ render_text->set_shadows(shadows); |
+ } |
+ |
render_text->Draw(canvas); |
// Draw the detached drop cursor that marks where the text will be dropped. |