diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-04-17 12:12:27 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-04-17 12:18:08 +0100 |
commit | bcf07a9665b2c777b177b4b58a7381f894417c61 (patch) | |
tree | 972cea705da0698c4ea5bf0a0d34e3b9007d0bbb /render | |
parent | 69a26c50a3538682427c9c0dfa12f7d394d3e161 (diff) | |
download | netsurf-bcf07a9665b2c777b177b4b58a7381f894417c61.tar.gz netsurf-bcf07a9665b2c777b177b4b58a7381f894417c61.tar.bz2 |
Hacky fix for clipping of top of text.
Diffstat (limited to 'render')
-rw-r--r-- | render/layout.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; + } } |