|
|
@@ -182,10 +182,13 @@ struct lay {
|
|
|
int left, right;
|
|
|
int y;
|
|
|
int line_x, line_y, line_h;
|
|
|
+ int line_left, line_right;
|
|
|
int run_x;
|
|
|
int align;
|
|
|
int depth;
|
|
|
int space_pending;
|
|
|
+ unsigned char float_active;
|
|
|
+ int float_left, float_right, float_bottom;
|
|
|
struct lay_run runs[96];
|
|
|
int nruns;
|
|
|
};
|
|
|
@@ -576,6 +579,148 @@ static int js_host_rect(unsigned int node, int *x, int *y, int *w, int *h)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+static void form_copy_out(const char *s, char *buf, int cap)
|
|
|
+{
|
|
|
+ int i = 0;
|
|
|
+
|
|
|
+ if (!buf || cap <= 0)
|
|
|
+ return;
|
|
|
+ while (s && s[i] && i + 1 < cap) {
|
|
|
+ buf[i] = s[i];
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ buf[i] = '\0';
|
|
|
+}
|
|
|
+
|
|
|
+static int js_host_form_value(unsigned int node, char *buf, int cap)
|
|
|
+{
|
|
|
+ struct form_state *fs;
|
|
|
+ int kind;
|
|
|
+
|
|
|
+ if (!form_is_control(node))
|
|
|
+ return 0;
|
|
|
+ kind = form_kind_of(node);
|
|
|
+ if (kind == FORM_CHECKBOX || kind == FORM_RADIO)
|
|
|
+ return 0;
|
|
|
+ if (kind == FORM_SELECT) {
|
|
|
+ char opt[64] = "";
|
|
|
+ unsigned int c, i = 0;
|
|
|
+
|
|
|
+ fs = form_get(node, 1);
|
|
|
+ if (!fs)
|
|
|
+ return 0;
|
|
|
+ form_option_text(node, fs->selected, opt, sizeof(opt));
|
|
|
+ for (c = doc.nodes[node].first; c; c = doc.nodes[c].next) {
|
|
|
+ if (doc.nodes[c].type != BR_NODE_ELEM ||
|
|
|
+ doc.nodes[c].tag != BR_TAG_OPTION)
|
|
|
+ continue;
|
|
|
+ if (i == fs->selected) {
|
|
|
+ const char *v = br_value(&doc, c);
|
|
|
+ if (v && v[0])
|
|
|
+ form_copy_out(v, buf, cap);
|
|
|
+ else
|
|
|
+ form_copy_out(opt, buf, cap);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ form_copy_out(opt, buf, cap);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ fs = form_get(node, 1);
|
|
|
+ if (!fs)
|
|
|
+ return 0;
|
|
|
+ form_copy_out(fs->value, buf, cap);
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+static int js_host_form_checked(unsigned int node)
|
|
|
+{
|
|
|
+ struct form_state *fs;
|
|
|
+ int kind;
|
|
|
+
|
|
|
+ if (!form_is_control(node))
|
|
|
+ return -1;
|
|
|
+ kind = form_kind_of(node);
|
|
|
+ if (kind != FORM_CHECKBOX && kind != FORM_RADIO)
|
|
|
+ return -1;
|
|
|
+ fs = form_get(node, 1);
|
|
|
+ return fs ? fs->checked : 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int js_host_form_selected(unsigned int node)
|
|
|
+{
|
|
|
+ struct form_state *fs;
|
|
|
+
|
|
|
+ if (!form_is_control(node) || form_kind_of(node) != FORM_SELECT)
|
|
|
+ return -1;
|
|
|
+ fs = form_get(node, 1);
|
|
|
+ return fs ? fs->selected : 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int js_host_form_set_value(unsigned int node, const char *value)
|
|
|
+{
|
|
|
+ struct form_state *fs;
|
|
|
+ unsigned int n;
|
|
|
+
|
|
|
+ if (!form_is_control(node))
|
|
|
+ return 0;
|
|
|
+ fs = form_get(node, 1);
|
|
|
+ if (!fs)
|
|
|
+ return 0;
|
|
|
+ n = s_len(value ? value : "");
|
|
|
+ if (n > FORM_VALUE_MAX)
|
|
|
+ n = FORM_VALUE_MAX;
|
|
|
+ for (unsigned int i = 0; i < n; i++)
|
|
|
+ fs->value[i] = value[i];
|
|
|
+ fs->value[n] = '\0';
|
|
|
+ fs->len = (unsigned char)n;
|
|
|
+ fs->caret = (unsigned char)n;
|
|
|
+ layout_valid = 0;
|
|
|
+ ngui_invalidate(&ui);
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+static int js_host_form_set_checked(unsigned int node, int checked)
|
|
|
+{
|
|
|
+ struct form_state *fs;
|
|
|
+ int kind;
|
|
|
+
|
|
|
+ if (!form_is_control(node))
|
|
|
+ return 0;
|
|
|
+ kind = form_kind_of(node);
|
|
|
+ if (kind != FORM_CHECKBOX && kind != FORM_RADIO)
|
|
|
+ return 0;
|
|
|
+ fs = form_get(node, 1);
|
|
|
+ if (!fs)
|
|
|
+ return 0;
|
|
|
+ fs->checked = (unsigned char)(checked != 0);
|
|
|
+ layout_valid = 0;
|
|
|
+ ngui_invalidate(&ui);
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+static int js_host_form_set_selected(unsigned int node, int index)
|
|
|
+{
|
|
|
+ struct form_state *fs;
|
|
|
+ unsigned int n;
|
|
|
+
|
|
|
+ if (!form_is_control(node) || form_kind_of(node) != FORM_SELECT)
|
|
|
+ return 0;
|
|
|
+ fs = form_get(node, 1);
|
|
|
+ if (!fs)
|
|
|
+ return 0;
|
|
|
+ n = form_option_count(node);
|
|
|
+ if (index < 0)
|
|
|
+ index = 0;
|
|
|
+ if (n && (unsigned int)index >= n)
|
|
|
+ index = (int)n - 1;
|
|
|
+ fs->selected = (unsigned char)index;
|
|
|
+ layout_valid = 0;
|
|
|
+ ngui_invalidate(&ui);
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
static int fetch_script_text(const char *url, unsigned char **out,
|
|
|
unsigned int *outlen, char *err,
|
|
|
unsigned int errcap);
|
|
|
@@ -611,6 +756,12 @@ static void run_page_scripts(void)
|
|
|
host.navigate = js_host_navigate;
|
|
|
host.changed = js_host_changed;
|
|
|
host.rect = js_host_rect;
|
|
|
+ host.form_value = js_host_form_value;
|
|
|
+ host.form_checked = js_host_form_checked;
|
|
|
+ host.form_selected = js_host_form_selected;
|
|
|
+ host.form_set_value = js_host_form_set_value;
|
|
|
+ host.form_set_checked = js_host_form_set_checked;
|
|
|
+ host.form_set_selected = js_host_form_set_selected;
|
|
|
host.page_url = page_url;
|
|
|
host.width = ui.w;
|
|
|
host.height = ui.h;
|
|
|
@@ -2738,16 +2889,37 @@ static int run_width(const struct lay_run *r)
|
|
|
return (int)r->w;
|
|
|
}
|
|
|
|
|
|
+static void start_line(struct lay *l, const struct br_style *st)
|
|
|
+{
|
|
|
+ (void)st;
|
|
|
+ if (l->nruns == 0) {
|
|
|
+ l->line_y = l->y;
|
|
|
+ l->line_h = 0;
|
|
|
+ }
|
|
|
+ l->line_left = l->left;
|
|
|
+ l->line_right = l->right;
|
|
|
+ if (l->float_active && l->line_y < l->float_bottom) {
|
|
|
+ if (l->float_left > l->line_left)
|
|
|
+ l->line_left = l->float_left;
|
|
|
+ if (l->float_right < l->line_right)
|
|
|
+ l->line_right = l->float_right;
|
|
|
+ }
|
|
|
+ if (l->line_right < l->line_left + 8)
|
|
|
+ l->line_right = l->line_left + 8;
|
|
|
+ l->line_x = l->line_left;
|
|
|
+ l->run_x = l->line_left;
|
|
|
+}
|
|
|
+
|
|
|
static void flush_line(struct lay *l)
|
|
|
{
|
|
|
int total, x, i, vis;
|
|
|
|
|
|
- if (!l->nruns && l->line_x == l->left) {
|
|
|
+ if (!l->nruns && l->line_x == l->line_left) {
|
|
|
l->line_h = 0;
|
|
|
return;
|
|
|
}
|
|
|
- total = l->line_x - l->left;
|
|
|
- x = l->left;
|
|
|
+ total = l->line_x - l->line_left;
|
|
|
+ x = l->line_left;
|
|
|
vis = 1;
|
|
|
if (l->draw) {
|
|
|
int lh = l->line_h ? l->line_h : 16;
|
|
|
@@ -2756,11 +2928,11 @@ static void flush_line(struct lay *l)
|
|
|
l->line_y <= page_rect.y + page_rect.h;
|
|
|
}
|
|
|
if (l->align == BR_ALIGN_CENTER)
|
|
|
- x += (l->right - l->left - total) / 2;
|
|
|
+ x += (l->line_right - l->line_left - total) / 2;
|
|
|
else if (l->align == BR_ALIGN_RIGHT)
|
|
|
- x = l->right - total;
|
|
|
- if (x < l->left)
|
|
|
- x = l->left;
|
|
|
+ x = l->line_right - total;
|
|
|
+ if (x < l->line_left)
|
|
|
+ x = l->line_left;
|
|
|
for (i = 0; i < l->nruns; i++) {
|
|
|
struct lay_run *r = &l->runs[i];
|
|
|
int w = run_width(r);
|
|
|
@@ -2921,9 +3093,13 @@ static void flush_line(struct lay *l)
|
|
|
x += w;
|
|
|
}
|
|
|
l->y += l->line_h + 2;
|
|
|
+ if (l->float_active && l->y >= l->float_bottom)
|
|
|
+ l->float_active = 0;
|
|
|
l->nruns = 0;
|
|
|
l->line_x = l->left;
|
|
|
l->run_x = l->left;
|
|
|
+ l->line_left = l->left;
|
|
|
+ l->line_right = l->right;
|
|
|
l->line_h = 0;
|
|
|
l->space_pending = 0;
|
|
|
}
|
|
|
@@ -2942,6 +3118,7 @@ static void add_run(struct lay *l, unsigned short off, unsigned short len,
|
|
|
if (l->nruns == 0) {
|
|
|
l->line_y = l->y;
|
|
|
l->line_h = 0;
|
|
|
+ start_line(l, st);
|
|
|
}
|
|
|
{
|
|
|
struct lay_run *r = &l->runs[l->nruns++];
|
|
|
@@ -3009,11 +3186,14 @@ static void add_image_run(struct lay *l, unsigned int node,
|
|
|
|
|
|
if (idx >= 0 && idx < image_count && images[idx].state == 1)
|
|
|
bi = &images[idx];
|
|
|
- if (l->space_pending && (l->nruns > 0 || l->line_x > l->left)) {
|
|
|
+ if (l->nruns == 0)
|
|
|
+ start_line(l, st);
|
|
|
+ if (l->space_pending &&
|
|
|
+ (l->nruns > 0 || l->line_x > l->line_left)) {
|
|
|
int sp = (int)ngui_text_width_px(l->ui, " ", 1, st->font_px,
|
|
|
st->bold, st->italic,
|
|
|
st->mono);
|
|
|
- if (l->line_x + sp <= l->right)
|
|
|
+ if (l->line_x + sp <= l->line_right)
|
|
|
l->line_x += sp;
|
|
|
}
|
|
|
l->space_pending = 0;
|
|
|
@@ -3031,8 +3211,8 @@ static void add_image_run(struct lay *l, unsigned int node,
|
|
|
s_append(tmp, &n, "]", sizeof(tmp));
|
|
|
w = (int)ngui_text_width_px(l->ui, tmp, n, gs.font_px,
|
|
|
gs.bold, gs.italic, gs.mono);
|
|
|
- if (l->line_x + w > l->right &&
|
|
|
- (l->nruns > 0 || l->line_x > l->left))
|
|
|
+ if (l->line_x + w > l->line_right &&
|
|
|
+ (l->nruns > 0 || l->line_x > l->line_left))
|
|
|
flush_line(l);
|
|
|
add_run(l, 0, 0, &gs, href, tmp);
|
|
|
if (!l->draw) {
|
|
|
@@ -3049,7 +3229,7 @@ static void add_image_run(struct lay *l, unsigned int node,
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- maxw = l->right - l->left;
|
|
|
+ maxw = l->line_right - l->line_left;
|
|
|
if (maxw < 8)
|
|
|
maxw = 8;
|
|
|
{
|
|
|
@@ -3121,14 +3301,15 @@ static void add_image_run(struct lay *l, unsigned int node,
|
|
|
img_top[node] = (unsigned short)t;
|
|
|
img_h[node] = (unsigned short)dh;
|
|
|
}
|
|
|
- if (l->line_x + dw > l->right && (l->nruns > 0 ||
|
|
|
- l->line_x > l->left))
|
|
|
+ if (l->line_x + dw > l->line_right && (l->nruns > 0 ||
|
|
|
+ l->line_x > l->line_left))
|
|
|
flush_line(l);
|
|
|
if (l->nruns >= (int)(sizeof(l->runs) / sizeof(l->runs[0])))
|
|
|
flush_line(l);
|
|
|
if (l->nruns == 0) {
|
|
|
l->line_y = l->y;
|
|
|
l->line_h = 0;
|
|
|
+ start_line(l, st);
|
|
|
}
|
|
|
{
|
|
|
struct lay_run *r = &l->runs[l->nruns++];
|
|
|
@@ -3208,19 +3389,25 @@ static void emit_word(struct lay *l, const char *s, unsigned int start,
|
|
|
unsigned int n, unsigned int base,
|
|
|
const struct br_style *st, unsigned short href)
|
|
|
{
|
|
|
- int avail = l->right - l->left;
|
|
|
+ int avail;
|
|
|
int w = text_width(l, s + start, n, st);
|
|
|
unsigned int off = start;
|
|
|
|
|
|
+ if (l->nruns == 0)
|
|
|
+ start_line(l, st);
|
|
|
+ avail = l->line_right - l->line_left;
|
|
|
if (st->nowrap) {
|
|
|
if (n)
|
|
|
add_run(l, (unsigned short)(base + start),
|
|
|
(unsigned short)n, st, href, 0);
|
|
|
return;
|
|
|
}
|
|
|
- if (l->line_x + w > l->right &&
|
|
|
- (l->nruns > 0 || l->line_x > l->left))
|
|
|
+ if (l->line_x + w > l->line_right &&
|
|
|
+ (l->nruns > 0 || l->line_x > l->line_left)) {
|
|
|
flush_line(l);
|
|
|
+ start_line(l, st);
|
|
|
+ avail = l->line_right - l->line_left;
|
|
|
+ }
|
|
|
if (w <= avail) {
|
|
|
if (n)
|
|
|
add_run(l, (unsigned short)(base + start),
|
|
|
@@ -3234,8 +3421,11 @@ static void emit_word(struct lay *l, const char *s, unsigned int start,
|
|
|
(unsigned short)take, st, href, 0);
|
|
|
off += take;
|
|
|
n -= take;
|
|
|
- if (n)
|
|
|
+ if (n) {
|
|
|
flush_line(l);
|
|
|
+ start_line(l, st);
|
|
|
+ avail = l->line_right - l->line_left;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -3251,6 +3441,8 @@ static void emit_text(struct lay *l, const char *s, unsigned int len,
|
|
|
return;
|
|
|
if (space_w <= 0)
|
|
|
space_w = 8;
|
|
|
+ if (l->nruns == 0)
|
|
|
+ start_line(l, st);
|
|
|
base = (unsigned int)(s - doc.text);
|
|
|
if (st->uppercase) {
|
|
|
char *p = (char *)s;
|
|
|
@@ -3266,15 +3458,18 @@ static void emit_text(struct lay *l, const char *s, unsigned int len,
|
|
|
|
|
|
if (s[i] == '\n') {
|
|
|
flush_line(l);
|
|
|
+ start_line(l, st);
|
|
|
i++;
|
|
|
continue;
|
|
|
}
|
|
|
if (s[i] == ' ') {
|
|
|
- if (l->line_x + space_w > l->right &&
|
|
|
- (l->nruns > 0 || l->line_x > l->left))
|
|
|
+ if (l->line_x + space_w > l->line_right &&
|
|
|
+ (l->nruns > 0 || l->line_x > l->line_left)) {
|
|
|
flush_line(l);
|
|
|
- else
|
|
|
+ start_line(l, st);
|
|
|
+ } else {
|
|
|
l->line_x += space_w;
|
|
|
+ }
|
|
|
i++;
|
|
|
continue;
|
|
|
}
|
|
|
@@ -3298,8 +3493,9 @@ static void emit_text(struct lay *l, const char *s, unsigned int len,
|
|
|
i++;
|
|
|
n = i - start;
|
|
|
if (l->space_pending &&
|
|
|
- (l->nruns > 0 || l->line_x > l->left)) {
|
|
|
- if (st->nowrap || l->line_x + space_w <= l->right)
|
|
|
+ (l->nruns > 0 || l->line_x > l->line_left)) {
|
|
|
+ if (st->nowrap ||
|
|
|
+ l->line_x + space_w <= l->line_right)
|
|
|
l->line_x += space_w;
|
|
|
}
|
|
|
l->space_pending = 0;
|
|
|
@@ -3332,6 +3528,8 @@ static void add_form_run(struct lay *l, unsigned int node,
|
|
|
|
|
|
if (!fs)
|
|
|
return;
|
|
|
+ if (l->nruns == 0)
|
|
|
+ start_line(l, st);
|
|
|
if (kind == FORM_CHECKBOX || kind == FORM_RADIO) {
|
|
|
text = "";
|
|
|
w = 16;
|
|
|
@@ -3375,18 +3573,19 @@ static void add_form_run(struct lay *l, unsigned int node,
|
|
|
} else if (kind == FORM_SELECT) {
|
|
|
w = st->width_kind == 1 ? st->width : 120;
|
|
|
}
|
|
|
- if (w > l->right - l->left)
|
|
|
- w = l->right - l->left;
|
|
|
+ if (w > l->line_right - l->line_left)
|
|
|
+ w = l->line_right - l->line_left;
|
|
|
if (w < 8)
|
|
|
w = 8;
|
|
|
- if (l->line_x + w > l->right &&
|
|
|
- (l->nruns > 0 || l->line_x > l->left))
|
|
|
+ if (l->line_x + w > l->line_right &&
|
|
|
+ (l->nruns > 0 || l->line_x > l->line_left))
|
|
|
flush_line(l);
|
|
|
if (l->nruns >= 96)
|
|
|
return;
|
|
|
if (l->nruns == 0) {
|
|
|
l->line_y = l->y;
|
|
|
l->line_h = 0;
|
|
|
+ start_line(l, st);
|
|
|
}
|
|
|
r = &l->runs[l->nruns++];
|
|
|
r->gap = (unsigned short)(l->line_x - l->run_x);
|
|
|
@@ -3945,6 +4144,8 @@ static void layout_block(struct lay *l, unsigned int node,
|
|
|
if (l->right < l->left + 8)
|
|
|
l->right = l->left + 8;
|
|
|
l->align = st->align;
|
|
|
+ l->line_left = l->left;
|
|
|
+ l->line_right = l->right;
|
|
|
l->y = top + bt + pt;
|
|
|
|
|
|
if (doc.nodes[node].tag == BR_TAG_HR) {
|
|
|
@@ -4038,6 +4239,11 @@ static void layout_block(struct lay *l, unsigned int node,
|
|
|
layout_children(l, node, st, depth + 1, link);
|
|
|
}
|
|
|
flush_line(l);
|
|
|
+ if (l->float_active) {
|
|
|
+ if (l->y < l->float_bottom)
|
|
|
+ l->y = l->float_bottom;
|
|
|
+ l->float_active = 0;
|
|
|
+ }
|
|
|
if (st->height_kind == 1) {
|
|
|
content_h = st->height;
|
|
|
if (st->box_sizing)
|
|
|
@@ -4225,10 +4431,12 @@ static unsigned int layout_float_group(struct lay *l, unsigned int first,
|
|
|
unsigned int n = first;
|
|
|
int row_left = l->left, row_right = l->right;
|
|
|
int row_top, row_bottom, xl, xr, any = 0;
|
|
|
+ int fl_left = row_left, fl_right = row_right, fl_bottom;
|
|
|
|
|
|
flush_line(l);
|
|
|
row_top = l->y;
|
|
|
row_bottom = l->y;
|
|
|
+ fl_bottom = row_top;
|
|
|
xl = row_left;
|
|
|
xr = row_right;
|
|
|
while (n) {
|
|
|
@@ -4295,6 +4503,8 @@ static unsigned int layout_float_group(struct lay *l, unsigned int first,
|
|
|
l->left = row_left;
|
|
|
l->right = xr;
|
|
|
xr = l->left;
|
|
|
+ if (xr < fl_right)
|
|
|
+ fl_right = xr;
|
|
|
} else {
|
|
|
if (any && xl + colw > xr) {
|
|
|
row_top = row_bottom;
|
|
|
@@ -4305,6 +4515,8 @@ static unsigned int layout_float_group(struct lay *l, unsigned int first,
|
|
|
l->left = xl;
|
|
|
l->right = xl + colw;
|
|
|
xl += colw;
|
|
|
+ if (xl > fl_left)
|
|
|
+ fl_left = xl;
|
|
|
}
|
|
|
if (l->right < l->left + 8)
|
|
|
l->right = l->left + 8;
|
|
|
@@ -4319,14 +4531,53 @@ static unsigned int layout_float_group(struct lay *l, unsigned int first,
|
|
|
layout_block(l, n, &cs, depth + 1, lk);
|
|
|
if (l->y > row_bottom)
|
|
|
row_bottom = l->y;
|
|
|
+ if (l->y > fl_bottom)
|
|
|
+ fl_bottom = l->y;
|
|
|
any = 1;
|
|
|
n = nd->next;
|
|
|
}
|
|
|
l->left = row_left;
|
|
|
l->right = row_right;
|
|
|
- l->y = row_bottom;
|
|
|
+ if (n && any) {
|
|
|
+ struct br_node *nd = &doc.nodes[n];
|
|
|
+ int inline_next = 0;
|
|
|
+
|
|
|
+ if (nd->type == BR_NODE_TEXT) {
|
|
|
+ inline_next = 1;
|
|
|
+ } else if (nd->type == BR_NODE_ELEM) {
|
|
|
+ struct br_style cs;
|
|
|
+
|
|
|
+ br_style_for(&doc, n, pst, &cs);
|
|
|
+ inline_next = cs.display != BR_DISPLAY_BLOCK &&
|
|
|
+ cs.display != BR_DISPLAY_NONE &&
|
|
|
+ !br_tag_is_block(nd->tag);
|
|
|
+ }
|
|
|
+ if (inline_next) {
|
|
|
+ if (l->float_active) {
|
|
|
+ if (l->float_left > fl_left)
|
|
|
+ fl_left = l->float_left;
|
|
|
+ if (l->float_right < fl_right)
|
|
|
+ fl_right = l->float_right;
|
|
|
+ if (l->float_bottom > fl_bottom)
|
|
|
+ fl_bottom = l->float_bottom;
|
|
|
+ }
|
|
|
+ l->float_active = 1;
|
|
|
+ l->float_left = fl_left;
|
|
|
+ l->float_right = fl_right;
|
|
|
+ l->float_bottom = fl_bottom;
|
|
|
+ l->y = row_top;
|
|
|
+ } else {
|
|
|
+ l->float_active = 0;
|
|
|
+ l->y = row_bottom;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ l->float_active = 0;
|
|
|
+ l->y = row_bottom;
|
|
|
+ }
|
|
|
l->line_x = l->left;
|
|
|
l->run_x = l->left;
|
|
|
+ l->line_left = l->left;
|
|
|
+ l->line_right = l->right;
|
|
|
l->line_y = l->y;
|
|
|
l->line_h = 0;
|
|
|
l->nruns = 0;
|
|
|
@@ -5588,6 +5839,20 @@ static void layout_children(struct lay *l, unsigned int parent,
|
|
|
n = nd->next;
|
|
|
continue;
|
|
|
}
|
|
|
+ if (cs.clear && l->float_active) {
|
|
|
+ flush_line(l);
|
|
|
+ if (l->y < l->float_bottom)
|
|
|
+ l->y = l->float_bottom;
|
|
|
+ l->float_active = 0;
|
|
|
+ l->line_x = l->left;
|
|
|
+ l->run_x = l->left;
|
|
|
+ l->line_left = l->left;
|
|
|
+ l->line_right = l->right;
|
|
|
+ l->line_y = l->y;
|
|
|
+ l->line_h = 0;
|
|
|
+ l->nruns = 0;
|
|
|
+ l->space_pending = 0;
|
|
|
+ }
|
|
|
if (nd->tag == BR_TAG_A && nd->href_off)
|
|
|
lk = (unsigned short)n;
|
|
|
if (cs.pos == 1 || cs.pos == 2) {
|
|
|
@@ -5692,9 +5957,12 @@ static int measure_page(int left, int right)
|
|
|
l->y = 0;
|
|
|
l->line_x = left;
|
|
|
l->run_x = left;
|
|
|
+ l->line_left = left;
|
|
|
+ l->line_right = right;
|
|
|
l->line_y = 0;
|
|
|
l->line_h = 0;
|
|
|
l->align = BR_ALIGN_LEFT;
|
|
|
+ l->float_active = 0;
|
|
|
l->depth = 0;
|
|
|
l->nruns = 0;
|
|
|
l->space_pending = 0;
|
|
|
@@ -5742,9 +6010,12 @@ static void render_page(int left, int right, int y0)
|
|
|
l->y = y0;
|
|
|
l->line_x = left;
|
|
|
l->run_x = left;
|
|
|
+ l->line_left = left;
|
|
|
+ l->line_right = right;
|
|
|
l->line_y = y0;
|
|
|
l->line_h = 0;
|
|
|
l->align = BR_ALIGN_LEFT;
|
|
|
+ l->float_active = 0;
|
|
|
l->depth = 0;
|
|
|
l->nruns = 0;
|
|
|
l->space_pending = 0;
|