summaryrefslogtreecommitdiff
path: root/render/layout.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2005-05-23 22:14:09 +0000
committerJames Bursa <james@netsurf-browser.org>2005-05-23 22:14:09 +0000
commite2fb0a94cd4283c09e63e0c616bcba5df4342d48 (patch)
tree7953d8148e951fc70d57d16f212f45689b6ba7d5 /render/layout.c
parent2714ddd459b558a07cc2143470f262caa4291071 (diff)
downloadnetsurf-e2fb0a94cd4283c09e63e0c616bcba5df4342d48.tar.gz
netsurf-e2fb0a94cd4283c09e63e0c616bcba5df4342d48.tar.bz2
[project @ 2005-05-23 22:14:09 by bursa]
Start to implement borders on inline elements. Note: borders of form controls are rendered incorrectly (text boxes in form controls need changing from INLINE to TEXT). svn path=/import/netsurf/; revision=1734
Diffstat (limited to 'render/layout.c')
-rw-r--r--render/layout.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/render/layout.c b/render/layout.c
index 8cf417c4e..90bdc8c3c 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -738,6 +738,7 @@ bool layout_line(struct box *first, int width, int *y,
bool move_y = false;
int space_before = 0, space_after = 0;
unsigned int inline_count = 0;
+ unsigned int i;
LOG(("first %p, first->text '%.*s', width %i, y %i, cy %i",
first, first->length, first->text, width, *y, cy));
@@ -787,6 +788,15 @@ bool layout_line(struct box *first, int width, int *y,
if (b->type != BOX_INLINE && b->type != BOX_TEXT)
continue;
+ if (b->type == BOX_INLINE) {
+ /* calculate borders, margins, and padding */
+ layout_find_dimensions(width, b->style,
+ b->margin, b->padding, b->border);
+ for (i = 0; i != 4; i++)
+ if (b->margin[i] == AUTO)
+ b->margin[i] = 0;
+ }
+
if (!b->object && !b->gadget) {
/* inline non-replaced, 10.3.1 and 10.6.1 */
b->height = line_height(b->style ? b->style :
@@ -1121,7 +1131,10 @@ bool layout_line(struct box *first, int width, int *y,
if (d->type == BOX_INLINE || d->type == BOX_INLINE_BLOCK ||
d->type == BOX_BR || d->type == BOX_TEXT) {
d->x += x0;
- d->y = *y + d->border[TOP];
+ d->y = *y - d->padding[TOP];
+ }
+ if ((d->type == BOX_INLINE && (d->object || d->gadget)) ||
+ d->type == BOX_INLINE_BLOCK) {
h = d->border[TOP] + d->padding[TOP] + d->height +
d->padding[BOTTOM] + d->border[BOTTOM];
if (used_height < h)