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

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

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to refactor ink drop animations (wired up chained EventHandler) Created 5 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
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/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/gfx/animation/throb_animation.h" 9 #include "ui/gfx/animation/throb_animation.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 329 }
330 330
331 gfx::Point label_origin(label_area.origin()); 331 gfx::Point label_origin(label_area.origin());
332 if (!image_size.IsEmpty() && adjusted_alignment != gfx::ALIGN_RIGHT) { 332 if (!image_size.IsEmpty() && adjusted_alignment != gfx::ALIGN_RIGHT) {
333 label_origin.set_x(image_origin.x() + image_size.width() + 333 label_origin.set_x(image_origin.x() + image_size.width() +
334 image_label_spacing_); 334 image_label_spacing_);
335 } 335 }
336 336
337 image_->SetBoundsRect(gfx::Rect(image_origin, image_size)); 337 image_->SetBoundsRect(gfx::Rect(image_origin, image_size));
338 label_->SetBoundsRect(gfx::Rect(label_origin, label_size)); 338 label_->SetBoundsRect(gfx::Rect(label_origin, label_size));
339 CustomButton::Layout();
339 } 340 }
340 341
341 const char* LabelButton::GetClassName() const { 342 const char* LabelButton::GetClassName() const {
342 return kViewClassName; 343 return kViewClassName;
343 } 344 }
344 345
345 void LabelButton::EnableCanvasFlippingForRTLUI(bool flip) { 346 void LabelButton::EnableCanvasFlippingForRTLUI(bool flip) {
346 CustomButton::EnableCanvasFlippingForRTLUI(flip); 347 CustomButton::EnableCanvasFlippingForRTLUI(flip);
347 image_->EnableCanvasFlippingForRTLUI(flip); 348 image_->EnableCanvasFlippingForRTLUI(flip);
348 } 349 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 GetExtraParams(params); 511 GetExtraParams(params);
511 return ui::NativeTheme::kHovered; 512 return ui::NativeTheme::kHovered;
512 } 513 }
513 514
514 void LabelButton::ResetCachedPreferredSize() { 515 void LabelButton::ResetCachedPreferredSize() {
515 cached_preferred_size_valid_ = false; 516 cached_preferred_size_valid_ = false;
516 cached_preferred_size_ = gfx::Size(); 517 cached_preferred_size_ = gfx::Size();
517 } 518 }
518 519
519 } // namespace views 520 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698