mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
Make sure the last clone box for a wrapped text is properly measuered.
svn path=/trunk/netsurf/; revision=11920
This commit is contained in:
parent
f892e59d76
commit
9be22ab590
@ -122,7 +122,8 @@ typedef enum {
|
|||||||
STYLE_OWNED = 1 << 1, /* style is owned by this box */
|
STYLE_OWNED = 1 << 1, /* style is owned by this box */
|
||||||
PRINTED = 1 << 2, /* box has already been printed */
|
PRINTED = 1 << 2, /* box has already been printed */
|
||||||
PRE_STRIP = 1 << 3, /* PRE tag needing leading newline stripped */
|
PRE_STRIP = 1 << 3, /* PRE tag needing leading newline stripped */
|
||||||
CLONE = 1 << 4 /* continuation of previous box from wrapping */
|
CLONE = 1 << 4, /* continuation of previous box from wrapping */
|
||||||
|
MEASURED = 1 << 5 /* text box width has been measured */
|
||||||
} box_flags;
|
} box_flags;
|
||||||
|
|
||||||
/* Sides of a box */
|
/* Sides of a box */
|
||||||
|
@ -1950,11 +1950,13 @@ static bool layout_text_box_split(struct content *content,
|
|||||||
|
|
||||||
/* Set c2 according to the remaining text */
|
/* Set c2 according to the remaining text */
|
||||||
c2->width -= new_width + space_width;
|
c2->width -= new_width + space_width;
|
||||||
|
c2->flags &= ~MEASURED; /* width has been estimated */
|
||||||
c2->length = split_box->length - (new_length + 1);
|
c2->length = split_box->length - (new_length + 1);
|
||||||
|
|
||||||
/* Update split_box for its reduced text */
|
/* Update split_box for its reduced text */
|
||||||
split_box->length = new_length;
|
split_box->length = new_length;
|
||||||
split_box->width = new_width;
|
split_box->width = new_width;
|
||||||
|
split_box->flags |= MEASURED;
|
||||||
|
|
||||||
/* Insert c2 into box list */
|
/* Insert c2 into box list */
|
||||||
c2->next = split_box->next;
|
c2->next = split_box->next;
|
||||||
@ -2166,9 +2168,20 @@ bool layout_line(struct box *first, int *width, int *y,
|
|||||||
} else {
|
} else {
|
||||||
font_func->font_width(&fstyle, b->text,
|
font_func->font_width(&fstyle, b->text,
|
||||||
b->length, &b->width);
|
b->length, &b->width);
|
||||||
|
b->flags |= MEASURED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the current text has not been measured (i.e. its
|
||||||
|
* width was estimated after splitting), and it fits on
|
||||||
|
* the line, measure it properly. */
|
||||||
|
if (b->text && (x + b->width < x1 - x0) &&
|
||||||
|
!(b->flags & MEASURED)) {
|
||||||
|
font_func->font_width(&fstyle, b->text,
|
||||||
|
b->length, &b->width);
|
||||||
|
b->flags |= MEASURED;
|
||||||
|
}
|
||||||
|
|
||||||
x += b->width;
|
x += b->width;
|
||||||
if (b->space == UNKNOWN_WIDTH) {
|
if (b->space == UNKNOWN_WIDTH) {
|
||||||
font_func->font_width(&fstyle, " ", 1,
|
font_func->font_width(&fstyle, " ", 1,
|
||||||
@ -2782,6 +2795,7 @@ struct box *layout_minmax_line(struct box *first,
|
|||||||
} else {
|
} else {
|
||||||
font_func->font_width(&fstyle, b->text,
|
font_func->font_width(&fstyle, b->text,
|
||||||
b->length, &b->width);
|
b->length, &b->width);
|
||||||
|
b->flags |= MEASURED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
max += b->width;
|
max += b->width;
|
||||||
@ -3826,6 +3840,7 @@ void layout_lists(struct box *box,
|
|||||||
marker->text,
|
marker->text,
|
||||||
marker->length,
|
marker->length,
|
||||||
&marker->width);
|
&marker->width);
|
||||||
|
marker->flags |= MEASURED;
|
||||||
}
|
}
|
||||||
marker->x = -marker->width;
|
marker->x = -marker->width;
|
||||||
marker->y = 0;
|
marker->y = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user