From dc8518abd7443d89ceba490f26cef788e5092a11 Mon Sep 17 00:00:00 2001 From: "shaver%netscape.com" Date: Fri, 28 Aug 1998 07:53:18 +0000 Subject: [PATCH] break universal dep on lm_dom.h; start wiring DOM_Node<->LO_Element --- lib/layout/layout.h | 9 +++------ lib/layout/laytags.c | 18 ++++++++++++++++++ lib/layout/layutil.c | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/layout/layout.h b/lib/layout/layout.h index fcaae895f3c..5862b925de5 100644 --- a/lib/layout/layout.h +++ b/lib/layout/layout.h @@ -35,10 +35,6 @@ #include "libmocha.h" -#ifdef DOM -#include "dom.h" -#endif - #define MEMORY_ARENAS 1 #define NEXT_ELEMENT state->top_state->element_id++ @@ -662,8 +658,9 @@ typedef struct lo_DocState_struct { #ifdef DOM Bool in_span; PA_Block current_span; - DOM_Node *top_node; - DOM_Node *current_node; + void /*DOM_Node*/ *top_node; + void /*DOM_Node*/ *current_node; + void /*DOM_Node*/ *last_node; #endif } lo_DocState; diff --git a/lib/layout/laytags.c b/lib/layout/laytags.c index 9c5605ac4f7..fb6759a393d 100644 --- a/lib/layout/laytags.c +++ b/lib/layout/laytags.c @@ -45,6 +45,11 @@ #include "privacy.h" #include "intl_csi.h" + +#ifdef DOM +#include "lm_dom.h" +#endif + /* WEBFONTS are defined only in laytags.c and layout.c */ #define WEBFONTS @@ -7306,6 +7311,19 @@ 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(); } diff --git a/lib/layout/layutil.c b/lib/layout/layutil.c index 73076d8aa95..02bb89a09be 100644 --- a/lib/layout/layutil.c +++ b/lib/layout/layutil.c @@ -36,6 +36,10 @@ #endif /* NSPR20 */ #include "intl_csi.h" +#ifdef DOM +#include "lm_dom.h" +#endif + #ifdef EDITOR #include "edt.h" #endif @@ -2579,6 +2583,17 @@ lo_AppendToLineList(MWContext *context, lo_DocState *state, } state->current_span = NULL; } + + /* Wire the element to the DOM Node data for DOM-driven feedback. */ + + if (CURRENT_NODE(state) && + CURRENT_NODE(state)->type != NODE_TYPE_DOCUMENT) { + XP_ASSERT(!ELEMENT_PRIV(CURRENT_NODE(state))->ele_end); + eptr = ELEMENT_PRIV(CURRENT_NODE(state))->ele_start; + if (!eptr) + /* this the first element for this node, so mark it */ + ELEMENT_PRIV(CURRENT_NODE(state))->ele_start = element; + } #endif if (state->current_named_anchor != NULL) {