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

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

Issue 358553004: Added text filtering to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Terry's comments. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
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..dc48cf72934dd6d29c50c04c82d01e7726826584 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::SetHasShadow(bool has_shadow) {
+ has_shadow_ = has_shadow;
+ SchedulePaint();
+}
+
bool Textfield::GetCursorEnabled() const {
return GetRenderText()->cursor_enabled();
}
@@ -647,8 +653,12 @@ void Textfield::OnMouseReleased(const ui::MouseEvent& event) {
}
bool Textfield::OnKeyPressed(const ui::KeyEvent& event) {
+ base::WeakPtr<Textfield> textfield(weak_ptr_factory_.GetWeakPtr());
flackr 2014/06/26 17:33:08 nit: Might be worth a comment that HandleKeyEvent
Nina 2014/06/27 15:20:39 Done.
bool handled = controller_ && controller_->HandleKeyEvent(this, event);
+ if (!textfield)
+ return handled;
+
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
ui::TextEditKeyBindingsDelegateAuraLinux* delegate =
ui::GetTextEditKeyBindingsDelegate();
@@ -1588,6 +1598,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));
flackr 2014/06/26 17:33:08 Maybe we should pass the ShadowValues in when sett
+ render_text->set_shadows(shadows);
+ }
+
render_text->Draw(canvas);
// Draw the detached drop cursor that marks where the text will be dropped.
« ash/wm/overview/window_selector_panels.cc ('K') | « ui/views/controls/textfield/textfield.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698