Diff for /Amaya/amaya/styleparser.c between versions 1.210 and 1.211

version 1.210, 2003/06/25 15:29:18 version 1.211, 2003/07/02 11:09:24
Line 214  static void CSSPrintError (char *msg, ch Line 214  static void CSSPrintError (char *msg, ch
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static void CSSParseError (char *msg, char *value, char *endvalue)  static void CSSParseError (char *msg, char *value, char *endvalue)
 {  {
   char        c = EOS;    char        c;
   
   if (endvalue)    if (endvalue)
     {      {
Line 1219  static char *ParseCSSFloat (Element elem Line 1219  static char *ParseCSSFloat (Element elem
                             CSSInfoPtr css, ThotBool isHTML)                              CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
   char               *ptr;  
   
   pval.typed_data.value = 0;    pval.typed_data.value = 0;
   pval.typed_data.unit = UNIT_BOX;    pval.typed_data.unit = UNIT_BOX;
Line 1236  static char *ParseCSSFloat (Element elem Line 1235  static char *ParseCSSFloat (Element elem
   else if (!strncasecmp (cssRule, "right", 5))    else if (!strncasecmp (cssRule, "right", 5))
     pval.typed_data.value = FloatRight;      pval.typed_data.value = FloatRight;
   
   ptr = cssRule;  
   cssRule = SkipWord (cssRule);  
   if (pval.typed_data.value == 0)    if (pval.typed_data.value == 0)
     CSSParseError ("Invalid float value", ptr, cssRule);      cssRule = SkipValue ("Invalid float value", cssRule);
   else    else
     {      {
       if (DoApply)        if (DoApply)
Line 1248  static char *ParseCSSFloat (Element elem Line 1245  static char *ParseCSSFloat (Element elem
             cssRule = CheckImportantRule (cssRule, context);              cssRule = CheckImportantRule (cssRule, context);
           TtaSetStylePresentation (PRFloat, element, tsch, context, pval);            TtaSetStylePresentation (PRFloat, element, tsch, context, pval);
         }          }
         cssRule = SkipValue (NULL, cssRule);
     }      }
   cssRule = SkipValue (NULL, cssRule);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1261  static char *ParseCSSClear (Element elem Line 1258  static char *ParseCSSClear (Element elem
                             CSSInfoPtr css, ThotBool isHTML)                              CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
   char               *ptr;  
   
   pval.typed_data.value = 0;    pval.typed_data.value = 0;
   pval.typed_data.unit = UNIT_BOX;    pval.typed_data.unit = UNIT_BOX;
Line 1280  static char *ParseCSSClear (Element elem Line 1276  static char *ParseCSSClear (Element elem
   else if (!strncasecmp (cssRule, "both", 4))    else if (!strncasecmp (cssRule, "both", 4))
     pval.typed_data.value = ClearBoth;      pval.typed_data.value = ClearBoth;
   
   ptr = cssRule;  
   cssRule = SkipWord (cssRule);  
   if (pval.typed_data.value == 0)    if (pval.typed_data.value == 0)
     CSSParseError ("Invalid clear value", ptr, cssRule);      cssRule = SkipValue ("Invalid clear value", cssRule);
   else    else
     {      {
       if (DoApply)        if (DoApply)
Line 1292  static char *ParseCSSClear (Element elem Line 1286  static char *ParseCSSClear (Element elem
             cssRule = CheckImportantRule (cssRule, context);              cssRule = CheckImportantRule (cssRule, context);
           TtaSetStylePresentation (PRClear, element, tsch, context, pval);            TtaSetStylePresentation (PRClear, element, tsch, context, pval);
         }          }
         cssRule = SkipValue (NULL, cssRule);
     }      }
   cssRule = SkipValue (NULL, cssRule);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1316  static char *ParseCSSDisplay (Element el Line 1310  static char *ParseCSSDisplay (Element el
                               CSSInfoPtr css, ThotBool isHTML)                                CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
   char               *ptr;  
   
   pval.typed_data.unit = UNIT_REL;    pval.typed_data.unit = UNIT_REL;
   pval.typed_data.real = FALSE;    pval.typed_data.real = FALSE;
Line 1358  static char *ParseCSSDisplay (Element el Line 1351  static char *ParseCSSDisplay (Element el
               strncasecmp (cssRule, "table-caption", 13) &&                strncasecmp (cssRule, "table-caption", 13) &&
               strncasecmp (cssRule, "table", 5) &&                strncasecmp (cssRule, "table", 5) &&
               strncasecmp (cssRule, "inherit", 7))                strncasecmp (cssRule, "inherit", 7))
             {              cssRule = SkipValue ("Invalid display value", cssRule);
               ptr = cssRule;            return (cssRule);
               cssRule = SkipWord (cssRule);  
               CSSParseError ("Invalid display value", ptr, cssRule);  
             }  
           return (cssRule);  
         }          }
               
       if (DoApply)        if (DoApply)
Line 1447  static char *ParseCSSTextAlign (Element Line 1436  static char *ParseCSSTextAlign (Element
                                 CSSInfoPtr css, ThotBool isHTML)                                  CSSInfoPtr css, ThotBool isHTML)
 {  {
    PresentationValue   align;     PresentationValue   align;
    char               *ptr;  
   
    align.typed_data.value = 0;     align.typed_data.value = 0;
    align.typed_data.unit = UNIT_REL;     align.typed_data.unit = UNIT_REL;
Line 1476  static char *ParseCSSTextAlign (Element Line 1464  static char *ParseCSSTextAlign (Element
      }       }
    else     else
      {       {
        ptr = cssRule;         cssRule = SkipValue ("Invalid text-align value", cssRule);
        cssRule = SkipWord (cssRule);         return (cssRule);
        CSSParseError ("Invalid text-align value", ptr, cssRule);  
         return (cssRule);  
      }       }
   
    /*     /*
Line 1502  static char *ParseCSSDirection (Element Line 1488  static char *ParseCSSDirection (Element
                                 CSSInfoPtr css, ThotBool isHTML)                                  CSSInfoPtr css, ThotBool isHTML)
 {  {
    PresentationValue   direction;     PresentationValue   direction;
    char               *ptr;  
   
    direction.typed_data.value = 0;     direction.typed_data.value = 0;
    direction.typed_data.unit = UNIT_REL;     direction.typed_data.unit = UNIT_REL;
Line 1527  static char *ParseCSSDirection (Element Line 1512  static char *ParseCSSDirection (Element
      }       }
    else     else
      {       {
        ptr = cssRule;         cssRule = SkipValue ("Invalid direction value", cssRule);
        cssRule = SkipWord (cssRule);  
        CSSParseError ("Invalid direction value", ptr, cssRule);  
        return (cssRule);         return (cssRule);
      }       }
   
Line 1553  static char *ParseCSSUnicodeBidi (Elemen Line 1536  static char *ParseCSSUnicodeBidi (Elemen
                                   CSSInfoPtr css, ThotBool isHTML)                                    CSSInfoPtr css, ThotBool isHTML)
 {  {
    PresentationValue   bidi;     PresentationValue   bidi;
    char               *ptr;  
   
    bidi.typed_data.value = 0;     bidi.typed_data.value = 0;
    bidi.typed_data.unit = UNIT_REL;     bidi.typed_data.unit = UNIT_REL;
Line 1583  static char *ParseCSSUnicodeBidi (Elemen Line 1565  static char *ParseCSSUnicodeBidi (Elemen
      }       }
    else     else
      {       {
        ptr = cssRule;         cssRule = SkipValue ("Invalid unicode-bidi value", cssRule);
        cssRule = SkipWord (cssRule);  
        CSSParseError ("Invalid unicode-bidi value", ptr, cssRule);  
        return (cssRule);         return (cssRule);
      }       }
   
Line 2262  static char *ParseCSSTextDecoration (Ele Line 2242  static char *ParseCSSTextDecoration (Ele
                                      CSSInfoPtr css, ThotBool isHTML)                                       CSSInfoPtr css, ThotBool isHTML)
 {  {
    PresentationValue   decor;     PresentationValue   decor;
    char               *ptr;  
   
    decor.typed_data.value = 0;     decor.typed_data.value = 0;
    decor.typed_data.unit = UNIT_REL;     decor.typed_data.unit = UNIT_REL;
    decor.typed_data.real = FALSE;     decor.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "none", strlen ("none")))     if (!strncasecmp (cssRule, "none", 4))
      {       {
         decor.typed_data.value = NoUnderline;          decor.typed_data.value = NoUnderline;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "underline", strlen ("underline")))     else if (!strncasecmp (cssRule, "underline", 9))
      {       {
         decor.typed_data.value = Underline;          decor.typed_data.value = Underline;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "overline", strlen ("overline")))     else if (!strncasecmp (cssRule, "overline", 8))
      {       {
         decor.typed_data.value = Overline;          decor.typed_data.value = Overline;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "line-through", strlen ("line-through")))     else if (!strncasecmp (cssRule, "line-through", 12))
      {       {
         decor.typed_data.value = CrossOut;          decor.typed_data.value = CrossOut;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "blink", strlen ("blink")))     else if (!strncasecmp (cssRule, "blink", 5))
      {       {
         /* the blink text-decoration attribute is not supported */          /* the blink text-decoration attribute is not supported */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
Line 2300  static char *ParseCSSTextDecoration (Ele Line 2279  static char *ParseCSSTextDecoration (Ele
      }       }
    else     else
      {       {
        ptr = cssRule;         cssRule = SkipValue ("Invalid text-decoration value", cssRule);
        cssRule = SkipWord (cssRule);         return (cssRule);
        CSSParseError ("Invalid text-decoration value", ptr, cssRule);  
         return (cssRule);  
      }       }
   
    /*     /*
Line 2343  static char *ParseCSSHeight (Element ele Line 2320  static char *ParseCSSHeight (Element ele
   if (val.typed_data.value != 0 &&    if (val.typed_data.value != 0 &&
       (val.typed_data.unit == UNIT_INVALID ||        (val.typed_data.unit == UNIT_INVALID ||
        val.typed_data.unit == UNIT_BOX))         val.typed_data.unit == UNIT_BOX))
     CSSParseError ("height value", ptr, cssRule);      {
   else if (DoApply)        CSSParseError ("height value", ptr, cssRule);
         val.typed_data.unit == UNIT_PX;
       }
     if (DoApply)
     {      {
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
Line 2380  static char *ParseCSSWidth (Element elem Line 2360  static char *ParseCSSWidth (Element elem
   if (val.typed_data.value != 0 &&    if (val.typed_data.value != 0 &&
       (val.typed_data.unit == UNIT_INVALID ||        (val.typed_data.unit == UNIT_INVALID ||
        val.typed_data.unit == UNIT_BOX))         val.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid width value", ptr, cssRule);      {
   else if (DoApply)        CSSParseError ("Invalid width value", ptr, cssRule);
         val.typed_data.unit == UNIT_PX;
       }
     if (DoApply)
     {      {
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);

Removed from v.1.210  
changed lines
  Added in v.1.211


Webmaster