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

Unified Diff: ui/views/controls/button/label_button.cc

Issue 872113004: Modified OverviewMode's LabelButton bounds to cover the entire item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary changes from unittests Created 5 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/button/label_button.cc
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index 0387e1d641e64caa1bb93dc934811e27945bee58..5378dec1033f6ffd5d5eeba58a3fd4422bcd00a2 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -70,7 +70,8 @@ LabelButton::LabelButton(ButtonListener* listener, const base::string16& text)
is_default_(false),
style_(STYLE_TEXTBUTTON),
border_is_themed_border_(true),
- image_label_spacing_(kSpacing) {
+ image_label_spacing_(kSpacing),
+ ignore_vertical_overlap_(true) {
SetAnimationDuration(kHoverAnimationDurationMs);
SetText(text);
@@ -297,7 +298,9 @@ void LabelButton::Layout() {
// views are centered. In that case, using the tighter preferred label width
// avoids wasted space within the label that would look like awkward padding.
// Labels can paint over the full button height, including the border height.
- gfx::Size label_size(child_area.width(), height());
+ gfx::Size label_size(child_area.width(), ignore_vertical_overlap_
+ ? height()
+ : child_area.height());
if (!image_size.IsEmpty() && !label_size.IsEmpty()) {
label_size.set_width(std::max(child_area.width() -
image_size.width() - image_label_spacing_, 0));
@@ -320,7 +323,8 @@ void LabelButton::Layout() {
image_origin.Offset(child_area.width() - image_size.width(), 0);
}
- gfx::Point label_origin(child_area.x(), 0);
+ gfx::Point label_origin(child_area.x(),
+ ignore_vertical_overlap_ ? 0 : child_area.y());
flackr 2015/01/30 15:34:04 Out of curiosity, can you tell from the git histor
Nina 2015/01/30 15:44:32 It's required by the bookmark bar: https://coderev
sky 2015/02/03 21:40:02 This seems suspicious to me. If BookmarkBar wants
msw 2015/02/03 23:50:19 Ignoring the vertical insets for text rendering wa
Nina 2015/02/04 16:20:11 Acknowledged.
flackr 2015/02/04 16:39:08 So it sounds like if we ignore borders for the pur
if (!image_size.IsEmpty() && adjusted_alignment != gfx::ALIGN_RIGHT) {
label_origin.set_x(image_origin.x() + image_size.width() +
image_label_spacing_);
« ash/wm/overview/window_selector_item.cc ('K') | « ui/views/controls/button/label_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698