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

Unified Diff: ui/views/controls/styled_label.cc

Issue 2722503005: Add bottom border to StyledLabel. (Closed)
Patch Set: Spacing fixed Created 3 years, 9 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 | ui/views/controls/styled_label_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/styled_label.cc
diff --git a/ui/views/controls/styled_label.cc b/ui/views/controls/styled_label.cc
index 5ad539ff653b6e47973bb0ab61d4f88139be799a..fbd480f35adacc9b0c7b00aeb4575ba44155276d 100644
--- a/ui/views/controls/styled_label.cc
+++ b/ui/views/controls/styled_label.cc
@@ -353,16 +353,19 @@ gfx::Size StyledLabel::CalculateAndDoLayout(int width, bool dry_run) {
// Calculate the size of the optional focus border, and overlap by that
// amount. Otherwise, "<a>link</a>," will render as "link ,".
gfx::Insets focus_border_insets(label->GetInsets());
- focus_border_insets += -label->View::GetInsets();
+ focus_border_insets -= label->View::GetInsets();
const gfx::Size view_size = label->GetPreferredSize();
+ const gfx::Insets insets = GetInsets();
label->SetBoundsRect(gfx::Rect(
gfx::Point(
- GetInsets().left() + x - focus_border_insets.left(),
- GetInsets().top() + line * line_height - focus_border_insets.top()),
+ insets.left() + x - focus_border_insets.left(),
+ insets.top() + line * line_height - focus_border_insets.top()),
view_size));
x += view_size.width() - focus_border_insets.width();
used_width = std::max(used_width, x);
- total_height = std::max(total_height, label->bounds().bottom());
+ total_height =
+ std::max(total_height, label->bounds().bottom() + insets.bottom() -
+ focus_border_insets.bottom());
if (!dry_run)
AddChildView(label.release());
« no previous file with comments | « no previous file | ui/views/controls/styled_label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698