Commit a0b11455 authored by ananta's avatar ananta Committed by Commit bot

For multiline text use the maximum of the string height and the line height...

For multiline text use the maximum of the string height and the line height while calculating the height of the text being displayed.

The current code in the Canvas::SizeStringFloat function uses the passed in line_height while calculating the total
height for multiline text. This works for all cases except for DirectWrite where in the text height is a touch bigger
leading to it getting clipped. Example where this breaks is in the message center notifications where the line height
is hardcoded to 18. We could fix notification views. However it seems like fixing canvas_skia would be better.

BUG=429108

Review URL: https://codereview.chromium.org/692803004

Cr-Commit-Position: refs/heads/master@{#302704}
parent 504d780c
......@@ -191,7 +191,9 @@ void Canvas::SizeStringFloat(const base::string16& text,
render_text->SetText(strings[i]);
const SizeF& string_size = render_text->GetStringSizeF();
w = std::max(w, string_size.width());
h += (i > 0 && line_height > 0) ? line_height : string_size.height();
h += (i > 0 && line_height > 0) ?
std::max(static_cast<float>(line_height), string_size.height())
: string_size.height();
}
*width = w;
*height = h;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment