Author: tlsa
Date: Sat Jan 31 07:26:28 2009
New Revision: 6319
URL:
http://source.netsurf-browser.org?rev=6319&view=rev
Log:
Make inline boxes store the height of their line box and include in box tree dump.
Modified:
trunk/netsurf/render/box.c
trunk/netsurf/render/box.h
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/box.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/render/box.c?rev=6319&...
==============================================================================
--- trunk/netsurf/render/box.c (original)
+++ trunk/netsurf/render/box.c Sat Jan 31 07:26:28 2009
@@ -102,6 +102,7 @@
box->parent = NULL;
box->fallback = NULL;
box->inline_end = NULL;
+ box->line_height = 0;
box->float_children = NULL;
box->float_container = NULL;
box->next_float = NULL;
@@ -576,6 +577,9 @@
fprintf(stream, " ");
fprintf(stream, "%p ", box);
+ if (box->type == BOX_INLINE || box->type == BOX_TEXT ||
+ box->type == BOX_INLINE_END)
+ fprintf(stream, "lh%i ", box->line_height);
fprintf(stream, "x%i y%i w%i h%i ", box->x, box->y,
box->width, box->height);
if (box->max_width != UNKNOWN_MAX_WIDTH)
Modified: trunk/netsurf/render/box.h
URL:
http://source.netsurf-browser.org/trunk/netsurf/render/box.h?rev=6319&...
==============================================================================
--- trunk/netsurf/render/box.h (original)
+++ trunk/netsurf/render/box.h Sat Jan 31 07:26:28 2009
@@ -201,6 +201,7 @@
* corresponding to this INLINE_END box. */
struct box *inline_end;
bool inline_new_line;
+ int line_height;
/** 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
Modified: trunk/netsurf/render/layout.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=6319&...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Sat Jan 31 07:26:28 2009
@@ -1420,6 +1420,7 @@
if ((!c->object && c->text && (c->length || is_pre)) ||
c->type == BOX_BR)
has_text_children = true;
+ c->line_height = 0;
}
/** \todo fix wrapping so that a box with horizontal scrollbar will
@@ -2126,6 +2127,16 @@
(d->style->position == CSS_POSITION_ABSOLUTE ||
d->style->position == CSS_POSITION_FIXED))
continue;
+ if (d->type == BOX_INLINE && d->inline_end &&
+ d->next != d->inline_end) {
+ if (d->height > d->inline_end->line_height)
+ d->inline_end->line_height = d->height;
+ for (struct box *il = d; il != d->inline_end;
+ il = il->next) {
+ if (d->height > il->line_height)
+ il->line_height = d->height;
+ }
+ }
if ((d->type == BOX_INLINE && (d->object || d->gadget)) ||
d->type == BOX_INLINE_BLOCK) {
h = d->margin[TOP] + d->border[TOP] + d->padding[TOP] +
@@ -2134,9 +2145,14 @@
if (used_height < h)
used_height = h;
}
- if (d->type == BOX_TEXT && d->height > used_height)
- used_height = d->height;
- }
+ if (d->line_height > used_height)
+ used_height = d->line_height;
+ }
+
+ /* Set the line_height for the boxes on the current line */
+ for (d = first; d != b; d = d->next)
+ d->line_height = used_height;
+
first->inline_new_line = true;
assert(b != first || (move_y && 0 < used_height && (left ||
right)));