From a05b5fcff48946fd5fee4204e3afb80ff4450e2e Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 18 Jul 2014 20:09:20 +0100 Subject: Always treat root element as overflow:visible. Fixes bug #2149. --- render/html_redraw.c | 97 +++++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 47 deletions(-) (limited to 'render') diff --git a/render/html_redraw.c b/render/html_redraw.c index 2ceb23934..92b70fec7 100644 --- a/render/html_redraw.c +++ b/render/html_redraw.c @@ -1907,7 +1907,6 @@ bool html_redraw_box(const html_content *html, struct box *box, css_computed_clip_rect css_rect; enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE; enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE; - bool need_clip; if (html_redraw_printing && (box->flags & PRINTED)) return true; @@ -1954,7 +1953,8 @@ bool html_redraw_box(const html_content *html, struct box *box, } /* calculate rectangle covering this box and descendants */ - if (box->style && overflow_x != CSS_OVERFLOW_VISIBLE) { + if (box->style && overflow_x != CSS_OVERFLOW_VISIBLE && + box->parent != NULL) { /* box contents clipped to box size */ r.x0 = x - border_left; r.x1 = x + padding_width + border_right; @@ -1987,7 +1987,8 @@ bool html_redraw_box(const html_content *html, struct box *box, } /* calculate rectangle covering this box and descendants */ - if (box->style && overflow_y != CSS_OVERFLOW_VISIBLE) { + if (box->style && overflow_y != CSS_OVERFLOW_VISIBLE && + box->parent != NULL) { /* box contents clipped to box size */ r.y0 = y - border_top; r.y1 = y + padding_height + border_bottom; @@ -2330,51 +2331,53 @@ bool html_redraw_box(const html_content *html, struct box *box, } /* clip to the padding edge for objects, or boxes with overflow hidden - * or scroll */ - need_clip = false; - if (box->object || box->flags & IFRAME || - (overflow_x != CSS_OVERFLOW_VISIBLE && - overflow_y != CSS_OVERFLOW_VISIBLE)) { - r.x0 = x; - r.y0 = y; - r.x1 = x + padding_width; - r.y1 = y + padding_height; - if (r.x0 < clip->x0) r.x0 = clip->x0; - if (r.y0 < clip->y0) r.y0 = clip->y0; - if (clip->x1 < r.x1) r.x1 = clip->x1; - if (clip->y1 < r.y1) r.y1 = clip->y1; - if (r.x1 <= r.x0 || r.y1 <= r.y0) - return ((!plot->group_end) || (plot->group_end())); - need_clip = true; - - } else if (overflow_x != CSS_OVERFLOW_VISIBLE) { - r.x0 = x; - r.y0 = clip->y0; - r.x1 = x + padding_width; - r.y1 = clip->y1; - if (r.x0 < clip->x0) r.x0 = clip->x0; - if (clip->x1 < r.x1) r.x1 = clip->x1; - if (r.x1 <= r.x0) - return ((!plot->group_end) || (plot->group_end())); - need_clip = true; - - } else if (overflow_y != CSS_OVERFLOW_VISIBLE) { - r.x0 = clip->x0; - r.y0 = y; - r.x1 = clip->x1; - r.y1 = y + padding_height; - if (r.y0 < clip->y0) r.y0 = clip->y0; - if (clip->y1 < r.y1) r.y1 = clip->y1; - if (r.y1 <= r.y0) - return ((!plot->group_end) || (plot->group_end())); - need_clip = true; - } + * or scroll, unless it's the root element */ + if (box->parent != NULL) { + bool need_clip = false; + if (box->object || box->flags & IFRAME || + (overflow_x != CSS_OVERFLOW_VISIBLE && + overflow_y != CSS_OVERFLOW_VISIBLE)) { + r.x0 = x; + r.y0 = y; + r.x1 = x + padding_width; + r.y1 = y + padding_height; + if (r.x0 < clip->x0) r.x0 = clip->x0; + if (r.y0 < clip->y0) r.y0 = clip->y0; + if (clip->x1 < r.x1) r.x1 = clip->x1; + if (clip->y1 < r.y1) r.y1 = clip->y1; + if (r.x1 <= r.x0 || r.y1 <= r.y0) + return (!plot->group_end || plot->group_end()); + need_clip = true; + + } else if (overflow_x != CSS_OVERFLOW_VISIBLE) { + r.x0 = x; + r.y0 = clip->y0; + r.x1 = x + padding_width; + r.y1 = clip->y1; + if (r.x0 < clip->x0) r.x0 = clip->x0; + if (clip->x1 < r.x1) r.x1 = clip->x1; + if (r.x1 <= r.x0) + return (!plot->group_end || plot->group_end()); + need_clip = true; + + } else if (overflow_y != CSS_OVERFLOW_VISIBLE) { + r.x0 = clip->x0; + r.y0 = y; + r.x1 = clip->x1; + r.y1 = y + padding_height; + if (r.y0 < clip->y0) r.y0 = clip->y0; + if (clip->y1 < r.y1) r.y1 = clip->y1; + if (r.y1 <= r.y0) + return (!plot->group_end || plot->group_end()); + need_clip = true; + } - if (need_clip && (box->type == BOX_BLOCK || - box->type == BOX_INLINE_BLOCK || - box->type == BOX_TABLE_CELL || box->object)) { - if (!plot->clip(&r)) - return false; + if (need_clip && (box->type == BOX_BLOCK || + box->type == BOX_INLINE_BLOCK || + box->type == BOX_TABLE_CELL || box->object)) { + if (!plot->clip(&r)) + return false; + } } /* text decoration */ -- cgit v1.2.3