mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Use is_*_element() to determine whether element is block or inline
Use that in the stack killing code, where we do some pretty funny checks and stuff. The decision is based on the linebreak struct attribute, non-zero for block elements.
This commit is contained in:
parent
a3f177e088
commit
7a91098135
@ -140,6 +140,8 @@ struct html_element {
|
||||
ELEMENT_VISITED = 2,
|
||||
} pseudo_class;
|
||||
};
|
||||
#define is_inline_element(e) (e->linebreak == 0)
|
||||
#define is_block_element(e) (e->linebreak > 0)
|
||||
|
||||
enum html_special_type {
|
||||
SP_TAG,
|
||||
|
@ -812,10 +812,10 @@ start_element(struct element_info *ei,
|
||||
if (ei->type == ELEMENT_TYPE_NON_NESTABLE) {
|
||||
foreach (e, html_context->stack) {
|
||||
if (e->type < ELEMENT_KILLABLE) break;
|
||||
if (e->linebreak || !ei->linebreak) break;
|
||||
if (is_block_element(e) || is_inline_element(ei)) break;
|
||||
}
|
||||
} else foreach (e, html_context->stack) {
|
||||
if (e->linebreak && !ei->linebreak) break;
|
||||
if (is_block_element(e) && is_inline_element(ei)) break;
|
||||
if (e->type < ELEMENT_KILLABLE) break;
|
||||
if (!strlcasecmp(e->name, e->namelen, name, namelen)) break;
|
||||
}
|
||||
@ -930,7 +930,7 @@ end_element(struct element_info *ei,
|
||||
|
||||
/* dump_html_stack(html_context); */
|
||||
foreach (e, html_context->stack) {
|
||||
if (e->linebreak && !ei->linebreak) kill = 1;
|
||||
if (is_block_element(e) && is_inline_element(ei)) kill = 1;
|
||||
if (strlcasecmp(e->name, e->namelen, name, namelen)) {
|
||||
if (e->type < ELEMENT_KILLABLE)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user