Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. | |
|
tapted
2016/10/31 00:30:25
This is a great comment, and a nice find. Things l
Patti Lor
2016/11/02 03:19:48
Thank you! :))
| |
| 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 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3005 | 3010 |
| 3006 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 3011 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 3007 ui::AXViewState state_protected; | 3012 ui::AXViewState state_protected; |
| 3008 textfield_->GetAccessibleState(&state_protected); | 3013 textfield_->GetAccessibleState(&state_protected); |
| 3009 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 3014 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
| 3010 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 3015 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
| 3011 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 3016 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 3012 } | 3017 } |
| 3013 | 3018 |
| 3014 } // namespace views | 3019 } // namespace views |
| OLD | NEW |