mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-11 23:14:13 +03:00
[project @ 2005-10-30 21:23:24 by bursa]
Treat HTML objects (frames) as part of the box tree during layout. svn path=/import/netsurf/; revision=1875
This commit is contained in:
parent
c28747d710
commit
a54ae0e82d
@ -161,6 +161,22 @@ bool layout_block_context(struct box *block, struct content *content)
|
|||||||
|
|
||||||
gui_multitask();
|
gui_multitask();
|
||||||
|
|
||||||
|
if (block->object) {
|
||||||
|
if (block->object->type == CONTENT_HTML) {
|
||||||
|
box = block->object->data.html.layout;
|
||||||
|
box->width = block->width;
|
||||||
|
box->height = AUTO;
|
||||||
|
if (!layout_block_context(box, block->object))
|
||||||
|
return false;
|
||||||
|
block->height = box->height;
|
||||||
|
layout_calculate_descendant_bboxes(box);
|
||||||
|
block->object->width = box->descendant_x1;
|
||||||
|
block->object->height = box->descendant_y1;
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
box = margin_box = block->children;
|
box = margin_box = block->children;
|
||||||
cx = 0;
|
cx = 0;
|
||||||
cy = block->padding[TOP];
|
cy = block->padding[TOP];
|
||||||
@ -180,7 +196,7 @@ bool layout_block_context(struct box *block, struct content *content)
|
|||||||
* correct handling of floats.
|
* correct handling of floats.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (box->type == BOX_BLOCK)
|
if (box->type == BOX_BLOCK || box->object)
|
||||||
layout_block_find_dimensions(box->parent->width, box);
|
layout_block_find_dimensions(box->parent->width, box);
|
||||||
else if (box->type == BOX_TABLE) {
|
else if (box->type == BOX_TABLE) {
|
||||||
if (!layout_table(box, box->parent->width, content))
|
if (!layout_table(box, box->parent->width, content))
|
||||||
@ -223,7 +239,21 @@ bool layout_block_context(struct box *block, struct content *content)
|
|||||||
LOG(("box %p, cx %i, cy %i", box, cx, cy));
|
LOG(("box %p, cx %i, cy %i", box, cx, cy));
|
||||||
|
|
||||||
/* Layout (except tables). */
|
/* Layout (except tables). */
|
||||||
if (box->type == BOX_INLINE_CONTAINER) {
|
if (box->object) {
|
||||||
|
if (box->object->type == CONTENT_HTML) {
|
||||||
|
box->object->data.html.layout->width =
|
||||||
|
box->width;
|
||||||
|
if (!layout_block_context(box->object->
|
||||||
|
data.html.layout, box->object))
|
||||||
|
return false;
|
||||||
|
box->height = box->object->
|
||||||
|
data.html.layout->height;
|
||||||
|
/* + margins etc. */
|
||||||
|
} else {
|
||||||
|
/* this case handled already in
|
||||||
|
* layout_block_find_dimensions() */
|
||||||
|
}
|
||||||
|
} else if (box->type == BOX_INLINE_CONTAINER) {
|
||||||
box->width = box->parent->width;
|
box->width = box->parent->width;
|
||||||
if (!layout_inline_container(box, box->width, block,
|
if (!layout_inline_container(box, box->width, block,
|
||||||
cx, cy, content))
|
cx, cy, content))
|
||||||
@ -260,7 +290,7 @@ bool layout_block_context(struct box *block, struct content *content)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Advance to next box. */
|
/* Advance to next box. */
|
||||||
if (box->type == BOX_BLOCK && box->children) {
|
if (box->type == BOX_BLOCK && !box->object && box->children) {
|
||||||
y = box->padding[TOP];
|
y = box->padding[TOP];
|
||||||
box = box->children;
|
box = box->children;
|
||||||
box->y = y;
|
box->y = y;
|
||||||
@ -271,7 +301,7 @@ bool layout_block_context(struct box *block, struct content *content)
|
|||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else if (box->type == BOX_BLOCK)
|
} else if (box->type == BOX_BLOCK || box->object)
|
||||||
cy += box->padding[TOP];
|
cy += box->padding[TOP];
|
||||||
if (box->type == BOX_BLOCK && box->height == AUTO)
|
if (box->type == BOX_BLOCK && box->height == AUTO)
|
||||||
box->height = 0;
|
box->height = 0;
|
||||||
@ -348,6 +378,15 @@ void layout_minmax_block(struct box *block)
|
|||||||
if (block->max_width != UNKNOWN_MAX_WIDTH)
|
if (block->max_width != UNKNOWN_MAX_WIDTH)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (block->object) {
|
||||||
|
if (block->object->type == CONTENT_HTML) {
|
||||||
|
layout_minmax_block(block->object->data.html.layout);
|
||||||
|
min = block->object->data.html.layout->min_width;
|
||||||
|
max = block->object->data.html.layout->max_width;
|
||||||
|
} else {
|
||||||
|
min = max = block->object->width;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
/* recurse through children */
|
/* recurse through children */
|
||||||
for (child = block->children; child; child = child->next) {
|
for (child = block->children; child; child = child->next) {
|
||||||
switch (child->type) {
|
switch (child->type) {
|
||||||
@ -369,6 +408,7 @@ void layout_minmax_block(struct box *block)
|
|||||||
if (max < child->max_width)
|
if (max < child->max_width)
|
||||||
max = child->max_width;
|
max = child->max_width;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (max < min) {
|
if (max < min) {
|
||||||
box_dump(block, 0);
|
box_dump(block, 0);
|
||||||
@ -438,7 +478,7 @@ void layout_block_find_dimensions(int available_width, struct box *box)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box->object) {
|
if (box->object && box->object->type != CONTENT_HTML) {
|
||||||
/* block-level replaced element, see 10.3.4 and 10.6.2 */
|
/* block-level replaced element, see 10.3.4 and 10.6.2 */
|
||||||
if (width == AUTO && box->height == AUTO) {
|
if (width == AUTO && box->height == AUTO) {
|
||||||
width = box->object->width;
|
width = box->object->width;
|
||||||
@ -473,13 +513,6 @@ void layout_block_find_dimensions(int available_width, struct box *box)
|
|||||||
box->padding[BOTTOM] += SCROLLBAR_WIDTH;
|
box->padding[BOTTOM] += SCROLLBAR_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box->object && box->object->type == CONTENT_HTML &&
|
|
||||||
box->width != box->object->available_width) {
|
|
||||||
content_reformat(box->object, box->width, box->height);
|
|
||||||
if (style->height.height == CSS_HEIGHT_AUTO)
|
|
||||||
box->height = box->object->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (margin[TOP] == AUTO)
|
if (margin[TOP] == AUTO)
|
||||||
margin[TOP] = 0;
|
margin[TOP] = 0;
|
||||||
if (margin[BOTTOM] == AUTO)
|
if (margin[BOTTOM] == AUTO)
|
||||||
@ -703,7 +736,7 @@ void layout_float_find_dimensions(int available_width,
|
|||||||
box->padding[RIGHT] += scrollbar_width;
|
box->padding[RIGHT] += scrollbar_width;
|
||||||
box->padding[BOTTOM] += scrollbar_width;
|
box->padding[BOTTOM] += scrollbar_width;
|
||||||
|
|
||||||
if (box->object) {
|
if (box->object && box->object->type != CONTENT_HTML) {
|
||||||
/* floating replaced element, see 10.3.6 and 10.6.2 */
|
/* floating replaced element, see 10.3.6 and 10.6.2 */
|
||||||
if (box->width == AUTO && box->height == AUTO) {
|
if (box->width == AUTO && box->height == AUTO) {
|
||||||
box->width = box->object->width;
|
box->width = box->object->width;
|
||||||
|
Loading…
Reference in New Issue
Block a user