version 1.233, 2003/10/06 14:05:44
|
version 1.234, 2003/10/14 14:29:03
|
Line 211 static void CSSParseError (char *msg, ch
|
Line 211 static void CSSParseError (char *msg, ch
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
SkipProperty skips a property and display and error message |
SkipProperty skips a property and display and error message |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
static char *SkipProperty (char *ptr) |
static char *SkipProperty (char *ptr, ThotBool reportError) |
{ |
{ |
char *deb; |
char *deb; |
char c; |
char c; |
Line 232 static char *SkipProperty (char *ptr)
|
Line 232 static char *SkipProperty (char *ptr)
|
/* print the skipped property */ |
/* print the skipped property */ |
c = *ptr; |
c = *ptr; |
*ptr = EOS; |
*ptr = EOS; |
#ifdef CSS_WARNING |
if (reportError && *deb != EOS && |
if (*deb != EOS) |
strncasecmp (deb, "border-spacing", 14) && |
|
strncasecmp (deb, "caption-side", 12) && |
|
strncasecmp (deb, "clip", 4) && |
|
strncasecmp (deb, "counter-increment", 16) && |
|
strncasecmp (deb, "counter-reset", 13) && |
|
strncasecmp (deb, "cursor", 6) && |
|
strncasecmp (deb, "empty-cells", 11) && |
|
strncasecmp (deb, "letter-spacing", 14) && |
|
strncasecmp (deb, "max-height", 10) && |
|
strncasecmp (deb, "max-width", 9) && |
|
strncasecmp (deb, "min-height", 10) && |
|
strncasecmp (deb, "min-width", 9) && |
|
strncasecmp (deb, "orphans", 7) && |
|
strncasecmp (deb, "outline-color", 13) && |
|
strncasecmp (deb, "outline-style", 13) && |
|
strncasecmp (deb, "outline-width", 13) && |
|
strncasecmp (deb, "outline", 7) && |
|
strncasecmp (deb, "overflow", 8) && |
|
strncasecmp (deb, "quotes", 6) && |
|
strncasecmp (deb, "table-layout", 12) && |
|
strncasecmp (deb, "visibility", 10) && |
|
strncasecmp (deb, "widows", 6)) |
CSSPrintError ("CSS property ignored:", deb); |
CSSPrintError ("CSS property ignored:", deb); |
#endif /* CSS_WARNING */ |
|
*ptr = c; |
*ptr = c; |
return (ptr); |
return (ptr); |
} |
} |
Line 761 static char *ParseCSSBorderColorTop (Ele
|
Line 781 static char *ParseCSSBorderColorTop (Ele
|
{ |
{ |
PresentationValue best; |
PresentationValue best; |
|
|
cssRule = ParseCSSColor (cssRule, &best); |
if (!strncasecmp (cssRule, "transparent", 11)) |
|
{ |
|
best.typed_data.value = -2; /* -2 means transparent */ |
|
best.typed_data.unit = UNIT_REL; |
|
cssRule = SkipWord (cssRule); |
|
} |
|
else |
|
cssRule = ParseCSSColor (cssRule, &best); |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
{ |
{ |
/* check if it's an important rule */ |
/* check if it's an important rule */ |
Line 784 static char *ParseCSSBorderColorLeft (El
|
Line 811 static char *ParseCSSBorderColorLeft (El
|
{ |
{ |
PresentationValue best; |
PresentationValue best; |
|
|
cssRule = ParseCSSColor (cssRule, &best); |
if (!strncasecmp (cssRule, "transparent", 11)) |
|
{ |
|
best.typed_data.value = -2; /* -2 means transparent */ |
|
best.typed_data.unit = UNIT_REL; |
|
cssRule = SkipWord (cssRule); |
|
} |
|
else |
|
cssRule = ParseCSSColor (cssRule, &best); |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
{ |
{ |
/* check if it's an important rule */ |
/* check if it's an important rule */ |
Line 807 static char *ParseCSSBorderColorBottom (
|
Line 841 static char *ParseCSSBorderColorBottom (
|
{ |
{ |
PresentationValue best; |
PresentationValue best; |
|
|
cssRule = ParseCSSColor (cssRule, &best); |
if (!strncasecmp (cssRule, "transparent", 11)) |
|
{ |
|
best.typed_data.value = -2; /* -2 means transparent */ |
|
best.typed_data.unit = UNIT_REL; |
|
cssRule = SkipWord (cssRule); |
|
} |
|
else |
|
cssRule = ParseCSSColor (cssRule, &best); |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
{ |
{ |
/* check if it's an important rule */ |
/* check if it's an important rule */ |
Line 830 static char *ParseCSSBorderColorRight (E
|
Line 871 static char *ParseCSSBorderColorRight (E
|
{ |
{ |
PresentationValue best; |
PresentationValue best; |
|
|
cssRule = ParseCSSColor (cssRule, &best); |
if (!strncasecmp (cssRule, "transparent", 11)) |
|
{ |
|
best.typed_data.value = -2; /* -2 means transparent */ |
|
best.typed_data.unit = UNIT_REL; |
|
cssRule = SkipWord (cssRule); |
|
} |
|
else |
|
cssRule = ParseCSSColor (cssRule, &best); |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
if (best.typed_data.unit != UNIT_INVALID && DoApply) |
{ |
{ |
/* check if it's an important rule */ |
/* check if it's an important rule */ |
Line 1693 static char *ParseCSSFontSizeAdjust (Ele
|
Line 1741 static char *ParseCSSFontSizeAdjust (Ele
|
PresentationContext context, char *cssRule, |
PresentationContext context, char *cssRule, |
CSSInfoPtr css, ThotBool isHTML) |
CSSInfoPtr css, ThotBool isHTML) |
{ |
{ |
cssRule = SkipProperty (cssRule); |
cssRule = SkipProperty (cssRule, FALSE); |
return (cssRule); |
return (cssRule); |
} |
} |
|
|
Line 3441 static char *ParseCSSBackground (Element
|
Line 3489 static char *ParseCSSBackground (Element
|
{ |
{ |
NewLineSkipped = skippedNL; |
NewLineSkipped = skippedNL; |
/* rule not found */ |
/* rule not found */ |
cssRule = SkipProperty (cssRule); |
cssRule = SkipProperty (cssRule, FALSE); |
} |
} |
} |
} |
cssRule = SkipBlanksAndComments (cssRule); |
cssRule = SkipBlanksAndComments (cssRule); |
Line 3867 static char *ParseCSSZIndex (Element ele
|
Line 3915 static char *ParseCSSZIndex (Element ele
|
*/ |
*/ |
static CSSProperty CSSProperties[] = |
static CSSProperty CSSProperties[] = |
{ |
{ |
{"font-family", ParseCSSFontFamily}, |
|
{"font-style", ParseCSSFontStyle}, |
|
{"font-variant", ParseCSSFontVariant}, |
|
{"font-weight", ParseCSSFontWeight}, |
|
{"font-size-adjust", ParseCSSFontSizeAdjust}, |
|
{"font-size", ParseCSSFontSize}, |
|
{"font", ParseCSSFont}, |
|
|
|
{"color", ParseCSSForeground}, |
|
{"background-color", ParseCSSBackgroundColor}, |
{"background-color", ParseCSSBackgroundColor}, |
{"background-image", ParseCSSBackgroundImage}, |
{"background-image", ParseCSSBackgroundImage}, |
{"background-repeat", ParseCSSBackgroundRepeat}, |
{"background-repeat", ParseCSSBackgroundRepeat}, |
{"background-attachment", ParseCSSBackgroundAttachment}, |
{"background-attachment", ParseCSSBackgroundAttachment}, |
{"background-position", ParseCSSBackgroundPosition}, |
{"background-position", ParseCSSBackgroundPosition}, |
{"background", ParseCSSBackground}, |
{"background", ParseCSSBackground}, |
|
|
{"word-spacing", ParseCSSWordSpacing}, |
|
{"letter-spacing", ParseCSSLetterSpacing}, |
|
{"text-decoration", ParseCSSTextDecoration}, |
|
{"vertical-align", ParseCSSVerticalAlign}, |
|
{"text-transform", ParseCSSTextTransform}, |
|
{"text-align", ParseCSSTextAlign}, |
|
{"text-indent", ParseCSSTextIndent}, |
|
{"line-height", ParseCSSLineHeight}, |
|
|
|
{"direction", ParseCSSDirection}, |
|
{"unicode-bidi", ParseCSSUnicodeBidi}, |
|
|
|
{"margin-top", ParseCSSMarginTop}, |
|
{"margin-right", ParseCSSMarginRight}, |
|
{"margin-bottom", ParseCSSMarginBottom}, |
|
{"margin-left", ParseCSSMarginLeft}, |
|
{"margin", ParseCSSMargin}, |
|
|
|
{"padding-top", ParseCSSPaddingTop}, |
|
{"padding-right", ParseCSSPaddingRight}, |
|
{"padding-bottom", ParseCSSPaddingBottom}, |
|
{"padding-left", ParseCSSPaddingLeft}, |
|
{"padding", ParseCSSPadding}, |
|
|
|
{"border-top-width", ParseCSSBorderTopWidth}, |
{"border-top-width", ParseCSSBorderTopWidth}, |
{"border-right-width", ParseCSSBorderRightWidth}, |
{"border-right-width", ParseCSSBorderRightWidth}, |
{"border-bottom-width", ParseCSSBorderBottomWidth}, |
{"border-bottom-width", ParseCSSBorderBottomWidth}, |
Line 3927 static CSSProperty CSSProperties[] =
|
Line 3941 static CSSProperty CSSProperties[] =
|
{"border-bottom", ParseCSSBorderBottom}, |
{"border-bottom", ParseCSSBorderBottom}, |
{"border-left", ParseCSSBorderLeft}, |
{"border-left", ParseCSSBorderLeft}, |
{"border", ParseCSSBorder}, |
{"border", ParseCSSBorder}, |
|
{"bottom", ParseCSSBottom}, |
{"width", ParseCSSWidth}, |
|
{"height", ParseCSSHeight}, |
|
{"float", ParseCSSFloat}, |
|
{"clear", ParseCSSClear}, |
{"clear", ParseCSSClear}, |
|
{"color", ParseCSSForeground}, |
{"content", ParseCSSContent}, |
{"content", ParseCSSContent}, |
|
{"direction", ParseCSSDirection}, |
{"display", ParseCSSDisplay}, |
{"display", ParseCSSDisplay}, |
{"white-space", ParseCSSWhiteSpace}, |
{"float", ParseCSSFloat}, |
{"position", ParseCSSPosition}, |
{"font-family", ParseCSSFontFamily}, |
{"top", ParseCSSTop}, |
{"font-style", ParseCSSFontStyle}, |
{"right", ParseCSSRight}, |
{"font-variant", ParseCSSFontVariant}, |
{"bottom", ParseCSSBottom}, |
{"font-weight", ParseCSSFontWeight}, |
|
{"font-size-adjust", ParseCSSFontSizeAdjust}, |
|
{"font-size", ParseCSSFontSize}, |
|
{"font", ParseCSSFont}, |
|
{"height", ParseCSSHeight}, |
{"left", ParseCSSLeft}, |
{"left", ParseCSSLeft}, |
{"z-index", ParseCSSZIndex}, |
{"letter-spacing", ParseCSSLetterSpacing}, |
|
{"line-height", ParseCSSLineHeight}, |
{"list-style-type", ParseCSSListStyleType}, |
{"list-style-type", ParseCSSListStyleType}, |
{"list-style-image", ParseCSSListStyleImage}, |
{"list-style-image", ParseCSSListStyleImage}, |
{"list-style-position", ParseCSSListStylePosition}, |
{"list-style-position", ParseCSSListStylePosition}, |
{"list-style", ParseCSSListStyle}, |
{"list-style", ParseCSSListStyle}, |
|
{"margin-bottom", ParseCSSMarginBottom}, |
|
{"margin-top", ParseCSSMarginTop}, |
|
{"margin-right", ParseCSSMarginRight}, |
|
{"margin-left", ParseCSSMarginLeft}, |
|
{"margin", ParseCSSMargin}, |
|
{"padding-top", ParseCSSPaddingTop}, |
|
{"padding-right", ParseCSSPaddingRight}, |
|
{"padding-bottom", ParseCSSPaddingBottom}, |
|
{"padding-left", ParseCSSPaddingLeft}, |
|
{"padding", ParseCSSPadding}, |
{"page-break-before", ParseCSSPageBreakBefore}, |
{"page-break-before", ParseCSSPageBreakBefore}, |
{"page-break-after", ParseCSSPageBreakAfter}, |
{"page-break-after", ParseCSSPageBreakAfter}, |
{"page-break-inside", ParseCSSPageBreakInside}, |
{"page-break-inside", ParseCSSPageBreakInside}, |
|
{"position", ParseCSSPosition}, |
|
{"right", ParseCSSRight}, |
|
{"text-align", ParseCSSTextAlign}, |
|
{"text-indent", ParseCSSTextIndent}, |
|
{"text-decoration", ParseCSSTextDecoration}, |
|
{"text-transform", ParseCSSTextTransform}, |
|
{"top", ParseCSSTop}, |
|
{"unicode-bidi", ParseCSSUnicodeBidi}, |
|
{"vertical-align", ParseCSSVerticalAlign}, |
|
{"white-space", ParseCSSWhiteSpace}, |
|
{"width", ParseCSSWidth}, |
|
{"word-spacing", ParseCSSWordSpacing}, |
|
{"z-index", ParseCSSZIndex}, |
|
|
/* SVG extensions */ |
/* SVG extensions */ |
{"stroke-opacity", ParseSVGStrokeOpacity}, |
|
{"stroke-width", ParseSVGStrokeWidth}, |
|
{"stroke", ParseSVGStroke}, |
|
|
|
{"fill-opacity", ParseSVGFillOpacity}, |
{"fill-opacity", ParseSVGFillOpacity}, |
{"fill", ParseSVGFill}, |
{"fill", ParseSVGFill}, |
|
{"opacity", ParseSVGOpacity}, |
{"opacity", ParseSVGOpacity} |
{"stroke-opacity", ParseSVGStrokeOpacity}, |
|
{"stroke-width", ParseSVGStrokeWidth}, |
|
{"stroke", ParseSVGStroke} |
}; |
}; |
|
|
#define NB_CSSSTYLEATTRIBUTE (sizeof(CSSProperties) / sizeof(CSSProperty)) |
#define NB_CSSSTYLEATTRIBUTE (sizeof(CSSProperties) / sizeof(CSSProperty)) |
Line 4008 static void ParseCSSRule (Element eleme
|
Line 4044 static void ParseCSSRule (Element eleme
|
} |
} |
} |
} |
if (i == NB_CSSSTYLEATTRIBUTE) |
if (i == NB_CSSSTYLEATTRIBUTE) |
cssRule = SkipProperty (cssRule); |
cssRule = SkipProperty (cssRule, TRUE); |
else |
else |
{ |
{ |
/* update index and skip the ":" indicator if present */ |
/* update index and skip the ":" indicator if present */ |
Line 4075 static void ParseCSSRule (Element eleme
|
Line 4111 static void ParseCSSRule (Element eleme
|
} |
} |
} |
} |
else |
else |
{ |
cssRule = SkipProperty (cssRule, TRUE); |
cssRule = SkipProperty (cssRule); |
|
c = *cssRule; |
|
*cssRule = EOS; |
|
CSSPrintError ("Unknown CSS2 property", p); |
|
*cssRule = c; |
|
} |
|
} |
} |
} |
} |
/* next property */ |
/* next property */ |
Line 4180 static char *ParseGenericSelector (char
|
Line 4210 static char *ParseGenericSelector (char
|
char *attrs[MAX_ANCESTORS]; |
char *attrs[MAX_ANCESTORS]; |
char *attrvals[MAX_ANCESTORS]; |
char *attrvals[MAX_ANCESTORS]; |
AttrMatch attrmatch[MAX_ANCESTORS]; |
AttrMatch attrmatch[MAX_ANCESTORS]; |
|
ThotBool immediat[MAX_ANCESTORS]; |
int i, j, k, max; |
int i, j, k, max; |
int att, maxAttr, kind; |
int att, maxAttr, kind; |
int specificity, xmlType; |
int specificity, xmlType; |
Line 4199 static char *ParseGenericSelector (char
|
Line 4230 static char *ParseGenericSelector (char
|
attrs[i] = NULL; |
attrs[i] = NULL; |
attrvals[i] = NULL; |
attrvals[i] = NULL; |
attrmatch[i] = Txtmatch; |
attrmatch[i] = Txtmatch; |
|
immediat[i] = FALSE; |
ctxt->name[i] = 0; |
ctxt->name[i] = 0; |
ctxt->names_nb[i] = 0; |
ctxt->names_nb[i] = 0; |
ctxt->attrType[i] = 0; |
ctxt->attrType[i] = 0; |
Line 4253 static char *ParseGenericSelector (char
|
Line 4285 static char *ParseGenericSelector (char
|
/* now names[0] points to the beginning of the parsed item |
/* now names[0] points to the beginning of the parsed item |
and cur to the next chain to be parsed */ |
and cur to the next chain to be parsed */ |
while (*selector == '.' || *selector == ':' || |
while (*selector == '.' || *selector == ':' || |
*selector == '#' || *selector == '[' || |
*selector == '#' || *selector == '[') |
*selector == '>') |
|
{ |
{ |
/* point to the following word in sel[] */ |
/* point to the following word in sel[] */ |
deb = cur; |
deb = cur; |
Line 4470 static char *ParseGenericSelector (char
|
Line 4501 static char *ParseGenericSelector (char
|
/* handle immediat parent as a simple parent */ |
/* handle immediat parent as a simple parent */ |
selector++; |
selector++; |
selector = SkipBlanksAndComments (selector); |
selector = SkipBlanksAndComments (selector); |
|
immediat[0] = TRUE; |
} |
} |
/* shifts the list to make room for the new name */ |
/* shifts the list to make room for the new name */ |
max++; /* a new level in ancestor tables */ |
max++; /* a new level in ancestor tables */ |
Line 4485 static char *ParseGenericSelector (char
|
Line 4517 static char *ParseGenericSelector (char
|
attrs[i] = attrs[i - 1]; |
attrs[i] = attrs[i - 1]; |
attrvals[i] = attrvals[i - 1]; |
attrvals[i] = attrvals[i - 1]; |
attrmatch[i] = attrmatch[i - 1]; |
attrmatch[i] = attrmatch[i - 1]; |
|
immediat[i] = immediat[i - 1]; |
} |
} |
} |
} |
} |
} |
Line 5153 char ReadCSSRules (Document docRef, CSSI
|
Line 5186 char ReadCSSRules (Document docRef, CSSI
|
int newlines; |
int newlines; |
ThotBool HTMLcomment; |
ThotBool HTMLcomment; |
ThotBool toParse, eof, quoted; |
ThotBool toParse, eof, quoted; |
ThotBool ignoreMedia, media; |
ThotBool ignore, media, page; |
ThotBool noRule, ignoreImport, skip; |
ThotBool noRule, ignoreImport, fontface; |
|
|
CSScomment = MAX_CSS_LENGTH; |
CSScomment = MAX_CSS_LENGTH; |
HTMLcomment = FALSE; |
HTMLcomment = FALSE; |
CSSindex = 0; |
CSSindex = 0; |
toParse = FALSE; |
toParse = FALSE; |
noRule = FALSE; |
noRule = FALSE; |
media = FALSE; |
media = FALSE; |
ignoreImport = FALSE; |
ignoreImport = FALSE; |
ignoreMedia = FALSE; |
ignore = FALSE; |
import = MAX_CSS_LENGTH; |
page = FALSE; |
|
quoted = FALSE; |
|
fontface = FALSE; |
eof = FALSE; |
eof = FALSE; |
openRule = 0; |
openRule = 0; |
|
import = MAX_CSS_LENGTH; |
c = SPACE; |
c = SPACE; |
index = 0; |
index = 0; |
base = NULL; |
base = NULL; |
quoted = FALSE; |
|
skip = FALSE; |
|
/* number of new lines parsed */ |
/* number of new lines parsed */ |
newlines = 0; |
newlines = 0; |
/* avoid too many redisplay */ |
/* avoid too many redisplay */ |
Line 5217 char ReadCSSRules (Document docRef, CSSI
|
Line 5251 char ReadCSSRules (Document docRef, CSSI
|
c = buffer[index++]; |
c = buffer[index++]; |
eof = (c == EOS); |
eof = (c == EOS); |
CSSbuffer[CSSindex] = c; |
CSSbuffer[CSSindex] = c; |
if (skip) |
if (CSScomment == MAX_CSS_LENGTH || |
{ |
c == '*' || c == '/' || c == '<') |
if (c == '}') |
|
{ |
|
/* end of the @font-face */ |
|
skip = FALSE; |
|
import = MAX_CSS_LENGTH; |
|
noRule = TRUE; |
|
CSSindex = 0; |
|
} |
|
/*if (c == EOL) |
|
LineNumber++;*/ |
|
c = CR; |
|
} |
|
else if (CSScomment == MAX_CSS_LENGTH || |
|
c == '*' || c == '/' || c == '<') |
|
{ |
{ |
/* we're not within a comment or we're parsing * or / */ |
/* we're not within a comment or we're parsing * or / */ |
switch (c) |
switch (c) |
{ |
{ |
case '@': /* perhaps an import primitive */ |
case '@': /* perhaps an import primitive */ |
if (!quoted) |
if (!fontface && !page && !quoted) |
import = CSSindex; |
import = CSSindex; |
break; |
break; |
case ';': |
case ';': |
Line 5261 char ReadCSSRules (Document docRef, CSSI
|
Line 5281 char ReadCSSRules (Document docRef, CSSI
|
if (!quoted && CSSindex > 1 && CSScomment != MAX_CSS_LENGTH && |
if (!quoted && CSSindex > 1 && CSScomment != MAX_CSS_LENGTH && |
CSSbuffer[CSSindex - 1] == '*') |
CSSbuffer[CSSindex - 1] == '*') |
{ |
{ |
/* close a comment:and ignore its contents */ |
/* close a comment and ignore its contents */ |
CSSindex = CSScomment - 1; /* will be incremented later */ |
CSSindex = CSScomment - 1; /* will be incremented later */ |
CSScomment = MAX_CSS_LENGTH; |
CSScomment = MAX_CSS_LENGTH; |
/* clean up the buffer */ |
/* clean up the buffer */ |
Line 5281 char ReadCSSRules (Document docRef, CSSI
|
Line 5301 char ReadCSSRules (Document docRef, CSSI
|
CSSindex--; |
CSSindex--; |
} |
} |
} |
} |
else if (!quoted && CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && |
else if (!fontface && !page && !quoted && |
|
CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && |
CSSbuffer[CSSindex - 1] == '<') |
CSSbuffer[CSSindex - 1] == '<') |
{ |
{ |
/* this is the closing tag ! */ |
/* this is the closing tag ! */ |
Line 5290 char ReadCSSRules (Document docRef, CSSI
|
Line 5311 char ReadCSSRules (Document docRef, CSSI
|
} |
} |
break; |
break; |
case '<': |
case '<': |
if (!quoted && CSScomment == MAX_CSS_LENGTH) |
if (!fontface && !page && !quoted && |
|
CSScomment == MAX_CSS_LENGTH) |
{ |
{ |
/* only if we're not parsing a comment */ |
/* only if we're not parsing a comment */ |
c = buffer[index++]; |
c = buffer[index++]; |
Line 5307 char ReadCSSRules (Document docRef, CSSI
|
Line 5329 char ReadCSSRules (Document docRef, CSSI
|
} |
} |
break; |
break; |
case '-': |
case '-': |
if (!quoted && CSSindex > 0 && CSSbuffer[CSSindex - 1] == '-' && |
if (!fontface && !page && !quoted && |
|
CSSindex > 0 && CSSbuffer[CSSindex - 1] == '-' && |
HTMLcomment) |
HTMLcomment) |
/* CSS within an HTML comment */ |
/* CSS within an HTML comment */ |
noRule = TRUE; |
noRule = TRUE; |
break; |
break; |
case '>': |
case '>': |
if (!quoted && HTMLcomment) |
if (!fontface && !page && !quoted && HTMLcomment) |
noRule = TRUE; |
noRule = TRUE; |
break; |
break; |
case ' ': |
case ' ': |
if (!quoted && import != MAX_CSS_LENGTH && openRule == 0) |
if (!quoted && import != MAX_CSS_LENGTH && openRule == 0) |
media = !strncasecmp (&CSSbuffer[import+1], "media", 5); |
media = !strncasecmp (&CSSbuffer[import+1], "media", 5); |
break; |
break; |
case '{': |
case '{': |
if (!quoted) |
if (!quoted) |
{ |
{ |
openRule++; |
openRule++; |
if (import != MAX_CSS_LENGTH && openRule == 1 && media) |
if (import != MAX_CSS_LENGTH) |
{ |
{ |
/* is it the screen concerned? */ |
if (openRule == 1 && media) |
CSSbuffer[CSSindex+1] = EOS; |
{ |
if (TtaIsPrinting ()) |
/* is it the screen concerned? */ |
base = strstr (&CSSbuffer[import], "print"); |
CSSbuffer[CSSindex+1] = EOS; |
else |
if (TtaIsPrinting ()) |
base = strstr (&CSSbuffer[import], "screen"); |
base = strstr (&CSSbuffer[import], "print"); |
if (base == NULL) |
else |
base = strstr (&CSSbuffer[import], "all"); |
base = strstr (&CSSbuffer[import], "screen"); |
if (base == NULL) |
if (base == NULL) |
ignoreMedia = TRUE; |
base = strstr (&CSSbuffer[import], "all"); |
|
if (base == NULL) |
|
ignore = TRUE; |
|
} |
|
else if (!strncasecmp (&CSSbuffer[import+1], "page", 4)) |
|
page = TRUE; |
|
else if (!strncasecmp (&CSSbuffer[import+1], "font-face", 9)) |
|
fontface = TRUE; |
noRule = TRUE; |
noRule = TRUE; |
} |
} |
else if (import != MAX_CSS_LENGTH && |
|
!strncasecmp (&CSSbuffer[import], "@font-face", 10)) |
|
skip = TRUE; |
|
} |
} |
break; |
break; |
case '}': |
case '}': |
if (!quoted) |
if (!quoted) |
{ |
{ |
openRule--; |
openRule--; |
if (import != MAX_CSS_LENGTH && openRule == 0) |
if (page) |
|
{ |
|
noRule = TRUE; |
|
page = FALSE; /* close the page section */ |
|
} |
|
else if (fontface) |
|
{ |
|
noRule = TRUE; |
|
fontface = FALSE; /* close the fontface section */ |
|
} |
|
else if (openRule == 0 && import != MAX_CSS_LENGTH) |
{ |
{ |
import = MAX_CSS_LENGTH; |
import = MAX_CSS_LENGTH; |
noRule = TRUE; |
noRule = TRUE; |
ignoreMedia = FALSE; |
ignore = FALSE; |
media = FALSE; |
media = FALSE; |
} |
} |
else |
else |
Line 5378 char ReadCSSRules (Document docRef, CSSI
|
Line 5415 char ReadCSSRules (Document docRef, CSSI
|
LineNumber++; |
LineNumber++; |
c = CR; |
c = CR; |
} |
} |
|
|
if (c != CR) |
if (c != CR) |
CSSindex++; |
CSSindex++; |
|
|
Line 5392 char ReadCSSRules (Document docRef, CSSI
|
Line 5430 char ReadCSSRules (Document docRef, CSSI
|
if (CSSindex > 0) |
if (CSSindex > 0) |
{ |
{ |
/* apply CSS rule if it's not just a saving of text */ |
/* apply CSS rule if it's not just a saving of text */ |
if (!noRule && !ignoreMedia) |
if (!noRule && !ignore) |
{ |
{ |
/* future import rules must be ignored */ |
/* future import rules must be ignored */ |
ignoreImport = TRUE; |
ignoreImport = TRUE; |
Line 5493 char ReadCSSRules (Document docRef, CSSI
|
Line 5531 char ReadCSSRules (Document docRef, CSSI
|
NewLineSkipped = 0; |
NewLineSkipped = 0; |
import = MAX_CSS_LENGTH; |
import = MAX_CSS_LENGTH; |
} |
} |
|
else |
|
{ |
|
LineNumber += newlines; |
|
newlines = 0; |
|
} |
} |
} |
toParse = FALSE; |
toParse = FALSE; |
noRule = FALSE; |
noRule = FALSE; |