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

Unified Diff: ash/launcher/launcher_button.cc

Issue 13982004: Partial revert of dynamic sizing of launcher buttons to maintain m26 behavior of launcher for m27. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_button.cc
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc
index 546a145bd6e9876082da8d1bd9be323fc591e656..854044b023d09b2f4e54d42102ada1a0832feb23 100644
--- a/ash/launcher/launcher_button.cc
+++ b/ash/launcher/launcher_button.cc
@@ -392,17 +392,17 @@ void LauncherButton::GetAccessibleState(ui::AccessibleViewState* state) {
void LauncherButton::Layout() {
const gfx::Rect button_bounds(GetContentsBounds());
-
- int x_offset = shelf_layout_manager_->SelectValueForShelfAlignment(
- 0, kIconPad, kIconPad, 0);
- int y_offset = shelf_layout_manager_->SelectValueForShelfAlignment(
- kIconPad, 0, 0, kIconPad);
-
- int icon_width = std::min(kIconSize, button_bounds.width() - x_offset);
- int icon_height = std::min(kIconSize, button_bounds.height() - y_offset);
-
- x_offset = std::max(x_offset, (button_bounds.width() - icon_width) / 2);
- y_offset = std::max(y_offset, (button_bounds.height() - icon_height) / 2);
+ int x_offset = 0, y_offset = 0;
+ gfx::Rect icon_bounds;
+ if (shelf_layout_manager_->IsHorizontalAlignment()) {
+ icon_bounds.SetRect(
+ button_bounds.x(), button_bounds.y() + kIconPad,
+ button_bounds.width(), kIconSize);
+ } else {
+ icon_bounds.SetRect(
+ button_bounds.x() + kIconPad, button_bounds.y(),
+ kIconSize, button_bounds.height());
+ }
if (ShouldHop(state_)) {
x_offset += shelf_layout_manager_->SelectValueForShelfAlignment(
@@ -411,11 +411,7 @@ void LauncherButton::Layout() {
-kHopSpacing, 0, 0, kHopSpacing);
}
- gfx::Rect icon_bounds(
- button_bounds.x() + x_offset,
- button_bounds.y() + y_offset,
- icon_width,
- icon_height);
+ icon_bounds.Offset(x_offset, y_offset);
icon_view_->SetBoundsRect(icon_bounds);
bar_->SetBarBoundsRect(GetContentsBounds());
UpdateState();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698