| OLD | NEW |
| 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 "chrome/browser/ui/views/location_bar/location_bar_layout.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 first_visible = false; | 158 first_visible = false; |
| 159 int x = (position_ == LEFT_EDGE) | 159 int x = (position_ == LEFT_EDGE) |
| 160 ? (bounds->x() + padding) | 160 ? (bounds->x() + padding) |
| 161 : (bounds->right() - padding - decoration->computed_width); | 161 : (bounds->right() - padding - decoration->computed_width); |
| 162 decoration->view->SetBounds(x, decoration->y, decoration->computed_width, | 162 decoration->view->SetBounds(x, decoration->y, decoration->computed_width, |
| 163 decoration->height); | 163 decoration->height); |
| 164 bounds->set_width(bounds->width() - padding - decoration->computed_width); | 164 bounds->set_width(bounds->width() - padding - decoration->computed_width); |
| 165 if (position_ == LEFT_EDGE) | 165 if (position_ == LEFT_EDGE) |
| 166 bounds->set_x(bounds->x() + padding + decoration->computed_width); | 166 bounds->set_x(bounds->x() + padding + decoration->computed_width); |
| 167 } | 167 } |
| 168 bounds->set_width(bounds->width() - item_edit_padding_); | 168 // Only apply the edit padding if there's a visible decoration to pad against. |
| 169 if (position_ == LEFT_EDGE) | 169 if (!first_visible) { |
| 170 bounds->set_x(bounds->x() + item_edit_padding_); | 170 bounds->set_width(bounds->width() - item_edit_padding_); |
| 171 if (position_ == LEFT_EDGE) |
| 172 bounds->set_x(bounds->x() + item_edit_padding_); |
| 173 } |
| 171 } | 174 } |
| OLD | NEW |