Move DOM Style parsers to laydom.[ch]

Add destructor to entries.
This commit is contained in:
pollmann%netscape.com 1998-10-16 21:18:24 +00:00
parent b6a0d81eab
commit 61e94462cf
9 changed files with 432 additions and 177 deletions

View File

@ -26,7 +26,7 @@ EXPORTS = laylayer.h layout.h lo_funcs.h
# XXX Perignon hack
ifdef DOM
EXPORTS += laystyle.h
EXPORTS += laydom.h laystyle.h
endif
CSRCS = bullet.c \
@ -67,6 +67,10 @@ CSRCS = bullet.c \
layutil.c \
$(NULL)
ifdef DOM
CSRCS +=laydom.c
endif
REQUIRES = parse style js layer applet nspr security dbm img util jtools edtplug java hook pref libfont lay rdf network htmldlgs privacy mocha oji ojiimpl xpcom mailto
ifdef DOM

View File

@ -30,6 +30,7 @@
#ifdef DOM
#include "domstyle.h"
#include "lm_dom.h"
#include "laydom.h"
#endif
/* This struct is used during the processing of a <LAYER> or <ILAYER>
@ -969,74 +970,6 @@ lo_ParseStyleCoords(MWContext *context,
}
#ifdef DOM
static JSBool
PositionParser(const char *position, uint32 *data, void *closure)
{
if (!strcasecomp(position, ABSOLUTE_STYLE))
*data = 0;
else if (!strcasecomp(position, RELATIVE_STYLE))
*data = 1;
else
*data = 2;
return JS_TRUE;
}
#define AXIS_NONE 0
#define AXIS_X 1
#define AXIS_Y 2
struct SSUnitContext {
MWContext *context;
uint32 enclosingVal;
uint8 units;
uint8 axisAdjust;
};
#define STYLE_UNITS_NONE 0
#define STYLE_UNITS_PERCENT 1
/* XXX finish */
JSBool
lo_ParseSSNum(const char *str, uint32 *num, uint8 *units)
{
*num = XP_ATOI(str);
if (strchr(str, '%'))
*units = STYLE_UNITS_PERCENT;
else
*units = STYLE_UNITS_NONE;
return JS_TRUE;
}
JSBool
lo_atoi(const char *str, uint32 *num, void *closure)
{
*num = XP_ATOI(str);
return JS_TRUE;
}
JSBool
lo_ParseSSNumToData(const char *str, uint32 *data, void *closure)
{
struct SSUnitContext *argp = closure;
uint32 num;
if (!lo_ParseSSNum(str, &num, &argp->units))
return JS_FALSE;
if (argp->units == STYLE_UNITS_PERCENT) {
num = argp->enclosingVal * num / 100;
}
if (argp->axisAdjust == AXIS_X)
num = FEUNITS_X(num, argp->context);
else if (argp->axisAdjust == AXIS_Y)
num = FEUNITS_Y(num, argp->context);
*data = num;
return JS_TRUE;
}
void
lo_SetStyleSheetLayerProperties(MWContext *context, lo_DocState *state,
DOM_StyleDatabase *db, DOM_Node *node,
@ -1075,7 +1008,7 @@ lo_SetStyleSheetLayerProperties(MWContext *context, lo_DocState *state,
return;
if (entry) {
if (!DOM_GetCleanEntryData(cx, entry, PositionParser,
if (!DOM_GetCleanEntryData(cx, entry, PositionParser, NULL,
(uint32 *)&inflow, NULL))
return;
} else {
@ -1101,7 +1034,7 @@ lo_SetStyleSheetLayerProperties(MWContext *context, lo_DocState *state,
if (entry) {
arg.axisAdjust = AXIS_X;
arg.enclosingVal = 0;
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData,
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData, NULL,
&param->left, (void *)&arg))
goto error;
CHECK_PERCENTAGE(entry, arg);
@ -1113,7 +1046,7 @@ lo_SetStyleSheetLayerProperties(MWContext *context, lo_DocState *state,
if (entry) {
arg.axisAdjust = AXIS_Y;
arg.enclosingVal = 0;
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData, &param->top,
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData, NULL, &param->top,
(void *)&arg))
goto error;
CHECK_PERCENTAGE(entry, arg);
@ -1125,7 +1058,7 @@ lo_SetStyleSheetLayerProperties(MWContext *context, lo_DocState *state,
if (entry) {
arg.axisAdjust = AXIS_Y;
arg.enclosingVal = lo_GetEnclosingLayerHeight(state);
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData,
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData, NULL,
&param->height, (void *)&arg))
goto error;
CHECK_PERCENTAGE(entry, arg);
@ -1147,7 +1080,7 @@ lo_SetStyleSheetLayerProperties(MWContext *context, lo_DocState *state,
if (!DOM_StyleGetProperty(cx, db, node, ZINDEX_STYLE, &entry))
goto error;
if (entry) {
if (!DOM_GetCleanEntryData(cx, entry, lo_atoi, &param->zindex, NULL))
if (!DOM_GetCleanEntryData(cx, entry, lo_atoi, NULL, &param->zindex, NULL))
goto error;
param->has_zindex = TRUE;
} else {
@ -3377,4 +3310,4 @@ lo_EndLayerReflow(MWContext *context, lo_DocState *state)
ET_SendLoadEvent(context, EVENT_LOAD, NULL, NULL, layer_state->id,
TRUE);
}
}

306
lib/layout/laydom.c Normal file
View File

@ -0,0 +1,306 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* laydom.c - Parse CSS/DOM values, constructors and destructors for data storage
*
*/
#include "xp.h"
#include "layout.h"
#include "dom.h"
#include "laydom.h"
#include "laystyle.h"
JSBool
lo_atoi(const char *str, uint32 *num, void *closure)
{
*num = XP_ATOI(str);
return JS_TRUE;
}
JSBool
lo_SSUnitsToData(const char *str, uint32 *data, void *closure)
{
/* XXX NYI */
*data = XP_ATOI(str);
return JS_TRUE;
}
JSBool
FontWeightToData(const char *str, uint32 *data, void *closure)
{
uint32 weight;
/* XXX use proper CSS-value parsing stuff */
if (!strcasecomp(str, "bolder")) {
weight = FONT_WEIGHT_BOLDER;
} else if (!strcasecomp(str, "lighter")) {
weight = FONT_WEIGHT_LIGHTER;
} else if (!strcasecomp(str, "bold")) {
weight = 700;
} else if (!strcasecomp(str, "normal")) {
weight = 400;
} else {
weight = XP_ATOI(str);
weight -= weight % 100;
}
*data = weight;
return JS_TRUE;
}
#define SET_ATTR_BIT_IF(style, bit) \
if (!strcasecomp(decors, style)) \
attrs |= bit;
JSBool
TextDecorationToData(const char *decors, uint32 *data, void *closure)
{
uint32 attrs = 0;
/* XXX handle multiple tokens */
SET_ATTR_BIT_IF(BLINK_STYLE, LO_ATTR_BLINK)
else
SET_ATTR_BIT_IF(STRIKEOUT_STYLE, LO_ATTR_STRIKEOUT)
else
SET_ATTR_BIT_IF(UNDERLINE_STYLE, LO_ATTR_UNDERLINE)
else
if (!strcasecomp(decors, "none"))
attrs = 0;
*data = attrs;
return JS_TRUE;
}
#undef SET_ATTR_BIT_IF
JSBool
PositionParser(const char *position, uint32 *data, void *closure)
{
if (!XP_STRCASECMP(position, ABSOLUTE_STYLE))
*data = 0;
else if (!XP_STRCASECMP(position, RELATIVE_STYLE))
*data = 1;
else
*data = 2;
return JS_TRUE;
}
JSBool
lo_ColorStringToData(const char *color, uint32 *data, void *closure)
{
LO_Color col;
if (!LO_ParseStyleSheetRGB((char *)color, &col.red, &col.green, &col.blue))
return JS_FALSE;
*data = *(uint32 *)&col;
return JS_TRUE;
}
/*
* Update LO_AdjustSSUnits() in laystyle.c to deal with DOM_StyleUnits
*/
JSBool
lo_ParseSSNum(const char *str, uint32 *num, DOM_StyleUnits *units)
{
const char *ptr, *num_ptr;
ptr = str;
/* skip any whitespace */
while(XP_IS_SPACE(*ptr)) ptr++;
/* save a pointer to the first non white char */
num_ptr = ptr;
/* go past any sign in front of the number */
if(*ptr == '-' || *ptr == '+') ptr++;
/* go forward until a non number is encountered */
while(XP_IS_DIGIT(*ptr)) ptr++;
/* go past a decimal */
if(*ptr == '.') ptr++;
while(XP_IS_DIGIT(*ptr)) ptr++;
/* skip any whitespace between the number and units */
while(XP_IS_SPACE(*ptr)) ptr++;
/*
* no need to clear out the string at the end since
* atof will do that for us, and writting to the string
* will make us crash
*
* ptr_value = *ptr;
* *ptr = '\0';
* *ptr = ptr_value;
*/
*num = XP_ATOI(num_ptr);
if(!XP_STRNCASECMP(ptr, "em", 2))
*units = STYLE_UNITS_EMS;
else if(!XP_STRNCASECMP(ptr, "ex", 2))
*units = STYLE_UNITS_EXS;
else if(!XP_STRNCASECMP(ptr, "px", 2))
*units = STYLE_UNITS_PXS;
else if(!XP_STRNCASECMP(ptr, "pt", 2))
*units = STYLE_UNITS_PTS;
else if(!XP_STRNCASECMP(ptr, "pc", 2))
*units = STYLE_UNITS_PCS;
else if(!XP_STRNCASECMP(ptr, "in", 2))
*units = STYLE_UNITS_INS;
else if(!XP_STRNCASECMP(ptr, "cm", 2))
*units = STYLE_UNITS_CMS;
else if(!XP_STRNCASECMP(ptr, "mm", 2))
*units = STYLE_UNITS_MMS;
else if(!XP_STRNCMP(ptr, "%", 1))
*units = STYLE_UNITS_PERCENT;
else if(!*ptr)
*units = STYLE_UNITS_REL;
else
*units = STYLE_UNITS_PXS;
return JS_TRUE;
}
JSBool
lo_ParseSSNumToData(const char *str, uint32 *data, void *closure)
{
struct SSUnitContext *argp = closure;
int32 num;
if (!lo_ParseSSNum(str, &num, (DOM_StyleUnits *)&argp->units))
return JS_FALSE;
if (argp->units == STYLE_UNITS_PERCENT) {
num = argp->enclosingVal * num / 100;
}
if (argp->axisAdjust == AXIS_X)
num = FEUNITS_X(num, argp->context);
else if (argp->axisAdjust == AXIS_Y)
num = FEUNITS_Y(num, argp->context);
*data = num;
return JS_TRUE;
}
/* XXX Merge with lo_ParseSSNum */
JSBool
lo_ParseFontSize(const char *str, uint32 *num, DOM_StyleUnits *units)
{
const char *ptr, *num_ptr;
double *value = XP_NEW(double);
if (!value)
return JS_FALSE;
ptr = str;
/* skip any whitespace */
while(XP_IS_SPACE(*ptr)) ptr++;
/* save a pointer to the first non white char */
num_ptr = ptr;
/* go past any sign in front of the number */
if(*ptr == '-' || *ptr == '+') ptr++;
/* go forward until a non number is encountered */
while(XP_IS_DIGIT(*ptr)) ptr++;
/* go past a decimal */
if(*ptr == '.') ptr++;
while(XP_IS_DIGIT(*ptr)) ptr++;
/* skip any whitespace between the number and units */
while(XP_IS_SPACE(*ptr)) ptr++;
/*
* no need to clear out the string at the end since
* atof will do that for us, and writting to the string
* will make us crash
*
* ptr_value = *ptr;
* *ptr = '\0';
* *ptr = ptr_value;
*/
*value = atof(num_ptr); /* Calculate value */
*num = (int32)value; /* Save pointer to value in data */
if(!XP_STRNCASECMP(ptr, "em", 2))
*units = STYLE_UNITS_EMS;
else if(!XP_STRNCASECMP(ptr, "ex", 2))
*units = STYLE_UNITS_EXS;
else if(!XP_STRNCASECMP(ptr, "px", 2))
*units = STYLE_UNITS_PXS;
else if(!XP_STRNCASECMP(ptr, "pt", 2))
*units = STYLE_UNITS_PTS;
else if(!XP_STRNCASECMP(ptr, "pc", 2))
*units = STYLE_UNITS_PCS;
else if(!XP_STRNCASECMP(ptr, "in", 2))
*units = STYLE_UNITS_INS;
else if(!XP_STRNCASECMP(ptr, "cm", 2))
*units = STYLE_UNITS_CMS;
else if(!XP_STRNCASECMP(ptr, "mm", 2))
*units = STYLE_UNITS_MMS;
else if(!XP_STRNCMP(ptr, "%", 1))
*units = STYLE_UNITS_PERCENT;
else if(!*ptr)
*units = STYLE_UNITS_REL;
else
*units = STYLE_UNITS_PXS;
return JS_TRUE;
}
JSBool
lo_ParseFontSizeToData(const char *str, uint32 *data, void *closure)
{
struct SSUnitContext *argp = closure;
int32 num;
if (!lo_ParseFontSize(str, &num, (DOM_StyleUnits *)&argp->units))
return JS_FALSE;
if (argp->units == STYLE_UNITS_PERCENT) {
num = argp->enclosingVal * num / 100;
}
if (argp->axisAdjust == AXIS_X)
num = FEUNITS_X(num, argp->context);
else if (argp->axisAdjust == AXIS_Y)
num = FEUNITS_Y(num, argp->context);
*data = num;
return JS_TRUE;
}
JSBool
lo_DeleteFontSize(DOM_AttributeEntry *entry)
{
if (!entry)
return JS_FALSE;
XP_FREEIF((double *)entry->data);
return JS_TRUE;
}

82
lib/layout/laydom.h Normal file
View File

@ -0,0 +1,82 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* Perignon: parse style information to store in the DOM.
*/
#ifndef LAY_DOM_H
#define LAY_DOM_H
#define AXIS_NONE 0
#define AXIS_X 1
#define AXIS_Y 2
#define FONT_WEIGHT_BOLDER 0x10000
#define FONT_WEIGHT_LIGHTER 0x20000
struct SSUnitContext {
MWContext *context;
uint32 enclosingVal;
uint8 units;
uint8 axisAdjust;
};
typedef enum DOM_StyleUnits {
STYLE_UNITS_UNKNOWN = -1,
STYLE_UNITS_NONE,
STYLE_UNITS_PERCENT,
STYLE_UNITS_EMS,
STYLE_UNITS_EXS,
STYLE_UNITS_PTS, /* points */
STYLE_UNITS_PXS, /* pixels */
STYLE_UNITS_PCS,
STYLE_UNITS_REL,
STYLE_UNITS_INS, /* inches */
STYLE_UNITS_CMS, /* centimeters */
STYLE_UNITS_MMS, /* millimeters */
} DOM_StyleUnits;
extern JSBool
lo_atoi(const char *str, uint32 *num, void *closure);
extern JSBool
lo_ColorStringToData(const char *color, uint32 *data, void *closure);
extern JSBool
lo_SSUnitsToData(const char *units, uint32 *data, void *closure);
extern JSBool
FontWeightToData(const char *str, uint32 *data, void *closure);
extern JSBool
TextDecorationToData(const char *decors, uint32 *data, void *closure);
extern JSBool
PositionParser(const char *position, uint32 *data, void *closure);
extern JSBool
lo_ParseSSNumToData(const char *str, uint32 *data, void *closure);
extern JSBool
lo_ParseFontSizeToData(const char *str, uint32 *data, void *closure);
extern JSBool
lo_DeleteFontSize(DOM_AttributeEntry *entry);
#endif /* LAY_DOM_H */

View File

@ -56,6 +56,7 @@
#ifdef DOM
#include "domstyle.h"
#include "lm_dom.h"
#include "laydom.h"
#endif
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
@ -834,7 +835,7 @@ new_form_element(MWContext *context, lo_DocState *state, int32 type)
return NULL;
}
if (entry) {
if (!DOM_GetCleanEntryData(cx, entry, lo_ColorStringToData,
if (!DOM_GetCleanEntryData(cx, entry, lo_ColorStringToData, NULL,
(uint32 *)&col, NULL)) {
XP_FREE(form_element);
return NULL;

View File

@ -35,6 +35,7 @@
#ifdef DOM
#include "domstyle.h"
#include "lm_dom.h"
#include "laydom.h"
#endif
extern int MK_OUT_OF_MEMORY;
@ -1553,7 +1554,7 @@ lo_FormatImage(MWContext *context, lo_DocState *state, PA_Tag *tag)
goto error;
if (entry) {
/* XXX handle borderTop/borderBottom/borderLeft/borderRight */
if (!DOM_GetCleanEntryData(cx, entry, lo_SSUnitsToData,
if (!DOM_GetCleanEntryData(cx, entry, lo_SSUnitsToData, NULL,
&image->border_width, context))
goto error;
} else {
@ -1568,7 +1569,7 @@ lo_FormatImage(MWContext *context, lo_DocState *state, PA_Tag *tag)
goto error;
if (entry) {
/* XXX handle paddingTop/paddingBottom/paddingLeft/paddingRight */
if (!DOM_GetCleanEntryData(cx, entry, lo_SSUnitsToData,
if (!DOM_GetCleanEntryData(cx, entry, lo_SSUnitsToData, NULL,
&image->border_vert_space, context))
goto error;
image->border_horiz_space = image->border_vert_space;

View File

@ -968,14 +968,6 @@ lo_GetCurrentTextAttr(lo_DocState *state, MWContext *context);
extern LO_TextAttr *
lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
LO_TextAttr *tptr, JSBool isMutable);
/* colour parsing function for use with DOM_GetCleanAttributeData */
extern JSBool
lo_ColorStringToData(const char *color, uint32 *data, void *closure);
extern JSBool
lo_SSUnitsToData(const char *units, uint32 *data, void *closure);
#endif /* DOM */
extern void lo_FindLineMargins(MWContext *, lo_DocState *, Bool updateFE);

View File

@ -39,6 +39,7 @@
#ifdef DOM
#include "domstyle.h"
#include "lm_dom.h"
#include "laydom.h"
#endif
#include "pics.h"
@ -4164,21 +4165,6 @@ DisplayParser(const char *str, uint32 *data, void *closure)
}
#if 0 /* not ready yet */
/* XXX -- copied struct def'n from layblock.c -- I'm going to hell for sure */
#define AXIS_NONE 0
#define AXIS_X 1
#define AXIS_Y 2
struct SSUnitContext {
MWContext *context;
uint32 enclosingVal;
uint8 units;
uint8 axisAdjust;
};
#define STYLE_UNITS_NONE 0
#define STYLE_UNITS_PERCENT 1
static void
lo_SetStyleSheetBoxProperties(MWContext *context, lo_DocState *state,
@ -4202,7 +4188,7 @@ lo_SetStyleSheetBoxProperties(MWContext *context, lo_DocState *state,
if (!DOM_StyleGetProperty(cx, db, node, DISPLAY_STYLE, &entry))
return;
if (entry) {
if (!DOM_GetCleanEntryData(cx, entry, DisplayParser, &value, NULL))
if (!DOM_GetCleanEntryData(cx, entry, DisplayParser, NULL, &value, NULL))
return;
if (value == DISPLAY_STYLE_BLOCK) {
/* display:block */
@ -4229,7 +4215,7 @@ lo_SetStyleSheetBoxProperties(MWContext *context, lo_DocState *state,
if (entry) {
arg.axisAdjust = AXIS_X;
arg.enclosingVal = 0; /* XXX enclosing left margin? */
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData,
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseSSNumToData, NULL,
&left_margin, (void *)&arg))
return;
CHECK_PERCENTAGE(entry, arg);
@ -4271,7 +4257,7 @@ lo_SetStyleSheetProperties(MWContext *context, lo_DocState *state, PA_Tag *tag)
return;
if (entry) {
uint32 value;
if (!DOM_GetCleanEntryData(cx, entry, DisplayParser, &value, NULL))
if (!DOM_GetCleanEntryData(cx, entry, DisplayParser, NULL, &value, NULL))
return;
if (value == DISPLAY_STYLE_NONE) {
/*

View File

@ -29,6 +29,7 @@
#ifdef DOM
#include "domstyle.h"
#include "lm_dom.h"
#include "laydom.h"
#endif
/*
@ -8470,7 +8471,7 @@ lo_GetCurrentTextAttr(lo_DocState *state, MWContext *context)
styleptr = lo_FillInTextStyleInfo(state, context, tptr, isMutable);
if (styleptr != tptr)
isMutable = JS_FALSE; /* already fetched, so no need to refetch */
isMutable = JS_FALSE; /* already fetched, so no need to refetch */
tptr = styleptr;
if (isMutable)
@ -8480,72 +8481,6 @@ lo_GetCurrentTextAttr(lo_DocState *state, MWContext *context)
return tptr;
}
JSBool
lo_ColorStringToData(const char *color, uint32 *data, void *closure)
{
LO_Color col;
if (!LO_ParseStyleSheetRGB((char *)color, &col.red, &col.green, &col.blue))
return JS_FALSE;
*data = *(uint32 *)&col;
return JS_TRUE;
}
#define FONT_WEIGHT_BOLDER 0x10000
#define FONT_WEIGHT_LIGHTER 0x20000
JSBool
lo_SSUnitsToData(const char *str, uint32 *data, void *closure)
{
/* XXX NYI */
*data = XP_ATOI(str);
return JS_TRUE;
}
static JSBool
FontWeightToData(const char *str, uint32 *data, void *closure)
{
uint32 weight;
/* XXX use proper CSS-value parsing stuff */
if (!strcasecomp(str, "bolder")) {
weight = FONT_WEIGHT_BOLDER;
} else if (!strcasecomp(str, "lighter")) {
weight = FONT_WEIGHT_LIGHTER;
} else if (!strcasecomp(str, "bold")) {
weight = 700;
} else if (!strcasecomp(str, "normal")) {
weight = 400;
} else {
weight = XP_ATOI(str);
weight -= weight % 100;
}
*data = weight;
return JS_TRUE;
}
#define SET_ATTR_BIT_IF(style, bit) \
if (!strcasecomp(decors, style)) \
attrs |= bit;
static JSBool
TextDecorationToData(const char *decors, uint32 *data, void *closure)
{
uint32 attrs = 0;
/* XXX handle multiple tokens */
SET_ATTR_BIT_IF(BLINK_STYLE, LO_ATTR_BLINK)
else
SET_ATTR_BIT_IF(STRIKEOUT_STYLE, LO_ATTR_STRIKEOUT)
else
SET_ATTR_BIT_IF(UNDERLINE_STYLE, LO_ATTR_UNDERLINE)
else
if (!strcasecomp(decors, "none"))
attrs = 0;
*data = attrs;
return JS_TRUE;
}
#undef SET_ATTR_BIT_IF
#ifdef DEBUG_shaver
/* #define DEBUG_shaver_textattr */
#endif
@ -8650,7 +8585,7 @@ lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
/* XXX report error? return NULL? */
goto done;
if (entry) {
if (!DOM_GetCleanEntryData(cx, entry, lo_ColorStringToData, (uint32*)&col,
if (!DOM_GetCleanEntryData(cx, entry, lo_ColorStringToData, NULL, (uint32*)&col,
NULL))
goto done;
if (*(uint32 *)&col != *(uint32 *)&tptr->fg) {
@ -8664,7 +8599,7 @@ lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
goto done;
if (entry) {
COW();
if (!DOM_GetCleanEntryData(cx, entry, lo_ColorStringToData, (uint32*)&col,
if (!DOM_GetCleanEntryData(cx, entry, lo_ColorStringToData, NULL, (uint32*)&col,
NULL))
goto done;
newptr->bg = col;
@ -8690,7 +8625,22 @@ lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
}
}
/* XXX font-size requires STYLESTRUCT_StringToSSNumber-alike */
/* check font-size */
if (!DOM_StyleGetProperty(cx, db, node, FONTSIZE_STYLE, &entry))
return NULL;
if (entry) {
double *fontsize;
struct SSUnitContext arg;
arg.context = context;
if (!DOM_GetCleanEntryData(cx, entry, lo_ParseFontSizeToData, lo_DeleteFontSize,
(uint32*)&fontsize, (void *)&arg))
return NULL;
if (newptr->point_size != *fontsize) {
COW();
newptr->point_size = *fontsize;
}
}
/* check font-weight */
if (!DOM_StyleGetProperty(cx, db, node, FONTWEIGHT_STYLE, &entry))
@ -8701,7 +8651,7 @@ lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
* For "bolder" and "lighter", we need to keep them dirty because they're
* dependent on the enclosing state.
*/
if (!DOM_GetCleanEntryData(cx, entry, FontWeightToData, &weight, NULL))
if (!DOM_GetCleanEntryData(cx, entry, FontWeightToData, NULL, &weight, NULL))
goto done;
if (weight) {
if (!newptr->font_weight) {
@ -8748,7 +8698,7 @@ lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
if (entry) {
uint32 attrs;
#define ATTRMASK (LO_ATTR_BLINK | LO_ATTR_STRIKEOUT | LO_ATTR_UNDERLINE)
if (!DOM_GetCleanEntryData(cx, entry, TextDecorationToData, &attrs, NULL))
if (!DOM_GetCleanEntryData(cx, entry, TextDecorationToData, NULL, &attrs, NULL))
goto done;
attrs = (tptr->attrmask & ~ATTRMASK) | (attrs & ATTRMASK);
if (attrs != tptr->attrmask) {
@ -8773,7 +8723,7 @@ lo_FillInTextStyleInfo(lo_DocState *state, MWContext *context,
return tptr;
}
#endif
#endif /* DOM */
#ifdef TEST_16BIT
#undef XP_WIN16