Diff for /Amaya/amaya/styleparser.c between versions 1.115 and 1.116

version 1.115, 2002/02/12 18:10:21 version 1.116, 2002/02/20 16:27:05
Line 90  static char         *DocURL = NULL; /* T Line 90  static char         *DocURL = NULL; /* T
 static Document      ParsedDoc; /* The document to which CSS are to be applied */  static Document      ParsedDoc; /* The document to which CSS are to be applied */
 static int           LineNumber = -1; /* The line where the error occurs */  static int           LineNumber = -1; /* The line where the error occurs */
 static int           NewLineSkipped = 0;  static int           NewLineSkipped = 0;
   static ThotBool      DoApply = TRUE;
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    SkipWord:                                                       SkipWord:                                                  
Line 504  static char *ParseCSSBorderTopWidth (Ele Line 505  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     {      {
       TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
Line 527  static char *ParseCSSBorderBottomWidth ( Line 528  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     {      {
       TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
Line 550  static char *ParseCSSBorderLeftWidth (El Line 551  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     {      {
       TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
Line 573  static char *ParseCSSBorderRightWidth (E Line 574  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     {      {
       TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);        TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);
       border.typed_data.value = 1;        border.typed_data.value = 1;
Line 656  static char *ParseCSSBorderColorTop (Ele Line 657  static char *ParseCSSBorderColorTop (Ele
    PresentationValue   best;     PresentationValue   best;
   
    cssRule = ParseCSSColor (cssRule, &best);     cssRule = ParseCSSColor (cssRule, &best);
    if (best.typed_data.unit != STYLE_UNIT_INVALID)     if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      /* install the new presentation */       /* install the new presentation */
      TtaSetStylePresentation (PRBorderTopColor, element, tsch, context, best);       TtaSetStylePresentation (PRBorderTopColor, element, tsch, context, best);
    return (cssRule);     return (cssRule);
Line 674  static char *ParseCSSBorderColorLeft (El Line 675  static char *ParseCSSBorderColorLeft (El
    PresentationValue   best;     PresentationValue   best;
   
    cssRule = ParseCSSColor (cssRule, &best);     cssRule = ParseCSSColor (cssRule, &best);
    if (best.typed_data.unit != STYLE_UNIT_INVALID)     if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      /* install the new presentation */       /* install the new presentation */
      TtaSetStylePresentation (PRBorderLeftColor, element, tsch, context, best);       TtaSetStylePresentation (PRBorderLeftColor, element, tsch, context, best);
    return (cssRule);     return (cssRule);
Line 692  static char *ParseCSSBorderColorBottom ( Line 693  static char *ParseCSSBorderColorBottom (
    PresentationValue   best;     PresentationValue   best;
   
    cssRule = ParseCSSColor (cssRule, &best);     cssRule = ParseCSSColor (cssRule, &best);
    if (best.typed_data.unit != STYLE_UNIT_INVALID)     if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      /* install the new presentation */       /* install the new presentation */
      TtaSetStylePresentation (PRBorderBottomColor, element, tsch, context, best);       TtaSetStylePresentation (PRBorderBottomColor, element, tsch, context, best);
    return (cssRule);     return (cssRule);
Line 710  static char *ParseCSSBorderColorRight (E Line 711  static char *ParseCSSBorderColorRight (E
    PresentationValue   best;     PresentationValue   best;
   
    cssRule = ParseCSSColor (cssRule, &best);     cssRule = ParseCSSColor (cssRule, &best);
    if (best.typed_data.unit != STYLE_UNIT_INVALID)     if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      /* install the new presentation */       /* install the new presentation */
      TtaSetStylePresentation (PRBorderRightColor, element, tsch, context, best);       TtaSetStylePresentation (PRBorderRightColor, element, tsch, context, best);
    return (cssRule);     return (cssRule);
Line 793  static char *ParseCSSBorderStyleTop (Ele Line 794  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);
   return (cssRule);    return (cssRule);
 }  }
Line 811  static char *ParseCSSBorderStyleLeft (El Line 812  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);
   return (cssRule);    return (cssRule);
 }  }
Line 829  static char *ParseCSSBorderStyleBottom ( Line 830  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);
   return (cssRule);    return (cssRule);
 }  }
Line 847  static char *ParseCSSBorderStyleRight (E Line 848  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)    if (border.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);
   return (cssRule);    return (cssRule);
 }  }
Line 1077  static char *ParseCSSDisplay (Element el Line 1078  static char *ParseCSSDisplay (Element el
    if (!strncasecmp (cssRule, "block", 5))     if (!strncasecmp (cssRule, "block", 5))
      {       {
        /* pval.typed_data.value = STYLE_INLINE;         /* pval.typed_data.value = STYLE_INLINE;
           if (DoApply)
           TtaSetStylePresentation (PRLine, element, tsch, context, pval); */            TtaSetStylePresentation (PRLine, element, tsch, context, pval); */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "inline", 6))     else if (!strncasecmp (cssRule, "inline", 6))
      {       {
        /* pval.typed_data.value = STYLE_INLINE;         /* pval.typed_data.value = STYLE_INLINE;
           if (DoApply)
           TtaSetStylePresentation (PRLine, element, tsch, context, pval); */            TtaSetStylePresentation (PRLine, element, tsch, context, pval); */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "none", 4))     else if (!strncasecmp (cssRule, "none", 4))
      {       {
         pval.typed_data.value = STYLE_HIDE;          pval.typed_data.value = STYLE_HIDE;
         TtaSetStylePresentation (PRVisibility, element, tsch, context, pval);          if (DoApply)
             TtaSetStylePresentation (PRVisibility, element, tsch, context, pval);
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "list-item", 9))     else if (!strncasecmp (cssRule, "list-item", 9))
Line 1216  static char *ParseCSSTextAlign (Element Line 1220  static char *ParseCSSTextAlign (Element
    /*     /*
     * install the new presentation.      * install the new presentation.
     */      */
    if (align.typed_data.value)     if (align.typed_data.value && DoApply)
      TtaSetStylePresentation (PRAdjust, element, tsch, context, align);       TtaSetStylePresentation (PRAdjust, element, tsch, context, align);
    return (cssRule);     return (cssRule);
 }  }
Line 1260  static char *ParseCSSDirection (Element Line 1264  static char *ParseCSSDirection (Element
    /*     /*
     * install the new presentation.      * install the new presentation.
     */      */
    if (direction.typed_data.value)     if (direction.typed_data.value && DoApply)
      TtaSetStylePresentation (PRDirection, element, tsch, context, direction);       TtaSetStylePresentation (PRDirection, element, tsch, context, direction);
    return (cssRule);     return (cssRule);
 }  }
Line 1309  static char *ParseCSSUnicodeBidi (Elemen Line 1313  static char *ParseCSSUnicodeBidi (Elemen
    /*     /*
     * install the new presentation.      * install the new presentation.
     */      */
    if (bidi.typed_data.value)     if (bidi.typed_data.value && DoApply)
      TtaSetStylePresentation (PRUnicodeBidi, element, tsch, context, bidi);       TtaSetStylePresentation (PRUnicodeBidi, element, tsch, context, bidi);
    return (cssRule);     return (cssRule);
 }  }
Line 1329  static char *ParseCSSTextIndent (Element Line 1333  static char *ParseCSSTextIndent (Element
    if (pval.typed_data.unit == STYLE_UNIT_INVALID)     if (pval.typed_data.unit == STYLE_UNIT_INVALID)
      return (cssRule);       return (cssRule);
    /* install the attribute */     /* install the attribute */
    TtaSetStylePresentation (PRIndent, element, tsch, context, pval);     if (DoApply)
        TtaSetStylePresentation (PRIndent, element, tsch, context, pval);
    return (cssRule);     return (cssRule);
 }  }
   
Line 1401  static char *ParseCSSLineSpacing (Elemen Line 1406  static char *ParseCSSLineSpacing (Elemen
    cssRule = ParseCSSUnit (cssRule, &lead);     cssRule = ParseCSSUnit (cssRule, &lead);
    if (lead.typed_data.unit != STYLE_UNIT_INVALID)     if (lead.typed_data.unit != STYLE_UNIT_INVALID)
      /* install the new presentation */       /* install the new presentation */
      TtaSetStylePresentation (PRLineSpacing, element, tsch, context, lead);       if (DoApply)
          TtaSetStylePresentation (PRLineSpacing, element, tsch, context, lead);
    return (cssRule);     return (cssRule);
 }  }
   
Line 1512  static char *ParseCSSFontSize (Element e Line 1518  static char *ParseCSSFontSize (Element e
      }       }
   
    /* install the presentation style */     /* install the presentation style */
    TtaSetStylePresentation (PRSize, element, tsch, context, pval);     if (DoApply)
        TtaSetStylePresentation (PRSize, element, tsch, context, pval);
   
    if (ptr != NULL)     if (ptr != NULL)
      cssRule = ParseCSSLineSpacing (element, tsch, context, ptr, css, isHTML);       cssRule = ParseCSSLineSpacing (element, tsch, context, ptr, css, isHTML);
Line 1618  static char *ParseCSSFontFamily (Element Line 1625  static char *ParseCSSFontFamily (Element
        cssRule = SkipBlanksAndComments (cssRule);         cssRule = SkipBlanksAndComments (cssRule);
        cssRule = SkipValue (cssRule, FALSE);         cssRule = SkipValue (cssRule, FALSE);
        /* install the new presentation */         /* install the new presentation */
        TtaSetStylePresentation (PRFont, element, tsch, context, font);         if (DoApply)
            TtaSetStylePresentation (PRFont, element, tsch, context, font);
      }       }
   return (cssRule);    return (cssRule);
 }  }
Line 1702  static char *ParseCSSFontWeight (Element Line 1710  static char *ParseCSSFontWeight (Element
        weight.typed_data.value = STYLE_WEIGHT_NORMAL;         weight.typed_data.value = STYLE_WEIGHT_NORMAL;
   
    /* install the new presentation */     /* install the new presentation */
    TtaSetStylePresentation (PRWeight, element, tsch, context, weight);      if (DoApply)
         TtaSetStylePresentation (PRWeight, element, tsch, context, weight);
    return (cssRule);     return (cssRule);
 }  }
   
Line 1792  static char *ParseCSSFontStyle (Element Line 1801  static char *ParseCSSFontStyle (Element
    /*     /*
     * install the new presentation.      * install the new presentation.
     */      */
    if (style.typed_data.value != 0)     if (style.typed_data.value != 0 && DoApply)
         TtaSetStylePresentation (PRStyle, element, tsch, context, style);          TtaSetStylePresentation (PRStyle, element, tsch, context, style);
    if (size.typed_data.value != 0)     if (size.typed_data.value != 0 && DoApply)
      {       {
         PresentationValue   previous_size;          PresentationValue   previous_size;
   
Line 1922  static char *ParseCSSTextDecoration (Ele Line 1931  static char *ParseCSSTextDecoration (Ele
    /*     /*
     * install the new presentation.      * install the new presentation.
     */      */
    if (decor.typed_data.value)     if (decor.typed_data.value && DoApply)
      {       {
        TtaSetStylePresentation (PRUnderline, element, tsch, context, decor);         TtaSetStylePresentation (PRUnderline, element, tsch, context, decor);
      }       }
Line 1945  static char *ParseCSSHeight (Element ele Line 1954  static char *ParseCSSHeight (Element ele
    else     else
      {       {
        cssRule = ParseCSSUnit (cssRule, &val);         cssRule = ParseCSSUnit (cssRule, &val);
        if (val.typed_data.unit != STYLE_UNIT_INVALID)         if (val.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
          /* install the new presentation */           /* install the new presentation */
          TtaSetStylePresentation (PRHeight, element, tsch, context, val);           TtaSetStylePresentation (PRHeight, element, tsch, context, val);
      }       }
Line 1969  static char *ParseCSSWidth (Element elem Line 1978  static char *ParseCSSWidth (Element elem
    else     else
      {       {
        cssRule = ParseCSSUnit (cssRule, &val);         cssRule = ParseCSSUnit (cssRule, &val);
        if (val.typed_data.unit != STYLE_UNIT_INVALID)         if (val.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
          /* install the new presentation */           /* install the new presentation */
          TtaSetStylePresentation (PRWidth, element, tsch, context, val);           TtaSetStylePresentation (PRWidth, element, tsch, context, val);
      }       }
Line 1989  static char *ParseCSSMarginTop (Element Line 1998  static char *ParseCSSMarginTop (Element
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRMarginTop, element, tsch, context, margin);      TtaSetStylePresentation (PRMarginTop, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
 }  }
Line 2007  static char *ParseCSSMarginBottom (Eleme Line 2016  static char *ParseCSSMarginBottom (Eleme
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRMarginBottom, element, tsch, context, margin);      TtaSetStylePresentation (PRMarginBottom, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
 }  }
Line 2025  static char *ParseCSSMarginLeft (Element Line 2034  static char *ParseCSSMarginLeft (Element
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRMarginLeft, element, tsch, context, margin);      TtaSetStylePresentation (PRMarginLeft, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
 }  }
Line 2043  static char *ParseCSSMarginRight (Elemen Line 2052  static char *ParseCSSMarginRight (Elemen
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
       TtaSetStylePresentation (PRMarginRight, element, tsch, context, margin);        TtaSetStylePresentation (PRMarginRight, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
 }  }
Line 2122  static char *ParseCSSPaddingTop (Element Line 2131  static char *ParseCSSPaddingTop (Element
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
       TtaSetStylePresentation (PRPaddingTop, element, tsch, context, padding);        TtaSetStylePresentation (PRPaddingTop, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
 }  }
Line 2140  static char *ParseCSSPaddingBottom (Elem Line 2149  static char *ParseCSSPaddingBottom (Elem
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
       TtaSetStylePresentation (PRPaddingBottom, element, tsch, context, padding);        TtaSetStylePresentation (PRPaddingBottom, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
 }  }
Line 2158  static char *ParseCSSPaddingLeft (Elemen Line 2167  static char *ParseCSSPaddingLeft (Elemen
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
       TtaSetStylePresentation (PRPaddingLeft, element, tsch, context, padding);        TtaSetStylePresentation (PRPaddingLeft, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
 }  }
Line 2176  static char *ParseCSSPaddingRight (Eleme Line 2185  static char *ParseCSSPaddingRight (Eleme
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
       TtaSetStylePresentation (PRPaddingRight, element, tsch, context, padding);        TtaSetStylePresentation (PRPaddingRight, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
 }  }
Line 2253  static char *ParseCSSForeground (Element Line 2262  static char *ParseCSSForeground (Element
    PresentationValue   best;     PresentationValue   best;
   
    cssRule = ParseCSSColor (cssRule, &best);     cssRule = ParseCSSColor (cssRule, &best);
    if (best.typed_data.unit != STYLE_UNIT_INVALID)     if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      /* install the new presentation */       /* install the new presentation */
      TtaSetStylePresentation (PRForeground, element, tsch, context, best);       TtaSetStylePresentation (PRForeground, element, tsch, context, best);
    return (cssRule);     return (cssRule);
Line 2290  static char *ParseCSSBackgroundColor (El Line 2299  static char *ParseCSSBackgroundColor (El
     {      {
       best.typed_data.value = STYLE_PATTERN_NONE;        best.typed_data.value = STYLE_PATTERN_NONE;
       best.typed_data.unit = STYLE_UNIT_REL;        best.typed_data.unit = STYLE_UNIT_REL;
       TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);        if (DoApply)
           TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
     }      }
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       if (best.typed_data.unit != STYLE_UNIT_INVALID)        if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
         {          {
           /* install the new presentation. */            /* install the new presentation. */
           TtaSetStylePresentation (PRBackground, element, tsch, context, best);            TtaSetStylePresentation (PRBackground, element, tsch, context, best);
Line 2332  static char *ParseSVGStroke (Element ele Line 2342  static char *ParseSVGStroke (Element ele
     {      {
       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 = STYLE_UNIT_REL;
       TtaSetStylePresentation (PRForeground, element, tsch, context, best);        if (DoApply)
           TtaSetStylePresentation (PRForeground, element, tsch, context, best);
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
     }      }
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       if (best.typed_data.unit != STYLE_UNIT_INVALID)        if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
         /* install the new presentation */          /* install the new presentation */
         TtaSetStylePresentation (PRForeground, element, tsch, context, best);          TtaSetStylePresentation (PRForeground, element, tsch, context, best);
     }      }
Line 2360  static char *ParseSVGFill (Element eleme Line 2371  static char *ParseSVGFill (Element eleme
     {      {
       best.typed_data.value = STYLE_PATTERN_NONE;        best.typed_data.value = STYLE_PATTERN_NONE;
       best.typed_data.unit = STYLE_UNIT_REL;        best.typed_data.unit = STYLE_UNIT_REL;
       TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);        if (DoApply)
           TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
     }      }
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       if (best.typed_data.unit != STYLE_UNIT_INVALID)        if (best.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
         {          {
           /* install the new presentation. */            /* install the new presentation. */
           TtaSetStylePresentation (PRBackground, element, tsch, context, best);            TtaSetStylePresentation (PRBackground, element, tsch, context, best);
Line 2650  static char *ParseCSSBackgroundRepeat (E Line 2662  static char *ParseCSSBackgroundRepeat (E
     return (cssRule);      return (cssRule);
   
    /* install the new presentation */     /* install the new presentation */
   TtaSetStylePresentation (PRPictureMode, element, tsch, context, repeat);    if (DoApply)
       TtaSetStylePresentation (PRPictureMode, element, tsch, context, repeat);
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   
   /* restore the refered element */    /* restore the refered element */
Line 2740  static char *ParseCSSBackgroundPosition Line 2753  static char *ParseCSSBackgroundPosition
    else     else
      ok = FALSE;       ok = FALSE;
   
    if (ok)     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 = STYLE_REALSIZE;
Line 2858  static char *ParseCSSPageBreakBefore (El Line 2871  static char *ParseCSSPageBreakBefore (El
   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 == STYLE_UNIT_REL &&
       page.typed_data.value == STYLE_ALWAYS)        page.typed_data.value == STYLE_ALWAYS && DoApply)
     TtaSetStylePresentation (PRPageBefore, element, tsch, context, page);      TtaSetStylePresentation (PRPageBefore, element, tsch, context, page);
   return (cssRule);    return (cssRule);
 }  }
Line 2908  static char *ParseCSSPageBreakAfter (Ele Line 2921  static char *ParseCSSPageBreakAfter (Ele
     }      }
   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 == STYLE_UNIT_REL && DoApply)
     TtaSetStylePresentation (PRPageAfter, element, tsch, context, page);*/      TtaSetStylePresentation (PRPageAfter, element, tsch, context, page);*/
   return (cssRule);    return (cssRule);
 }  }
Line 2944  static char *ParseCSSPageBreakInside (El Line 2957  static char *ParseCSSPageBreakInside (El
   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 == STYLE_UNIT_REL &&
       page.typed_data.value == STYLE_AVOID)        page.typed_data.value == STYLE_AVOID && DoApply)
       TtaSetStylePresentation (PRPageInside, element, tsch, context, page);*/        TtaSetStylePresentation (PRPageInside, element, tsch, context, page);*/
   return (cssRule);    return (cssRule);
 }  }
Line 2965  static char *ParseSVGStrokeWidth (Elemen Line 2978  static char *ParseSVGStrokeWidth (Elemen
   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_INVALID)    if (width.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      {       {
      TtaSetStylePresentation (PRLineWeight, element, tsch, context, width);       TtaSetStylePresentation (PRLineWeight, element, tsch, context, width);
      width.typed_data.value = 1;       width.typed_data.value = 1;
Line 3767  static char *ParseGenericSelector (char Line 3780  static char *ParseGenericSelector (char
           *cur++ = EOS;            *cur++ = EOS;
           /* point to the class in sel[] if it's valid name */            /* point to the class in sel[] if it's valid name */
           if (deb[0] <= 64)            if (deb[0] <= 64)
             CSSParseError ("Invalid class", deb);              {
                 CSSParseError ("Invalid class", deb);
                 DoApply = FALSE;
               }
           else            else
             classes[0] = deb;              classes[0] = deb;
         }          }
Line 3782  static char *ParseGenericSelector (char Line 3798  static char *ParseGenericSelector (char
           *cur++ = EOS;            *cur++ = EOS;
           /* point to the pseudoclass in sel[] if it's valid name */            /* point to the pseudoclass in sel[] if it's valid name */
           if (deb[0] <= 64)            if (deb[0] <= 64)
             CSSParseError ("Invalid pseudoclass", deb);              {
                 CSSParseError ("Invalid pseudoclass", deb);
                 DoApply = FALSE;
               }
           else            else
             pseudoclasses[0]= deb;              {
                 if (!strcmp (deb, "first-letter") ||
                     !strcmp (deb, "first-line"))
                   /* not supported */
                   DoApply = FALSE;
                 pseudoclasses[0]= deb;
               }
         }          }
       else if (*selector == '#')        else if (*selector == '#')
         {          {
Line 3797  static char *ParseGenericSelector (char Line 3822  static char *ParseGenericSelector (char
           *cur++ = EOS;            *cur++ = EOS;
           /* point to the attribute in sel[] if it's valid name */            /* point to the attribute in sel[] if it's valid name */
           if (deb[0] <= 64)            if (deb[0] <= 64)
             CSSParseError ("Invalid id", deb);              {
                 CSSParseError ("Invalid id", deb);
                 DoApply = FALSE;
               }
           else            else
             ids[0] = deb;              ids[0] = deb;
         }          }
Line 3811  static char *ParseGenericSelector (char Line 3839  static char *ParseGenericSelector (char
           *cur++ = EOS;            *cur++ = EOS;
           /* point to the attribute in sel[] if it's valid name */            /* point to the attribute in sel[] if it's valid name */
           if (deb[0] <= 64)            if (deb[0] <= 64)
             CSSParseError ("Invalid attribute", deb);              {
                 CSSParseError ("Invalid attribute", deb);
                 DoApply = FALSE;
               }
           else            else
             attrs[0] = deb;              attrs[0] = deb;
           if (*selector == '=')            if (*selector == '=')
Line 3821  static char *ParseGenericSelector (char Line 3852  static char *ParseGenericSelector (char
                 *cur++ = *selector++;                  *cur++ = *selector++;
               /* there is a value */                /* there is a value */
               if (*selector == EOS)                if (*selector == EOS)
                 CSSParseError ("Invalid attribute value", deb);                  {
                     CSSParseError ("Invalid attribute value", deb);
                     DoApply = FALSE;
                   }
               else                else
                 {                  {
                   /* we are now parsing the attribute value */                    /* we are now parsing the attribute value */
Line 4044  static char *ParseGenericSelector (char Line 4078  static char *ParseGenericSelector (char
       if (tsch && cssRule)        if (tsch && cssRule)
         ParseCSSRule (NULL, tsch, (PresentationContext) ctxt, cssRule, css, isHTML);          ParseCSSRule (NULL, tsch, (PresentationContext) ctxt, cssRule, css, isHTML);
     }      }
     /* future CSS rules should apply */
     DoApply = TRUE;
   return (selector);    return (selector);
 }  }
   

Removed from v.1.115  
changed lines
  Added in v.1.116


Webmaster