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

Side by Side Diff: chrome/views/controls/button/radio_button.cc

Issue 92004: Fix focus rects for checkboxes and radio buttons:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/views/controls/button/radio_button.h ('k') | chrome/views/controls/label.h » ('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 (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/views/controls/button/radio_button.h" 5 #include "chrome/views/controls/button/radio_button.h"
6 6
7 #include "chrome/views/widget/root_view.h" 7 #include "chrome/views/widget/root_view.h"
8 8
9 namespace views { 9 namespace views {
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 return NULL; 75 return NULL;
76 } 76 }
77 77
78 bool RadioButton::IsGroupFocusTraversable() const { 78 bool RadioButton::IsGroupFocusTraversable() const {
79 // When focusing a radio button with tab/shift+tab, only the selected button 79 // When focusing a radio button with tab/shift+tab, only the selected button
80 // from the group should be focused. 80 // from the group should be focused.
81 return false; 81 return false;
82 } 82 }
83 83
84 void RadioButton::OnMouseReleased(const views::MouseEvent& event, 84 void RadioButton::OnMouseReleased(const MouseEvent& event, bool canceled) {
85 bool canceled) {
86 native_wrapper_->SetPushed(false); 85 native_wrapper_->SetPushed(false);
87 // Call through to toggle the button only if we're not already checked, since 86 // Set the checked state to true only if we are unchecked, since we can't
88 // radio buttons can't be toggled like checkboxes. 87 // be toggled on and off like a checkbox.
89 if (!checked()) 88 if (!checked() && !canceled && HitTestLabel(event))
90 Checkbox::OnMouseReleased(event, canceled); 89 SetChecked(true);
90
91 ButtonPressed();
91 } 92 }
92 93
93 std::string RadioButton::GetClassName() const { 94 std::string RadioButton::GetClassName() const {
94 return kViewClassName; 95 return kViewClassName;
95 } 96 }
96 97
97 //////////////////////////////////////////////////////////////////////////////// 98 ////////////////////////////////////////////////////////////////////////////////
98 // RadioButton, NativeButton overrides: 99 // RadioButton, NativeButton overrides:
99 100
100 void RadioButton::CreateWrapper() { 101 void RadioButton::CreateWrapper() {
101 native_wrapper_ = NativeButtonWrapper::CreateRadioButtonWrapper(this); 102 native_wrapper_ = NativeButtonWrapper::CreateRadioButtonWrapper(this);
102 native_wrapper_->UpdateLabel(); 103 native_wrapper_->UpdateLabel();
103 native_wrapper_->UpdateChecked(); 104 native_wrapper_->UpdateChecked();
104 } 105 }
105 106
106 } // namespace views 107 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/controls/button/radio_button.h ('k') | chrome/views/controls/label.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698