Diff for /Amaya/amaya/styleparser.c between versions 1.163 and 1.164

version 1.163, 2003/01/03 18:13:39 version 1.164, 2003/01/06 09:33:54
Line 4 Line 4
  *  Please first read the full copyright statement in file COPYRIGHT.   *  Please first read the full copyright statement in file COPYRIGHT.
  *   *
  */   */
    
 /*  /*
  * Everything directly linked to the CSS syntax should now hopefully   * Everything directly related to the CSS syntax should now hopefully
  * be contained in this module.   * be contained in this module.
  *   *
  * Author: I. Vatton   * Author: I. Vatton
Line 2194  static char *ParseCSSHeight (Element ele Line 2194  static char *ParseCSSHeight (Element ele
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strcasecmp (cssRule, "auto"))    if (!strncasecmp (cssRule, "auto", 4))
     cssRule = SkipWord (cssRule);      {
         val.typed_data.unit = STYLE_VALUE_AUTO;
         val.typed_data.value = 0;
         val.typed_data.real = FALSE;
         cssRule = SkipWord (cssRule);
       }
   else    else
       cssRule = ParseCSSUnit (cssRule, &val);
     if (val.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
     {      {
       cssRule = ParseCSSUnit (cssRule, &val);        if (tsch)
       if (val.typed_data.unit != STYLE_UNIT_INVALID && DoApply)          cssRule = CheckImportantRule (cssRule, context);
         {        /* install the new presentation */
           if (tsch)        TtaSetStylePresentation (PRHeight, element, tsch, context, val);
             cssRule = CheckImportantRule (cssRule, context);  
           /* install the new presentation */  
           TtaSetStylePresentation (PRHeight, element, tsch, context, val);  
         }  
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 2222  static char *ParseCSSWidth (Element elem Line 2225  static char *ParseCSSWidth (Element elem
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   if (!strcasecmp (cssRule, "auto"))    if (!strncasecmp (cssRule, "auto", 4))
     cssRule = SkipWord (cssRule);  
   else  
     {      {
         val.typed_data.unit = STYLE_VALUE_AUTO;
         val.typed_data.value = 0;
         val.typed_data.real = FALSE;
         cssRule = SkipWord (cssRule);
       }
     else
       cssRule = ParseCSSUnit (cssRule, &val);        cssRule = ParseCSSUnit (cssRule, &val);
       if (val.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (val.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
         {      {
           if (tsch)        if (tsch)
             cssRule = CheckImportantRule (cssRule, context);          cssRule = CheckImportantRule (cssRule, context);
           /* install the new presentation */        /* install the new presentation */
           TtaSetStylePresentation (PRWidth, element, tsch, context, val);        TtaSetStylePresentation (PRWidth, element, tsch, context, val);
         }  
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 2250  static char *ParseCSSMarginTop (Element Line 2256  static char *ParseCSSMarginTop (Element
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    if (!strncasecmp (cssRule, "auto", 4))
       {
         margin.typed_data.unit = STYLE_VALUE_AUTO;
         margin.typed_data.value = 0;
         margin.typed_data.real = FALSE;
         cssRule = SkipWord (cssRule);
       }
     else
       cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      {       {
        if (tsch)         if (tsch)
Line 2272  static char *ParseCSSMarginBottom (Eleme Line 2286  static char *ParseCSSMarginBottom (Eleme
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    if (!strncasecmp (cssRule, "auto", 4))
       {
         margin.typed_data.unit = STYLE_VALUE_AUTO;
         margin.typed_data.value = 0;
         margin.typed_data.real = FALSE;
         cssRule = SkipWord (cssRule);
       }
     else
       cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      {       {
        if (tsch)         if (tsch)
Line 2294  static char *ParseCSSMarginLeft (Element Line 2316  static char *ParseCSSMarginLeft (Element
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    if (!strncasecmp (cssRule, "auto", 4))
       {
         margin.typed_data.unit = STYLE_VALUE_AUTO;
         margin.typed_data.value = 0;
         margin.typed_data.real = FALSE;
         cssRule = SkipWord (cssRule);
       }
     else
       cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      {       {
        if (tsch)         if (tsch)
Line 2316  static char *ParseCSSMarginRight (Elemen Line 2346  static char *ParseCSSMarginRight (Elemen
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    if (!strncasecmp (cssRule, "auto", 4))
       {
         margin.typed_data.unit = STYLE_VALUE_AUTO;
         margin.typed_data.value = 0;
         margin.typed_data.real = FALSE;
         cssRule = SkipWord (cssRule);
       }
     else
       cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)    if (margin.typed_data.unit != STYLE_UNIT_INVALID && DoApply)
      {       {
        if (tsch)         if (tsch)
Line 3553  void PToCss (PresentationSetting setting Line 3591  void PToCss (PresentationSetting setting
       if (real)        if (real)
         sprintf (buffer, "margin-left: %g", fval);          sprintf (buffer, "margin-left: %g", fval);
       else        else
         sprintf (buffer, "margin-left: %d",          sprintf (buffer, "margin-left: %d", settings->value.typed_data.value);
                   settings->value.typed_data.value);  
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRMarginRight:      case PRMarginRight:
       if (real)        if (real)
         sprintf (buffer, "margin-right: %g", fval);          sprintf (buffer, "margin-right: %g", fval);
       else        else
         sprintf (buffer, "margin-right: %d",          sprintf (buffer, "margin-right: %d", settings->value.typed_data.value);
                   settings->value.typed_data.value);  
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRPaddingTop:      case PRPaddingTop:
       if (real)        if (real)
         sprintf (buffer, "padding-top: %g", fval);          sprintf (buffer, "padding-top: %g", fval);
       else        else
         sprintf (buffer, "padding-top: %d",settings->value.typed_data.value);          sprintf (buffer, "padding-top: %d", settings->value.typed_data.value);
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRPaddingBottom:      case PRPaddingBottom:
Line 3584  void PToCss (PresentationSetting setting Line 3620  void PToCss (PresentationSetting setting
       if (real)        if (real)
         sprintf (buffer, "padding-left: %g", fval);          sprintf (buffer, "padding-left: %g", fval);
       else        else
         sprintf (buffer, "padding-left: %d",          sprintf (buffer, "padding-left: %d", settings->value.typed_data.value);
                   settings->value.typed_data.value);  
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRPaddingRight:      case PRPaddingRight:

Removed from v.1.163  
changed lines
  Added in v.1.164


Webmaster