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

Unified Diff: ash/shelf/shelf_button.cc

Issue 1907363004: (Merge to M-51) Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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 | « ash/shelf/shelf_bezel_event_filter.cc ('k') | ash/shelf/shelf_layout_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_button.cc
diff --git a/ash/shelf/shelf_button.cc b/ash/shelf/shelf_button.cc
index 7a805bd99388f9bac7de93d1392259e550d27104..328fe5180694112bd59d89976e3d58ababbcc2a2 100644
--- a/ash/shelf/shelf_button.cc
+++ b/ash/shelf/shelf_button.cc
@@ -180,7 +180,7 @@ class ShelfButton::BarView : public views::ImageView,
double animation = animating_ ?
ShelfButtonAnimation::GetInstance()->GetAnimation() : 1.0;
double scale = .35 + .65 * animation;
- if (shelf_->alignment() == SHELF_ALIGNMENT_BOTTOM) {
+ if (shelf_->IsHorizontalAlignment()) {
int width = base_bounds_.width() * scale;
bounds.set_width(std::min(width, kIconSize));
int x_offset = (base_bounds_.width() - bounds.width()) / 2;
@@ -485,19 +485,16 @@ void ShelfButton::UpdateBar() {
bar_id = IDR_ASH_SHELF_UNDERLINE_RUNNING;
if (bar_id != 0) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- const gfx::ImageSkia* image = rb.GetImageNamed(bar_id).ToImageSkia();
-
Shelf* shelf = shelf_view_->shelf();
- if (shelf->alignment() == SHELF_ALIGNMENT_BOTTOM) {
- bar_->SetImage(*image);
- } else {
- bar_->SetImage(gfx::ImageSkiaOperations::CreateRotatedImage(
- *image, shelf->SelectValueForShelfAlignment(
- SkBitmapOperations::ROTATION_90_CW,
- SkBitmapOperations::ROTATION_90_CW,
- SkBitmapOperations::ROTATION_270_CW)));
+ ResourceBundle* rb = &ResourceBundle::GetSharedInstance();
+ gfx::ImageSkia image = *rb->GetImageNamed(bar_id).ToImageSkia();
+ if (!shelf->IsHorizontalAlignment()) {
+ image = gfx::ImageSkiaOperations::CreateRotatedImage(
+ image, shelf->alignment() == SHELF_ALIGNMENT_LEFT
+ ? SkBitmapOperations::ROTATION_90_CW
+ : SkBitmapOperations::ROTATION_270_CW);
}
+ bar_->SetImage(image);
bar_->SetHorizontalAlignment(shelf->SelectValueForShelfAlignment(
views::ImageView::CENTER, views::ImageView::LEADING,
views::ImageView::TRAILING));
« no previous file with comments | « ash/shelf/shelf_bezel_event_filter.cc ('k') | ash/shelf/shelf_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698