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

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

Issue 2345183002: Views: Draw Textfield selected text in gray when top-level Widget loses focus.
Patch Set: Fix lifetime issues with BorderView's widget_ and address review comments. 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
Index: ui/views/controls/textfield/textfield_unittest.cc
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
index dc14cc4a209afe6058e84dcf49c39f7939281959..d147056dfcab2135553b35069bca76c36c2f8cd3 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -330,6 +330,11 @@ class TextfieldDestroyerController : public views::TextfieldController {
const ui::KeyEvent& key_event) override {
if (target_)
msw 2016/11/09 02:08:53 Odd, why is this happening on HandleKeyEvent?
target_->OnBlur();
+ // Removal of the Textfield must be done manually here since
+ // Textfield::ViewHierarchyChanged() needs to be executed. Allowing View to
+ // do it in its destructor instead (which calls RemoveChildView()) means
+ // only View::ViewHierarchyChanged() is called.
+ target_->parent()->RemoveChildView(target_.get());
target_.reset();
return false;
}

Powered by Google App Engine
This is Rietveld 408576698