mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
wire up DOM_Nodes and LO_Elements; maybe fix <LI> CSS bug? (all #if DOM)
This commit is contained in:
parent
88923c2b13
commit
afbbab923a
@ -33,6 +33,9 @@
|
||||
#include "pa_parse.h"
|
||||
#include "edt.h"
|
||||
#include "libmocha.h"
|
||||
#ifdef DOM
|
||||
#include "lm_dom.h"
|
||||
#endif
|
||||
#include "libevent.h"
|
||||
#include "laystyle.h"
|
||||
#include "hk_funcs.h"
|
||||
@ -4008,6 +4011,68 @@ static void *hooked_data_object = NULL;
|
||||
static intn hooked_status = 0;
|
||||
static PA_Tag *hooked_tag = NULL;
|
||||
|
||||
#ifdef DOM
|
||||
static char *element_names[] = {
|
||||
"NONE",
|
||||
"TEXT",
|
||||
"LINEFEED",
|
||||
"HRULE",
|
||||
"IMAGE",
|
||||
"BULLET",
|
||||
"FORM_ELE",
|
||||
"SUBDOC",
|
||||
"TABLE",
|
||||
"CELL",
|
||||
"EMBED",
|
||||
"EDGE",
|
||||
"JAVA",
|
||||
"SCRIPT",
|
||||
"OBJECT",
|
||||
"PARAGRAPH",
|
||||
"CENTER",
|
||||
"MULTICOL",
|
||||
"FLOAT",
|
||||
"TEXTBLOCK",
|
||||
"LIST",
|
||||
"DESCTITLE",
|
||||
"DESCTEXT",
|
||||
"BLOCKQUOTE",
|
||||
"LAYER",
|
||||
"HEADING",
|
||||
"SPAN",
|
||||
"BUILTIN",
|
||||
"SPACER",
|
||||
"SUPER",
|
||||
"SUB"
|
||||
};
|
||||
|
||||
static void
|
||||
DumpNodeElements(DOM_Node *node)
|
||||
{
|
||||
#ifdef DEBUG_shaver
|
||||
LO_Element *eptr;
|
||||
if (node->type != NODE_TYPE_ELEMENT &&
|
||||
node->type != NODE_TYPE_TEXT)
|
||||
return;
|
||||
fprintf(stderr, "%s %s elements:",
|
||||
PA_TagString(ELEMENT_PRIV(node)->tagtype),
|
||||
node->name ? node->name : "");
|
||||
eptr = ELEMENT_PRIV(node)->ele_start;
|
||||
if (!eptr) {
|
||||
fprintf(stderr, " <none> (SHOULD REMOVE FROM TREE!)\n");
|
||||
return;
|
||||
}
|
||||
while (eptr && eptr != ELEMENT_PRIV(node)->ele_end) {
|
||||
fprintf(stderr, " %s", element_names[eptr->type]);
|
||||
eptr = eptr->lo_any.next;
|
||||
}
|
||||
if (eptr)
|
||||
fprintf(stderr, " %s", element_names[eptr->type]);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************
|
||||
* Function: LO_ProcessTag
|
||||
*
|
||||
@ -4034,6 +4099,9 @@ LO_ProcessTag(void *data_object, PA_Tag *tag, intn status)
|
||||
lo_DocState *state;
|
||||
lo_DocState *orig_state;
|
||||
lo_DocState *up_state;
|
||||
#ifdef DOM
|
||||
DOM_Node *last_node;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If this call came from a hook feed
|
||||
@ -4087,7 +4155,9 @@ LO_ProcessTag(void *data_object, PA_Tag *tag, intn status)
|
||||
|
||||
#ifdef DOM
|
||||
if (state && context)
|
||||
LM_ReflectTagNode(tag, state, context);
|
||||
last_node = LM_ReflectTagNode(tag, state, context);
|
||||
else
|
||||
last_node = NULL;
|
||||
#endif
|
||||
/*
|
||||
* if we get called with abort/complete then ignore oom condition
|
||||
@ -4757,6 +4827,40 @@ XP_TRACE(("Initializing new doc %d\n", doc_id));
|
||||
|
||||
lo_LayoutTag(context, state, tag);
|
||||
|
||||
#ifdef DOM
|
||||
/*
|
||||
* If we're ending a tag, then we're also ending a node.
|
||||
* In this case, LM_RefectTagNode will have returned the closing
|
||||
* node, so we can fill it in.
|
||||
* Otherwise, if it's a text tag, LM_ReflectTagNode will
|
||||
* return the Text block and we want to mark it as done. (Text nodes
|
||||
* will probably only ever have one LO_Element, but why take
|
||||
* chances?)
|
||||
*/
|
||||
if (last_node &&
|
||||
((tag->is_end && last_node->type == NODE_TYPE_ELEMENT) ||
|
||||
last_node->type == NODE_TYPE_TEXT)) {
|
||||
/* mark the end LO_Element for the _last_ node */
|
||||
LO_Element *eptr = state->line_list;
|
||||
if (eptr) {
|
||||
while (eptr->lo_any.next != NULL) {
|
||||
eptr = eptr->lo_any.next;
|
||||
}
|
||||
} else {
|
||||
eptr = state->end_last_line;
|
||||
}
|
||||
#if 0
|
||||
/* there are Nodes (TITLE,HEAD) that don't generate LO_Elements */
|
||||
XP_ASSERT(eptr);
|
||||
XP_ASSERT(ELEMENT_PRIV(last_node)->ele_start);
|
||||
#endif
|
||||
ELEMENT_PRIV(last_node)->ele_end = eptr;
|
||||
#ifdef DEBUG_shaver
|
||||
DumpNodeElements(last_node);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (top_state->wedged_on_mocha) {
|
||||
top_state->wedged_on_mocha = FALSE;
|
||||
return(1);
|
||||
|
@ -658,9 +658,8 @@ typedef struct lo_DocState_struct {
|
||||
#ifdef DOM
|
||||
Bool in_span;
|
||||
PA_Block current_span;
|
||||
void /*DOM_Node*/ *top_node;
|
||||
void /*DOM_Node*/ *current_node;
|
||||
void /*DOM_Node*/ *last_node;
|
||||
void /*DOM_Node*/ *top_node; /* top of the DOM_Node tree */
|
||||
void /*DOM_Node*/ *current_node; /* active node (only during tree gen) */
|
||||
#endif
|
||||
} lo_DocState;
|
||||
|
||||
|
@ -4142,12 +4142,14 @@ lo_IsEmptyTag(TagType type)
|
||||
|| type == P_EMBED
|
||||
|| type == P_KEYGEN
|
||||
|| type == P_JAVA_APPLET
|
||||
|| type == P_LIST_ITEM
|
||||
|| type == P_BASEFONT
|
||||
|| type == P_AREA
|
||||
#ifndef DOM
|
||||
|| type == P_LIST_ITEM /* not really empty! */
|
||||
|| type == P_DESC_TITLE
|
||||
|| type == P_NSDT
|
||||
|| type == P_DESC_TEXT
|
||||
#endif
|
||||
|| type == P_BASEFONT
|
||||
|| type == P_AREA
|
||||
|| type == P_BASE)
|
||||
{
|
||||
return TRUE;
|
||||
@ -7311,18 +7313,6 @@ XP_TRACE(("lo_LayoutTag(%d)\n", tag->type));
|
||||
*/
|
||||
lo_PostLayoutTag( context, state, tag, started_in_head);
|
||||
|
||||
#ifdef DOM_NOTYET
|
||||
if (tag->is_end && state->current_node) {
|
||||
/* mark the end LO_Element for the _last_ node */
|
||||
LO_Element *eptr = state->line_list;
|
||||
XP_ASSERT(eptr);
|
||||
while (eptr->lo_any.next != NULL) {
|
||||
eptr = eptr->lo_any.next;
|
||||
}
|
||||
XP_ASSERT(ELEMENT_PRIV(state->last_node)->ele_start);
|
||||
ELEMENT_PRIV(state->last_node)->ele_end = eptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
LO_UnlockLayout();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user