version 1.134, 2002/06/03 13:44:43
|
version 1.135, 2002/06/03 16:15:58
|
Line 222 static char *SkipProperty (char *ptr)
|
Line 222 static char *SkipProperty (char *ptr)
|
char c; |
char c; |
|
|
deb = ptr; |
deb = ptr; |
while (*ptr != EOS && *ptr != ';' && *ptr != '}' && *ptr != '"') |
while (*ptr != EOS && *ptr != ';' && *ptr != '}') |
{ |
{ |
if (*ptr == '"' && (ptr == deb || ptr[-1] != '\\')) |
if (*ptr == '"' && (ptr == deb || ptr[-1] != '\\')) |
{ |
{ |
Line 253 static char *SkipValue (char *ptr, ThotB
|
Line 253 static char *SkipValue (char *ptr, ThotB
|
char c; |
char c; |
|
|
deb = ptr; |
deb = ptr; |
while (*ptr != EOS && *ptr != ';' && *ptr != '}' && *ptr != '"') |
while (*ptr != EOS && *ptr != ';' && *ptr != '}') |
{ |
{ |
if (*ptr == '"' && (ptr == deb || ptr[-1] != '\\')) |
if (*ptr == '"' && (ptr == deb || ptr[-1] != '\\')) |
{ |
{ |
Line 493 static char *ParseCSSColor (char *cssRul
|
Line 493 static char *ParseCSSColor (char *cssRul
|
val->typed_data.real = FALSE; |
val->typed_data.real = FALSE; |
val->typed_data.value = 0; |
val->typed_data.value = 0; |
ptr = TtaGiveRGB (cssRule, &redval, &greenval, &blueval); |
ptr = TtaGiveRGB (cssRule, &redval, &greenval, &blueval); |
|
if (!strncasecmp (cssRule, "inherit", 7)) |
|
{ |
|
cssRule = SkipWord (cssRule); |
|
return (cssRule); |
|
} |
if (ptr == cssRule) |
if (ptr == cssRule) |
{ |
{ |
cssRule = SkipValue (cssRule, TRUE); |
cssRule = SkipValue (cssRule, TRUE); |
Line 3354 static void ParseCSSRule (Element eleme
|
Line 3359 static void ParseCSSRule (Element eleme
|
if (*cssRule < 0x41 || *cssRule > 0x7A || |
if (*cssRule < 0x41 || *cssRule > 0x7A || |
(*cssRule > 0x5A && *cssRule < 0x60)) |
(*cssRule > 0x5A && *cssRule < 0x60)) |
{ |
{ |
|
CSSParseError ("Invalid character", cssRule); |
cssRule++; |
cssRule++; |
CSSParseError ("Invalid character", "{"); |
|
cssRule = SkipBlanksAndComments (cssRule); |
cssRule = SkipBlanksAndComments (cssRule); |
} |
} |
|
|
Line 4862 char ReadCSSRules (Document docRef, CSSI
|
Line 4867 char ReadCSSRules (Document docRef, CSSI
|
c = SPACE; |
c = SPACE; |
index = 0; |
index = 0; |
base = NULL; |
base = NULL; |
|
quoted = FALSE; |
/* number of new lines parsed */ |
/* number of new lines parsed */ |
newlines = 0; |
newlines = 0; |
/* avoid too many redisplay */ |
/* avoid too many redisplay */ |
Line 4896 char ReadCSSRules (Document docRef, CSSI
|
Line 4902 char ReadCSSRules (Document docRef, CSSI
|
switch (c) |
switch (c) |
{ |
{ |
case '@': /* perhaps an import primitive */ |
case '@': /* perhaps an import primitive */ |
import = CSSindex; |
if (!quoted) |
|
import = CSSindex; |
break; |
break; |
case ';': |
case ';': |
if (import != MAX_CSS_LENGTH && !media) |
if (!quoted && !media && import != MAX_CSS_LENGTH) |
{ |
{ |
if (strncasecmp (&CSSbuffer[import+1], "import", 6)) |
if (strncasecmp (&CSSbuffer[import+1], "import", 6)) |
/* it's not an import */ |
/* it's not an import */ |
Line 4909 char ReadCSSRules (Document docRef, CSSI
|
Line 4916 char ReadCSSRules (Document docRef, CSSI
|
} |
} |
break; |
break; |
case '*': |
case '*': |
if (CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && |
if (!quoted && CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && |
CSSbuffer[CSSindex - 1] == '/') |
CSSbuffer[CSSindex - 1] == '/') |
/* start a comment */ |
/* start a comment */ |
CSScomment = CSSindex - 1; |
CSScomment = CSSindex - 1; |
break; |
break; |
case '/': |
case '/': |
if (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 */ |
Line 4938 char ReadCSSRules (Document docRef, CSSI
|
Line 4945 char ReadCSSRules (Document docRef, CSSI
|
CSSindex--; |
CSSindex--; |
} |
} |
} |
} |
else if (CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && |
else if (!quoted && CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && |
CSSbuffer[CSSindex - 1] == '<') |
CSSbuffer[CSSindex - 1] == '<') |
{ |
{ |
/* this is the closing tag ! */ |
/* this is the closing tag ! */ |
Line 4947 char ReadCSSRules (Document docRef, CSSI
|
Line 4954 char ReadCSSRules (Document docRef, CSSI
|
} |
} |
break; |
break; |
case '<': |
case '<': |
if (CSScomment == MAX_CSS_LENGTH) |
if (!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 4964 char ReadCSSRules (Document docRef, CSSI
|
Line 4971 char ReadCSSRules (Document docRef, CSSI
|
} |
} |
break; |
break; |
case '-': |
case '-': |
if (CSSindex > 0 && CSSbuffer[CSSindex - 1] == '-' && |
if (!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 (HTMLcomment) |
if (!quoted && HTMLcomment) |
noRule = TRUE; |
noRule = TRUE; |
break; |
break; |
case ' ': |
case ' ': |
if (import != MAX_CSS_LENGTH && openRule == 0) |
if (!quoted && import != MAX_CSS_LENGTH && openRule == 0) |
media = !strncmp (&CSSbuffer[import+1], "media", 5); |
media = !strncmp (&CSSbuffer[import+1], "media", 5); |
break; |
break; |
case '{': |
case '{': |
openRule++; |
if (!quoted) |
if (import != MAX_CSS_LENGTH && openRule == 1 && media) |
|
{ |
{ |
/* is it the screen concerned? */ |
openRule++; |
CSSbuffer[CSSindex+1] = EOS; |
if (import != MAX_CSS_LENGTH && openRule == 1 && media) |
if (TtaIsPrinting ()) |
{ |
base = strstr (&CSSbuffer[import], "print"); |
/* is it the screen concerned? */ |
else |
CSSbuffer[CSSindex+1] = EOS; |
base = strstr (&CSSbuffer[import], "screen"); |
if (TtaIsPrinting ()) |
if (base == NULL) |
base = strstr (&CSSbuffer[import], "print"); |
base = strstr (&CSSbuffer[import], "all"); |
else |
if (base == NULL) |
base = strstr (&CSSbuffer[import], "screen"); |
ignoreMedia = TRUE; |
if (base == NULL) |
noRule = TRUE; |
base = strstr (&CSSbuffer[import], "all"); |
|
if (base == NULL) |
|
ignoreMedia = TRUE; |
|
noRule = TRUE; |
|
} |
} |
} |
break; |
break; |
case '}': |
case '}': |
openRule--; |
if (!quoted) |
if (import != MAX_CSS_LENGTH && openRule == 0) |
|
{ |
{ |
import = MAX_CSS_LENGTH; |
openRule--; |
noRule = TRUE; |
if (import != MAX_CSS_LENGTH && openRule == 0) |
ignoreMedia = FALSE; |
{ |
media = FALSE; |
import = MAX_CSS_LENGTH; |
|
noRule = TRUE; |
|
ignoreMedia = FALSE; |
|
media = FALSE; |
|
} |
|
else |
|
toParse = TRUE; |
|
} |
|
break; |
|
case '"': |
|
if (quoted) |
|
{ |
|
if (CSSbuffer[CSSindex - 1] != '\\') |
|
quoted = FALSE; |
} |
} |
else |
else |
toParse = TRUE; |
quoted = TRUE; |
break; |
break; |
default: |
default: |
if (c == EOL) |
if (c == EOL) |