mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-17 16:19:18 +03:00
parent
7063846614
commit
a05b5fcff4
@ -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;
|
||||
* 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_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;
|
||||
}
|
||||
} 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 */
|
||||
|
Loading…
Reference in New Issue
Block a user