mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
Make box flags and move new line indicator to it.
svn path=/trunk/netsurf/; revision=11886
This commit is contained in:
parent
4aef849eba
commit
f744c9dfa0
@ -131,6 +131,7 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
|
||||
talloc_set_destructor(box, free_box_style);
|
||||
|
||||
box->type = BOX_INLINE;
|
||||
box->flags = 0;
|
||||
box->styles = styles;
|
||||
box->style = style;
|
||||
box->style_owned = style_owned;
|
||||
@ -156,7 +157,6 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
|
||||
box->columns = 1;
|
||||
box->rows = 1;
|
||||
box->start_column = 0;
|
||||
box->inline_new_line = false;
|
||||
box->printed = false;
|
||||
box->next = NULL;
|
||||
box->prev = NULL;
|
||||
|
10
render/box.h
10
render/box.h
@ -115,6 +115,12 @@ typedef enum {
|
||||
BOX_INLINE_END, BOX_NONE
|
||||
} box_type;
|
||||
|
||||
|
||||
/** Type of a struct box. */
|
||||
typedef enum {
|
||||
NEW_LINE = 1 << 0 /* first inline on a new line */
|
||||
} box_flags;
|
||||
|
||||
/* Sides of a box */
|
||||
enum box_side { TOP, RIGHT, BOTTOM, LEFT };
|
||||
|
||||
@ -132,6 +138,9 @@ struct box {
|
||||
/** Type of box. */
|
||||
box_type type;
|
||||
|
||||
/** Box flags */
|
||||
box_flags flags;
|
||||
|
||||
/** Computed styles for elements and their pseudo elements. NULL on
|
||||
* non-element boxes. */
|
||||
css_select_results *styles;
|
||||
@ -219,7 +228,6 @@ struct box {
|
||||
/** INLINE_END box corresponding to this INLINE box, or INLINE box
|
||||
* corresponding to this INLINE_END box. */
|
||||
struct box *inline_end;
|
||||
bool inline_new_line;
|
||||
|
||||
/** First float child box, or 0. Float boxes are in the tree twice, in
|
||||
* this list for the block box which defines the area for floats, and
|
||||
|
@ -528,7 +528,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
|
||||
ib_b_right = ib->border[RIGHT].width * scale;
|
||||
}
|
||||
|
||||
if (ib->inline_new_line && ib != box) {
|
||||
if ((ib->flags & NEW_LINE) && ib != box) {
|
||||
/* inline element has wrapped, plot background
|
||||
* and borders */
|
||||
if (!html_redraw_inline_background(
|
||||
|
@ -2560,7 +2560,7 @@ bool layout_line(struct box *first, int *width, int *y,
|
||||
}
|
||||
|
||||
for (d = first; d != b; d = d->next) {
|
||||
d->inline_new_line = false;
|
||||
d->flags &= ~NEW_LINE;
|
||||
|
||||
if (d->type == BOX_INLINE_BLOCK &&
|
||||
(css_computed_position(d->style) ==
|
||||
@ -2601,7 +2601,7 @@ bool layout_line(struct box *first, int *width, int *y,
|
||||
}
|
||||
}
|
||||
|
||||
first->inline_new_line = true;
|
||||
first->flags |= NEW_LINE;
|
||||
|
||||
assert(b != first || (move_y && 0 < used_height && (left || right)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user