Diff for /Amaya/amaya/styleparser.c between versions 1.183 and 1.184

version 1.183, 2003/02/10 14:20:00 version 1.184, 2003/02/11 16:32:24
Line 75  struct unit_def Line 75  struct unit_def
   
 static struct unit_def CSSUnitNames[] =  static struct unit_def CSSUnitNames[] =
 {  {
    {"pt", STYLE_UNIT_PT},     {"pt", UNIT_PT},
    {"pc", STYLE_UNIT_PC},     {"pc", UNIT_PC},
    {"in", STYLE_UNIT_IN},     {"in", UNIT_IN},
    {"cm", STYLE_UNIT_CM},     {"cm", UNIT_CM},
    {"mm", STYLE_UNIT_MM},     {"mm", UNIT_MM},
    {"em", STYLE_UNIT_EM},     {"em", UNIT_EM},
    {"px", STYLE_UNIT_PX},     {"px", UNIT_PX},
    {"ex", STYLE_UNIT_XHEIGHT},     {"ex", UNIT_XHEIGHT},
    {"%", STYLE_UNIT_PERCENT}     {"%", UNIT_PERCENT}
 };  };
   
 #define NB_UNITS (sizeof(CSSUnitNames) / sizeof(struct unit_def))  #define NB_UNITS (sizeof(CSSUnitNames) / sizeof(struct unit_def))
Line 242  static char *SkipProperty (char *ptr) Line 242  static char *SkipProperty (char *ptr)
   deb = ptr;    deb = ptr;
   while (*ptr != EOS && *ptr != ';' && *ptr != '}')    while (*ptr != EOS && *ptr != ';' && *ptr != '}')
     {      {
       if (*ptr == '"' && (ptr == deb || ptr[-1] != '\\'))        if (ptr[0] == '"' && (ptr == deb || ptr[-1] != '\\'))
         {          {
           /* skip to the end of the string "..." */            /* skip to the end of the string "..." */
           ptr++;            ptr++;
           while (*ptr != '"' && ptr[-1] != '\\')            while (ptr[0] != '"' || (ptr[0] == '"' && ptr[-1] == '\\'))
             ptr++;              ptr++;
         }          }
       ptr++;        ptr++;
Line 278  static char *SkipValue (char *msg, char Line 278  static char *SkipValue (char *msg, char
         {          {
           /* skip to the end of the string "..." */            /* skip to the end of the string "..." */
           ptr++;            ptr++;
           while (*ptr != '"' && ptr[-1] != '\\')            while (*ptr != '"' || (ptr[0] == '"' && ptr[-1] == '\\'))
             ptr++;              ptr++;
         }          }
       ptr++;        ptr++;
Line 304  char *ParseNumber (char *cssRule, Presen Line 304  char *ParseNumber (char *cssRule, Presen
   int                 f = 0;    int                 f = 0;
   ThotBool            real = FALSE;    ThotBool            real = FALSE;
   
   pval->typed_data.unit = STYLE_UNIT_REL;    pval->typed_data.unit = UNIT_REL;
   pval->typed_data.real = FALSE;    pval->typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   if (*cssRule == '-')    if (*cssRule == '-')
Line 358  char *ParseNumber (char *cssRule, Presen Line 358  char *ParseNumber (char *cssRule, Presen
   
   if (!valid)    if (!valid)
     {      {
       pval->typed_data.unit = STYLE_UNIT_INVALID;        pval->typed_data.unit = UNIT_INVALID;
       pval->typed_data.value = 0;        pval->typed_data.value = 0;
     }      }
   else    else
Line 413  char *ParseClampedUnit (char *text, Line 413  char *ParseClampedUnit (char *text,
           else             else 
             int_clamped_value = (int) (clamped_value * 1000);              int_clamped_value = (int) (clamped_value * 1000);
         }          }
       pval->typed_data.unit = STYLE_UNIT_REL;        pval->typed_data.unit = UNIT_REL;
       pval->typed_data.value = int_clamped_value;        pval->typed_data.value = int_clamped_value;
       pval->typed_data.real = 0;        pval->typed_data.real = 0;
       pval->data = int_clamped_value;           pval->data = int_clamped_value;   
Line 429  char *ParseCSSUnit (char *cssRule, Prese Line 429  char *ParseCSSUnit (char *cssRule, Prese
 {  {
   unsigned int        uni;    unsigned int        uni;
   
   pval->typed_data.unit = STYLE_UNIT_REL;    pval->typed_data.unit = UNIT_REL;
   cssRule = ParseNumber (cssRule, pval);    cssRule = ParseNumber (cssRule, pval);
   if (pval->typed_data.unit == STYLE_UNIT_INVALID)    if (pval->typed_data.unit == UNIT_INVALID)
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
   else    else
     {      {
Line 446  char *ParseCSSUnit (char *cssRule, Prese Line 446  char *ParseCSSUnit (char *cssRule, Prese
             }              }
         }          }
       /* not in the list of predefined units */        /* not in the list of predefined units */
       pval->typed_data.unit = STYLE_UNIT_BOX;        pval->typed_data.unit = UNIT_BOX;
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 460  static char *ParseBorderValue (char *css Line 460  static char *ParseBorderValue (char *css
   
   /* first parse the attribute string */    /* first parse the attribute string */
    border->typed_data.value = 0;     border->typed_data.value = 0;
    border->typed_data.unit = STYLE_UNIT_INVALID;     border->typed_data.unit = UNIT_INVALID;
    border->typed_data.real = FALSE;     border->typed_data.real = FALSE;
    if (!strncasecmp (cssRule, "thin", 4))     if (!strncasecmp (cssRule, "thin", 4))
      {       {
        border->typed_data.unit = STYLE_UNIT_PX;         border->typed_data.unit = UNIT_PX;
        border->typed_data.value = 1;         border->typed_data.value = 1;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "medium", 6))     else if (!strncasecmp (cssRule, "medium", 6))
      {       {
        border->typed_data.unit = STYLE_UNIT_PX;         border->typed_data.unit = UNIT_PX;
        border->typed_data.value = 3;         border->typed_data.value = 3;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "thick", 5))     else if (!strncasecmp (cssRule, "thick", 5))
      {       {
        border->typed_data.unit = STYLE_UNIT_PX;         border->typed_data.unit = UNIT_PX;
        border->typed_data.value = 5;         border->typed_data.value = 5;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
Line 485  static char *ParseBorderValue (char *css Line 485  static char *ParseBorderValue (char *css
        ptr = cssRule;         ptr = cssRule;
        cssRule = ParseCSSUnit (cssRule, border);         cssRule = ParseCSSUnit (cssRule, border);
        if (border->typed_data.value == 0)         if (border->typed_data.value == 0)
          border->typed_data.unit = STYLE_UNIT_PX;           border->typed_data.unit = UNIT_PX;
        else if (border->typed_data.unit == STYLE_UNIT_INVALID ||         else if (border->typed_data.unit == UNIT_INVALID ||
                 border->typed_data.unit == STYLE_UNIT_BOX)                  border->typed_data.unit == UNIT_BOX)
          {           {
            border->typed_data.unit = STYLE_UNIT_INVALID;             border->typed_data.unit = UNIT_INVALID;
            border->typed_data.value = 0;             border->typed_data.value = 0;
            CSSParseError ("Invalid border-width value", ptr, cssRule);             CSSParseError ("Invalid border-width value", ptr, cssRule);
          }           }
Line 504  static char *ParseBorderStyle (char *css Line 504  static char *ParseBorderStyle (char *css
 {  {
   /* first parse the attribute string */    /* first parse the attribute string */
    border->typed_data.value = 0;     border->typed_data.value = 0;
    border->typed_data.unit = STYLE_UNIT_PX;     border->typed_data.unit = UNIT_PX;
    border->typed_data.real = FALSE;     border->typed_data.real = FALSE;
    if (!strncasecmp (cssRule, "none", 4))     if (!strncasecmp (cssRule, "none", 4))
      border->typed_data.value = STYLE_BORDERNONE;       border->typed_data.value = BorderStyleNone;
    else if (!strncasecmp (cssRule, "hidden", 6))     else if (!strncasecmp (cssRule, "hidden", 6))
      border->typed_data.value = STYLE_BORDERHIDDEN;       border->typed_data.value = BorderStyleHidden;
    else if (!strncasecmp (cssRule, "dotted", 6))     else if (!strncasecmp (cssRule, "dotted", 6))
      border->typed_data.value = STYLE_BORDERDOTTED;       border->typed_data.value = BorderStyleDotted;
    else if (!strncasecmp (cssRule, "dashed", 6))     else if (!strncasecmp (cssRule, "dashed", 6))
      border->typed_data.value = STYLE_BORDERDASHED;       border->typed_data.value = BorderStyleDashed;
    else if (!strncasecmp (cssRule, "solid", 5))     else if (!strncasecmp (cssRule, "solid", 5))
      border->typed_data.value = STYLE_BORDERSOLID;       border->typed_data.value = BorderStyleSolid;
    else if (!strncasecmp (cssRule, "double", 6))     else if (!strncasecmp (cssRule, "double", 6))
      border->typed_data.value = STYLE_BORDERDOUBLE;       border->typed_data.value = BorderStyleDouble;
    else if (!strncasecmp (cssRule, "groove", 6))     else if (!strncasecmp (cssRule, "groove", 6))
      border->typed_data.value = STYLE_BORDERGROOVE;       border->typed_data.value = BorderStyleGroove;
    else if (!strncasecmp (cssRule, "ridge", 5))     else if (!strncasecmp (cssRule, "ridge", 5))
      border->typed_data.value = STYLE_BORDERRIDGE;       border->typed_data.value = BorderStyleRidge;
    else if (!strncasecmp (cssRule, "inset", 5))     else if (!strncasecmp (cssRule, "inset", 5))
      border->typed_data.value = STYLE_BORDERINSET;       border->typed_data.value = BorderStyleInset;
    else if (!strncasecmp (cssRule, "outset", 6))     else if (!strncasecmp (cssRule, "outset", 6))
      border->typed_data.value = STYLE_BORDEROUTSET;       border->typed_data.value = BorderStyleOutset;
    else     else
      {       {
        /* invalid style */         /* invalid style */
        border->typed_data.unit = STYLE_UNIT_INVALID;         border->typed_data.unit = UNIT_INVALID;
        return (cssRule);         return (cssRule);
      }       }
    /* the value is parsed now */     /* the value is parsed now */
Line 553  static char *ParseCSSColor (char *cssRul Line 553  static char *ParseCSSColor (char *cssRul
   int                 best = 0; /* best color in list found */    int                 best = 0; /* best color in list found */
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   val->typed_data.unit = STYLE_UNIT_INVALID;    val->typed_data.unit = UNIT_INVALID;
   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);
Line 567  static char *ParseCSSColor (char *cssRul Line 567  static char *ParseCSSColor (char *cssRul
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
       CSSParseError ("Invalid color value", ptr, cssRule);        CSSParseError ("Invalid color value", ptr, cssRule);
       val->typed_data.value = 0;        val->typed_data.value = 0;
       val->typed_data.unit = STYLE_UNIT_INVALID;        val->typed_data.unit = UNIT_INVALID;
     }      }
   else    else
     {      {
       best = TtaGetThotColor (redval, greenval, blueval);        best = TtaGetThotColor (redval, greenval, blueval);
       val->typed_data.value = best;        val->typed_data.value = best;
       val->typed_data.unit = STYLE_UNIT_REL;        val->typed_data.unit = UNIT_REL;
       cssRule = ptr;        cssRule = ptr;
     }      }
   val->typed_data.real = FALSE;    val->typed_data.real = FALSE;
Line 616  static char *ParseCSSBorderTopWidth (Ele Line 616  static char *ParseCSSBorderTopWidth (Ele
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
       TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
       border.typed_data.unit = STYLE_UNIT_REL;        border.typed_data.unit = UNIT_REL;
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 642  static char *ParseCSSBorderBottomWidth ( Line 642  static char *ParseCSSBorderBottomWidth (
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
       TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
       border.typed_data.unit = STYLE_UNIT_REL;        border.typed_data.unit = UNIT_REL;
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 668  static char *ParseCSSBorderLeftWidth (El Line 668  static char *ParseCSSBorderLeftWidth (El
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
       TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
       border.typed_data.unit = STYLE_UNIT_REL;        border.typed_data.unit = UNIT_REL;
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 694  static char *ParseCSSBorderRightWidth (E Line 694  static char *ParseCSSBorderRightWidth (E
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
       TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
       border.typed_data.unit = STYLE_UNIT_REL;        border.typed_data.unit = UNIT_REL;
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 780  static char *ParseCSSBorderColorTop (Ele Line 780  static char *ParseCSSBorderColorTop (Ele
   PresentationValue   best;    PresentationValue   best;
   
   cssRule = ParseCSSColor (cssRule, &best);    cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != STYLE_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 */
       if (tsch)        if (tsch)
Line 803  static char *ParseCSSBorderColorLeft (El Line 803  static char *ParseCSSBorderColorLeft (El
   PresentationValue   best;    PresentationValue   best;
       
   cssRule = ParseCSSColor (cssRule, &best);    cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != STYLE_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 */
       if (tsch)        if (tsch)
Line 826  static char *ParseCSSBorderColorBottom ( Line 826  static char *ParseCSSBorderColorBottom (
   PresentationValue   best;    PresentationValue   best;
   
   cssRule = ParseCSSColor (cssRule, &best);    cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != STYLE_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 */
       if (tsch)        if (tsch)
Line 849  static char *ParseCSSBorderColorRight (E Line 849  static char *ParseCSSBorderColorRight (E
   PresentationValue   best;    PresentationValue   best;
   
   cssRule = ParseCSSColor (cssRule, &best);    cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != STYLE_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 */
       if (tsch)        if (tsch)
Line 937  static char *ParseCSSBorderStyleTop (Ele Line 937  static char *ParseCSSBorderStyleTop (Ele
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
Line 960  static char *ParseCSSBorderStyleLeft (El Line 960  static char *ParseCSSBorderStyleLeft (El
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
Line 983  static char *ParseCSSBorderStyleBottom ( Line 983  static char *ParseCSSBorderStyleBottom (
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
Line 1006  static char *ParseCSSBorderStyleRight (E Line 1006  static char *ParseCSSBorderStyleRight (E
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
Line 1216  static char *ParseCSSBorder (Element ele Line 1216  static char *ParseCSSBorder (Element ele
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    ParseCSSClear: parse a CSS clear attribute string         ParseCSSFloat: parse a CSS float attribute string    
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static char *ParseCSSClear (Element element, PSchema tsch,  static char *ParseCSSFloat (Element element, PSchema tsch,
                             PresentationContext context, char *cssRule,                              PresentationContext context, char *cssRule,
                             CSSInfoPtr css, ThotBool isHTML)                              CSSInfoPtr css, ThotBool isHTML)
 {  {
     PresentationValue   pval;
     char               *ptr;
   
     pval.typed_data.value = 0;
     if (!strncasecmp (cssRule, "none", 4))
       pval.typed_data.value = FloatNone;
     else if (!strncasecmp (cssRule, "left", 4))
       pval.typed_data.value = FloatLeft;
     else if (!strncasecmp (cssRule, "right", 5))
       pval.typed_data.value = FloatRight;
   
     ptr = cssRule;
     cssRule = SkipWord (cssRule);
     if (pval.typed_data.value == 0)
       CSSParseError ("Invalid float value", ptr, cssRule);
     else
       {
         if (DoApply)
           {
             if (tsch)
               cssRule = CheckImportantRule (cssRule, context);
             TtaSetStylePresentation (PRFloat, element, tsch, context, pval);
           }
       }
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    ParseCSSDisplay: parse a CSS display attribute string             ParseCSSClear: parse a CSS clear rule 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static char *ParseCSSDisplay (Element element, PSchema tsch,  static char *ParseCSSClear (Element element, PSchema tsch,
                               PresentationContext context, char *cssRule,                              PresentationContext context, char *cssRule,
                               CSSInfoPtr css, ThotBool isHTML)                              CSSInfoPtr css, ThotBool isHTML)
 {  {
    PresentationValue   pval;    PresentationValue   pval;
    char               *ptr;    char               *ptr;
   
    pval.typed_data.unit = STYLE_UNIT_REL;    pval.typed_data.value = 0;
    pval.typed_data.real = FALSE;    if (!strncasecmp (cssRule, "none", 4))
    cssRule = SkipBlanksAndComments (cssRule);      pval.typed_data.value = ClearNone;
    if (!strncasecmp (cssRule, "none", 4))    else if (!strncasecmp (cssRule, "left", 4))
      {      pval.typed_data.value = ClearLeft;
         pval.typed_data.value = 0;    else if (!strncasecmp (cssRule, "right", 5))
         if (DoApply)      pval.typed_data.value = ClearRight;
     else if (!strncasecmp (cssRule, "both", 4))
       pval.typed_data.value = ClearBoth;
   
     ptr = cssRule;
     cssRule = SkipWord (cssRule);
     if (pval.typed_data.value == 0)
       CSSParseError ("Invalid float value", ptr, cssRule);
     else
       {
         if (DoApply)
         {          {
           if (tsch)            if (tsch)
             cssRule = CheckImportantRule (cssRule, context);              cssRule = CheckImportantRule (cssRule, context);
           TtaSetStylePresentation (PRVisibility, element, tsch, context, pval);            TtaSetStylePresentation (PRClear, element, tsch, context, pval);
         }          }
         cssRule = SkipWord (cssRule);      }
      }    cssRule = SkipValue (NULL, cssRule);
    else    return (cssRule);
      {  
        if (!strncasecmp (cssRule, "block", 5))  
          pval.typed_data.value = STYLE_DISPLAYBLOCK;  
        else if (!strncasecmp (cssRule, "inline", 6))  
          pval.typed_data.value = STYLE_DISPLAYINLINE;  
        else if (!strncasecmp (cssRule, "list-item", 9))  
        pval.typed_data.value = STYLE_DISPLAYLISTITEM;  
        else if (!strncasecmp (cssRule, "run-in", 6))  
          pval.typed_data.value = STYLE_DISPLAYRUNIN;  
        else if (!strncasecmp (cssRule, "compact", 7))  
          pval.typed_data.value = STYLE_DISPLAYCOMPACT;  
        else if (!strncasecmp (cssRule, "marker", 6))  
          pval.typed_data.value = STYLE_DISPLAYMARKER;  
        else  
          {  
            if (strncasecmp (cssRule, "table-row-group", 15) &&  
                strncasecmp (cssRule, "table-column-group", 18) &&  
                strncasecmp (cssRule, "table-header-group", 5) &&  
                strncasecmp (cssRule, "table-footer-group", 6) &&  
                strncasecmp (cssRule, "table-row", 9) &&  
                strncasecmp (cssRule, "table-column", 12) &&  
                strncasecmp (cssRule, "table-cell", 10) &&  
                strncasecmp (cssRule, "table-caption", 13) &&  
                strncasecmp (cssRule, "table", 5) &&  
                strncasecmp (cssRule, "inherit", 7))  
              {  
                ptr = cssRule;  
                cssRule = SkipWord (cssRule);  
                CSSParseError ("Invalid display value", ptr, cssRule);  
              }  
            return (cssRule);  
          }  
   
        if (DoApply)  
          {  
            if (tsch)  
              cssRule = CheckImportantRule (cssRule, context);  
            TtaSetStylePresentation (PRDisplay, element, tsch, context, pval);  
          }  
        cssRule = SkipWord (cssRule);  
      }  
    return (cssRule);  
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    ParseCSSFloat: parse a CSS float attribute string         ParseCSSContent: parse a CSS content value    
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static char *ParseCSSFloat (Element element, PSchema tsch,  static char *ParseCSSContent (Element element, PSchema tsch,
                             PresentationContext context, char *cssRule,                                PresentationContext context, char *cssRule,
                             CSSInfoPtr css, ThotBool isHTML)                                CSSInfoPtr css, ThotBool isHTML)
 {  {
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
      ParseCSSDisplay: parse a CSS display attribute string        
     ----------------------------------------------------------------------*/
   static char *ParseCSSDisplay (Element element, PSchema tsch,
                                 PresentationContext context, char *cssRule,
                                 CSSInfoPtr css, ThotBool isHTML)
   {
     PresentationValue   pval;
     char               *ptr;
   
     pval.typed_data.unit = UNIT_REL;
     pval.typed_data.real = FALSE;
     cssRule = SkipBlanksAndComments (cssRule);
     if (!strncasecmp (cssRule, "none", 4))
       {
         pval.typed_data.value = 0;
         if (DoApply)
           {
             if (tsch)
               cssRule = CheckImportantRule (cssRule, context);
             TtaSetStylePresentation (PRVisibility, element, tsch, context, pval);
           }
         cssRule = SkipWord (cssRule);
       }
     else
       {
         if (!strncasecmp (cssRule, "block", 5))
           pval.typed_data.value = Block;
         else if (!strncasecmp (cssRule, "inline", 6))
           pval.typed_data.value = Inline;
         else if (!strncasecmp (cssRule, "list-item", 9))
           pval.typed_data.value = ListItem;
         else if (!strncasecmp (cssRule, "run-in", 6))
           pval.typed_data.value = RunIn;
         else if (!strncasecmp (cssRule, "compact", 7))
           pval.typed_data.value = Compact;
         else if (!strncasecmp (cssRule, "marker", 6))
           pval.typed_data.value = Marker;
         else
           {
             if (strncasecmp (cssRule, "table-row-group", 15) &&
                 strncasecmp (cssRule, "table-column-group", 18) &&
                 strncasecmp (cssRule, "table-header-group", 5) &&
                 strncasecmp (cssRule, "table-footer-group", 6) &&
                 strncasecmp (cssRule, "table-row", 9) &&
                 strncasecmp (cssRule, "table-column", 12) &&
                 strncasecmp (cssRule, "table-cell", 10) &&
                 strncasecmp (cssRule, "table-caption", 13) &&
                 strncasecmp (cssRule, "table", 5) &&
                 strncasecmp (cssRule, "inherit", 7))
               {
                 ptr = cssRule;
                 cssRule = SkipWord (cssRule);
                 CSSParseError ("Invalid display value", ptr, cssRule);
               }
             return (cssRule);
           }
         
         if (DoApply)
           {
             if (tsch)
               cssRule = CheckImportantRule (cssRule, context);
             TtaSetStylePresentation (PRDisplay, element, tsch, context, pval);
           }
         cssRule = SkipWord (cssRule);
       }
     return (cssRule);
   }
   
   /*----------------------------------------------------------------------
    ParseCSSLetterSpacing: parse a CSS letter-spacing         ParseCSSLetterSpacing: parse a CSS letter-spacing    
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
Line 1379  static char *ParseCSSTextAlign (Element Line 1440  static char *ParseCSSTextAlign (Element
    char               *ptr;     char               *ptr;
   
    align.typed_data.value = 0;     align.typed_data.value = 0;
    align.typed_data.unit = STYLE_UNIT_REL;     align.typed_data.unit = UNIT_REL;
    align.typed_data.real = FALSE;     align.typed_data.real = FALSE;
   
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
Line 1434  static char *ParseCSSDirection (Element Line 1495  static char *ParseCSSDirection (Element
    char               *ptr;     char               *ptr;
   
    direction.typed_data.value = 0;     direction.typed_data.value = 0;
    direction.typed_data.unit = STYLE_UNIT_REL;     direction.typed_data.unit = UNIT_REL;
    direction.typed_data.real = FALSE;     direction.typed_data.real = FALSE;
   
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "ltr", 3))     if (!strncasecmp (cssRule, "ltr", 3))
      {       {
        direction.typed_data.value = STYLE_LEFTTORIGHT;         direction.typed_data.value = LeftToRight;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "rtl", 3))     else if (!strncasecmp (cssRule, "rtl", 3))
      {       {
        direction.typed_data.value = STYLE_RIGHTTOLEFT;         direction.typed_data.value = RightToLeft;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "inherit", 7))     else if (!strncasecmp (cssRule, "inherit", 7))
Line 1485  static char *ParseCSSUnicodeBidi (Elemen Line 1546  static char *ParseCSSUnicodeBidi (Elemen
    char               *ptr;     char               *ptr;
   
    bidi.typed_data.value = 0;     bidi.typed_data.value = 0;
    bidi.typed_data.unit = STYLE_UNIT_REL;     bidi.typed_data.unit = UNIT_REL;
    bidi.typed_data.real = FALSE;     bidi.typed_data.real = FALSE;
   
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "normal", 6))     if (!strncasecmp (cssRule, "normal", 6))
      {       {
        bidi.typed_data.value = STYLE_BIDINORMAL;         bidi.typed_data.value = Normal;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "embed", 5))     else if (!strncasecmp (cssRule, "embed", 5))
      {       {
        bidi.typed_data.value = STYLE_BIDIEMBED;         bidi.typed_data.value = Embed;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "override", 8))     else if (!strncasecmp (cssRule, "override", 8))
      {       {
        bidi.typed_data.value = STYLE_BIDIOVERRIDE;         bidi.typed_data.value = Override;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "inherit", 7))     else if (!strncasecmp (cssRule, "inherit", 7))
Line 1545  static char *ParseCSSTextIndent (Element Line 1606  static char *ParseCSSTextIndent (Element
    ptr = cssRule;     ptr = cssRule;
    cssRule = ParseCSSUnit (cssRule, &pval);     cssRule = ParseCSSUnit (cssRule, &pval);
    if (pval.typed_data.value == 0)     if (pval.typed_data.value == 0)
      pval.typed_data.unit = STYLE_UNIT_PX;       pval.typed_data.unit = UNIT_PX;
    else if (pval.typed_data.unit == STYLE_UNIT_INVALID ||     else if (pval.typed_data.unit == UNIT_INVALID ||
        pval.typed_data.unit == STYLE_UNIT_BOX)         pval.typed_data.unit == UNIT_BOX)
      {       {
        CSSParseError ("Invalid text-indent value", ptr, cssRule);         CSSParseError ("Invalid text-indent value", ptr, cssRule);
        return (cssRule);         return (cssRule);
Line 1629  static char *ParseCSSLineHeight (Element Line 1690  static char *ParseCSSLineHeight (Element
   ptr = cssRule;    ptr = cssRule;
   if (!strncasecmp (cssRule, "normal", 6))    if (!strncasecmp (cssRule, "normal", 6))
     {      {
       pval.typed_data.unit = STYLE_UNIT_REL;        pval.typed_data.unit = UNIT_REL;
       pval.typed_data.real = TRUE;        pval.typed_data.real = TRUE;
       pval.typed_data.value = 1100;        pval.typed_data.value = 1100;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 1642  static char *ParseCSSLineHeight (Element Line 1703  static char *ParseCSSLineHeight (Element
   else    else
     cssRule = ParseCSSUnit (cssRule, &pval);      cssRule = ParseCSSUnit (cssRule, &pval);
   
   if (pval.typed_data.unit == STYLE_UNIT_INVALID)    if (pval.typed_data.unit == UNIT_INVALID)
     CSSParseError ("Invalid line-height value", ptr, cssRule);      CSSParseError ("Invalid line-height value", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     {      {
       /* install the new presentation */        /* install the new presentation */
       if (pval.typed_data.unit == STYLE_UNIT_BOX)        if (pval.typed_data.unit == UNIT_BOX)
         pval.typed_data.unit = STYLE_UNIT_EM;          pval.typed_data.unit = UNIT_EM;
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
       TtaSetStylePresentation (PRLineSpacing, element, tsch, context, pval);        TtaSetStylePresentation (PRLineSpacing, element, tsch, context, pval);
Line 1675  static char *ParseCSSFontSize (Element e Line 1736  static char *ParseCSSFontSize (Element e
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "larger", 6))     if (!strncasecmp (cssRule, "larger", 6))
      {       {
         pval.typed_data.unit = STYLE_UNIT_PERCENT;          pval.typed_data.unit = UNIT_PERCENT;
         pval.typed_data.value = 130;          pval.typed_data.value = 130;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "smaller", 7))     else if (!strncasecmp (cssRule, "smaller", 7))
      {       {
         pval.typed_data.unit = STYLE_UNIT_PERCENT;          pval.typed_data.unit = UNIT_PERCENT;
         pval.typed_data.value = 80;          pval.typed_data.value = 80;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "xx-small", 8))     else if (!strncasecmp (cssRule, "xx-small", 8))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = UNIT_REL;
         pval.typed_data.value = 1;          pval.typed_data.value = 1;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "x-small", 7))     else if (!strncasecmp (cssRule, "x-small", 7))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = UNIT_REL;
         pval.typed_data.value = 2;          pval.typed_data.value = 2;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "small", 5))     else if (!strncasecmp (cssRule, "small", 5))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = UNIT_REL;
         pval.typed_data.value = 3;          pval.typed_data.value = 3;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "medium", 6))     else if (!strncasecmp (cssRule, "medium", 6))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = UNIT_REL;
         pval.typed_data.value = 4;          pval.typed_data.value = 4;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "large", 5))     else if (!strncasecmp (cssRule, "large", 5))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = UNIT_REL;
         pval.typed_data.value = 5;          pval.typed_data.value = 5;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "x-large", 7))     else if (!strncasecmp (cssRule, "x-large", 7))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = UNIT_REL;
         pval.typed_data.value = 6;          pval.typed_data.value = 6;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "xx-large", 8))     else if (!strncasecmp (cssRule, "xx-large", 8))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = UNIT_REL;
         pval.typed_data.value = 7;          pval.typed_data.value = 7;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
Line 1745  static char *ParseCSSFontSize (Element e Line 1806  static char *ParseCSSFontSize (Element e
                 
        cssRule = ParseCSSUnit (cssRule, &pval);         cssRule = ParseCSSUnit (cssRule, &pval);
   
        if (pval.typed_data.unit == STYLE_UNIT_BOX)         if (pval.typed_data.unit == UNIT_BOX)
          /* no unit specified */           /* no unit specified */
          {           {
            elType = TtaGetElementType(element);             elType = TtaGetElementType(element);
            if (!strcmp(TtaGetSSchemaName (elType.ElSSchema), "SVG"))             if (!strcmp(TtaGetSSchemaName (elType.ElSSchema), "SVG"))
              /* we are working for an SVG element. No unit means pixels */               /* we are working for an SVG element. No unit means pixels */
              pval.typed_data.unit = STYLE_UNIT_PX;               pval.typed_data.unit = UNIT_PX;
          }           }
        if (pval.typed_data.value != 0 &&         if (pval.typed_data.value != 0 &&
            (pval.typed_data.unit == STYLE_UNIT_INVALID ||             (pval.typed_data.unit == UNIT_INVALID ||
             pval.typed_data.unit == STYLE_UNIT_BOX ||              pval.typed_data.unit == UNIT_BOX ||
             pval.typed_data.value < 0))              pval.typed_data.value < 0))
          /* not a valid value */           /* not a valid value */
          return (cssRule);           return (cssRule);
        else if (pval.typed_data.unit == STYLE_UNIT_REL && pval.typed_data.value > 0)         else if (pval.typed_data.unit == UNIT_REL && pval.typed_data.value > 0)
          /* CSS relative sizes have to be higher than Thot ones */           /* CSS relative sizes have to be higher than Thot ones */
          pval.typed_data.value += 1;           pval.typed_data.value += 1;
        else          else 
          {           {
            real = pval.typed_data.real;             real = pval.typed_data.real;
            if (pval.typed_data.unit == STYLE_UNIT_EM)             if (pval.typed_data.unit == UNIT_EM)
              {               {
                if (real)                 if (real)
                  {                   {
Line 1775  static char *ParseCSSFontSize (Element e Line 1836  static char *ParseCSSFontSize (Element e
                  }                   }
                else                 else
                  pval.typed_data.value *= 100;                   pval.typed_data.value *= 100;
                pval.typed_data.unit = STYLE_UNIT_PERCENT;                 pval.typed_data.unit = UNIT_PERCENT;
              }               }
            else if (pval.typed_data.unit == STYLE_UNIT_XHEIGHT)             else if (pval.typed_data.unit == UNIT_XHEIGHT)
              {               {
                /* a font size expressed in ex is converted into a percentage.                 /* a font size expressed in ex is converted into a percentage.
                   For example, "3ex" is converted into "180%", supposing                    For example, "3ex" is converted into "180%", supposing
Line 1792  static char *ParseCSSFontSize (Element e Line 1853  static char *ParseCSSFontSize (Element e
                  }                   }
                else                 else
                  pval.typed_data.value *= 60;                   pval.typed_data.value *= 60;
                pval.typed_data.unit = STYLE_UNIT_PERCENT;                 pval.typed_data.unit = UNIT_PERCENT;
              }               }
          }           }
      }       }
Line 1822  static char *ParseCSSFontFamily (Element Line 1883  static char *ParseCSSFontFamily (Element
   char              quoteChar;    char              quoteChar;
   
   font.typed_data.value = 0;    font.typed_data.value = 0;
   font.typed_data.unit = STYLE_UNIT_REL;    font.typed_data.unit = UNIT_REL;
   font.typed_data.real = FALSE;    font.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   if (*cssRule == '"' || *cssRule == '\'')    if (*cssRule == '"' || *cssRule == '\'')
Line 1836  static char *ParseCSSFontFamily (Element Line 1897  static char *ParseCSSFontFamily (Element
   if (!strncasecmp (cssRule, "times", 5) &&    if (!strncasecmp (cssRule, "times", 5) &&
       (quoteChar == EOS || quoteChar == cssRule[5]))        (quoteChar == EOS || quoteChar == cssRule[5]))
     {      {
       font.typed_data.value = STYLE_FONT_TIMES;        font.typed_data.value = FontTimes;
       cssRule += 5;        cssRule += 5;
     }      }
   else if (!strncasecmp (cssRule, "serif", 5) &&    else if (!strncasecmp (cssRule, "serif", 5) &&
       (quoteChar == EOS || quoteChar == cssRule[5]))        (quoteChar == EOS || quoteChar == cssRule[5]))
     {      {
       font.typed_data.value = STYLE_FONT_TIMES;        font.typed_data.value = FontTimes;
       cssRule += 5;        cssRule += 5;
       if (quoteChar != EOS)        if (quoteChar != EOS)
         cssRule++;          cssRule++;
Line 1850  static char *ParseCSSFontFamily (Element Line 1911  static char *ParseCSSFontFamily (Element
   else if (!strncasecmp (cssRule, "helvetica", 9) &&    else if (!strncasecmp (cssRule, "helvetica", 9) &&
       (quoteChar == EOS || quoteChar == cssRule[9]))        (quoteChar == EOS || quoteChar == cssRule[9]))
     {      {
      font.typed_data.value = STYLE_FONT_HELVETICA;       font.typed_data.value = FontHelvetica;
       cssRule += 9;        cssRule += 9;
       if (quoteChar != EOS)        if (quoteChar != EOS)
         cssRule++;          cssRule++;
Line 1858  static char *ParseCSSFontFamily (Element Line 1919  static char *ParseCSSFontFamily (Element
   else if (!strncasecmp (cssRule, "verdana", 7) &&    else if (!strncasecmp (cssRule, "verdana", 7) &&
       (quoteChar == EOS || quoteChar == cssRule[7]))        (quoteChar == EOS || quoteChar == cssRule[7]))
     {      {
       font.typed_data.value = STYLE_FONT_HELVETICA;        font.typed_data.value = FontHelvetica;
       cssRule += 7;        cssRule += 7;
       if (quoteChar != EOS)        if (quoteChar != EOS)
         cssRule++;          cssRule++;
Line 1866  static char *ParseCSSFontFamily (Element Line 1927  static char *ParseCSSFontFamily (Element
   else if (!strncasecmp (cssRule, "sans-serif", 10) &&    else if (!strncasecmp (cssRule, "sans-serif", 10) &&
       (quoteChar == EOS || quoteChar == cssRule[10]))        (quoteChar == EOS || quoteChar == cssRule[10]))
     {      {
       font.typed_data.value = STYLE_FONT_HELVETICA;        font.typed_data.value = FontHelvetica;
       cssRule += 10;        cssRule += 10;
       if (quoteChar != EOS)        if (quoteChar != EOS)
         cssRule++;          cssRule++;
Line 1874  static char *ParseCSSFontFamily (Element Line 1935  static char *ParseCSSFontFamily (Element
   else if (!strncasecmp (cssRule, "courier", 7) &&    else if (!strncasecmp (cssRule, "courier", 7) &&
       (quoteChar == EOS || quoteChar == cssRule[7]))        (quoteChar == EOS || quoteChar == cssRule[7]))
     {      {
       font.typed_data.value = STYLE_FONT_COURIER;        font.typed_data.value = FontCourier;
       cssRule += 7;        cssRule += 7;
       if (quoteChar != EOS)        if (quoteChar != EOS)
         cssRule++;          cssRule++;
Line 1882  static char *ParseCSSFontFamily (Element Line 1943  static char *ParseCSSFontFamily (Element
   else if (!strncasecmp (cssRule, "monospace", 9) &&    else if (!strncasecmp (cssRule, "monospace", 9) &&
       (quoteChar == EOS || quoteChar == cssRule[9]))        (quoteChar == EOS || quoteChar == cssRule[9]))
     {      {
       font.typed_data.value = STYLE_FONT_COURIER;        font.typed_data.value = FontCourier;
       cssRule += 9;        cssRule += 9;
       if (quoteChar != EOS)        if (quoteChar != EOS)
         cssRule++;          cssRule++;
Line 1934  static char *ParseCSSFontWeight (Element Line 1995  static char *ParseCSSFontWeight (Element
    PresentationValue   weight;     PresentationValue   weight;
   
    weight.typed_data.value = 0;     weight.typed_data.value = 0;
    weight.typed_data.unit = STYLE_UNIT_REL;     weight.typed_data.unit = UNIT_REL;
    weight.typed_data.real = FALSE;     weight.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "100", 3) && !isalpha (cssRule[3]))     if (!strncasecmp (cssRule, "100", 3) && !isalpha (cssRule[3]))
Line 1996  static char *ParseCSSFontWeight (Element Line 2057  static char *ParseCSSFontWeight (Element
     * by the Thot presentation API.      * by the Thot presentation API.
     */      */
     if (weight.typed_data.value > 0)      if (weight.typed_data.value > 0)
        weight.typed_data.value = STYLE_WEIGHT_BOLD;         weight.typed_data.value = WeightBold;
     else      else
        weight.typed_data.value = STYLE_WEIGHT_NORMAL;         weight.typed_data.value = WeightNormal;
   
    /* install the new presentation */     /* install the new presentation */
     if (DoApply)      if (DoApply)
Line 2022  static char *ParseCSSFontVariant (Elemen Line 2083  static char *ParseCSSFontVariant (Elemen
    PresentationValue   style;     PresentationValue   style;
   
    style.typed_data.value = 0;     style.typed_data.value = 0;
    style.typed_data.unit = STYLE_UNIT_REL;     style.typed_data.unit = UNIT_REL;
    style.typed_data.real = FALSE;     style.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "small-caps", 10))     if (!strncasecmp (cssRule, "small-caps", 10))
Line 2060  static char *ParseCSSFontStyle (Element Line 2121  static char *ParseCSSFontStyle (Element
    PresentationValue   size;     PresentationValue   size;
   
    style.typed_data.value = 0;     style.typed_data.value = 0;
    style.typed_data.unit = STYLE_UNIT_REL;     style.typed_data.unit = UNIT_REL;
    style.typed_data.real = FALSE;     style.typed_data.real = FALSE;
    size.typed_data.value = 0;     size.typed_data.value = 0;
    size.typed_data.unit = STYLE_UNIT_REL;     size.typed_data.unit = UNIT_REL;
    size.typed_data.real = FALSE;     size.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "italic", 6))     if (!strncasecmp (cssRule, "italic", 6))
      {       {
         style.typed_data.value = STYLE_FONT_ITALICS;          style.typed_data.value = StyleItalics;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "oblique", 7))     else if (!strncasecmp (cssRule, "oblique", 7))
      {       {
         style.typed_data.value = STYLE_FONT_OBLIQUE;          style.typed_data.value = StyleOblique;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "normal", 6))     else if (!strncasecmp (cssRule, "normal", 6))
      {       {
         style.typed_data.value = STYLE_FONT_ROMAN;          style.typed_data.value = StyleRoman;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "inherit", 7))     else if (!strncasecmp (cssRule, "inherit", 7))
Line 2194  static char *ParseCSSTextDecoration (Ele Line 2255  static char *ParseCSSTextDecoration (Ele
    char               *ptr;     char               *ptr;
   
    decor.typed_data.value = 0;     decor.typed_data.value = 0;
    decor.typed_data.unit = STYLE_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", strlen ("none")))
Line 2262  static char *ParseCSSHeight (Element ele Line 2323  static char *ParseCSSHeight (Element ele
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       val.typed_data.unit = STYLE_VALUE_AUTO;        val.typed_data.unit = VALUE_AUTO;
       val.typed_data.value = 0;        val.typed_data.value = 0;
       val.typed_data.real = FALSE;        val.typed_data.real = FALSE;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 2270  static char *ParseCSSHeight (Element ele Line 2331  static char *ParseCSSHeight (Element ele
   else    else
     cssRule = ParseCSSUnit (cssRule, &val);      cssRule = ParseCSSUnit (cssRule, &val);
   if (val.typed_data.value != 0 &&    if (val.typed_data.value != 0 &&
       (val.typed_data.unit == STYLE_UNIT_INVALID ||        (val.typed_data.unit == UNIT_INVALID ||
        val.typed_data.unit == STYLE_UNIT_BOX))         val.typed_data.unit == UNIT_BOX))
     CSSParseError ("height value", ptr, cssRule);      CSSParseError ("height value", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     {      {
Line 2299  static char *ParseCSSWidth (Element elem Line 2360  static char *ParseCSSWidth (Element elem
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       val.typed_data.unit = STYLE_VALUE_AUTO;        val.typed_data.unit = VALUE_AUTO;
       val.typed_data.value = 0;        val.typed_data.value = 0;
       val.typed_data.real = FALSE;        val.typed_data.real = FALSE;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 2307  static char *ParseCSSWidth (Element elem Line 2368  static char *ParseCSSWidth (Element elem
   else    else
       cssRule = ParseCSSUnit (cssRule, &val);        cssRule = ParseCSSUnit (cssRule, &val);
   if (val.typed_data.value != 0 &&    if (val.typed_data.value != 0 &&
       (val.typed_data.unit == STYLE_UNIT_INVALID ||        (val.typed_data.unit == UNIT_INVALID ||
        val.typed_data.unit == STYLE_UNIT_BOX))         val.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid width value", ptr, cssRule);      CSSParseError ("Invalid width value", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     {      {
Line 2336  static char *ParseCSSMarginTop (Element Line 2397  static char *ParseCSSMarginTop (Element
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       margin.typed_data.unit = STYLE_VALUE_AUTO;        margin.typed_data.unit = VALUE_AUTO;
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 2344  static char *ParseCSSMarginTop (Element Line 2405  static char *ParseCSSMarginTop (Element
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == STYLE_UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == STYLE_UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-top value", ptr, cssRule);      CSSParseError ("Invalid margin-top value", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
      {       {
Line 2372  static char *ParseCSSMarginBottom (Eleme Line 2433  static char *ParseCSSMarginBottom (Eleme
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       margin.typed_data.unit = STYLE_VALUE_AUTO;        margin.typed_data.unit = VALUE_AUTO;
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 2380  static char *ParseCSSMarginBottom (Eleme Line 2441  static char *ParseCSSMarginBottom (Eleme
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == STYLE_UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == STYLE_UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-bottom value", ptr, cssRule);      CSSParseError ("Invalid margin-bottom value", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
      {       {
Line 2408  static char *ParseCSSMarginLeft (Element Line 2469  static char *ParseCSSMarginLeft (Element
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       margin.typed_data.unit = STYLE_VALUE_AUTO;        margin.typed_data.unit = VALUE_AUTO;
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 2416  static char *ParseCSSMarginLeft (Element Line 2477  static char *ParseCSSMarginLeft (Element
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == STYLE_UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == STYLE_UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-left value", ptr, cssRule);      CSSParseError ("Invalid margin-left value", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
   if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (margin.typed_data.unit != UNIT_INVALID && DoApply)
      {       {
        if (tsch)         if (tsch)
          cssRule = CheckImportantRule (cssRule, context);           cssRule = CheckImportantRule (cssRule, context);
Line 2445  static char *ParseCSSMarginRight (Elemen Line 2506  static char *ParseCSSMarginRight (Elemen
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       margin.typed_data.unit = STYLE_VALUE_AUTO;        margin.typed_data.unit = VALUE_AUTO;
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 2453  static char *ParseCSSMarginRight (Elemen Line 2514  static char *ParseCSSMarginRight (Elemen
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == STYLE_UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == STYLE_UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-right value", ptr, cssRule);      CSSParseError ("Invalid margin-right value", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
      {       {
Line 2542  static char *ParseCSSPaddingTop (Element Line 2603  static char *ParseCSSPaddingTop (Element
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == STYLE_UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == STYLE_UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
     {      {
       CSSParseError ("Invalid padding-top value", ptr, cssRule);        CSSParseError ("Invalid padding-top value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
Line 2573  static char *ParseCSSPaddingBottom (Elem Line 2634  static char *ParseCSSPaddingBottom (Elem
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.value == 0)    if (padding.typed_data.value == 0)
     padding.typed_data.unit = STYLE_UNIT_EM;      padding.typed_data.unit = UNIT_EM;
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == STYLE_UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == STYLE_UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
     {      {
       CSSParseError ("Invalid padding-bottom value", ptr, cssRule);        CSSParseError ("Invalid padding-bottom value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
Line 2606  static char *ParseCSSPaddingLeft (Elemen Line 2667  static char *ParseCSSPaddingLeft (Elemen
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.value == 0)    if (padding.typed_data.value == 0)
     padding.typed_data.unit = STYLE_UNIT_EM;      padding.typed_data.unit = UNIT_EM;
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == STYLE_UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == STYLE_UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
     {      {
       CSSParseError ("Invalid padding-left value", ptr, cssRule);        CSSParseError ("Invalid padding-left value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
Line 2639  static char *ParseCSSPaddingRight (Eleme Line 2700  static char *ParseCSSPaddingRight (Eleme
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.value == 0)    if (padding.typed_data.value == 0)
     padding.typed_data.unit = STYLE_UNIT_EM;      padding.typed_data.unit = UNIT_EM;
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == STYLE_UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == STYLE_UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
     {      {
       CSSParseError ("Invalid padding-right value", ptr, cssRule);        CSSParseError ("Invalid padding-right value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
Line 2728  static char *ParseCSSForeground (Element Line 2789  static char *ParseCSSForeground (Element
   PresentationValue   best;    PresentationValue   best;
   
   cssRule = ParseCSSColor (cssRule, &best);    cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
      {       {
        if (tsch)         if (tsch)
          cssRule = CheckImportantRule (cssRule, context);           cssRule = CheckImportantRule (cssRule, context);
Line 2748  static char *ParseCSSBackgroundColor (El Line 2809  static char *ParseCSSBackgroundColor (El
 {  {
   PresentationValue     best;    PresentationValue     best;
   
   best.typed_data.unit = STYLE_UNIT_INVALID;    best.typed_data.unit = UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   if (!strncasecmp (cssRule, "transparent", strlen ("transparent")))    if (!strncasecmp (cssRule, "transparent", strlen ("transparent")))
     {      {
       best.typed_data.value = STYLE_PATTERN_NONE;        best.typed_data.value = PATTERN_NONE;
       best.typed_data.unit = STYLE_UNIT_REL;        best.typed_data.unit = UNIT_REL;
       if (DoApply)        if (DoApply)
         {          {
           if (tsch)            if (tsch)
Line 2765  static char *ParseCSSBackgroundColor (El Line 2826  static char *ParseCSSBackgroundColor (El
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)        if (best.typed_data.unit != UNIT_INVALID && DoApply)
         {          {
           if (tsch)            if (tsch)
             cssRule = CheckImportantRule (cssRule, context);              cssRule = CheckImportantRule (cssRule, context);
           /* install the new presentation. */            /* install the new presentation. */
           TtaSetStylePresentation (PRBackground, element, tsch, context, best);            TtaSetStylePresentation (PRBackground, element, tsch, context, best);
           /* thot specificity: need to set fill pattern for background color */            /* thot specificity: need to set fill pattern for background color */
           best.typed_data.value = STYLE_PATTERN_BACKGROUND;            best.typed_data.value = PATTERN_BACKGROUND;
           best.typed_data.unit = STYLE_UNIT_REL;            best.typed_data.unit = UNIT_REL;
           TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);            TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);
           best.typed_data.value = 1;            best.typed_data.value = 1;
           best.typed_data.unit = STYLE_UNIT_REL;            best.typed_data.unit = UNIT_REL;
           TtaSetStylePresentation (PRShowBox, element, tsch, context, best);            TtaSetStylePresentation (PRShowBox, element, tsch, context, best);
         }          }
     }      }
Line 2792  static char *ParseSVGStroke (Element ele Line 2853  static char *ParseSVGStroke (Element ele
 {  {
   PresentationValue     best;    PresentationValue     best;
   
   best.typed_data.unit = STYLE_UNIT_INVALID;    best.typed_data.unit = UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
       best.typed_data.value = -2;  /* -2 means transparent */        best.typed_data.value = -2;  /* -2 means transparent */
       best.typed_data.unit = STYLE_UNIT_REL;        best.typed_data.unit = UNIT_REL;
       if (DoApply)        if (DoApply)
         {          {
           if (tsch)            if (tsch)
Line 2809  static char *ParseSVGStroke (Element ele Line 2870  static char *ParseSVGStroke (Element ele
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)        if (best.typed_data.unit != UNIT_INVALID && DoApply)
         {          {
           if (tsch)            if (tsch)
             cssRule = CheckImportantRule (cssRule, context);              cssRule = CheckImportantRule (cssRule, context);
Line 2829  static char *ParseSVGFill (Element eleme Line 2890  static char *ParseSVGFill (Element eleme
 {  {
   PresentationValue     best;    PresentationValue     best;
   
   best.typed_data.unit = STYLE_UNIT_INVALID;    best.typed_data.unit = UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
       best.typed_data.value = STYLE_PATTERN_NONE;        best.typed_data.value = PATTERN_NONE;
       best.typed_data.unit = STYLE_UNIT_REL;        best.typed_data.unit = UNIT_REL;
       if (DoApply)        if (DoApply)
         {          {
           if (tsch)            if (tsch)
Line 2846  static char *ParseSVGFill (Element eleme Line 2907  static char *ParseSVGFill (Element eleme
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)        if (best.typed_data.unit != UNIT_INVALID && DoApply)
         {          {
           if (tsch)            if (tsch)
             cssRule = CheckImportantRule (cssRule, context);              cssRule = CheckImportantRule (cssRule, context);
           /* install the new presentation. */            /* install the new presentation. */
           TtaSetStylePresentation (PRBackground, element, tsch, context, best);            TtaSetStylePresentation (PRBackground, element, tsch, context, best);
           /* thot specificity: need to set fill pattern for background color */            /* thot specificity: need to set fill pattern for background color */
           best.typed_data.value = STYLE_PATTERN_BACKGROUND;            best.typed_data.value = PATTERN_BACKGROUND;
           best.typed_data.unit = STYLE_UNIT_REL;            best.typed_data.unit = UNIT_REL;
           TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);            TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);
         }          }
     }      }
Line 2870  static char *ParseSVGOpacity (Element el Line 2931  static char *ParseSVGOpacity (Element el
 {  {
   PresentationValue     best;    PresentationValue     best;
   
   best.typed_data.unit = STYLE_UNIT_INVALID;    best.typed_data.unit = UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   cssRule = ParseClampedUnit (cssRule, &best);    cssRule = ParseClampedUnit (cssRule, &best);
   if (DoApply)    if (DoApply)
Line 2892  static char *ParseSVGStrokeOpacity (Elem Line 2953  static char *ParseSVGStrokeOpacity (Elem
 {  {
   PresentationValue     best;    PresentationValue     best;
   
   best.typed_data.unit = STYLE_UNIT_INVALID;    best.typed_data.unit = UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   cssRule = ParseClampedUnit (cssRule, &best);    cssRule = ParseClampedUnit (cssRule, &best);
   if (DoApply)    if (DoApply)
Line 2914  static char *ParseSVGFillOpacity (Elemen Line 2975  static char *ParseSVGFillOpacity (Elemen
 {  {
   PresentationValue     best;    PresentationValue     best;
   
   best.typed_data.unit = STYLE_UNIT_INVALID;    best.typed_data.unit = UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   cssRule = ParseClampedUnit (cssRule, &best);    cssRule = ParseClampedUnit (cssRule, &best);
   if (DoApply)    if (DoApply)
Line 2961  void ParseCSSBackgroundImageCallback (Do Line 3022  void ParseCSSBackgroundImageCallback (Do
   
   /* enforce the showbox */    /* enforce the showbox */
   value.typed_data.value = 1;    value.typed_data.value = 1;
   value.typed_data.unit = STYLE_UNIT_REL;    value.typed_data.unit = UNIT_REL;
   value.typed_data.real = FALSE;    value.typed_data.real = FALSE;
   TtaSetStylePresentation (PRShowBox, el, tsch, context, value);    TtaSetStylePresentation (PRShowBox, el, tsch, context, value);
   
Line 3112  static char *ParseCSSBackgroundImage (El Line 3173  static char *ParseCSSBackgroundImage (El
             {              {
               /* there is no FillPattern rule -> remove ShowBox rule */                /* there is no FillPattern rule -> remove ShowBox rule */
               value.typed_data.value = 1;                value.typed_data.value = 1;
               value.typed_data.unit = STYLE_UNIT_REL;                value.typed_data.unit = UNIT_REL;
               value.typed_data.real = FALSE;                value.typed_data.real = FALSE;
               TtaSetStylePresentation (PRShowBox, element, tsch, context, value);                TtaSetStylePresentation (PRShowBox, element, tsch, context, value);
             }              }
Line 3165  static char *ParseCSSBackgroundRepeat (E Line 3226  static char *ParseCSSBackgroundRepeat (E
 {  {
   PresentationValue   repeat;    PresentationValue   repeat;
   
   repeat.typed_data.value = STYLE_REALSIZE;    repeat.typed_data.value = REALSIZE;
   repeat.typed_data.unit = STYLE_UNIT_REL;    repeat.typed_data.unit = UNIT_REL;
   repeat.typed_data.real = FALSE;    repeat.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   if (!strncasecmp (cssRule, "no-repeat", 9))    if (!strncasecmp (cssRule, "no-repeat", 9))
     repeat.typed_data.value = STYLE_REALSIZE;      repeat.typed_data.value = REALSIZE;
   else if (!strncasecmp (cssRule, "repeat-y", 8))    else if (!strncasecmp (cssRule, "repeat-y", 8))
     repeat.typed_data.value = STYLE_VREPEAT;      repeat.typed_data.value = VREPEAT;
   else if (!strncasecmp (cssRule, "repeat-x", 8))    else if (!strncasecmp (cssRule, "repeat-x", 8))
     repeat.typed_data.value = STYLE_HREPEAT;      repeat.typed_data.value = HREPEAT;
   else if (!strncasecmp (cssRule, "repeat", 6))    else if (!strncasecmp (cssRule, "repeat", 6))
     repeat.typed_data.value = STYLE_REPEAT;      repeat.typed_data.value = REPEAT;
   else    else
     return (cssRule);      return (cssRule);
   
Line 3241  static char *ParseCSSBackgroundPosition Line 3302  static char *ParseCSSBackgroundPosition
   if (ok && DoApply)    if (ok && DoApply)
     {      {
       /* force realsize for the background image */        /* force realsize for the background image */
       repeat.typed_data.value = STYLE_REALSIZE;        repeat.typed_data.value = REALSIZE;
       repeat.typed_data.unit = STYLE_UNIT_REL;        repeat.typed_data.unit = UNIT_REL;
       repeat.typed_data.real = FALSE;        repeat.typed_data.real = FALSE;
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
Line 3319  static char *ParseCSSPageBreakBefore (El Line 3380  static char *ParseCSSPageBreakBefore (El
 {  {
   PresentationValue   page;    PresentationValue   page;
   
   page.typed_data.unit = STYLE_UNIT_INVALID;    page.typed_data.unit = UNIT_INVALID;
   page.typed_data.real = FALSE;    page.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      page.typed_data.value = PageAuto;
       /*page.typed_data.unit = STYLE_UNIT_REL;*/  
       page.typed_data.value = STYLE_AUTO;  
     }  
   else if (!strncasecmp (cssRule, "always", 6))    else if (!strncasecmp (cssRule, "always", 6))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_ALWAYS;        page.typed_data.value = PageAlways;
     }      }
   else if (!strncasecmp (cssRule, "avoid", 5))    else if (!strncasecmp (cssRule, "avoid", 5))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_AVOID;        page.typed_data.value = PageAvoid;
     }      }
   else if (!strncasecmp (cssRule, "left", 4))    else if (!strncasecmp (cssRule, "left", 4))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_PAGELEFT;        page.typed_data.value = PageLeft;
     }      }
   else if (!strncasecmp (cssRule, "right", 5))    else if (!strncasecmp (cssRule, "right", 5))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_PAGERIGHT;        page.typed_data.value = PageRight;
     }      }
   else if (!strncasecmp (cssRule, "inherit", 7))    else if (!strncasecmp (cssRule, "inherit", 7))
     {      {
       /*page.typed_data.unit = STYLE_UNIT_REL;*/        /*page.typed_data.unit = UNIT_REL;*/
       page.typed_data.value = STYLE_INHERIT;        page.typed_data.value = PageInherit;
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* install the new presentation */    /* install the new presentation */
   if (page.typed_data.unit == STYLE_UNIT_REL &&    if (page.typed_data.unit == UNIT_REL &&
       page.typed_data.value == STYLE_ALWAYS && DoApply)        page.typed_data.value == PageAlways && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
Line 3375  static char *ParseCSSPageBreakAfter (Ele Line 3433  static char *ParseCSSPageBreakAfter (Ele
 {  {
   PresentationValue   page;    PresentationValue   page;
   
   page.typed_data.unit = STYLE_UNIT_INVALID;    page.typed_data.unit = UNIT_INVALID;
   page.typed_data.real = FALSE;    page.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      page.typed_data.value = PageAuto;
       /*page.typed_data.unit = STYLE_UNIT_REL;*/  
       page.typed_data.value = STYLE_AUTO;  
     }  
   else if (!strncasecmp (cssRule, "always", 6))    else if (!strncasecmp (cssRule, "always", 6))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_ALWAYS;        page.typed_data.value = PageAlways;
     }      }
   else if (!strncasecmp (cssRule, "avoid", 5))    else if (!strncasecmp (cssRule, "avoid", 5))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_AVOID;        page.typed_data.value = PageAvoid;
     }      }
   else if (!strncasecmp (cssRule, "left", 4))    else if (!strncasecmp (cssRule, "left", 4))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_PAGELEFT;        page.typed_data.value = PageLeft;
     }      }
   else if (!strncasecmp (cssRule, "right", 5))    else if (!strncasecmp (cssRule, "right", 5))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_PAGERIGHT;        page.typed_data.value = PageRight;
     }      }
   else if (!strncasecmp (cssRule, "inherit", 7))    else if (!strncasecmp (cssRule, "inherit", 7))
     {      {
       /*page.typed_data.unit = STYLE_UNIT_REL;*/        /*page.typed_data.unit = UNIT_REL;*/
       page.typed_data.value = STYLE_INHERIT;        page.typed_data.value = PageInherit;
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* install the new presentation */    /* install the new presentation */
   /*if (page.typed_data.unit == STYLE_UNIT_REL && DoApply)    /*if (page.typed_data.unit == UNIT_REL && DoApply)
     {      {
     if (tsch)      if (tsch)
     cssRule = CheckImportantRule (cssRule, context);      cssRule = CheckImportantRule (cssRule, context);
Line 3429  static char *ParseCSSPageBreakInside (El Line 3484  static char *ParseCSSPageBreakInside (El
 {  {
   PresentationValue   page;    PresentationValue   page;
   
   page.typed_data.unit = STYLE_UNIT_INVALID;    page.typed_data.unit = UNIT_INVALID;
   page.typed_data.real = FALSE;    page.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       /*page.typed_data.unit = STYLE_UNIT_REL;*/        /*page.typed_data.unit = UNIT_REL;*/
       page.typed_data.value = STYLE_AUTO;        page.typed_data.value = PageAuto;
     }      }
   else if (!strncasecmp (cssRule, "avoid", 5))    else if (!strncasecmp (cssRule, "avoid", 5))
     {      {
       page.typed_data.unit = STYLE_UNIT_REL;        page.typed_data.unit = UNIT_REL;
       page.typed_data.value = STYLE_AVOID;        page.typed_data.value = PageAvoid;
     }      }
   else if (!strncasecmp (cssRule, "inherit", 7))    else if (!strncasecmp (cssRule, "inherit", 7))
     {      {
       /*page.typed_data.unit = STYLE_UNIT_REL;*/        /*page.typed_data.unit = UNIT_REL;*/
       page.typed_data.value = STYLE_INHERIT;        page.typed_data.value = PageInherit;
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* install the new presentation */    /* install the new presentation */
   /*if (page.typed_data.unit == STYLE_UNIT_REL &&    /*if (page.typed_data.unit == UNIT_REL &&
     page.typed_data.value == STYLE_AVOID && DoApply)      page.typed_data.value == PageAvoid && DoApply)
     {      {
     if (tsch)      if (tsch)
     cssRule = CheckImportantRule (cssRule, context);      cssRule = CheckImportantRule (cssRule, context);
Line 3471  static char *ParseSVGStrokeWidth (Elemen Line 3526  static char *ParseSVGStrokeWidth (Elemen
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   width.typed_data.value = 0;    width.typed_data.value = 0;
   width.typed_data.unit = STYLE_UNIT_INVALID;    width.typed_data.unit = UNIT_INVALID;
   width.typed_data.real = FALSE;    width.typed_data.real = FALSE;
   if (isdigit (*cssRule) || *cssRule == '.')    if (isdigit (*cssRule) || *cssRule == '.')
     {      {
      cssRule = ParseCSSUnit (cssRule, &width);       cssRule = ParseCSSUnit (cssRule, &width);
      if (width.typed_data.unit == STYLE_UNIT_BOX)       if (width.typed_data.unit == UNIT_BOX)
        width.typed_data.unit = STYLE_UNIT_PX;         width.typed_data.unit = UNIT_PX;
     }      }
   if (width.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (width.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* check if it's an important rule */        /* check if it's an important rule */
       if (tsch)        if (tsch)
         cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
       TtaSetStylePresentation (PRLineWeight, element, tsch, context, width);        TtaSetStylePresentation (PRLineWeight, element, tsch, context, width);
       width.typed_data.value = 1;        width.typed_data.value = 1;
       width.typed_data.unit = STYLE_UNIT_REL;        width.typed_data.unit = UNIT_REL;
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 3566  static CSSProperty CSSProperties[] = Line 3621  static CSSProperty CSSProperties[] =
    {"height", ParseCSSHeight},     {"height", ParseCSSHeight},
    {"float", ParseCSSFloat},     {"float", ParseCSSFloat},
    {"clear", ParseCSSClear},     {"clear", ParseCSSClear},
      {"content", ParseCSSContent},
   
    {"display", ParseCSSDisplay},     {"display", ParseCSSDisplay},
    {"white-space", ParseCSSWhiteSpace},     {"white-space", ParseCSSWhiteSpace},
Line 3684  static void AddBorderStyleValue (char *b Line 3740  static void AddBorderStyleValue (char *b
 {  {
   switch (value)    switch (value)
     {      {
     case STYLE_BORDERNONE:      case BorderStyleNone:
       strcat (buffer, "none");        strcat (buffer, "none");
       break;        break;
     case STYLE_BORDERHIDDEN:      case BorderStyleHidden:
       strcat (buffer, "hidden");        strcat (buffer, "hidden");
       break;        break;
     case STYLE_BORDERDOTTED:      case BorderStyleDotted:
       strcat (buffer, "dotted");        strcat (buffer, "dotted");
       break;        break;
     case STYLE_BORDERDASHED:      case BorderStyleDashed:
       strcat (buffer, "dashed");        strcat (buffer, "dashed");
       break;        break;
     case STYLE_BORDERSOLID:      case BorderStyleSolid:
       strcat (buffer, "solid");        strcat (buffer, "solid");
       break;        break;
     case STYLE_BORDERDOUBLE:      case BorderStyleDouble:
       strcat (buffer, "double");        strcat (buffer, "double");
       break;        break;
     case STYLE_BORDERGROOVE:      case BorderStyleGroove:
       strcat (buffer, "groove");        strcat (buffer, "groove");
       break;        break;
     case STYLE_BORDERRIDGE:      case BorderStyleRidge:
       strcat (buffer, "ridge");        strcat (buffer, "ridge");
       break;        break;
     case STYLE_BORDERINSET:      case BorderStyleInset:
       strcat (buffer, "inset");        strcat (buffer, "inset");
       break;        break;
     case STYLE_BORDEROUTSET:      case BorderStyleOutset:
       strcat (buffer, "outset");        strcat (buffer, "outset");
       break;        break;
     }      }
Line 3894  void PToCss (PresentationSetting setting Line 3950  void PToCss (PresentationSetting setting
       AddBorderStyleValue (buffer, settings->value.typed_data.value);        AddBorderStyleValue (buffer, settings->value.typed_data.value);
       break;        break;
     case PRSize:      case PRSize:
       if (unit == STYLE_UNIT_REL)        if (unit == UNIT_REL)
         {          {
           if (real)            if (real)
             {              {
Line 3945  void PToCss (PresentationSetting setting Line 4001  void PToCss (PresentationSetting setting
     case PRStyle:      case PRStyle:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_FONT_ROMAN:          case StyleRoman:
           strcpy (buffer, "font-style: normal");            strcpy (buffer, "font-style: normal");
           break;            break;
         case STYLE_FONT_ITALICS:          case StyleItalics:
           strcpy (buffer, "font-style: italic");            strcpy (buffer, "font-style: italic");
           break;            break;
         case STYLE_FONT_OBLIQUE:          case StyleOblique:
           strcpy (buffer, "font-style: oblique");            strcpy (buffer, "font-style: oblique");
           break;            break;
         }          }
Line 3959  void PToCss (PresentationSetting setting Line 4015  void PToCss (PresentationSetting setting
     case PRWeight:      case PRWeight:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_WEIGHT_BOLD:          case WeightBold:
           strcpy (buffer, "font-weight: bold");            strcpy (buffer, "font-weight: bold");
           break;            break;
         case STYLE_WEIGHT_NORMAL:          case WeightNormal:
           strcpy (buffer, "font-weight: normal");            strcpy (buffer, "font-weight: normal");
           break;            break;
         }          }
Line 3970  void PToCss (PresentationSetting setting Line 4026  void PToCss (PresentationSetting setting
     case PRFont:      case PRFont:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_FONT_HELVETICA:          case FontHelvetica:
           strcpy (buffer, "font-family: helvetica");            strcpy (buffer, "font-family: helvetica");
           break;            break;
         case STYLE_FONT_TIMES:          case FontTimes:
           strcpy (buffer, "font-family: times");            strcpy (buffer, "font-family: times");
           break;            break;
         case STYLE_FONT_COURIER:          case FontCourier:
           strcpy (buffer, "font-family: courier");            strcpy (buffer, "font-family: courier");
           break;            break;
         }          }
Line 3984  void PToCss (PresentationSetting setting Line 4040  void PToCss (PresentationSetting setting
     case PRUnderline:      case PRUnderline:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_UNDERLINE:          case Underline:
           strcpy (buffer, "text-decoration: underline");            strcpy (buffer, "text-decoration: underline");
           break;            break;
         case STYLE_OVERLINE:          case Overline:
           strcpy (buffer, "text-decoration: overline");            strcpy (buffer, "text-decoration: overline");
           break;            break;
         case STYLE_CROSSOUT:          case CrossOut:
           strcpy (buffer, "text-decoration: line-through");            strcpy (buffer, "text-decoration: line-through");
           break;            break;
         }          }
Line 4018  void PToCss (PresentationSetting setting Line 4074  void PToCss (PresentationSetting setting
     case PRAdjust:      case PRAdjust:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_ADJUSTLEFT:          case AdjustLeft:
           strcpy (buffer, "text-align: left");            strcpy (buffer, "text-align: left");
           break;            break;
         case STYLE_ADJUSTRIGHT:          case AdjustRight:
           strcpy (buffer, "text-align: right");            strcpy (buffer, "text-align: right");
           break;            break;
         case STYLE_ADJUSTCENTERED:          case Centered:
           strcpy (buffer, "text-align: center");            strcpy (buffer, "text-align: center");
           break;            break;
         case STYLE_ADJUSTLEFTWITHDOTS:          case LeftWithDots:
           strcpy (buffer, "text-align: left");            strcpy (buffer, "text-align: left");
           break;            break;
         case STYLE_ADJUSTJUSTIFY:          case Justify:
           strcpy (buffer, "text-align: justify");            strcpy (buffer, "text-align: justify");
           break;            break;
         }          }
Line 4038  void PToCss (PresentationSetting setting Line 4094  void PToCss (PresentationSetting setting
     case PRDirection:      case PRDirection:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_LEFTTORIGHT:          case LeftToRight:
           strcpy (buffer, "direction: ltr");            strcpy (buffer, "direction: ltr");
           break;            break;
         case STYLE_RIGHTTOLEFT:          case RightToLeft:
           strcpy (buffer, "direction: rtl");            strcpy (buffer, "direction: rtl");
           break;            break;
         }          }
Line 4049  void PToCss (PresentationSetting setting Line 4105  void PToCss (PresentationSetting setting
     case PRUnicodeBidi:      case PRUnicodeBidi:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_BIDINORMAL:          case Normal:
           strcpy (buffer, "unicode-bidi: normal");            strcpy (buffer, "unicode-bidi: normal");
           break;            break;
         case STYLE_BIDIEMBED:          case Embed:
           strcpy (buffer, "unicode-bidi: embed");            strcpy (buffer, "unicode-bidi: embed");
           break;            break;
         case STYLE_BIDIOVERRIDE:          case Override:
           strcpy (buffer, "unicode-bidi: bidi-override");            strcpy (buffer, "unicode-bidi: bidi-override");
           break;            break;
         }          }
Line 4065  void PToCss (PresentationSetting setting Line 4121  void PToCss (PresentationSetting setting
     case PRDisplay:      case PRDisplay:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_DISPLAYINLINE:          case Inline:
           strcpy (buffer, "display: inline");            strcpy (buffer, "display: inline");
           break;            break;
         case STYLE_DISPLAYBLOCK:          case Block:
           strcpy (buffer, "display: block");            strcpy (buffer, "display: block");
           break;            break;
         case STYLE_DISPLAYLISTITEM:          case ListItem:
           strcpy (buffer, "display: list-item");            strcpy (buffer, "display: list-item");
           break;            break;
         case STYLE_DISPLAYRUNIN:          case RunIn:
           strcpy (buffer, "display: runin");            strcpy (buffer, "display: runin");
           break;            break;
         case STYLE_DISPLAYCOMPACT:          case Compact:
           strcpy (buffer, "display: compact");            strcpy (buffer, "display: compact");
           break;            break;
         case STYLE_DISPLAYMARKER:          case Marker:
           strcpy (buffer, "display: marker");            strcpy (buffer, "display: marker");
           break;            break;
         default:          default:
Line 4140  void PToCss (PresentationSetting setting Line 4196  void PToCss (PresentationSetting setting
     case PRPictureMode:      case PRPictureMode:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_REALSIZE:          case REALSIZE:
           sprintf (buffer, "background-repeat: no-repeat");            sprintf (buffer, "background-repeat: no-repeat");
           break;            break;
         case STYLE_REPEAT:          case REPEAT:
           sprintf (buffer, "background-repeat: repeat");            sprintf (buffer, "background-repeat: repeat");
           break;            break;
         case STYLE_VREPEAT:          case VREPEAT:
           sprintf (buffer, "background-repeat: repeat-y");            sprintf (buffer, "background-repeat: repeat-y");
           break;            break;
         case STYLE_HREPEAT:          case HREPEAT:
           sprintf (buffer, "background-repeat: repeat-x");            sprintf (buffer, "background-repeat: repeat-x");
           break;            break;
         }          }

Removed from v.1.183  
changed lines
  Added in v.1.184


Webmaster