switch to void * in lo_DocState, not DOM_Node * because too many places #include "layout.h"

This commit is contained in:
shaver%netscape.com 1998-08-28 07:52:07 +00:00
Родитель bbba70cdf8
Коммит a3b18a4883
3 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

@ -26,6 +26,7 @@ REQUIRES = lay parse img js style layer applet dbm nspr security \
htmldlgs util jtools pref caps java libreg softupdt jsdebug netcache network httpurl plugin plugimpl mocha
ifdef DOM
EXPORTS = lm_dom.h # required by layout
REQUIRES += dom
endif

Просмотреть файл

@ -254,7 +254,7 @@ LM_ReflectTagNode(PA_Tag *tag, void *doc_state, MWContext *context)
lo_DocState *doc = (lo_DocState *)doc_state;
DOM_Node *node;
if (!doc->top_node) {
if (!TOP_NODE(doc)) {
#if 0
node = DOM_NewDocument(context, doc);
#else
@ -264,7 +264,7 @@ LM_ReflectTagNode(PA_Tag *tag, void *doc_state, MWContext *context)
return NULL;
node->type = NODE_TYPE_DOCUMENT;
node->name = XP_STRDUP("#document");
doc->current_node = doc->top_node = node;
CURRENT_NODE(doc) = TOP_NODE(doc) = node;
}
if (!tag) {
@ -272,31 +272,31 @@ LM_ReflectTagNode(PA_Tag *tag, void *doc_state, MWContext *context)
fprintf(stderr, "finished reflecting document\n");
LM_Node_indent = 0;
#endif
doc->current_node = doc->top_node;
return doc->current_node;
CURRENT_NODE(doc) = TOP_NODE(doc);
return CURRENT_NODE(doc);
}
if (tag->type == -1)
return doc->current_node;
return CURRENT_NODE(doc);
if (tag->is_end) {
if (doc->current_node == doc->top_node) {
XP_ASSERT(doc->current_node->type == NODE_TYPE_DOCUMENT);
if (CURRENT_NODE(doc) == TOP_NODE(doc)) {
XP_ASSERT(CURRENT_NODE(doc)->type == NODE_TYPE_DOCUMENT);
#ifdef DEBUG_shaver
fprintf(stderr, "not popping tag </%s> from doc-only stack\n",
PA_TagString(tag->type));
#endif
return doc->current_node;
return CURRENT_NODE(doc);
}
doc->current_node = (DOM_Node *)DOM_HTMLPopElementByType(tag->type,
(DOM_Element *)doc->current_node);
doc->current_node = doc->current_node->parent;
return doc->current_node;
CURRENT_NODE(doc) = (DOM_Node *)DOM_HTMLPopElementByType(tag->type,
(DOM_Element *)CURRENT_NODE(doc));
CURRENT_NODE(doc) = CURRENT_NODE(doc)->parent;
return CURRENT_NODE(doc);
}
node = lm_NodeForTag(tag, doc->current_node, context, csid);
node = lm_NodeForTag(tag, CURRENT_NODE(doc), context, csid);
if (node) {
if (!DOM_HTMLPushNode(node, doc->current_node)) {
if (!DOM_HTMLPushNode(node, CURRENT_NODE(doc))) {
if (node->ops->destroyNode)
node->ops->destroyNode(context->mocha_context,
node);
@ -304,10 +304,10 @@ LM_ReflectTagNode(PA_Tag *tag, void *doc_state, MWContext *context)
}
/* only elements have children (I think) */
if (node->type == NODE_TYPE_ELEMENT)
doc->current_node = node;
CURRENT_NODE(doc) = node;
}
PR_ASSERT(!doc->current_node->parent ||
doc->current_node->parent->type != NODE_TYPE_TEXT);
PR_ASSERT(!CURRENT_NODE(doc)->parent ||
CURRENT_NODE(doc)->parent->type != NODE_TYPE_TEXT);
return node;
}

Просмотреть файл

@ -30,10 +30,12 @@ typedef struct DOM_HTMLElementPrivate {
TagType tagtype;
LO_Element * ele_start;
LO_Element * ele_end;
DOM_AttributeList attrs;
} DOM_HTMLElementPrivate;
#define ELEMENT_PRIV(e) ((DOM_HTMLElementPrivate *)(((DOM_Node *)(e))->data))
#define CURRENT_NODE(d) ((DOM_Node *)(d->current_node))
#define LAST_NODE(d) ((DOM_Node *)(d->last_node))
#define TOP_NODE(d) ((DOM_Node *)(d->top_node))
DOM_Element *
DOM_HTMLPopElementByType(TagType type, DOM_Element *node);