mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Use ACTIVE_NODE now rather than CURRENT_NODE, and include lm_dom.h everywhere
to make that possible. Move LM_ReflectNode call to laytags.c back-end from layout.c front-end (thank you, Uncle Brendan). Correct FIND_LAST_ELEMENT to handle newly-ended doc_states.
This commit is contained in:
parent
0c850d6b89
commit
453cc779ce
@ -649,7 +649,7 @@ lo_BeginLayerTag(MWContext *context, lo_DocState *state, PA_Tag *tag)
|
||||
CL_Layer *parent_layer;
|
||||
#ifdef DOM
|
||||
DOM_AttributeEntry *entry;
|
||||
DOM_Node *node = state->top_state->current_node;
|
||||
DOM_Node *node = ACTIVE_NODE(state);
|
||||
DOM_StyleDatabase *db = state->top_state->style_db;
|
||||
JSContext *cx = context->mocha_context;
|
||||
#endif
|
||||
@ -1046,8 +1046,9 @@ lo_SetStyleSheetLayerProperties(MWContext *context, lo_DocState *state,
|
||||
} else {
|
||||
if (!DOM_StyleGetProperty(cx, db, node, LAYER_SRC_STYLE, &entry))
|
||||
return;
|
||||
if (entry)
|
||||
inflow = JS_TRUE;
|
||||
if (!entry)
|
||||
return;
|
||||
inflow = JS_TRUE;
|
||||
}
|
||||
|
||||
param = XP_NEW_ZAP(LO_BlockInitializeStruct);
|
||||
|
@ -55,6 +55,7 @@
|
||||
|
||||
#ifdef DOM
|
||||
#include "domstyle.h"
|
||||
#include "lm_dom.h"
|
||||
#endif
|
||||
|
||||
#ifndef XP_TRACE
|
||||
@ -815,7 +816,7 @@ new_form_element(MWContext *context, lo_DocState *state, int32 type)
|
||||
DOM_AttributeEntry *entry;
|
||||
JSContext *cx = context->mocha_context;
|
||||
DOM_StyleDatabase *db = state->top_state->style_db;
|
||||
DOM_Node *node = state->top_state->current_node;
|
||||
DOM_Node *node = ACTIVE_NODE(state);
|
||||
|
||||
if (node && (cx || db)) {
|
||||
/*
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "layers.h"
|
||||
#ifdef DOM
|
||||
#include "domstyle.h"
|
||||
#include "lm_dom.h"
|
||||
#endif
|
||||
|
||||
extern int MK_OUT_OF_MEMORY;
|
||||
@ -1515,7 +1516,7 @@ lo_FormatImage(MWContext *context, lo_DocState *state, PA_Tag *tag)
|
||||
#ifdef DOM
|
||||
JSContext *cx = context->mocha_context;
|
||||
DOM_StyleDatabase *db = state->top_state->style_db;
|
||||
DOM_Element *element = (DOM_Element *)state->top_state->current_node;
|
||||
DOM_Element *element = (DOM_Element *)ACTIVE_NODE(state);
|
||||
DOM_AttributeEntry *entry;
|
||||
#endif
|
||||
|
||||
|
@ -275,6 +275,7 @@ lo_NewTopState(MWContext *context, char *url)
|
||||
#ifdef DOM
|
||||
top_state->top_node = NULL;
|
||||
top_state->current_node = NULL;
|
||||
top_state->active_node = NULL;
|
||||
top_state->style_db = NULL;
|
||||
#endif
|
||||
|
||||
@ -4161,12 +4162,6 @@ LO_ProcessTag(void *data_object, PA_Tag *tag, intn status)
|
||||
}
|
||||
context = doc_data->window_id;
|
||||
|
||||
#ifdef DOM
|
||||
if (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
|
||||
* and clean up
|
||||
|
@ -854,7 +854,8 @@ struct lo_TopState_struct {
|
||||
#endif
|
||||
#ifdef DOM
|
||||
struct DOM_Node *top_node; /* top of the DOM_Node tree */
|
||||
struct DOM_Node *current_node; /* active node (only during tree gen) */
|
||||
struct DOM_Node *current_node; /* node that's parent of next content */
|
||||
struct DOM_Node *active_node; /* node for which we're making elements */
|
||||
struct DOM_StyleDatabase *style_db;
|
||||
#endif
|
||||
void* LAPIprobe;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "intl_csi.h"
|
||||
#ifdef DOM
|
||||
#include "domstyle.h"
|
||||
#include "lm_dom.h"
|
||||
#endif
|
||||
|
||||
void
|
||||
@ -306,7 +307,7 @@ LO_CheckForContentHiding(lo_DocState *state, MWContext *context)
|
||||
{
|
||||
JSContext *cx = context->mocha_context;
|
||||
DOM_StyleDatabase *db = state->top_state->style_db;
|
||||
DOM_Node *node = state->top_state->current_node;
|
||||
DOM_Node *node = ACTIVE_NODE(state);
|
||||
DOM_AttributeEntry *entry;
|
||||
|
||||
if (!db || !cx || !node ||
|
||||
|
@ -1503,7 +1503,7 @@ lo_process_anchor_tag(MWContext *context, lo_DocState *state, PA_Tag *tag)
|
||||
{
|
||||
lo_DocLists *doc_lists;
|
||||
#ifdef DOM
|
||||
DOM_Node *node = state->top_state->current_node;
|
||||
DOM_Node *node = ACTIVE_NODE(state);
|
||||
DOM_Element *element = (DOM_Element *)node;
|
||||
JSContext *cx = context->mocha_context;
|
||||
#else
|
||||
@ -1514,6 +1514,9 @@ lo_process_anchor_tag(MWContext *context, lo_DocState *state, PA_Tag *tag)
|
||||
|
||||
#ifdef DOM
|
||||
XP_ASSERT(node->type == NODE_TYPE_ELEMENT);
|
||||
#ifdef DEBUG_shaver
|
||||
PR_ASSERT(node->type == NODE_TYPE_ELEMENT);
|
||||
#endif
|
||||
#endif
|
||||
/*
|
||||
* Opening a new anchor
|
||||
@ -4146,7 +4149,7 @@ lo_SetStyleSheetProperties(MWContext *context, lo_DocState *state, PA_Tag *tag)
|
||||
{
|
||||
JSContext *cx = context->mocha_context;
|
||||
DOM_StyleDatabase *db = state->top_state->style_db;
|
||||
DOM_Node *node = state->top_state->current_node;
|
||||
DOM_Node *node = ACTIVE_NODE(state);
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
@ -4525,12 +4528,16 @@ XP_TRACE(("lo_LayoutTag(%d)\n", tag->type));
|
||||
|
||||
LO_LockLayout();
|
||||
|
||||
#ifdef DOM
|
||||
LM_ReflectTagNode(tag, state, context);
|
||||
#endif
|
||||
|
||||
if(!tag->is_end && lo_IsEmptyTag(tag->type))
|
||||
{
|
||||
#ifdef DOM
|
||||
lo_SetStyleSheetProperties(context, state, tag);
|
||||
lo_SetStyleSheetProperties(context, state, tag);
|
||||
#else
|
||||
lo_SetStyleSheetProperties(context, style_struct, tag);
|
||||
lo_SetStyleSheetProperties(context, style_struct, tag);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -7644,13 +7651,19 @@ XP_TRACE(("lo_LayoutTag(%d)\n", tag->type));
|
||||
/* find the last element on the line list and its node */
|
||||
#define FIND_LAST_ELEMENT(eptr) \
|
||||
eptr = state->line_list; \
|
||||
if (!eptr) \
|
||||
eptr = state->end_last_line; \
|
||||
/* if there are no elements in state, try the currently active one */ \
|
||||
if (!eptr) \
|
||||
eptr = state->top_state->doc_state->line_list; \
|
||||
if (!eptr) \
|
||||
eptr = state->top_state->doc_state->end_last_line; \
|
||||
if (eptr) { \
|
||||
while (eptr->lo_any.next != NULL) { \
|
||||
eptr = eptr->lo_any.next; \
|
||||
} \
|
||||
} else { \
|
||||
eptr = state->end_last_line; \
|
||||
}
|
||||
|
||||
FIND_LAST_ELEMENT(eptr);
|
||||
if (!eptr)
|
||||
return;
|
||||
@ -7673,6 +7686,12 @@ XP_TRACE(("lo_LayoutTag(%d)\n", tag->type));
|
||||
/* if we popped stuff, resync the end pointer */
|
||||
if (resyncElements) {
|
||||
FIND_LAST_ELEMENT(eptr);
|
||||
if (!eptr) {
|
||||
#ifdef DEBUG_shaver
|
||||
fprintf(stderr, "can't find new eptr for resync!\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
XP_ASSERT(eptr->lo_any.node == node);
|
||||
}
|
||||
|
||||
|
@ -8553,7 +8553,7 @@ lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
|
||||
JSContext *cx = context->mocha_context;
|
||||
DOM_StyleDatabase *db = state->top_state->style_db;
|
||||
DOM_AttributeEntry *entry;
|
||||
DOM_Node *node = state->top_state->current_node;
|
||||
DOM_Node *node = ACTIVE_NODE(state);
|
||||
LO_TextAttr text_attr, *newptr = NULL;
|
||||
JSBool copied = JS_FALSE;
|
||||
LO_Color col;
|
||||
|
@ -2608,7 +2608,7 @@ lo_SetNodeElement(lo_DocState *state, LO_Element *element)
|
||||
/* this the first element for this node, so mark it */
|
||||
ELEMENT_PRIV(node)->ele_start = element;
|
||||
}
|
||||
#ifdef DEBUG_shaver
|
||||
#ifdef DEBUG_shaver_verbose
|
||||
if (element->lo_any.node)
|
||||
fprintf(stderr, "element %p (type %d) already has node %x\n",
|
||||
element, element->lo_any.type, element->lo_any.node);
|
||||
|
Loading…
Reference in New Issue
Block a user