From bcf07a9665b2c777b177b4b58a7381f894417c61 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 17 Apr 2013 12:12:27 +0100 Subject: Hacky fix for clipping of top of text. --- render/layout.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'render/layout.c') diff --git a/render/layout.c b/render/layout.c index d560a6d9c..18f67b7d3 100644 --- a/render/layout.c +++ b/render/layout.c @@ -4957,6 +4957,22 @@ static void layout_get_box_bbox(struct box *box, int *desc_x0, int *desc_y0, box->border[RIGHT].width; *desc_y1 = box->padding[TOP] + box->height + box->padding[BOTTOM] + box->border[BOTTOM].width; + + /* To stop the top of text getting clipped when css line-height is + * reduced, we increase the top of the descendant bbox. */ + if (box->type == BOX_BLOCK && box->style != NULL && + css_computed_overflow(box->style) == + CSS_OVERFLOW_VISIBLE && + box->object == NULL) { + css_fixed font_size = 0; + css_unit font_unit = CSS_UNIT_PT; + int text_height; + + css_computed_font_size(box->style, &font_size, &font_unit); + text_height = nscss_len2px(font_size, font_unit, box->style); + + *desc_y0 = (*desc_y0 < -text_height) ? *desc_y0 : -text_height; + } } -- cgit v1.2.3