mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 17:54:33 +03:00
Move strip_leading_newline to box flags.
svn path=/trunk/netsurf/; revision=11889
This commit is contained in:
parent
3707be6292
commit
be366b0e6b
@ -132,7 +132,7 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
|
||||
|
||||
box->type = BOX_INLINE;
|
||||
box->flags = 0;
|
||||
box->flags = style_owned ? box->flags | STYLE_OWNED : box->flags;
|
||||
box->flags = style_owned ? (box->flags | STYLE_OWNED) : box->flags;
|
||||
box->styles = styles;
|
||||
box->style = style;
|
||||
box->x = box->y = 0;
|
||||
@ -150,7 +150,6 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
|
||||
box->length = 0;
|
||||
box->space = 0;
|
||||
box->clone = 0;
|
||||
box->strip_leading_newline = 0;
|
||||
box->href = href;
|
||||
box->target = target;
|
||||
box->title = title;
|
||||
|
@ -120,7 +120,8 @@ typedef enum {
|
||||
typedef enum {
|
||||
NEW_LINE = 1 << 0, /* first inline on a new line */
|
||||
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 */
|
||||
} box_flags;
|
||||
|
||||
/* Sides of a box */
|
||||
@ -205,10 +206,6 @@ struct box {
|
||||
/** This box is a continuation of the previous box (eg from line
|
||||
* breaking). */
|
||||
unsigned int clone : 1;
|
||||
/** This box represents a <pre> tag which has not yet had its white
|
||||
* space stripped if possible
|
||||
*/
|
||||
unsigned int strip_leading_newline : 1;
|
||||
|
||||
char *href; /**< Link, or 0. */
|
||||
const char *target; /**< Link target, or 0. */
|
||||
|
@ -302,10 +302,10 @@ bool box_construct_element(xmlNode *n, struct content *content,
|
||||
gui_multitask();
|
||||
|
||||
/* In case the parent is a pre block, we clear the
|
||||
* strip_leading_newline flag since it is not used if we
|
||||
* PRE_STRIP flag since it is not used if we
|
||||
* follow the pre with a tag
|
||||
*/
|
||||
parent->strip_leading_newline = 0;
|
||||
parent->flags &= ~PRE_STRIP;
|
||||
|
||||
styles = box_get_style(content, parent_style, n);
|
||||
if (!styles)
|
||||
@ -824,7 +824,7 @@ bool box_construct_text(xmlNode *n, struct content *content,
|
||||
current = text;
|
||||
|
||||
/* swallow a single leading new line */
|
||||
if (parent->strip_leading_newline) {
|
||||
if (parent->flags & PRE_STRIP) {
|
||||
switch (*current) {
|
||||
case '\n':
|
||||
current++; break;
|
||||
@ -833,7 +833,7 @@ bool box_construct_text(xmlNode *n, struct content *content,
|
||||
if (*current == '\n') current++;
|
||||
break;
|
||||
}
|
||||
parent->strip_leading_newline = 0;
|
||||
parent->flags &= ~PRE_STRIP;
|
||||
}
|
||||
|
||||
do {
|
||||
@ -1079,7 +1079,7 @@ bool box_br(BOX_SPECIAL_PARAMS)
|
||||
|
||||
bool box_pre(BOX_SPECIAL_PARAMS)
|
||||
{
|
||||
box->strip_leading_newline = 1;
|
||||
box->flags |= PRE_STRIP;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user