Enable setting of table cell attributes (bgcolor -- still broken), and

expose lo_SetColor to other code (libmocha's DOM stuff, specifically).


git-svn-id: svn://10.0.0.236/trunk@9279 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
shaver%netscape.com 1998-09-04 00:08:08 +00:00
parent 18f85f8dd0
commit 35c4e01d18
4 changed files with 47 additions and 4 deletions

View File

@ -1186,6 +1186,7 @@ extern Bool lo_SetNamedAnchor(lo_DocState *, PA_Block);
#ifdef DOM
extern Bool lo_SetNamedSpan(lo_DocState *, PA_Block);
extern void lo_SetColor( LO_Element *ele, LO_Color *color, Bool background);
#endif
extern void lo_AddNameList(lo_DocState *, lo_DocState *);

View File

@ -30,7 +30,7 @@
/* Initial attempt at DOM by letting JS set style of SPAN contents */
static void lo_SetColor( LO_Element *ele, LO_Color *color, Bool background);
void lo_SetColor( LO_Element *ele, LO_Color *color, Bool background);
static void lo_SetFontFamily( MWContext *context, LO_Element *ele, char *family);
static void lo_SetFontWeight( MWContext *context, LO_Element *ele, char *weight);
static void lo_SetFontSlant( MWContext *context, LO_Element *ele, char *weight);
@ -167,8 +167,7 @@ lo_FindParentSpan( LO_Element *ele )
return (LO_SpanStruct *) ele;
}
/* Functions internal to this file */
static void lo_SetColor( LO_Element *ele, LO_Color *color, Bool background)
void lo_SetColor( LO_Element *ele, LO_Color *color, Bool background)
{
switch (ele->lo_any.type)
{
@ -210,6 +209,7 @@ static void lo_SetColor( LO_Element *ele, LO_Color *color, Bool background)
}
}
/* Functions internal to this file */
static void
lo_SetFontFamily( MWContext *context,
LO_Element *ele,

View File

@ -136,6 +136,48 @@ static void lo_UpdateCaptionCellFromSubDoc( MWContext *context, lo_DocState *sta
static void lo_FreeCaptionCell( MWContext *context, lo_DocState *state, LO_CellStruct *cell_ele);
static void lo_FreeTableCaption( MWContext *context, lo_DocState *state, lo_TableRec *table );
#ifdef DEBUG_shaver
extern char *element_names[];
#endif
void LO_SetTableCellAttributes(MWContext *context, void *cell_v,
const char *name, const char *value)
{
lo_TableCell *cell = (lo_TableCell *)cell_v;
LO_Element *start = cell->cell->cell_list, *end = cell->cell->cell_list_end;
if (!start)
return;
#ifdef DEBUG_shaver
fprintf(stderr, "setting %s=%s on <TD>\n", name, value);
#endif
if (!XP_STRCASECMP(name, "bgcolor")) {
LO_Color rgb;
LO_Element *iter = start;
if (!LO_ParseRGB((char *)value, &rgb.red, &rgb.green, &rgb.blue))
return;
/* while (iter && iter != end) { */
#ifdef DEBUG_shaver
fprintf(stderr, "setting bgcolor of %s to %s\n",
element_names[iter->type], value);
#endif
lo_SetColor(start, &rgb, TRUE);
/* iter = iter->lo_any.next;
}
if (iter != start) {
#ifdef DEBUG_shaver
fprintf(stderr, "setting bgcolor of %s to %s\n",
element_names[iter->type], value);
#endif
lo_SetColor(start, &rgb, TRUE);
}
*/
}
/* XXX LO_JustRedrawNothingChangedThatsImportant */
LO_RelayoutFromElement(context, start);
}
static int32
lo_ComputeCellEmptySpace(MWContext *context, lo_TableRec *table,
LO_SubDocStruct *subdoc)

View File

@ -2571,7 +2571,7 @@ lo_SetNodeElement(lo_DocState *state, LO_Element *element)
LO_Element *eptr;
DOM_Node *node = CURRENT_NODE(state);
#ifdef DEBUG_shaver
#ifdef DEBUG_shaver_0
fprintf(stderr, "lo_SetNodeElement: state %x: ", state);
if (!node)
fprintf(stderr, "NULL node\n");