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

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: Thanks chrome team for helping me fix the previous patch 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..d0f2d6c8f31e08495c5df42d8d4e4112aef02dfd 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -601,7 +601,7 @@ bool Textfield::OnMousePressed(const ui::MouseEvent& event) {
ui::Clipboard::GetForCurrentThread(),
ui::CLIPBOARD_TYPE_SELECTION).WriteText(base::string16());
OnAfterUserAction();
- } else if(!read_only()) {
+ } else if (!read_only()) {
PasteSelectionClipboard(event);
}
}
@@ -647,8 +647,14 @@ void Textfield::OnMouseReleased(const ui::MouseEvent& event) {
}
bool Textfield::OnKeyPressed(const ui::KeyEvent& event) {
+ // Since HandleKeyEvent() might destroy |this|, get a weak pointer and verify
+ // it isn't null before proceeding.
+ base::WeakPtr<Textfield> textfield(weak_ptr_factory_.GetWeakPtr());
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 +1594,8 @@ void Textfield::PaintTextAndCursor(gfx::Canvas* canvas) {
// Draw the text, cursor, and selection.
render_text->set_cursor_visible(cursor_visible_ && !drop_cursor_visible_ &&
!HasSelection());
+ render_text->set_shadows(shadows_);
+
flackr 2014/06/27 20:00:07 nit: no need for an extra newline here.
render_text->Draw(canvas);
// Draw the detached drop cursor that marks where the text will be dropped.
« ui/views/controls/textfield/textfield.h ('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