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

Side by Side Diff: views/controls/button/checkbox.cc

Issue 8359029: ui/gfx: Convert Canvas::DrawFocusRect() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Peter's review Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | views/controls/button/text_button.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/button/checkbox.h" 5 #include "views/controls/button/checkbox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/accessibility/accessible_view_state.h" 8 #include "ui/base/accessibility/accessible_view_state.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "views/controls/label.h" 10 #include "views/controls/label.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 state->role = ui::AccessibilityTypes::ROLE_CHECKBUTTON; 59 state->role = ui::AccessibilityTypes::ROLE_CHECKBUTTON;
60 state->state = checked() ? ui::AccessibilityTypes::STATE_CHECKED : 0; 60 state->state = checked() ? ui::AccessibilityTypes::STATE_CHECKED : 0;
61 } 61 }
62 62
63 void Checkbox::OnPaintFocusBorder(gfx::Canvas* canvas) { 63 void Checkbox::OnPaintFocusBorder(gfx::Canvas* canvas) {
64 if (HasFocus() && (IsFocusable() || IsAccessibilityFocusableInRootView())) { 64 if (HasFocus() && (IsFocusable() || IsAccessibilityFocusableInRootView())) {
65 gfx::Rect bounds(GetTextBounds()); 65 gfx::Rect bounds(GetTextBounds());
66 // Increate the bounding box by one on each side so that that focus border 66 // Increate the bounding box by one on each side so that that focus border
67 // does not draw on top of the letters. 67 // does not draw on top of the letters.
68 bounds.Inset(-1, -1, -1, -1); 68 bounds.Inset(-1, -1, -1, -1);
69 canvas->DrawFocusRect(bounds.x(), bounds.y(), bounds.width(), 69 canvas->DrawFocusRect(bounds);
70 bounds.height());
71 } 70 }
72 } 71 }
73 72
74 void Checkbox::NotifyClick(const views::Event& event) { 73 void Checkbox::NotifyClick(const views::Event& event) {
75 SetChecked(!checked()); 74 SetChecked(!checked());
76 RequestFocus(); 75 RequestFocus();
77 TextButtonBase::NotifyClick(event); 76 TextButtonBase::NotifyClick(event);
78 } 77 }
79 78
80 gfx::NativeTheme::Part Checkbox::GetThemePart() const { 79 gfx::NativeTheme::Part Checkbox::GetThemePart() const {
(...skipping 23 matching lines...) Expand all
104 gfx::NativeTheme::ExtraParams extra; 103 gfx::NativeTheme::ExtraParams extra;
105 gfx::NativeTheme::State state = GetThemeState(&extra); 104 gfx::NativeTheme::State state = GetThemeState(&extra);
106 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), 105 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(),
107 state, 106 state,
108 extra)); 107 extra));
109 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); 108 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0);
110 return bounds; 109 return bounds;
111 } 110 }
112 111
113 } // namespace views 112 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | views/controls/button/text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698