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

Side by Side 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: Refactor to use SelectionController(Delegate). Unfinished! Created 4 years 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.cc ('k') | ui/views/focus/focus_traversal_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 target_->set_controller(this); 323 target_->set_controller(this);
324 } 324 }
325 325
326 views::Textfield* target() { return target_.get(); } 326 views::Textfield* target() { return target_.get(); }
327 327
328 // views::TextfieldController: 328 // views::TextfieldController:
329 bool HandleKeyEvent(views::Textfield* sender, 329 bool HandleKeyEvent(views::Textfield* sender,
330 const ui::KeyEvent& key_event) override { 330 const ui::KeyEvent& key_event) override {
331 if (target_) 331 if (target_)
332 target_->OnBlur(); 332 target_->OnBlur();
333 // Removal of the Textfield must be done manually here since
334 // Textfield::ViewHierarchyChanged() needs to be executed. Allowing View to
335 // do it in its destructor instead (which calls RemoveChildView()) means
336 // only View::ViewHierarchyChanged() is called.
337 target_->parent()->RemoveChildView(target_.get());
333 target_.reset(); 338 target_.reset();
334 return false; 339 return false;
335 } 340 }
336 341
337 private: 342 private:
338 std::unique_ptr<views::Textfield> target_; 343 std::unique_ptr<views::Textfield> target_;
339 }; 344 };
340 345
341 base::string16 GetClipboardText(ui::ClipboardType type) { 346 base::string16 GetClipboardText(ui::ClipboardType type) {
342 base::string16 text; 347 base::string16 text;
(...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after
3009 ui::AXNodeData node_data_protected; 3014 ui::AXNodeData node_data_protected;
3010 node_data_protected.state = 0; 3015 node_data_protected.state = 0;
3011 textfield_->GetAccessibleNodeData(&node_data_protected); 3016 textfield_->GetAccessibleNodeData(&node_data_protected);
3012 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); 3017 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role);
3013 EXPECT_EQ(ASCIIToUTF16("********"), 3018 EXPECT_EQ(ASCIIToUTF16("********"),
3014 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); 3019 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE));
3015 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 3020 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
3016 } 3021 }
3017 3022
3018 } // namespace views 3023 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/focus/focus_traversal_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698