Diff for /Amaya/amaya/styleparser.c between versions 1.359 and 1.360

version 1.359, 2006/05/19 15:59:46 version 1.360, 2006/05/22 11:04:07
Line 70  static int           NewLineSkipped = 0; Line 70  static int           NewLineSkipped = 0;
 static int           RedisplayImages = 0; /* number of BG images loading */  static int           RedisplayImages = 0; /* number of BG images loading */
 static int           RedisplayDoc = 0; /* document to be redisplayed */  static int           RedisplayDoc = 0; /* document to be redisplayed */
 static int           Style_parsing = 0; /* > 0 when parsing a set of CSS rules */  static int           Style_parsing = 0; /* > 0 when parsing a set of CSS rules */
   static char         *ImportantPos = NULL;
 static ThotBool      RedisplayBGImage = FALSE; /* TRUE when a BG image is inserted */  static ThotBool      RedisplayBGImage = FALSE; /* TRUE when a BG image is inserted */
 static ThotBool      DoApply = TRUE;  static ThotBool      DoApply = TRUE;
   
Line 776  static char *ParseCSSColor (char *cssRul Line 777  static char *ParseCSSColor (char *cssRul
   CheckImportantRule updates the field important of the context and    CheckImportantRule updates the field important of the context and
   the line number.    the line number.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static char *CheckImportantRule (char *cssRule, PresentationContext context)  static void CheckImportantRule (char *cssRule, PresentationContext context)
 {  {
   PresentationContextBlock dummyctxt;    PresentationContextBlock dummyctxt;
   
Line 785  static char *CheckImportantRule (char *c Line 786  static char *CheckImportantRule (char *c
     context = &dummyctxt;      context = &dummyctxt;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* update the line number */    while (*cssRule != EOS && *cssRule != '!' && *cssRule != ';')
   context->cssLine = LineNumber + NewLineSkipped;      cssRule++;
   if (*cssRule != '!')    if (*cssRule != '!')
     context->important = FALSE;      context->important = FALSE;
   else    else
     {      {
       cssRule++;        cssRule++;
         ImportantPos = cssRule;
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipBlanksAndComments (cssRule);
       if (!strncasecmp (cssRule, "important", 9))        if (!strncasecmp (cssRule, "important", 9))
         {          {
             ImportantPos[-1] = EOS;
           context->important = TRUE;            context->important = TRUE;
           cssRule += 9;  
         }          }
       else        else
         context->important = FALSE;          {
             ImportantPos = NULL;
             context->important = FALSE;
           }
       }
   }
   
   /*----------------------------------------------------------------------
     SkipImportantRule skips important markup
     ----------------------------------------------------------------------*/
   static char *SkipImportantRule (char *cssRule)
   {
     if (ImportantPos)
       {
         ImportantPos[-1] = '!';
         cssRule = ImportantPos + 9;
         ImportantPos = NULL;
     }      }
     cssRule = SkipBlanksAndComments (cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
Line 817  static char *ParseCSSBorderTopWidth (Ele Line 836  static char *ParseCSSBorderTopWidth (Ele
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);
       TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);  
       border.typed_data.value = 1;  
       border.typed_data.unit = UNIT_REL;  
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 842  static char *ParseCSSBorderBottomWidth ( Line 855  static char *ParseCSSBorderBottomWidth (
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);
       TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);  
       border.typed_data.value = 1;  
       border.typed_data.unit = UNIT_REL;  
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 867  static char *ParseCSSBorderLeftWidth (El Line 874  static char *ParseCSSBorderLeftWidth (El
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);
       TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);  
       border.typed_data.value = 1;  
       border.typed_data.unit = UNIT_REL;  
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 892  static char *ParseCSSBorderRightWidth (E Line 893  static char *ParseCSSBorderRightWidth (E
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {      TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);
       TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);  
       border.typed_data.value = 1;  
       border.typed_data.unit = UNIT_REL;  
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 984  static char *ParseCSSBorderColorTop (Ele Line 979  static char *ParseCSSBorderColorTop (Ele
     }      }
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, context);  
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != 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 1013  static char *ParseCSSBorderColorLeft (El Line 1004  static char *ParseCSSBorderColorLeft (El
     }      }
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, context);  
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != 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 1042  static char *ParseCSSBorderColorBottom ( Line 1029  static char *ParseCSSBorderColorBottom (
     }      }
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, context);  
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != 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 1071  static char *ParseCSSBorderColorRight (E Line 1054  static char *ParseCSSBorderColorRight (E
     }      }
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   cssRule = CheckImportantRule (cssRule, context);  
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
     {  
       /* check if it's an important rule */  
       /* install the new presentation */  
       TtaSetStylePresentation (PRBorderRightColor, element, tsch, context, best);        TtaSetStylePresentation (PRBorderRightColor, element, tsch, context, best);
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1158  static char *ParseCSSBorderStyleTop (Ele Line 1136  static char *ParseCSSBorderStyleTop (Ele
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {  
       /* check if it's an important rule */  
       TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);        TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1180  static char *ParseCSSBorderStyleLeft (El Line 1154  static char *ParseCSSBorderStyleLeft (El
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {  
       /* check if it's an important rule */  
       TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);        TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1202  static char *ParseCSSBorderStyleBottom ( Line 1172  static char *ParseCSSBorderStyleBottom (
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {  
       /* check if it's an important rule */  
       TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);        TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1224  static char *ParseCSSBorderStyleRight (E Line 1190  static char *ParseCSSBorderStyleRight (E
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   cssRule = CheckImportantRule (cssRule, context);  
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     {  
       /* check if it's an important rule */  
       TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);        TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1326  static char *ParseCSSBorderTop (Element Line 1288  static char *ParseCSSBorderTop (Element
             {              {
               /* rule not found */                /* rule not found */
               cssRule = SkipValue ("Invalid border value", cssRule);                cssRule = SkipValue ("Invalid border value", cssRule);
               cssRule = CheckImportantRule (cssRule, context);  
               return (cssRule);                return (cssRule);
             }              }
         }          }
Line 1339  static char *ParseCSSBorderTop (Element Line 1300  static char *ParseCSSBorderTop (Element
     ParseCSSBorderTopWidth (element, tsch, context, "medium", css, isHTML);      ParseCSSBorderTopWidth (element, tsch, context, "medium", css, isHTML);
   if (!style)    if (!style)
     ParseCSSBorderStyleTop (element, tsch, context, "none", css, isHTML);      ParseCSSBorderStyleTop (element, tsch, context, "none", css, isHTML);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1375  static char *ParseCSSBorderLeft (Element Line 1335  static char *ParseCSSBorderLeft (Element
             {              {
               /* rule not found */                /* rule not found */
               cssRule = SkipValue ("Invalid border value", cssRule);                cssRule = SkipValue ("Invalid border value", cssRule);
               cssRule = CheckImportantRule (cssRule, context);  
               return (cssRule);                return (cssRule);
             }              }
         }          }
Line 1388  static char *ParseCSSBorderLeft (Element Line 1347  static char *ParseCSSBorderLeft (Element
     ParseCSSBorderLeftWidth (element, tsch, context, "medium", css, isHTML);      ParseCSSBorderLeftWidth (element, tsch, context, "medium", css, isHTML);
   if (!style)    if (!style)
     ParseCSSBorderStyleLeft (element, tsch, context, "none", css, isHTML);      ParseCSSBorderStyleLeft (element, tsch, context, "none", css, isHTML);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1424  static char *ParseCSSBorderBottom (Eleme Line 1382  static char *ParseCSSBorderBottom (Eleme
             {              {
               /* rule not found */                /* rule not found */
               cssRule = SkipValue ("Invalid border value", cssRule);                cssRule = SkipValue ("Invalid border value", cssRule);
               cssRule = CheckImportantRule (cssRule, context);  
               return (cssRule);                return (cssRule);
             }              }
         }          }
Line 1437  static char *ParseCSSBorderBottom (Eleme Line 1394  static char *ParseCSSBorderBottom (Eleme
     ParseCSSBorderBottomWidth (element, tsch, context, "medium", css, isHTML);      ParseCSSBorderBottomWidth (element, tsch, context, "medium", css, isHTML);
   if (!style)    if (!style)
     ParseCSSBorderStyleBottom (element, tsch, context, "none", css, isHTML);      ParseCSSBorderStyleBottom (element, tsch, context, "none", css, isHTML);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1473  static char *ParseCSSBorderRight (Elemen Line 1429  static char *ParseCSSBorderRight (Elemen
             {              {
               /* rule not found */                /* rule not found */
               cssRule = SkipValue ("Invalid border value", cssRule);                cssRule = SkipValue ("Invalid border value", cssRule);
               cssRule = CheckImportantRule (cssRule, context);  
               return (cssRule);                return (cssRule);
             }              }
         }          }
Line 1486  static char *ParseCSSBorderRight (Elemen Line 1441  static char *ParseCSSBorderRight (Elemen
     ParseCSSBorderRightWidth (element, tsch, context, "medium", css, isHTML);      ParseCSSBorderRightWidth (element, tsch, context, "medium", css, isHTML);
   if (!style)    if (!style)
     ParseCSSBorderStyleRight (element, tsch, context, "none", css, isHTML);      ParseCSSBorderStyleRight (element, tsch, context, "none", css, isHTML);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1569  static char *ParseCSSFloat (Element elem Line 1523  static char *ParseCSSFloat (Element elem
     }      }
   else    else
     {      {
       cssRule = CheckImportantRule (cssRule, context);  
       if (DoApply)        if (DoApply)
         {          {
           dispMode = TtaGetDisplayMode (context->doc);            dispMode = TtaGetDisplayMode (context->doc);
Line 1614  static char *ParseCSSClear (Element elem Line 1567  static char *ParseCSSClear (Element elem
   if (pval.typed_data.value == 0 && pval.typed_data.unit != VALUE_INHERIT)    if (pval.typed_data.value == 0 && pval.typed_data.unit != VALUE_INHERIT)
     {      {
       cssRule = SkipValue ("Invalid clear value", cssRule);        cssRule = SkipValue ("Invalid clear value", cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       cssRule = SkipValue (NULL, cssRule);        cssRule = SkipValue (NULL, cssRule);
     }      }
   else    else
     {      {
       cssRule = SkipValue (NULL, cssRule);        cssRule = SkipValue (NULL, cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       if (DoApply)        if (DoApply)
         TtaSetStylePresentation (PRClear, element, tsch, context, pval);          TtaSetStylePresentation (PRClear, element, tsch, context, pval);
     }      }
Line 1665  static char *ParseCSSVisibility(Element Line 1616  static char *ParseCSSVisibility(Element
       cssRule = SkipValue ("Invalid visibility value", cssRule);        cssRule = SkipValue ("Invalid visibility value", cssRule);
       return (cssRule);        return (cssRule);
     }      }
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRVis, element, tsch, context, pval);      TtaSetStylePresentation (PRVis, element, tsch, context, pval);
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid visibility value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid visibility value");
Line 1739  static char *ParseCSSDisplay (Element el Line 1689  static char *ParseCSSDisplay (Element el
       return (cssRule);        return (cssRule);
     }      }
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRDisplay, element, tsch, context, pval);      TtaSetStylePresentation (PRDisplay, element, tsch, context, pval);
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid display value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid display value");
Line 1755  static char *ParseCSSLetterSpacing (Elem Line 1704  static char *ParseCSSLetterSpacing (Elem
                                     CSSInfoPtr css, ThotBool isHTML)                                      CSSInfoPtr css, ThotBool isHTML)
 {  {
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 1858  static char *ParseACSSListStyleType (Ele Line 1806  static char *ParseACSSListStyleType (Ele
       return (cssRule);        return (cssRule);
     }      }
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRListStyleType, element, tsch, context, pval);      TtaSetStylePresentation (PRListStyleType, element, tsch, context, pval);
   return (cssRule);    return (cssRule);
Line 2069  static char *SetCSSImage (Element elemen Line 2016  static char *SetCSSImage (Element elemen
     el = TtaGetMainRoot (ctxt->doc);      el = TtaGetMainRoot (ctxt->doc);
   url = NULL;    url = NULL;
   cssRule = ParseCSSUrl (cssRule, &url);    cssRule = ParseCSSUrl (cssRule, &url);
   cssRule = CheckImportantRule (cssRule, ctxt);  
   if (ctxt->destroy)    if (ctxt->destroy)
     {      {
       /* remove the background image PRule */        /* remove the background image PRule */
Line 2137  static char *ParseACSSListStyleImage (El Line 2083  static char *ParseACSSListStyleImage (El
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, ctxt);  
       pval.typed_data.value = 0;        pval.typed_data.value = 0;
       if (DoApply)        if (DoApply)
         TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);          TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);
Line 2152  static char *ParseACSSListStyleImage (El Line 2097  static char *ParseACSSListStyleImage (El
     {      {
       cssRule += 7;        cssRule += 7;
       pval.typed_data.unit = VALUE_INHERIT;        pval.typed_data.unit = VALUE_INHERIT;
       cssRule = CheckImportantRule (cssRule, ctxt);  
       if (DoApply)        if (DoApply)
         TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);          TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);
     }      }
   else    else
     {  
       cssRule = SkipValue ("Invalid list-style-image value", cssRule);        cssRule = SkipValue ("Invalid list-style-image value", cssRule);
       cssRule = CheckImportantRule (cssRule, ctxt);  
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 2212  static char *ParseACSSListStylePosition Line 2153  static char *ParseACSSListStylePosition
   else    else
     {      {
       cssRule = SkipValue ("Invalid list-style-position value", cssRule);        cssRule = SkipValue ("Invalid list-style-position value", cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       return (cssRule);        return (cssRule);
     }      }
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRListStylePosition, element, tsch, context, pval);      TtaSetStylePresentation (PRListStylePosition, element, tsch, context, pval);
   return (cssRule);    return (cssRule);
Line 2331  static char *ParseCSSTextAlign (Element Line 2270  static char *ParseCSSTextAlign (Element
   else    else
     {      {
       cssRule = SkipValue ("Invalid text-align value", cssRule);        cssRule = SkipValue ("Invalid text-align value", cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       return (cssRule);        return (cssRule);
     }      }
   
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   cssRule = CheckImportantRule (cssRule, context);  
   if (align.typed_data.value && DoApply)    if (align.typed_data.value && DoApply)
     TtaSetStylePresentation (PRAdjust, element, tsch, context, align);      TtaSetStylePresentation (PRAdjust, element, tsch, context, align);
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-align value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-align value");
Line 2385  static char *ParseCSSTextAnchor (Element Line 2322  static char *ParseCSSTextAnchor (Element
   else    else
     {      {
       cssRule = SkipValue ("Invalid text-anchor value", cssRule);        cssRule = SkipValue ("Invalid text-anchor value", cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       return (cssRule);        return (cssRule);
     }      }
   
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply &&    if (DoApply &&
       (align.typed_data.value || align.typed_data.unit == VALUE_INHERIT))        (align.typed_data.value || align.typed_data.unit == VALUE_INHERIT))
     TtaSetStylePresentation (PRAdjust, element, tsch, context, align);      TtaSetStylePresentation (PRAdjust, element, tsch, context, align);
Line 2433  static char *ParseCSSDirection (Element Line 2368  static char *ParseCSSDirection (Element
   else    else
     {      {
       cssRule = SkipValue ("Invalid direction value", cssRule);        cssRule = SkipValue ("Invalid direction value", cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       return (cssRule);        return (cssRule);
     }      }
   
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply &&    if (DoApply &&
       (direction.typed_data.value || direction.typed_data.unit == VALUE_INHERIT))        (direction.typed_data.value || direction.typed_data.unit == VALUE_INHERIT))
     TtaSetStylePresentation (PRDirection, element, tsch, context, direction);      TtaSetStylePresentation (PRDirection, element, tsch, context, direction);
Line 2486  static char *ParseCSSUnicodeBidi (Elemen Line 2419  static char *ParseCSSUnicodeBidi (Elemen
   else    else
     {      {
       cssRule = SkipValue ("Invalid unicode-bidi value", cssRule);        cssRule = SkipValue ("Invalid unicode-bidi value", cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       return (cssRule);        return (cssRule);
     }      }
   
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply &&    if (DoApply &&
       (bidi.typed_data.value || bidi.typed_data.unit == VALUE_INHERIT))        (bidi.typed_data.value || bidi.typed_data.unit == VALUE_INHERIT))
     TtaSetStylePresentation (PRUnicodeBidi, element, tsch, context, bidi);      TtaSetStylePresentation (PRUnicodeBidi, element, tsch, context, bidi);
Line 2521  static char *ParseCSSTextIndent (Element Line 2452  static char *ParseCSSTextIndent (Element
            pval.typed_data.unit == UNIT_BOX)             pval.typed_data.unit == UNIT_BOX)
     {      {
       CSSParseError ("Invalid text-indent value", ptr, cssRule);        CSSParseError ("Invalid text-indent value", ptr, cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       return (cssRule);        return (cssRule);
     }      }
   /* install the attribute */    /* install the attribute */
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRIndent, element, tsch, context, pval);      TtaSetStylePresentation (PRIndent, element, tsch, context, pval);
   return (cssRule);    return (cssRule);
Line 2540  static char *ParseCSSTextTransform (Elem Line 2469  static char *ParseCSSTextTransform (Elem
                                     CSSInfoPtr css, ThotBool isHTML)                                      CSSInfoPtr css, ThotBool isHTML)
 {  {
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 2618  static char *ParseCSSVerticalAlign (Elem Line 2546  static char *ParseCSSVerticalAlign (Elem
         {          {
           pval.typed_data.value = 0;            pval.typed_data.value = 0;
           CSSParseError ("Invalid vertical-align value", ptr, cssRule);            CSSParseError ("Invalid vertical-align value", ptr, cssRule);
           cssRule = CheckImportantRule (cssRule, context);  
           return (cssRule);            return (cssRule);
         }          }
       else if (pval.typed_data.value == 0)        else if (pval.typed_data.value == 0)
Line 2634  static char *ParseCSSVerticalAlign (Elem Line 2561  static char *ParseCSSVerticalAlign (Elem
         }          }
     }      }
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (pval.typed_data.unit != UNIT_INVALID && DoApply)    if (pval.typed_data.unit != UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRHorizRef, element, tsch, context, pval);      TtaSetStylePresentation (PRHorizRef, element, tsch, context, pval);
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid vertical-align value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid vertical-align value");
Line 2667  static char *ParseCSSWhiteSpace (Element Line 2593  static char *ParseCSSWhiteSpace (Element
   else    else
     cssRule = SkipValue ("Invalid white-space value", cssRule);      cssRule = SkipValue ("Invalid white-space value", cssRule);
   
   cssRule = CheckImportantRule (cssRule, context);  
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid white-space value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid white-space value");
   return (cssRule);    return (cssRule);
 }  }
Line 2681  static char *ParseCSSWordSpacing (Elemen Line 2606  static char *ParseCSSWordSpacing (Elemen
                                   CSSInfoPtr css, ThotBool isHTML)                                    CSSInfoPtr css, ThotBool isHTML)
 {  {
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 2711  static char *ParseCSSLineHeight (Element Line 2635  static char *ParseCSSLineHeight (Element
   else    else
     cssRule = ParseCSSUnit (cssRule, &pval);      cssRule = ParseCSSUnit (cssRule, &pval);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (pval.typed_data.unit == 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)
Line 2834  static char *ParseACSSFontSize (Element Line 2757  static char *ParseACSSFontSize (Element
   else if (!isdigit (*cssRule) && *cssRule != '.')    else if (!isdigit (*cssRule) && *cssRule != '.')
     {      {
       if (!check)        if (!check)
         {          cssRule = SkipValue ("Invalid font-size value", cssRule);
           cssRule = SkipValue ("Invalid font-size value", cssRule);  
           cssRule = CheckImportantRule (cssRule, context);  
         }  
       return (cssRule);        return (cssRule);
     }      }
   else    else
Line 2896  static char *ParseACSSFontSize (Element Line 2816  static char *ParseACSSFontSize (Element
     }      }
   
   /* install the presentation style */    /* install the presentation style */
   cssRule = CheckImportantRule (cssRule, context);  
   if (!check && DoApply)    if (!check && DoApply)
     TtaSetStylePresentation (PRSize, element, tsch, context, pval);      TtaSetStylePresentation (PRSize, element, tsch, context, pval);
   if (!check && ptr)    if (!check && ptr)
Line 2919  static char *ParseCSSFontSize (Element e Line 2838  static char *ParseCSSFontSize (Element e
 {  {
   char               *ptr = cssRule;    char               *ptr = cssRule;
   cssRule = ParseACSSFontSize (element, tsch, context, cssRule, css, isHTML, FALSE);    cssRule = ParseACSSFontSize (element, tsch, context, cssRule, css, isHTML, FALSE);
   cssRule = CheckImportantRule (cssRule, context);  
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid font-size value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid font-size value");
   return cssRule;    return cssRule;
 }  }
Line 3049  static char *ParseACSSFontFamily (Elemen Line 2967  static char *ParseACSSFontFamily (Elemen
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipBlanksAndComments (cssRule);
     }      }
   
   cssRule = CheckImportantRule (cssRule, context);  
   if ((font.typed_data.value != 0 || font.typed_data.unit == VALUE_INHERIT) &&    if ((font.typed_data.value != 0 || font.typed_data.unit == VALUE_INHERIT) &&
       DoApply)        DoApply)
     /* install the new presentation */      /* install the new presentation */
Line 3178  static char *ParseACSSFontWeight (Elemen Line 3095  static char *ParseACSSFontWeight (Elemen
     }      }
   
   /* install the new presentation */    /* install the new presentation */
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRWeight, element, tsch, context, weight);      TtaSetStylePresentation (PRWeight, element, tsch, context, weight);
   return (cssRule);    return (cssRule);
Line 3199  static char *ParseCSSFontWeight (Element Line 3115  static char *ParseCSSFontWeight (Element
   cssRule = ParseACSSFontWeight (element, tsch, context, cssRule, css, isHTML);    cssRule = ParseACSSFontWeight (element, tsch, context, cssRule, css, isHTML);
   if (ptr == cssRule)    if (ptr == cssRule)
     cssRule = SkipValue ("Invalid font-weight value", cssRule);      cssRule = SkipValue ("Invalid font-weight value", cssRule);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 3251  static char *ParseCSSFontVariant (Elemen Line 3166  static char *ParseCSSFontVariant (Elemen
   cssRule = ParseACSSFontVariant (element, tsch, context, cssRule, css, isHTML);    cssRule = ParseACSSFontVariant (element, tsch, context, cssRule, css, isHTML);
   if (ptr == cssRule)    if (ptr == cssRule)
     cssRule = SkipValue ("Invalid font-variant value", cssRule);      cssRule = SkipValue ("Invalid font-variant value", cssRule);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 3302  static char *ParseACSSFontStyle (Element Line 3216  static char *ParseACSSFontStyle (Element
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply &&    if (DoApply &&
       (style.typed_data.value != 0 || style.typed_data.unit == VALUE_INHERIT))        (style.typed_data.value != 0 || style.typed_data.unit == VALUE_INHERIT))
     {      {
Line 3342  static char *ParseCSSFontStyle (Element Line 3255  static char *ParseCSSFontStyle (Element
   cssRule = ParseACSSFontStyle (element, tsch, context, cssRule, css, isHTML);    cssRule = ParseACSSFontStyle (element, tsch, context, cssRule, css, isHTML);
   if (ptr == cssRule)    if (ptr == cssRule)
     cssRule = SkipValue ("Invalid font-style value", cssRule);      cssRule = SkipValue ("Invalid font-style value", cssRule);
   cssRule = CheckImportantRule (cssRule, context);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 3441  static char *ParseCSSFont (Element eleme Line 3353  static char *ParseCSSFont (Element eleme
       if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)        if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)
         cssRule = ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);          cssRule = ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);
       if (ptr == cssRule)        if (ptr == cssRule)
         {          cssRule = SkipValue ("Invalid font value", cssRule);
           cssRule = SkipValue ("Invalid font value", cssRule);  
           cssRule = CheckImportantRule (cssRule, context);  
         }  
     }      }
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)    if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)
     {      cssRule = SkipValue ("Invalid font value", cssRule);
       cssRule = SkipValue ("Invalid font value", cssRule);  
       cssRule = CheckImportantRule (cssRule, context);  
     }  
   return (cssRule);    return (cssRule);
 }  }
   
Line 3519  static char *ParseCSSTextDecoration (Ele Line 3425  static char *ParseCSSTextDecoration (Ele
   if (!ok)    if (!ok)
     {      {
       cssRule = SkipValue ("Invalid text-decoration value", cssRule);        cssRule = SkipValue ("Invalid text-decoration value", cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       return (cssRule);        return (cssRule);
     }      }
   
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply &&    if (DoApply &&
       (decor.typed_data.value || decor.typed_data.unit == VALUE_INHERIT))        (decor.typed_data.value || decor.typed_data.unit == VALUE_INHERIT))
     TtaSetStylePresentation (PRUnderline, element, tsch, context, decor);      TtaSetStylePresentation (PRUnderline, element, tsch, context, decor);
Line 3553  static char *ParseCSSHeight (Element ele Line 3457  static char *ParseCSSHeight (Element ele
       val.typed_data.value = 0;        val.typed_data.value = 0;
       val.typed_data.real = FALSE;        val.typed_data.real = FALSE;
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, context);  
       cssRule = CheckImportantRule (cssRule, context);  
       cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid height value");        cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid height value");
     }      }
   else    else
Line 3567  static char *ParseCSSHeight (Element ele Line 3469  static char *ParseCSSHeight (Element ele
       CSSParseError ("height value", ptr, cssRule);        CSSParseError ("height value", ptr, cssRule);
       val.typed_data.unit = UNIT_PX;        val.typed_data.unit = UNIT_PX;
     }      }
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     /* install the new presentation */      /* install the new presentation */
     TtaSetStylePresentation (PRHeight, element, tsch, context, val);      TtaSetStylePresentation (PRHeight, element, tsch, context, val);
Line 3594  static char *ParseCSSWidth (Element elem Line 3495  static char *ParseCSSWidth (Element elem
       val.typed_data.value = 0;        val.typed_data.value = 0;
       val.typed_data.real = FALSE;        val.typed_data.real = FALSE;
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, context);  
       cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid width value");        cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid width value");
     }      }
   else    else
Line 3604  static char *ParseCSSWidth (Element elem Line 3504  static char *ParseCSSWidth (Element elem
        val.typed_data.unit == UNIT_BOX))         val.typed_data.unit == UNIT_BOX))
     {      {
       CSSParseError ("Invalid width value", ptr, cssRule);        CSSParseError ("Invalid width value", ptr, cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       val.typed_data.unit = UNIT_PX;        val.typed_data.unit = UNIT_PX;
     }      }
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     /* install the new presentation */      /* install the new presentation */
     TtaSetStylePresentation (PRWidth, element, tsch, context, val);      TtaSetStylePresentation (PRWidth, element, tsch, context, val);
Line 3635  static char *ParseACSSMarginTop (Element Line 3533  static char *ParseACSSMarginTop (Element
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, context);  
     }      }
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
Line 3685  static char *ParseACSSMarginBottom (Elem Line 3581  static char *ParseACSSMarginBottom (Elem
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, context);  
     }      }
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
Line 3735  static char *ParseACSSMarginLeft (Elemen Line 3629  static char *ParseACSSMarginLeft (Elemen
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, context);  
     }      }
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
Line 3786  static char *ParseACSSMarginRight (Eleme Line 3678  static char *ParseACSSMarginRight (Eleme
       margin.typed_data.value = 0;        margin.typed_data.value = 0;
       margin.typed_data.real = FALSE;        margin.typed_data.real = FALSE;
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, context);  
     }      }
   else    else
     cssRule = ParseCSSUnit (cssRule, &margin);      cssRule = ParseCSSUnit (cssRule, &margin);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (margin.typed_data.value != 0 &&    if (margin.typed_data.value != 0 &&
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
Line 3893  static char *ParseCSSPaddingTop (Element Line 3783  static char *ParseCSSPaddingTop (Element
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
Line 3924  static char *ParseCSSPaddingBottom (Elem Line 3813  static char *ParseCSSPaddingBottom (Elem
   if (padding.typed_data.value == 0)    if (padding.typed_data.value == 0)
     padding.typed_data.unit = UNIT_EM;      padding.typed_data.unit = UNIT_EM;
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
Line 3955  static char *ParseCSSPaddingLeft (Elemen Line 3843  static char *ParseCSSPaddingLeft (Elemen
   if (padding.typed_data.value == 0)    if (padding.typed_data.value == 0)
     padding.typed_data.unit = UNIT_EM;      padding.typed_data.unit = UNIT_EM;
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
Line 3986  static char *ParseCSSPaddingRight (Eleme Line 3873  static char *ParseCSSPaddingRight (Eleme
   if (padding.typed_data.value == 0)    if (padding.typed_data.value == 0)
     padding.typed_data.unit = UNIT_EM;      padding.typed_data.unit = UNIT_EM;
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (padding.typed_data.value != 0 &&    if (padding.typed_data.value != 0 &&
       (padding.typed_data.unit == UNIT_INVALID ||        (padding.typed_data.unit == UNIT_INVALID ||
        padding.typed_data.unit == UNIT_BOX))         padding.typed_data.unit == UNIT_BOX))
Line 4073  static char *ParseCSSForeground (Element Line 3959  static char *ParseCSSForeground (Element
   
   p = cssRule;    p = cssRule;
   cssRule = ParseCSSColor (cssRule, &best);    cssRule = ParseCSSColor (cssRule, &best);
   cssRule = CheckImportantRule (cssRule, context);  
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       if (*cssRule != EOS && *cssRule !=';')        if (*cssRule != EOS && *cssRule !=';')
Line 4105  static char *ParseCSSBackgroundColor (El Line 3990  static char *ParseCSSBackgroundColor (El
       best.typed_data.value = PATTERN_NONE;        best.typed_data.value = PATTERN_NONE;
       best.typed_data.unit = UNIT_REL;        best.typed_data.unit = UNIT_REL;
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
       cssRule = CheckImportantRule (cssRule, context);  
       if (DoApply)        if (DoApply)
         TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);          TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);
     }      }
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       cssRule = CheckImportantRule (cssRule, context);  
       if (best.typed_data.unit != UNIT_INVALID && DoApply)        if (best.typed_data.unit != UNIT_INVALID && DoApply)
         {          {
           /* install the new presentation. */            /* install the new presentation. */
Line 4164  static char *ParseSVGStroke (Element ele Line 4047  static char *ParseSVGStroke (Element ele
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
     /* install the new presentation */      /* install the new presentation */
     TtaSetStylePresentation (PRForeground, element, tsch, context, best);      TtaSetStylePresentation (PRForeground, element, tsch, context, best);
Line 4187  static char *ParseSVGFill (Element eleme Line 4069  static char *ParseSVGFill (Element eleme
     {      {
       best.typed_data.value = PATTERN_NONE;        best.typed_data.value = PATTERN_NONE;
       best.typed_data.unit = UNIT_REL;        best.typed_data.unit = UNIT_REL;
       cssRule = CheckImportantRule (cssRule, context);  
       if (DoApply)        if (DoApply)
         TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);          TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 4210  static char *ParseSVGFill (Element eleme Line 4091  static char *ParseSVGFill (Element eleme
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   
   cssRule = CheckImportantRule (cssRule, context);  
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       /* install the new presentation. */        /* install the new presentation. */
Line 4235  static char *ParseSVGOpacity (Element el Line 4115  static char *ParseSVGOpacity (Element el
   best.typed_data.unit = 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);
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     /* install the new presentation. */      /* install the new presentation. */
     TtaSetStylePresentation (PROpacity, element, tsch, context, best);      TtaSetStylePresentation (PROpacity, element, tsch, context, best);
Line 4254  static char *ParseSVGStrokeOpacity (Elem Line 4133  static char *ParseSVGStrokeOpacity (Elem
   best.typed_data.unit = 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);
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     /* install the new presentation. */      /* install the new presentation. */
     TtaSetStylePresentation (PRStrokeOpacity, element, tsch, context, best);      TtaSetStylePresentation (PRStrokeOpacity, element, tsch, context, best);
Line 4273  static char *ParseSVGFillOpacity (Elemen Line 4151  static char *ParseSVGFillOpacity (Elemen
   best.typed_data.unit = 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);
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     /* install the new presentation. */      /* install the new presentation. */
     TtaSetStylePresentation (PRFillOpacity, element, tsch, context, best);      TtaSetStylePresentation (PRFillOpacity, element, tsch, context, best);
Line 4493  static char *ParseCSSContent (Element el Line 4370  static char *ParseCSSContent (Element el
             *cssRule == '!')              *cssRule == '!')
           repeat = FALSE;            repeat = FALSE;
     }      }
   cssRule = CheckImportantRule (cssRule, ctxt);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 4513  static char *ParseCSSBackgroundImage (El Line 4389  static char *ParseCSSBackgroundImage (El
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
       cssRule += 4;        cssRule += 4;
       cssRule = CheckImportantRule (cssRule, ctxt);  
       if (DoApply)        if (DoApply)
         {          {
           /* no background image */            /* no background image */
Line 4578  static char *ParseACSSBackgroundRepeat ( Line 4453  static char *ParseACSSBackgroundRepeat (
   
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* check if it's an important rule */    /* check if it's an important rule */
   cssRule = CheckImportantRule (cssRule, ctxt);  
   if (DoApply)    if (DoApply)
     /* install the new presentation */      /* install the new presentation */
     TtaSetStylePresentation (PRPictureMode, element, tsch, ctxt, repeat);      TtaSetStylePresentation (PRPictureMode, element, tsch, ctxt, repeat);
Line 4599  static char *ParseCSSBackgroundRepeat (E Line 4473  static char *ParseCSSBackgroundRepeat (E
     {      {
       cssRule = SkipValue ("Invalid background-repeat value", cssRule);        cssRule = SkipValue ("Invalid background-repeat value", cssRule);
       /* check if it's an important rule */        /* check if it's an important rule */
       cssRule = CheckImportantRule (cssRule, ctxt);  
     }      }
   return cssRule;    return cssRule;
 }  }
Line 4642  static char *ParseCSSBackgroundAttachmen Line 4515  static char *ParseCSSBackgroundAttachmen
   if (ptr == cssRule)    if (ptr == cssRule)
     {      {
       cssRule = SkipValue ("Invalid background-attachement value", cssRule);        cssRule = SkipValue ("Invalid background-attachement value", cssRule);
       /* check if it's an important rule */  
       cssRule = CheckImportantRule (cssRule, ctxt);  
     }      }
   return cssRule;    return cssRule;
 }  }
Line 4680  static char *ParseACSSBackgroundPosition Line 4551  static char *ParseACSSBackgroundPosition
   else    else
     ok = FALSE;      ok = FALSE;
   
   if (ok)  
     {  
       /* check if it's an important rule */  
       cssRule = CheckImportantRule (cssRule, ctxt);  
     }  
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   return (cssRule);    return (cssRule);
 }  }
Line 4704  static char *ParseCSSBackgroundPosition Line 4570  static char *ParseCSSBackgroundPosition
   cssRule = ParseACSSBackgroundPosition (element, tsch, ctxt,    cssRule = ParseACSSBackgroundPosition (element, tsch, ctxt,
                                          cssRule, css, isHTML);                                           cssRule, css, isHTML);
   if (ptr == cssRule)    if (ptr == cssRule)
     {      cssRule = SkipValue ("Invalid background-position value", cssRule);
       cssRule = SkipValue ("Invalid background-position value", cssRule);  
       /* check if it's an important rule */  
       cssRule = CheckImportantRule (cssRule, ctxt);  
     }  
   else if (*cssRule !=  ';' && *cssRule != EOS)    else if (*cssRule !=  ';' && *cssRule != EOS)
     {      {
       /* possible second value */        /* possible second value */
Line 4716  static char *ParseCSSBackgroundPosition Line 4578  static char *ParseCSSBackgroundPosition
       cssRule = ParseACSSBackgroundPosition (element, tsch, ctxt,        cssRule = ParseACSSBackgroundPosition (element, tsch, ctxt,
                                              cssRule, css, isHTML);                                               cssRule, css, isHTML);
       if (ptr == cssRule)        if (ptr == cssRule)
         {          cssRule = SkipValue ("Invalid background-position value", cssRule);
           cssRule = SkipValue ("Invalid background-position value", cssRule);  
           /* check if it's an important rule */  
           cssRule = CheckImportantRule (cssRule, ctxt);  
         }  
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 4857  static char *ParseCSSPageBreakBefore (El Line 4715  static char *ParseCSSPageBreakBefore (El
       page.typed_data.value = PageInherit;        page.typed_data.value = PageInherit;
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, ctxt);  
   /* install the new presentation */    /* install the new presentation */
   if (DoApply &&    if (DoApply &&
       ((page.typed_data.unit == UNIT_REL && page.typed_data.value == PageAlways)        ((page.typed_data.unit == UNIT_REL && page.typed_data.value == PageAlways)
Line 4908  static char *ParseCSSPageBreakAfter (Ele Line 4764  static char *ParseCSSPageBreakAfter (Ele
       page.typed_data.value = PageInherit;        page.typed_data.value = PageInherit;
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, ctxt);  
 #if 0  #if 0
   /* install the new presentation */    /* install the new presentation */
   if (DoApply &&    if (DoApply &&
Line 4949  static char *ParseCSSPageBreakInside (El Line 4803  static char *ParseCSSPageBreakInside (El
       page.typed_data.value = PageInherit;        page.typed_data.value = PageInherit;
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   cssRule = CheckImportantRule (cssRule, ctxt);  
   /* install the new presentation */    /* install the new presentation */
   /*if ((page.typed_data.unit == UNIT_REL ||    /*if ((page.typed_data.unit == UNIT_REL ||
     page.typed_data.unit == VALUE_INHERIT) &&      page.typed_data.unit == VALUE_INHERIT) &&
Line 4980  static char *ParseSVGStrokeWidth (Elemen Line 4833  static char *ParseSVGStrokeWidth (Elemen
   else    else
     cssRule = SkipValue ("Invalid stroke-width value", cssRule);      cssRule = SkipValue ("Invalid stroke-width value", cssRule);
   
   /* check if it's an important rule */  
   cssRule = CheckImportantRule (cssRule, ctxt);  
   if (width.typed_data.unit != UNIT_INVALID && DoApply)    if (width.typed_data.unit != UNIT_INVALID && DoApply)
     {      {
       TtaSetStylePresentation (PRLineWeight, element, tsch, ctxt, width);        TtaSetStylePresentation (PRLineWeight, element, tsch, ctxt, width);
Line 5035  static char *ParseCSSPosition (Element e Line 4886  static char *ParseCSSPosition (Element e
   if (pval.typed_data.value == 0 && pval.typed_data.unit != VALUE_INHERIT)    if (pval.typed_data.value == 0 && pval.typed_data.unit != VALUE_INHERIT)
     {      {
       cssRule = SkipValue ("Invalid position value", ptr);        cssRule = SkipValue ("Invalid position value", ptr);
       cssRule = CheckImportantRule (cssRule, ctxt);  
       cssRule = SkipValue (NULL, cssRule);        cssRule = SkipValue (NULL, cssRule);
     }      }
   else    else
     {      {
       cssRule = CheckImportantRule (cssRule, ctxt);  
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipBlanksAndComments (cssRule);
       if (*cssRule != EOS && *cssRule != ';')        if (*cssRule != EOS && *cssRule != ';')
         SkipValue ("Invalid position value", ptr);          SkipValue ("Invalid position value", ptr);
Line 5084  static char *ParseCSSTop (Element elemen Line 4933  static char *ParseCSSTop (Element elemen
       cssRule = SkipValue ("top value", ptr);        cssRule = SkipValue ("top value", ptr);
       val.typed_data.unit = UNIT_PX;        val.typed_data.unit = UNIT_PX;
     }      }
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRTop, element, tsch, context, val);      TtaSetStylePresentation (PRTop, element, tsch, context, val);
   return (cssRule);    return (cssRule);
Line 5124  static char *ParseCSSRight (Element elem Line 4972  static char *ParseCSSRight (Element elem
       cssRule = SkipValue ("right value", ptr);        cssRule = SkipValue ("right value", ptr);
       val.typed_data.unit = UNIT_PX;        val.typed_data.unit = UNIT_PX;
     }      }
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRRight, element, tsch, context, val);      TtaSetStylePresentation (PRRight, element, tsch, context, val);
   return (cssRule);    return (cssRule);
Line 5164  static char *ParseCSSBottom (Element ele Line 5011  static char *ParseCSSBottom (Element ele
       cssRule = SkipValue ("bottom value", ptr);        cssRule = SkipValue ("bottom value", ptr);
       val.typed_data.unit = UNIT_PX;        val.typed_data.unit = UNIT_PX;
     }      }
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRBottom, element, tsch, context, val);      TtaSetStylePresentation (PRBottom, element, tsch, context, val);
   return (cssRule);    return (cssRule);
Line 5204  static char *ParseCSSLeft (Element eleme Line 5050  static char *ParseCSSLeft (Element eleme
       cssRule = SkipValue ("left value", ptr);        cssRule = SkipValue ("left value", ptr);
       val.typed_data.unit = UNIT_PX;        val.typed_data.unit = UNIT_PX;
     }      }
   cssRule = CheckImportantRule (cssRule, context);  
   if (DoApply)    if (DoApply)
     TtaSetStylePresentation (PRLeft, element, tsch, context, val);      TtaSetStylePresentation (PRLeft, element, tsch, context, val);
   return (cssRule);    return (cssRule);
Line 5240  static char *ParseCSSZIndex (Element ele Line 5085  static char *ParseCSSZIndex (Element ele
           val.typed_data.unit = UNIT_BOX;            val.typed_data.unit = UNIT_BOX;
         }          }
     }      }
   cssRule = CheckImportantRule (cssRule, context);  
   /***    /***
       if (DoApply)        if (DoApply)
       TtaSetStylePresentation (PR, element, tsch, context, val);        TtaSetStylePresentation (PR, element, tsch, context, val);
Line 5396  static void  ParseCSSRule (Element eleme Line 5240  static void  ParseCSSRule (Element eleme
                 }                  }
             }              }
   
             // check if it's an important rule
             CheckImportantRule (cssRule, ctxt);
           if (i < NB_CSSSTYLEATTRIBUTE &&            if (i < NB_CSSSTYLEATTRIBUTE &&
               !strcasecmp (CSSProperties[i].name, "content") &&                !strcasecmp (CSSProperties[i].name, "content") &&
               ((GenericContext)ctxt)->pseudo != PbBefore &&                ((GenericContext)ctxt)->pseudo != PbBefore &&
Line 5481  static void  ParseCSSRule (Element eleme Line 5327  static void  ParseCSSRule (Element eleme
               else                else
                 cssRule = SkipProperty (cssRule, TRUE);                  cssRule = SkipProperty (cssRule, TRUE);
             }              }
             // skip important markup
             cssRule = SkipImportantRule (cssRule);
   
         }          }
       /* next property */        /* next property */
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipBlanksAndComments (cssRule);

Removed from v.1.359  
changed lines
  Added in v.1.360


Webmaster