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

Unified Diff: chrome/views/controls/button/checkbox.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/views/controls/button/checkbox.h ('k') | chrome/views/controls/button/radio_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/controls/button/checkbox.cc
===================================================================
--- chrome/views/controls/button/checkbox.cc (revision 14167)
+++ chrome/views/controls/button/checkbox.cc (working copy)
@@ -82,17 +82,8 @@
native_wrapper_->GetView()->Layout();
}
-void Checkbox::Paint(ChromeCanvas* canvas) {
- // Paint the focus border manually since we don't want to send actual focus
- // in to the inner view.
- if (HasFocus()) {
- gfx::Rect label_bounds = label_->bounds();
- canvas->DrawFocusRect(
- MirroredLeftPointForRect(label_bounds) - kLabelFocusPaddingHorizontal,
- 0,
- label_bounds.width() + kLabelFocusPaddingHorizontal * 2,
- label_bounds.height() - kLabelFocusPaddingVertical * 2);
- }
+void Checkbox::PaintFocusBorder(ChromeCanvas* canvas) {
+ // Our focus border is rendered by the label, so we don't do anything here.
}
View* Checkbox::GetViewForPoint(const gfx::Point& point) {
@@ -129,6 +120,18 @@
}
}
+bool Checkbox::OnMouseDragged(const MouseEvent& e) {
+ return false;
+}
+
+void Checkbox::WillGainFocus() {
+ label_->set_paint_as_focused(true);
+}
+
+void Checkbox::WillLoseFocus() {
+ label_->set_paint_as_focused(false);
+}
+
std::string Checkbox::GetClassName() const {
return kViewClassName;
}
@@ -147,6 +150,15 @@
}
////////////////////////////////////////////////////////////////////////////////
+// Checkbox, protected:
+
+bool Checkbox::HitTestLabel(const MouseEvent& e) {
+ gfx::Point tmp(e.location());
+ ConvertPointToView(this, label_, &tmp);
+ return label_->HitTest(tmp);
+}
+
+////////////////////////////////////////////////////////////////////////////////
// Checkbox, private:
void Checkbox::Init(const std::wstring& label_text) {
@@ -156,10 +168,4 @@
AddChildView(label_);
}
-bool Checkbox::HitTestLabel(const MouseEvent& e) {
- gfx::Point tmp(e.location());
- ConvertPointToView(this, label_, &tmp);
- return label_->HitTest(tmp);
-}
-
} // namespace views
« no previous file with comments | « chrome/views/controls/button/checkbox.h ('k') | chrome/views/controls/button/radio_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698