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 htmldlgs util jtools pref caps java libreg softupdt jsdebug netcache network httpurl plugin plugimpl mocha
ifdef DOM ifdef DOM
EXPORTS = lm_dom.h # required by layout
REQUIRES += dom REQUIRES += dom
endif endif

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

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

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

@ -30,10 +30,12 @@ typedef struct DOM_HTMLElementPrivate {
TagType tagtype; TagType tagtype;
LO_Element * ele_start; LO_Element * ele_start;
LO_Element * ele_end; LO_Element * ele_end;
DOM_AttributeList attrs;
} DOM_HTMLElementPrivate; } DOM_HTMLElementPrivate;
#define ELEMENT_PRIV(e) ((DOM_HTMLElementPrivate *)(((DOM_Node *)(e))->data)) #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_Element *
DOM_HTMLPopElementByType(TagType type, DOM_Element *node); DOM_HTMLPopElementByType(TagType type, DOM_Element *node);