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

Side by Side Diff: ui/views/controls/button/image_button.cc

Issue 1550443002: Pushed InkDropHost inheritence up to CustomButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed whitespace in toolbar_action_view.h Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/button/image_button.h" 5 #include "ui/views/controls/button/image_button.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 const char* ImageButton::GetClassName() const { 103 const char* ImageButton::GetClassName() const {
104 return kViewClassName; 104 return kViewClassName;
105 } 105 }
106 106
107 void ImageButton::OnPaint(gfx::Canvas* canvas) { 107 void ImageButton::OnPaint(gfx::Canvas* canvas) {
108 // Call the base class first to paint any background/borders. 108 // Call the base class first to paint any background/borders.
109 View::OnPaint(canvas); 109 View::OnPaint(canvas);
110 110
111 // TODO(estade|tdanderson|bruthig): The ink drop layer should be positioned
112 // behind the button's image which means the image needs to be painted to its
113 // own layer instead of to the Canvas.
111 gfx::ImageSkia img = GetImageToPaint(); 114 gfx::ImageSkia img = GetImageToPaint();
112 115
113 if (!img.isNull()) { 116 if (!img.isNull()) {
114 gfx::ScopedCanvas scoped(canvas); 117 gfx::ScopedCanvas scoped(canvas);
115 if (draw_image_mirrored_) { 118 if (draw_image_mirrored_) {
116 canvas->Translate(gfx::Vector2d(width(), 0)); 119 canvas->Translate(gfx::Vector2d(width(), 0));
117 canvas->Scale(-1, 1); 120 canvas->Scale(-1, 1);
118 } 121 }
119 122
120 gfx::Point position = ComputeImagePaintPosition(img); 123 gfx::Point position = ComputeImagePaintPosition(img);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 *tooltip = toggled_tooltip_text_; 264 *tooltip = toggled_tooltip_text_;
262 return true; 265 return true;
263 } 266 }
264 267
265 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { 268 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) {
266 ImageButton::GetAccessibleState(state); 269 ImageButton::GetAccessibleState(state);
267 GetTooltipText(gfx::Point(), &state->name); 270 GetTooltipText(gfx::Point(), &state->name);
268 } 271 }
269 272
270 } // namespace views 273 } // namespace views
OLDNEW
« ui/views/controls/button/custom_button.cc ('K') | « ui/views/controls/button/custom_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698