summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/layout.c16
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;
+ }
}