Index: ui/gfx/render_text_pango.cc |
diff --git a/ui/gfx/render_text_pango.cc b/ui/gfx/render_text_pango.cc |
index 86a52425a00e60ce9a66a538f61b9a4139fc9be9..07cbfb93cdf5c0e71d09261b618bd009028ba17c 100644 |
--- a/ui/gfx/render_text_pango.cc |
+++ b/ui/gfx/render_text_pango.cc |
@@ -55,11 +55,20 @@ void SetPangoUnderlineMetrics(PangoFontDescription *desc, |
// Pango returns the position "above the baseline". Change its sign to convert |
// it to a vertical offset from the baseline. |
int position = -pango_font_metrics_get_underline_position(metrics); |
- pango_quantize_line_geometry(&thickness, &position); |
+ |
// Note: pango_quantize_line_geometry() guarantees pixel boundaries, so |
// PANGO_PIXELS() is safe to use. |
- renderer->SetUnderlineMetrics(PANGO_PIXELS(thickness), |
- PANGO_PIXELS(position)); |
+ pango_quantize_line_geometry(&thickness, &position); |
+ int thickness_pixels = PANGO_PIXELS(thickness); |
+ int position_pixels = PANGO_PIXELS(position); |
+ |
+ // Ugly hack: make sure that underlines don't get clipped. See |
+ // http://crbug.com/393117. |
+ int descent_pixels = PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); |
Daniel Erat
2014/08/28 20:37:23
it's also possible that this isn't the right fix a
msw
2014/08/29 00:41:55
I honestly don't know the Pango underline code tha
|
+ position_pixels = std::min(position_pixels, |
+ descent_pixels - thickness_pixels); |
+ |
+ renderer->SetUnderlineMetrics(thickness_pixels, position_pixels); |
} |
} // namespace |