version 1.162, 2003/01/03 09:26:03
|
version 1.163, 2003/01/03 18:13:39
|
Line 1
|
Line 1
|
/* |
/* |
* |
* |
* (c) COPYRIGHT MIT and INRIA, 1996-2002 |
* (c) COPYRIGHT MIT and INRIA, 1996-2003 |
* Please first read the full copyright statement in file COPYRIGHT. |
* Please first read the full copyright statement in file COPYRIGHT. |
* |
* |
*/ |
*/ |
Line 2565 static char *ParseCSSBackgroundColor (El
|
Line 2565 static char *ParseCSSBackgroundColor (El
|
char *cssRule, |
char *cssRule, |
CSSInfoPtr css, ThotBool isHTML) |
CSSInfoPtr css, ThotBool isHTML) |
{ |
{ |
GenericContext ctxt = (GenericContext) context; |
|
PresentationValue best; |
PresentationValue best; |
unsigned int savedtype = 0; |
|
ThotBool moved; |
|
|
|
/* Horrible hack requested by CSS: move the rule to the root element */ |
|
moved = (isHTML && |
|
(element != NULL || ctxt->attrType[0] == 0) && |
|
(ctxt->type == HTML_EL_HTML || ctxt->type == HTML_EL_BODY)); |
|
if (moved) |
|
{ |
|
if (element) |
|
element = TtaGetMainRoot (context->doc); |
|
else |
|
{ |
|
savedtype = context->type; |
|
context->type = HTML_EL_Document; |
|
} |
|
} |
|
|
|
best.typed_data.unit = STYLE_UNIT_INVALID; |
best.typed_data.unit = STYLE_UNIT_INVALID; |
best.typed_data.real = FALSE; |
best.typed_data.real = FALSE; |
Line 2617 static char *ParseCSSBackgroundColor (El
|
Line 2599 static char *ParseCSSBackgroundColor (El
|
TtaSetStylePresentation (PRShowBox, element, tsch, context, best); |
TtaSetStylePresentation (PRShowBox, element, tsch, context, best); |
} |
} |
} |
} |
|
|
/* restore the refered element */ |
|
if (moved && !element) |
|
context->type = savedtype; |
|
return (cssRule); |
return (cssRule); |
} |
} |
|
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
ParseSVGStroke: parse a SVG stroke property |
ParseSVGStroke: parse a SVG stroke property |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
Line 2845 static char *ParseCSSBackgroundImage (El
|
Line 2822 static char *ParseCSSBackgroundImage (El
|
char *base; |
char *base; |
char tempname[MAX_LENGTH]; |
char tempname[MAX_LENGTH]; |
char imgname[MAX_LENGTH]; |
char imgname[MAX_LENGTH]; |
unsigned int savedtype = 0; |
|
ThotBool moved; |
|
|
|
/* default element for FetchImage */ |
if (element) |
el = TtaGetMainRoot (context->doc); |
|
/* Horrible hack requested by CSS: move the rule to the root element */ |
|
moved = (isHTML && (element != NULL || ctxt->attrType[0] == 0) && |
|
(ctxt->type == HTML_EL_HTML || ctxt->type == HTML_EL_BODY)); |
|
if (moved) |
|
{ |
|
if (element) |
|
element = el; |
|
else |
|
{ |
|
savedtype = context->type; |
|
context->type = HTML_EL_Document; |
|
} |
|
} |
|
else if (element) |
|
el = element; |
el = element; |
|
else |
|
/* default element for FetchImage */ |
|
el = TtaGetMainRoot (context->doc); |
|
|
url = NULL; |
url = NULL; |
cssRule = SkipBlanksAndComments (cssRule); |
cssRule = SkipBlanksAndComments (cssRule); |
if (!strncasecmp (cssRule, "none", 4)) |
if (!strncasecmp (cssRule, "none", 4)) |
Line 2966 static char *ParseCSSBackgroundImage (El
|
Line 2929 static char *ParseCSSBackgroundImage (El
|
TtaFreeMemory (url); |
TtaFreeMemory (url); |
} |
} |
} |
} |
|
|
/* restore the refered element */ |
|
if (moved && !element) |
|
context->type = savedtype; |
|
return (cssRule); |
return (cssRule); |
} |
} |
|
|
Line 2980 static char *ParseCSSBackgroundRepeat (E
|
Line 2939 static char *ParseCSSBackgroundRepeat (E
|
PresentationContext context, |
PresentationContext context, |
char *cssRule, CSSInfoPtr css, ThotBool isHTML) |
char *cssRule, CSSInfoPtr css, ThotBool isHTML) |
{ |
{ |
GenericContext ctxt = (GenericContext) context; |
|
PresentationValue repeat; |
PresentationValue repeat; |
unsigned int savedtype = 0; |
|
ThotBool moved; |
|
|
|
/* Horrible hack requested by CSS: move the rule to the root element */ |
|
moved = (isHTML && (element != NULL || ctxt->attrType[0] == 0) && |
|
(ctxt->type == HTML_EL_HTML || ctxt->type == HTML_EL_BODY)); |
|
if (moved) |
|
{ |
|
if (element) |
|
element = TtaGetMainRoot (context->doc); |
|
else |
|
{ |
|
savedtype = context->type; |
|
context->type = HTML_EL_Document; |
|
} |
|
} |
|
|
|
repeat.typed_data.value = STYLE_REALSIZE; |
repeat.typed_data.value = STYLE_REALSIZE; |
repeat.typed_data.unit = STYLE_UNIT_REL; |
repeat.typed_data.unit = STYLE_UNIT_REL; |
Line 3023 static char *ParseCSSBackgroundRepeat (E
|
Line 2965 static char *ParseCSSBackgroundRepeat (E
|
TtaSetStylePresentation (PRPictureMode, element, tsch, context, repeat); |
TtaSetStylePresentation (PRPictureMode, element, tsch, context, repeat); |
} |
} |
cssRule = SkipWord (cssRule); |
cssRule = SkipWord (cssRule); |
|
return (cssRule); |
/* restore the refered element */ |
|
if (moved && !element) |
|
context->type = savedtype; |
|
return (cssRule); |
|
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 3039 static char *ParseCSSBackgroundAttachmen
|
Line 2977 static char *ParseCSSBackgroundAttachmen
|
char *cssRule, CSSInfoPtr css, |
char *cssRule, CSSInfoPtr css, |
ThotBool isHTML) |
ThotBool isHTML) |
{ |
{ |
GenericContext ctxt = (GenericContext) context; |
cssRule = SkipBlanksAndComments (cssRule); |
unsigned int savedtype = 0; |
if (!strncasecmp (cssRule, "scroll", 6)) |
ThotBool moved; |
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "fixed", 5)) |
/* Horrible hack requested by CSS: move the rule to the root element */ |
cssRule = SkipWord (cssRule); |
moved = (isHTML && (element != NULL || ctxt->attrType[0] == 0) && |
return (cssRule); |
(ctxt->type == HTML_EL_HTML || ctxt->type == HTML_EL_BODY)); |
|
if (moved) |
|
{ |
|
if (element) |
|
element = TtaGetMainRoot (context->doc); |
|
else |
|
{ |
|
savedtype = context->type; |
|
context->type = HTML_EL_Document; |
|
} |
|
} |
|
|
|
cssRule = SkipBlanksAndComments (cssRule); |
|
if (!strncasecmp (cssRule, "scroll", 6)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "fixed", 5)) |
|
cssRule = SkipWord (cssRule); |
|
|
|
/* restore the refered element */ |
|
if (moved && !element) |
|
context->type = savedtype; |
|
return (cssRule); |
|
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 3078 static char *ParseCSSBackgroundPosition
|
Line 2994 static char *ParseCSSBackgroundPosition
|
char *cssRule, CSSInfoPtr css, |
char *cssRule, CSSInfoPtr css, |
ThotBool isHTML) |
ThotBool isHTML) |
{ |
{ |
GenericContext ctxt = (GenericContext) context; |
|
PresentationValue repeat; |
PresentationValue repeat; |
unsigned int savedtype = 0; |
|
ThotBool moved; |
|
ThotBool ok; |
ThotBool ok; |
|
|
/* Horrible hack requested by CSS: move the rule to the root element */ |
cssRule = SkipBlanksAndComments (cssRule); |
moved = (isHTML && (element != NULL || ctxt->attrType[0] == 0) && |
ok = TRUE; |
(ctxt->type == HTML_EL_HTML || ctxt->type == HTML_EL_BODY)); |
if (!strncasecmp (cssRule, "left", 4)) |
if (moved) |
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "right", 5)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "center", 6)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "top", 3)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "bottom", 6)) |
|
cssRule = SkipWord (cssRule); |
|
else if (isdigit (*cssRule) || *cssRule == '.') |
|
cssRule = SkipWord (cssRule); |
|
else |
|
ok = FALSE; |
|
|
|
if (ok && DoApply) |
{ |
{ |
if (element) |
/* force realsize for the background image */ |
element = TtaGetMainRoot (context->doc); |
repeat.typed_data.value = STYLE_REALSIZE; |
else |
repeat.typed_data.unit = STYLE_UNIT_REL; |
{ |
repeat.typed_data.real = FALSE; |
savedtype = context->type; |
/* check if it's an important rule */ |
context->type = HTML_EL_Document; |
if (tsch) |
} |
cssRule = CheckImportantRule (cssRule, context); |
|
TtaSetStylePresentation (PRPictureMode, element, tsch, context, repeat); |
} |
} |
|
return (cssRule); |
cssRule = SkipBlanksAndComments (cssRule); |
|
ok = TRUE; |
|
if (!strncasecmp (cssRule, "left", 4)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "right", 5)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "center", 6)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "top", 3)) |
|
cssRule = SkipWord (cssRule); |
|
else if (!strncasecmp (cssRule, "bottom", 6)) |
|
cssRule = SkipWord (cssRule); |
|
else if (isdigit (*cssRule) || *cssRule == '.') |
|
cssRule = SkipWord (cssRule); |
|
else |
|
ok = FALSE; |
|
|
|
if (ok && DoApply) |
|
{ |
|
/* force realsize for the background image */ |
|
repeat.typed_data.value = STYLE_REALSIZE; |
|
repeat.typed_data.unit = STYLE_UNIT_REL; |
|
repeat.typed_data.real = FALSE; |
|
/* check if it's an important rule */ |
|
if (tsch) |
|
cssRule = CheckImportantRule (cssRule, context); |
|
TtaSetStylePresentation (PRPictureMode, element, tsch, context, repeat); |
|
} |
|
|
|
/* restore the refered element */ |
|
if (moved && !element) |
|
context->type = savedtype; |
|
return (cssRule); |
|
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |