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

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

Issue 2072513003: Fix StyledLabel so it doesn't clip the bottom of Hindi text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move GetClassName Created 4 years, 6 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 | « chrome/browser/ui/views/sync/bubble_sync_promo_view.cc ('k') | no next file » | 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 18e2bb95b92321fd3038ea45fe935677f57824dd..1b4cf1c93aaa038342e0949d9ce75ff1a78478d3 100644
--- a/ui/views/controls/styled_label.cc
+++ b/ui/views/controls/styled_label.cc
@@ -249,6 +249,7 @@ gfx::Size StyledLabel::CalculateAndDoLayout(int width, bool dry_run) {
// The x position (in pixels) of the line we're on, relative to content
// bounds.
int x = 0;
+ int total_height = 0;
// The width that was actually used. Guaranteed to be no larger than |width|.
int used_width = 0;
@@ -349,16 +350,16 @@ gfx::Size StyledLabel::CalculateAndDoLayout(int width, bool dry_run) {
gfx::Insets focus_border_insets(label->GetInsets());
focus_border_insets += -label->View::GetInsets();
const gfx::Size view_size = label->GetPreferredSize();
- if (!dry_run) {
- label->SetBoundsRect(gfx::Rect(
- gfx::Point(GetInsets().left() + x - focus_border_insets.left(),
- GetInsets().top() + line * line_height -
- focus_border_insets.top()),
- view_size));
- AddChildView(label.release());
- }
+ label->SetBoundsRect(gfx::Rect(
+ gfx::Point(
+ GetInsets().left() + x - focus_border_insets.left(),
+ GetInsets().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());
+ if (!dry_run)
+ AddChildView(label.release());
// If |gfx::ElideRectangleText| returned more than one substring, that
// means the whole text did not fit into remaining line width, with text
@@ -374,10 +375,6 @@ gfx::Size StyledLabel::CalculateAndDoLayout(int width, bool dry_run) {
}
DCHECK_LE(used_width, width);
- // The user-specified line height only applies to interline spacing, so the
- // final line's height is unaffected.
- int total_height = line * line_height +
- CalculateLineHeight(font_list_) + GetInsets().height();
calculated_size_ = gfx::Size(used_width + GetInsets().width(), total_height);
return calculated_size_;
}
« no previous file with comments | « chrome/browser/ui/views/sync/bubble_sync_promo_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698