Diff for /Amaya/amaya/styleparser.c between versions 1.365 and 1.366

version 1.365, 2006/07/10 10:26:46 version 1.366, 2006/09/05 10:13:34
Line 42  CSSImageCallbackBlock, *CSSImageCallback Line 42  CSSImageCallbackBlock, *CSSImageCallback
 #include "html2thot_f.h"  #include "html2thot_f.h"
 #include "init_f.h"  #include "init_f.h"
 #include "styleparser_f.h"  #include "styleparser_f.h"
   #include "wxdialogapi_f.h"
   
 #define MAX_BUFFER_LENGTH 200  #define MAX_BUFFER_LENGTH 200
 /*  /*
Line 73  static int           Style_parsing = 0; Line 74  static int           Style_parsing = 0;
 static char         *ImportantPos = NULL;  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;
   static ThotBool      All_sides = FALSE; // TRUE when "boder valus must be displayed
   
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   SkipWord:                                                      SkipWord:                                                  
Line 123  char *SkipBlanksAndComments (char *ptr) Line 126  char *SkipBlanksAndComments (char *ptr)
   return (ptr);    return (ptr);
 }  }
   
   
   /*----------------------------------------------------------------------
     Number of values
     ----------------------------------------------------------------------*/
   static int NumberOfValues (char *ptr)
   {
     int n = 0;
     while (*ptr != EOS && *ptr != ';' &&  *ptr != '}')
       {
         ptr = SkipBlanksAndComments (ptr);
         n++;
         ptr = SkipWord (ptr);
       }
     return n;
   }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   SkipQuotedString    SkipQuotedString
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
Line 168  static char *SkipQuotedString (char *ptr Line 187  static char *SkipQuotedString (char *ptr
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static void CSSPrintError (char *msg, char *value)  static void CSSPrintError (char *msg, char *value)
 {  {
   if (!TtaIsPrinting () && ParsedDoc > 0)    if (!DoDialog && !TtaIsPrinting () && ParsedDoc > 0)
     {      {
       if (!ErrFile)        if (!ErrFile)
         {          {
Line 297  static char *SkipProperty (char *ptr, Th Line 316  static char *SkipProperty (char *ptr, Th
   /* print the skipped property */    /* print the skipped property */
   c = *ptr;    c = *ptr;
   *ptr = EOS;    *ptr = EOS;
   if (reportError && *deb != EOS &&    if (DoDialog)
       strncasecmp (deb, "azimuth", 7) &&      DisplayStyleValue ("", deb, ptr);
       strncasecmp (deb, "border-collapse", 15) &&    else if (reportError && *deb != EOS &&
       strncasecmp (deb, "border-spacing", 14) &&             strncasecmp (deb, "azimuth", 7) &&
       strncasecmp (deb, "caption-side", 12) &&             strncasecmp (deb, "border-collapse", 15) &&
       strncasecmp (deb, "clip", 4) &&             strncasecmp (deb, "border-spacing", 14) &&
       strncasecmp (deb, "counter-increment", 16) &&             strncasecmp (deb, "caption-side", 12) &&
       strncasecmp (deb, "counter-reset", 13) &&             strncasecmp (deb, "clip", 4) &&
       strncasecmp (deb, "cue-after", 9) &&             strncasecmp (deb, "counter-increment", 16) &&
       strncasecmp (deb, "cue-before", 10) &&             strncasecmp (deb, "counter-reset", 13) &&
       strncasecmp (deb, "cue", 3) &&             strncasecmp (deb, "cue-after", 9) &&
       strncasecmp (deb, "cursor", 6) &&             strncasecmp (deb, "cue-before", 10) &&
       strncasecmp (deb, "elevation", 9) &&             strncasecmp (deb, "cue", 3) &&
       strncasecmp (deb, "empty-cells", 11) &&             strncasecmp (deb, "cursor", 6) &&
       strncasecmp (deb, "font-strech", 11) &&             strncasecmp (deb, "elevation", 9) &&
       strncasecmp (deb, "letter-spacing", 14) &&             strncasecmp (deb, "empty-cells", 11) &&
       strncasecmp (deb, "marker-offset", 12) &&             strncasecmp (deb, "font-strech", 11) &&
       strncasecmp (deb, "max-height", 10) &&             strncasecmp (deb, "letter-spacing", 14) &&
       strncasecmp (deb, "max-width", 9) &&             strncasecmp (deb, "marker-offset", 12) &&
       strncasecmp (deb, "min-height", 10) &&             strncasecmp (deb, "max-height", 10) &&
       strncasecmp (deb, "min-width", 9) &&             strncasecmp (deb, "max-width", 9) &&
       strncasecmp (deb, "orphans", 7) &&             strncasecmp (deb, "min-height", 10) &&
       strncasecmp (deb, "outline-color", 13) &&             strncasecmp (deb, "min-width", 9) &&
       strncasecmp (deb, "outline-style", 13) &&             strncasecmp (deb, "orphans", 7) &&
       strncasecmp (deb, "outline-width", 13) &&             strncasecmp (deb, "outline-color", 13) &&
       strncasecmp (deb, "outline", 7) &&             strncasecmp (deb, "outline-style", 13) &&
       strncasecmp (deb, "overflow", 8) &&             strncasecmp (deb, "outline-width", 13) &&
       strncasecmp (deb, "pause-after", 11) &&             strncasecmp (deb, "outline", 7) &&
       strncasecmp (deb, "pause-before", 12) &&             strncasecmp (deb, "overflow", 8) &&
       strncasecmp (deb, "pause", 5) &&             strncasecmp (deb, "pause-after", 11) &&
       strncasecmp (deb, "quotes", 6) &&             strncasecmp (deb, "pause-before", 12) &&
       strncasecmp (deb, "richness", 8) &&             strncasecmp (deb, "pause", 5) &&
       strncasecmp (deb, "speech-rate", 11) &&             strncasecmp (deb, "quotes", 6) &&
       strncasecmp (deb, "speak-header", 12) &&             strncasecmp (deb, "richness", 8) &&
       strncasecmp (deb, "speak-punctuation", 17) &&             strncasecmp (deb, "speech-rate", 11) &&
       strncasecmp (deb, "speak-numeral", 13) &&             strncasecmp (deb, "speak-header", 12) &&
       strncasecmp (deb, "speak", 5) &&             strncasecmp (deb, "speak-punctuation", 17) &&
       strncasecmp (deb, "pitch-range", 11) &&             strncasecmp (deb, "speak-numeral", 13) &&
       strncasecmp (deb, "pitch", 5) &&             strncasecmp (deb, "speak", 5) &&
       strncasecmp (deb, "stress", 6) &&             strncasecmp (deb, "pitch-range", 11) &&
       strncasecmp (deb, "table-layout", 12) &&             strncasecmp (deb, "pitch", 5) &&
       strncasecmp (deb, "text-shadow", 11) &&             strncasecmp (deb, "stress", 6) &&
       strncasecmp (deb, "voice-family", 12) &&             strncasecmp (deb, "table-layout", 12) &&
       strncasecmp (deb, "volume", 6) &&             strncasecmp (deb, "text-shadow", 11) &&
       strncasecmp (deb, "widows", 6))             strncasecmp (deb, "voice-family", 12) &&
              strncasecmp (deb, "volume", 6) &&
              strncasecmp (deb, "widows", 6))
     CSSPrintError ("CSS property ignored:", deb);      CSSPrintError ("CSS property ignored:", deb);
   *ptr = c;    *ptr = c;
   return (ptr);    return (ptr);
Line 848  static char *ParseCSSBorderTopWidth (Ele Line 869  static char *ParseCSSBorderTopWidth (Ele
                                      ThotBool isHTML)                                       ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value = cssRule;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID)
     TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);      {
         if (DoDialog)
           {
             if (All_sides)
               DisplayStyleValue ("border-width", start_value, cssRule);
             else
               DisplayStyleValue ("border-top-width", start_value, cssRule);
           }
         else if (DoApply)
           TtaSetStylePresentation (PRBorderTopWidth, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 866  static char *ParseCSSBorderBottomWidth ( Line 898  static char *ParseCSSBorderBottomWidth (
                                         ThotBool isHTML)                                          ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value = cssRule;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID)
     TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);      {
         if (DoDialog)
           DisplayStyleValue ("border-bottom-width", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRBorderBottomWidth, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 885  static char *ParseCSSBorderLeftWidth (El Line 923  static char *ParseCSSBorderLeftWidth (El
                                       ThotBool isHTML)                                        ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value = cssRule;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID)
     TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);      {
         if (DoDialog)
           DisplayStyleValue ("border-left-width", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRBorderLeftWidth, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 904  static char *ParseCSSBorderRightWidth (E Line 948  static char *ParseCSSBorderRightWidth (E
                                        ThotBool isHTML)                                         ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value = cssRule;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseABorderValue (cssRule, &border);    cssRule = ParseABorderValue (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);      {
         if (DoDialog)
           DisplayStyleValue ("border-right-width", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRBorderRightWidth, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 923  static char *ParseCSSBorderWidth (Elemen Line 973  static char *ParseCSSBorderWidth (Elemen
                                   ThotBool isHTML)                                    ThotBool isHTML)
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    char *ptrT, *ptrR, *ptrB, *ptrL;
   int   skippedNL;    int   skippedNL, n;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipBlanksAndComments (cssRule);
   /* First parse Border-Top */    if (DoDialog)
   ptrR = ParseCSSBorderTopWidth (element, tsch, context, ptrT, css, isHTML);      n = NumberOfValues (ptrT);
   ptrR = SkipBlanksAndComments (ptrR);    if (DoDialog && n < 2)
   if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')  
     {      {
       skippedNL = NewLineSkipped;        // check if the border dialog must be updated
       cssRule = ptrR;        All_sides = TRUE;
       /* apply the Border-Top to all */       ptrR = ParseCSSBorderTopWidth (element, tsch, context, ptrT, css, isHTML);
       ptrR = ParseCSSBorderRightWidth (element, tsch, context, ptrT, css, isHTML);        All_sides = FALSE;
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSBorderBottomWidth (element, tsch, context, ptrT, css, isHTML);  
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSBorderLeftWidth (element, tsch, context, ptrT, css, isHTML);  
     }      }
   else    else
     {      {
       /* parse Border-Right */        /* First parse Border-Top */
       ptrB = ParseCSSBorderRightWidth (element, tsch, context, ptrR, css, isHTML);        ptrR = ParseCSSBorderTopWidth (element, tsch, context, ptrT, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrR = SkipBlanksAndComments (ptrR);
       if (*ptrB == ';' || *ptrB == '}' || *ptrB == EOS || *ptrB == ',')        if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')
         {          {
           skippedNL = NewLineSkipped;            skippedNL = NewLineSkipped;
           cssRule = ptrB;            cssRule = ptrR;
           /* apply the Border-Top to Border-Bottom */            /* apply the Border-Top to all */
           ptrB = ParseCSSBorderBottomWidth (element, tsch, context, ptrT, css, isHTML);            ptrR = ParseCSSBorderRightWidth (element, tsch, context, ptrT, css, isHTML);
             NewLineSkipped = skippedNL;
             ptrR = ParseCSSBorderBottomWidth (element, tsch, context, ptrT, css, isHTML);
           NewLineSkipped = skippedNL;            NewLineSkipped = skippedNL;
           /* apply the Border-Right to Border-Left */            ptrR = ParseCSSBorderLeftWidth (element, tsch, context, ptrT, css, isHTML);
           ptrB = ParseCSSBorderLeftWidth (element, tsch, context, ptrR, css, isHTML);  
         }          }
       else        else
         {          {
           /* parse Border-Bottom */            /* parse Border-Right */
           ptrL = ParseCSSBorderBottomWidth (element, tsch, context, ptrB, css, isHTML);            ptrB = ParseCSSBorderRightWidth (element, tsch, context, ptrR, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrB = SkipBlanksAndComments (ptrB);
           if (*ptrL == ';' || *ptrL == '}' || *ptrL == EOS || *ptrL == ',')            if (*ptrB == ';' || *ptrB == '}' || *ptrB == EOS || *ptrB == ',')
             {              {
               cssRule = ptrL;                skippedNL = NewLineSkipped;
                 cssRule = ptrB;
                 /* apply the Border-Top to Border-Bottom */
                 ptrB = ParseCSSBorderBottomWidth (element, tsch, context, ptrT, css, isHTML);
                 NewLineSkipped = skippedNL;
               /* apply the Border-Right to Border-Left */                /* apply the Border-Right to Border-Left */
               ptrL = ParseCSSBorderLeftWidth (element, tsch, context, ptrR, css, isHTML);                ptrB = ParseCSSBorderLeftWidth (element, tsch, context, ptrR, css, isHTML);
             }              }
           else            else
             /* parse Border-Left */              {
             cssRule = ParseCSSBorderLeftWidth (element, tsch, context, ptrL, css, isHTML);                /* parse Border-Bottom */
           cssRule = SkipBlanksAndComments (cssRule);                ptrL = ParseCSSBorderBottomWidth (element, tsch, context, ptrB, css, isHTML);
                 ptrL = SkipBlanksAndComments (ptrL);
                 if (*ptrL == ';' || *ptrL == '}' || *ptrL == EOS || *ptrL == ',')
                   {
                     cssRule = ptrL;
                     /* apply the Border-Right to Border-Left */
                     ptrL = ParseCSSBorderLeftWidth (element, tsch, context, ptrR, css, isHTML);
                   }
                 else
                   /* parse Border-Left */
                   cssRule = ParseCSSBorderLeftWidth (element, tsch, context, ptrL, css, isHTML);
                 cssRule = SkipBlanksAndComments (cssRule);
               }
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 985  static char *ParseCSSBorderColorTop (Ele Line 1047  static char *ParseCSSBorderColorTop (Ele
                                      ThotBool isHTML)                                       ThotBool isHTML)
 {  {
   PresentationValue   best;    PresentationValue   best;
     char               *start_value = cssRule;
   
   if (!strncasecmp (cssRule, "transparent", 11))    if (!strncasecmp (cssRule, "transparent", 11))
     {      {
Line 994  static char *ParseCSSBorderColorTop (Ele Line 1057  static char *ParseCSSBorderColorTop (Ele
     }      }
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID)
     /* install the new presentation */      {
     TtaSetStylePresentation (PRBorderTopColor, element, tsch, context, best);        if (DoDialog)
           {
             if (All_sides)
               DisplayStyleValue ("border-color", start_value, cssRule);
             else
               DisplayStyleValue ("border-top-color", start_value, cssRule);
           }
         else if (DoApply)
           /* install the new presentation */
           TtaSetStylePresentation (PRBorderTopColor, element, tsch, context, best);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1010  static char *ParseCSSBorderColorLeft (El Line 1083  static char *ParseCSSBorderColorLeft (El
                                       ThotBool isHTML)                                        ThotBool isHTML)
 {  {
   PresentationValue   best;    PresentationValue   best;
     char               *start_value = cssRule;
       
   if (!strncasecmp (cssRule, "transparent", 11))    if (!strncasecmp (cssRule, "transparent", 11))
     {      {
Line 1020  static char *ParseCSSBorderColorLeft (El Line 1094  static char *ParseCSSBorderColorLeft (El
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
       /* install the new presentation */      {
       TtaSetStylePresentation (PRBorderLeftColor, element, tsch, context, best);        if (DoDialog)
           DisplayStyleValue ("border-left-color", start_value, cssRule);
         else if (DoApply)
           /* install the new presentation */
           TtaSetStylePresentation (PRBorderLeftColor, element, tsch, context, best);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1035  static char *ParseCSSBorderColorBottom ( Line 1114  static char *ParseCSSBorderColorBottom (
                                         ThotBool isHTML)                                          ThotBool isHTML)
 {  {
   PresentationValue   best;    PresentationValue   best;
     char               *start_value = cssRule;
   
   if (!strncasecmp (cssRule, "transparent", 11))    if (!strncasecmp (cssRule, "transparent", 11))
     {      {
Line 1045  static char *ParseCSSBorderColorBottom ( Line 1125  static char *ParseCSSBorderColorBottom (
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
       /* install the new presentation */      {
       TtaSetStylePresentation (PRBorderBottomColor, element, tsch, context, best);        if (DoDialog)
           DisplayStyleValue ("border-bottom-color", start_value, cssRule);
         else if (DoApply)
           /* install the new presentation */
           TtaSetStylePresentation (PRBorderBottomColor, element, tsch, context, best);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1060  static char *ParseCSSBorderColorRight (E Line 1145  static char *ParseCSSBorderColorRight (E
                                        ThotBool isHTML)                                         ThotBool isHTML)
 {  {
   PresentationValue   best;    PresentationValue   best;
     char               *start_value = cssRule;
   
   if (!strncasecmp (cssRule, "transparent", 11))    if (!strncasecmp (cssRule, "transparent", 11))
     {      {
Line 1070  static char *ParseCSSBorderColorRight (E Line 1156  static char *ParseCSSBorderColorRight (E
   else    else
     cssRule = ParseCSSColor (cssRule, &best);      cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID && DoApply)
       TtaSetStylePresentation (PRBorderRightColor, element, tsch, context, best);      {
         if (DoDialog)
           DisplayStyleValue ("border-right-color", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRBorderRightColor, element, tsch, context, best);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1084  static char *ParseCSSBorderColor (Elemen Line 1175  static char *ParseCSSBorderColor (Elemen
                                   ThotBool isHTML)                                    ThotBool isHTML)
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    char *ptrT, *ptrR, *ptrB, *ptrL;
   int   skippedNL;    int   skippedNL, n;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipBlanksAndComments (cssRule);
   /* First parse Border-Top */    if (DoDialog)
   ptrR = ParseCSSBorderColorTop (element, tsch, context, ptrT, css, isHTML);      n = NumberOfValues (ptrT);
   ptrR = SkipBlanksAndComments (ptrR);    if (DoDialog && n < 2)
   if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')  
     {      {
       skippedNL = NewLineSkipped;        // check if the border dialog must be updated
       cssRule = ptrR;        All_sides = TRUE;
       /* apply the Border-Top to all */       ptrR = ParseCSSBorderColorTop (element, tsch, context, ptrT, css, isHTML);
       ptrR = ParseCSSBorderColorRight (element, tsch, context, ptrT, css, isHTML);        All_sides = FALSE;
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSBorderColorBottom (element, tsch, context, ptrT, css, isHTML);  
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSBorderColorLeft (element, tsch, context, ptrT, css, isHTML);  
     }      }
   else    else
     {      {
       /* parse Border-Right */        /* First parse Border-Top */
       ptrB = ParseCSSBorderColorRight (element, tsch, context, ptrR, css, isHTML);        ptrR = ParseCSSBorderColorTop (element, tsch, context, ptrT, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrR = SkipBlanksAndComments (ptrR);
       if (*ptrB == ';' || *ptrB == '}' || *ptrB == EOS || *ptrB == ',')        if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')
         {          {
           skippedNL = NewLineSkipped;            skippedNL = NewLineSkipped;
           cssRule = ptrB;            cssRule = ptrR;
           /* apply the Border-Top to Border-Bottom */            /* apply the Border-Top to all */
           ptrB = ParseCSSBorderColorBottom (element, tsch, context, ptrT, css, isHTML);            ptrR = ParseCSSBorderColorRight (element, tsch, context, ptrT, css, isHTML);
           NewLineSkipped = skippedNL;            NewLineSkipped = skippedNL;
           /* apply the Border-Right to Border-Left */            ptrR = ParseCSSBorderColorBottom (element, tsch, context, ptrT, css, isHTML);
           ptrB = ParseCSSBorderColorLeft (element, tsch, context, ptrR, css, isHTML);            NewLineSkipped = skippedNL;
             ptrR = ParseCSSBorderColorLeft (element, tsch, context, ptrT, css, isHTML);
         }          }
       else        else
         {          {
           skippedNL = NewLineSkipped;            /* parse Border-Right */
           /* parse Border-Bottom */            ptrB = ParseCSSBorderColorRight (element, tsch, context, ptrR, css, isHTML);
           ptrL = ParseCSSBorderColorBottom (element, tsch, context, ptrB, css, isHTML);            ptrB = SkipBlanksAndComments (ptrB);
           NewLineSkipped = skippedNL;            if (*ptrB == ';' || *ptrB == '}' || *ptrB == EOS || *ptrB == ',')
           ptrL = SkipBlanksAndComments (ptrL);  
           if (*ptrL == ';' || *ptrL == '}' || *ptrL == EOS || *ptrL == ',')  
             {              {
               cssRule = ptrL;                skippedNL = NewLineSkipped;
                 cssRule = ptrB;
                 /* apply the Border-Top to Border-Bottom */
                 ptrB = ParseCSSBorderColorBottom (element, tsch, context, ptrT, css, isHTML);
                 NewLineSkipped = skippedNL;
               /* apply the Border-Right to Border-Left */                /* apply the Border-Right to Border-Left */
               ptrL = ParseCSSBorderColorLeft (element, tsch, context, ptrR, css, isHTML);                ptrB = ParseCSSBorderColorLeft (element, tsch, context, ptrR, css, isHTML);
             }              }
           else            else
             /* parse Border-Left */              {
             cssRule = ParseCSSBorderColorLeft (element, tsch, context, ptrL, css, isHTML);                skippedNL = NewLineSkipped;
           cssRule = SkipBlanksAndComments (cssRule);                /* parse Border-Bottom */
                 ptrL = ParseCSSBorderColorBottom (element, tsch, context, ptrB, css, isHTML);
                 NewLineSkipped = skippedNL;
                 ptrL = SkipBlanksAndComments (ptrL);
                 if (*ptrL == ';' || *ptrL == '}' || *ptrL == EOS || *ptrL == ',')
                   {
                     cssRule = ptrL;
                     /* apply the Border-Right to Border-Left */
                     ptrL = ParseCSSBorderColorLeft (element, tsch, context, ptrR, css, isHTML);
                   }
                 else
                   /* parse Border-Left */
                   cssRule = ParseCSSBorderColorLeft (element, tsch, context, ptrL, css, isHTML);
                 cssRule = SkipBlanksAndComments (cssRule);
               }
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 1148  static char *ParseCSSBorderStyleTop (Ele Line 1251  static char *ParseCSSBorderStyleTop (Ele
                                      ThotBool isHTML)                                       ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID)
       TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);      {
         if (DoDialog)
           {
             if (All_sides)
               DisplayStyleValue ("border-style", start_value, cssRule);
             else
               DisplayStyleValue ("border-top-style", start_value, cssRule);
           }
         else if (DoApply)
           TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1166  static char *ParseCSSBorderStyleLeft (El Line 1281  static char *ParseCSSBorderStyleLeft (El
                                       ThotBool isHTML)                                        ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID)
       TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);      {
         if (DoDialog)
           DisplayStyleValue ("border-left-style", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1184  static char *ParseCSSBorderStyleBottom ( Line 1306  static char *ParseCSSBorderStyleBottom (
                                         ThotBool isHTML)                                          ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID)
       TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);      {
         if (DoDialog)
           DisplayStyleValue ("border-bottom-style", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1202  static char *ParseCSSBorderStyleRight (E Line 1331  static char *ParseCSSBorderStyleRight (E
                                        ThotBool isHTML)                                         ThotBool isHTML)
 {  {
   PresentationValue   border;    PresentationValue   border;
     char               *start_value;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != UNIT_INVALID && DoApply)    if (border.typed_data.unit != UNIT_INVALID && DoApply)
       TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);      {
         if (DoDialog)
           DisplayStyleValue ("border-right-style", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 1219  static char *ParseCSSBorderStyle (Elemen Line 1355  static char *ParseCSSBorderStyle (Elemen
                                   ThotBool isHTML)                                    ThotBool isHTML)
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    char *ptrT, *ptrR, *ptrB, *ptrL;
   int   skippedNL;    int   skippedNL, n;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipBlanksAndComments (cssRule);
   /* First parse Border-Top */    if (DoDialog)
   ptrR = ParseCSSBorderStyleTop (element, tsch, context, ptrT, css, isHTML);      n = NumberOfValues (ptrT);
   ptrR = SkipBlanksAndComments (ptrR);    if (DoDialog && n < 2)
   if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')  
     {      {
       skippedNL = NewLineSkipped;        // check if the border dialog must be updated
       cssRule = ptrR;        All_sides = TRUE;
       /* apply the Border-Top to all */       ptrR =  ParseCSSBorderStyleTop(element, tsch, context, ptrT, css, isHTML);
       ptrR = ParseCSSBorderStyleRight (element, tsch, context, ptrT, css, isHTML);        All_sides = FALSE;
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSBorderStyleBottom (element, tsch, context, ptrT, css, isHTML);  
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSBorderStyleLeft (element, tsch, context, ptrT, css, isHTML);  
     }      }
   else    else
     {      {
       /* parse Border-Right */        /* First parse Border-Top */
       ptrB = ParseCSSBorderStyleRight (element, tsch, context, ptrR, css, isHTML);        ptrR = ParseCSSBorderStyleTop (element, tsch, context, ptrT, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrR = SkipBlanksAndComments (ptrR);
       if (*ptrB == ';' || *ptrR == '}' || *ptrB == EOS || *ptrB == ',')        if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')
         {          {
           skippedNL = NewLineSkipped;            skippedNL = NewLineSkipped;
           cssRule = ptrB;            cssRule = ptrR;
           /* apply the Border-Top to Border-Bottom */            /* apply the Border-Top to all */
           ptrB = ParseCSSBorderStyleBottom (element, tsch, context, ptrT, css, isHTML);            ptrR = ParseCSSBorderStyleRight (element, tsch, context, ptrT, css, isHTML);
             NewLineSkipped = skippedNL;
             ptrR = ParseCSSBorderStyleBottom (element, tsch, context, ptrT, css, isHTML);
           NewLineSkipped = skippedNL;            NewLineSkipped = skippedNL;
           /* apply the Border-Right to Border-Left */            ptrR = ParseCSSBorderStyleLeft (element, tsch, context, ptrT, css, isHTML);
           ptrB = ParseCSSBorderStyleLeft (element, tsch, context, ptrR, css, isHTML);  
         }          }
       else        else
         {          {
           /* parse Border-Bottom */            /* parse Border-Right */
           ptrL = ParseCSSBorderStyleBottom (element, tsch, context, ptrB, css, isHTML);            ptrB = ParseCSSBorderStyleRight (element, tsch, context, ptrR, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrB = SkipBlanksAndComments (ptrB);
           if (*ptrL == ';' || *ptrR == '}' || *ptrL == EOS || *ptrL == ',')            if (*ptrB == ';' || *ptrR == '}' || *ptrB == EOS || *ptrB == ',')
             {              {
               cssRule = ptrL;                skippedNL = NewLineSkipped;
                 cssRule = ptrB;
                 /* apply the Border-Top to Border-Bottom */
                 ptrB = ParseCSSBorderStyleBottom (element, tsch, context, ptrT, css, isHTML);
                 NewLineSkipped = skippedNL;
               /* apply the Border-Right to Border-Left */                /* apply the Border-Right to Border-Left */
               ptrL = ParseCSSBorderStyleLeft (element, tsch, context, ptrR, css, isHTML);                ptrB = ParseCSSBorderStyleLeft (element, tsch, context, ptrR, css, isHTML);
             }              }
           else            else
             /* parse Border-Left */              {
             cssRule = ParseCSSBorderStyleLeft (element, tsch, context, ptrL, css, isHTML);                /* parse Border-Bottom */
           cssRule = SkipBlanksAndComments (cssRule);                ptrL = ParseCSSBorderStyleBottom (element, tsch, context, ptrB, css, isHTML);
                 ptrL = SkipBlanksAndComments (ptrL);
                 if (*ptrL == ';' || *ptrR == '}' || *ptrL == EOS || *ptrL == ',')
                   {
                     cssRule = ptrL;
                     /* apply the Border-Right to Border-Left */
                     ptrL = ParseCSSBorderStyleLeft (element, tsch, context, ptrR, css, isHTML);
                   }
                 else
                   /* parse Border-Left */
                   cssRule = ParseCSSBorderStyleLeft (element, tsch, context, ptrL, css, isHTML);
                 cssRule = SkipBlanksAndComments (cssRule);
               }
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 1468  static char *ParseCSSBorder (Element ele Line 1616  static char *ParseCSSBorder (Element ele
                              CSSInfoPtr css, ThotBool isHTML)                               CSSInfoPtr css, ThotBool isHTML)
 {  {
   char *ptrT, *ptrR;    char *ptrT, *ptrR;
   int   skippedNL;    int   skippedNL, n;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipBlanksAndComments (cssRule);
   /* First parse Border-Top */    if (DoDialog)
   ptrR = ParseCSSBorderTop (element, tsch, context, ptrT, css, isHTML);      n = NumberOfValues (ptrT);
   ptrR = SkipBlanksAndComments (ptrR);    if (DoDialog && n < 4)
   if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')  
     {      {
       skippedNL = NewLineSkipped;        // check if the border dialog must be updated
       cssRule = ptrR;        All_sides = TRUE;
       /* apply the Border-Top to all */       ptrR = ParseCSSBorderTop (element, tsch, context, ptrT, css, isHTML);
       ptrR = ParseCSSBorderRight (element, tsch, context, ptrT, css, isHTML);        All_sides = FALSE;
       NewLineSkipped = skippedNL;      }
       ptrR = ParseCSSBorderBottom (element, tsch, context, ptrT, css, isHTML);    else
       NewLineSkipped = skippedNL;      {
       ptrR = ParseCSSBorderLeft (element, tsch, context, ptrT, css, isHTML);        /* First parse Border-Top */
         ptrR = ParseCSSBorderTop (element, tsch, context, ptrT, css, isHTML);
         ptrR = SkipBlanksAndComments (ptrR);
         if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')
           {
             skippedNL = NewLineSkipped;
             cssRule = ptrR;
             /* apply the Border-Top to all */
             ptrR = ParseCSSBorderRight (element, tsch, context, ptrT, css, isHTML);
             NewLineSkipped = skippedNL;
             ptrR = ParseCSSBorderBottom (element, tsch, context, ptrT, css, isHTML);
             NewLineSkipped = skippedNL;
             ptrR = ParseCSSBorderLeft (element, tsch, context, ptrT, css, isHTML);
           }
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 1538  static char *ParseCSSFloat (Element elem Line 1698  static char *ParseCSSFloat (Element elem
     }      }
   else    else
     {      {
       if (DoApply)        if (DoDialog)
           DisplayStyleValue ("float", ptr, cssRule);
         else if (DoApply)
         {          {
           dispMode = TtaGetDisplayMode (context->doc);            dispMode = TtaGetDisplayMode (context->doc);
           if (dispMode != NoComputedDisplay)            if (dispMode != NoComputedDisplay)
Line 1564  static char *ParseCSSClear (Element elem Line 1726  static char *ParseCSSClear (Element elem
                             CSSInfoPtr css, ThotBool isHTML)                              CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
     char               *start_value = cssRule;
   
   pval.typed_data.value = 0;    pval.typed_data.value = 0;
   pval.typed_data.unit = UNIT_BOX;    pval.typed_data.unit = UNIT_BOX;
Line 1587  static char *ParseCSSClear (Element elem Line 1750  static char *ParseCSSClear (Element elem
   else    else
     {      {
       cssRule = SkipValue (NULL, cssRule);        cssRule = SkipValue (NULL, cssRule);
       if (DoApply)        if (DoDialog)
           DisplayStyleValue ("clear", start_value, cssRule);
         else if (DoApply)
         TtaSetStylePresentation (PRClear, element, tsch, context, pval);          TtaSetStylePresentation (PRClear, element, tsch, context, pval);
     }      }
   return (cssRule);    return (cssRule);
Line 1601  static char *ParseCSSVisibility(Element Line 1766  static char *ParseCSSVisibility(Element
                                 CSSInfoPtr css, ThotBool isHTML)                                  CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
   char               *ptr = cssRule;    char               *ptr;
   
   pval.typed_data.unit = UNIT_REL;    pval.typed_data.unit = UNIT_REL;
   pval.typed_data.real = FALSE;    pval.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "hidden", 6))    if (!strncasecmp (cssRule, "hidden", 6))
     {      {
       cssRule += 6;        cssRule += 6;
Line 1631  static char *ParseCSSVisibility(Element Line 1797  static char *ParseCSSVisibility(Element
       cssRule = SkipValue ("Invalid visibility value", cssRule);        cssRule = SkipValue ("Invalid visibility value", cssRule);
       return (cssRule);        return (cssRule);
     }      }
   if (DoApply)    if (DoDialog)
       DisplayStyleValue ("visibility", ptr, cssRule);
     else 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");
   return (cssRule);    return (cssRule);
Line 1646  static char *ParseCSSDisplay (Element el Line 1814  static char *ParseCSSDisplay (Element el
                               CSSInfoPtr css, ThotBool isHTML)                                CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
   char               *ptr = cssRule;    char               *ptr;
   
   pval.typed_data.unit = UNIT_REL;    pval.typed_data.unit = UNIT_REL;
   pval.typed_data.real = FALSE;    pval.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
       cssRule += 4;        cssRule += 4;
Line 1704  static char *ParseCSSDisplay (Element el Line 1873  static char *ParseCSSDisplay (Element el
       return (cssRule);        return (cssRule);
     }      }
   
   if (DoApply)    if (DoDialog)
       DisplayStyleValue ("display", ptr, cssRule);
     else 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");
   return (cssRule);    return (cssRule);
Line 1718  static char *ParseCSSLetterSpacing (Elem Line 1889  static char *ParseCSSLetterSpacing (Elem
                                     PresentationContext context, char *cssRule,                                      PresentationContext context, char *cssRule,
                                     CSSInfoPtr css, ThotBool isHTML)                                      CSSInfoPtr css, ThotBool isHTML)
 {  {
     char               *start_value = cssRule;
   
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
     if (DoDialog)
       DisplayStyleValue ("letter-spacing", start_value, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
Line 1731  static char *ParseACSSListStyleType (Ele Line 1906  static char *ParseACSSListStyleType (Ele
                                      CSSInfoPtr css, ThotBool isHTML)                                       CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
     char               *start_value;
   
   pval.typed_data.unit = UNIT_REL;    pval.typed_data.unit = UNIT_REL;
   pval.typed_data.real = FALSE;    pval.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   if (!strncasecmp (cssRule, "disc", 4))    if (!strncasecmp (cssRule, "disc", 4))
     {      {
       cssRule += 4;        cssRule += 4;
Line 1821  static char *ParseACSSListStyleType (Ele Line 1998  static char *ParseACSSListStyleType (Ele
       return (cssRule);        return (cssRule);
     }      }
   
   if (DoApply)    if (DoDialog)
       DisplayStyleValue ("list-style-type", start_value, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRListStyleType, element, tsch, context, pval);      TtaSetStylePresentation (PRListStyleType, element, tsch, context, pval);
   return (cssRule);    return (cssRule);
 }  }
Line 2017  static char *SetCSSImage (Element elemen Line 2196  static char *SetCSSImage (Element elemen
 {  {
   CSSImageCallbackPtr        callblock;    CSSImageCallbackPtr        callblock;
   Element                    el;    Element                    el;
   char                      *url;  
   PresentationValue          image;    PresentationValue          image;
     char                      *url, *ptr;
   char                      *bg_image;    char                      *bg_image;
   char                       tempname[MAX_LENGTH];    char                       tempname[MAX_LENGTH];
   char                       imgname[MAX_LENGTH];    char                       imgname[MAX_LENGTH];
Line 2030  static char *SetCSSImage (Element elemen Line 2209  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);
     ptr = cssRule;
   if (ctxt->destroy)    if (ctxt->destroy)
     {      {
       /* remove the background image PRule */        /* remove the background image PRule */
       image.pointer = NULL;        image.pointer = NULL;
       TtaSetStylePresentation (ruleType, element, tsch, ctxt,image);        TtaSetStylePresentation (ruleType, element, tsch, ctxt, image);
     }      }
   else if (url && DoApply)    else if (url)
     {      {
      bg_image = TtaGetEnvString ("ENABLE_BG_IMAGES");        if (css && css->url)
       if (bg_image == NULL || !strcasecmp (bg_image, "yes"))          /* the image concerns a CSS file */
         /* background images are enabled */          NormalizeURL (url, 0, tempname, imgname, css->url);
         {        else
           callblock = (CSSImageCallbackPtr) TtaGetMemory (sizeof (CSSImageCallbackBlock));          /* the image concerns a style element */
           if (callblock)          NormalizeURL (url, ctxt->doc, tempname, imgname, NULL);
             {        if (DoDialog)
               callblock->el = element;          {
               callblock->tsch = tsch;            if (ruleType == PRBackgroundPicture)
               callblock->css = css;              DisplayStyleValue ("background-image", tempname, &tempname[MAX_LENGTH-1]);
               callblock->ctxt = ctxt;            else if (ruleType == PRListStyleImage)
               callblock->ruleType = ruleType;              DisplayStyleValue ("list-style-image", tempname, &tempname[MAX_LENGTH-1]);
               /* new use of the context */            else if (ruleType == PRContentURL)
               ctxt->uses += 1;              DisplayStyleValue ("", ptr, cssRule);
               /* check if the image url is related to an external CSS */          }
               if (css)        else if (DoApply)
           {
             bg_image = TtaGetEnvString ("ENABLE_BG_IMAGES");
             if (bg_image == NULL || !strcasecmp (bg_image, "yes"))
               /* background images are enabled */
               {
                 callblock = (CSSImageCallbackPtr) TtaGetMemory (sizeof (CSSImageCallbackBlock));
                 if (callblock)
                 {                  {
                   RedisplayDoc = ctxt->doc;                    callblock->el = element;
                   if (css->url)                    callblock->tsch = tsch;
                     /* the image concerns a CSS file */                    callblock->css = css;
                     NormalizeURL (url, 0, tempname, imgname, css->url);                    callblock->ctxt = ctxt;
                     callblock->ruleType = ruleType;
                     /* new use of the context */
                     ctxt->uses += 1;
                     /* check if the image url is related to an external CSS */
                     if (css)
                       {
                         RedisplayDoc = ctxt->doc;
                         /* fetch and display background image of element */
                         if (FetchImage (0, el, tempname, AMAYA_LOAD_IMAGE,
                                         ParseCSSImageCallback, callblock))
                           RedisplayImages++;
                       }
                   else                    else
                     /* the image concerns a style element */                      FetchImage (ctxt->doc, el, url, AMAYA_LOAD_IMAGE,
                     NormalizeURL (url, ctxt->doc, tempname, imgname, NULL);                                  ParseCSSImageCallback, callblock);
                   /* fetch and display background image of element */  
                   if (FetchImage (0, el, tempname, AMAYA_LOAD_IMAGE,  
                                   ParseCSSImageCallback, callblock))  
                     RedisplayImages++;  
                 }                  }
               else  
                 FetchImage (ctxt->doc, el, url, AMAYA_LOAD_IMAGE,  
                             ParseCSSImageCallback, callblock);  
             }              }
         }          }
         TtaFreeMemory (url);
     }      }
   if (url)  
     TtaFreeMemory (url);  
   return (cssRule);    return (cssRule);
 }  }
   
Line 2088  static char *ParseACSSListStyleImage (El Line 2279  static char *ParseACSSListStyleImage (El
                                       ThotBool isHTML)                                        ThotBool isHTML)
 {  {
   char               *url;    char               *url;
     char               *start_value;
   PresentationValue   pval;    PresentationValue   pval;
   
   pval.typed_data.unit = UNIT_REL;    pval.typed_data.unit = UNIT_REL;
   pval.typed_data.real = FALSE;    pval.typed_data.real = FALSE;
   url = NULL;    url = NULL;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
       cssRule += 4;        cssRule += 4;
       pval.typed_data.value = 0;        pval.typed_data.value = 0;
       if (DoApply)        if (DoDialog)
           DisplayStyleValue ("list-style-image", start_value, cssRule);
         else if (DoApply)
         TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);          TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);
     }      }
   else if (!strncasecmp (cssRule, "url", 3))    else if (!strncasecmp (cssRule, "url", 3))
Line 2111  static char *ParseACSSListStyleImage (El Line 2306  static char *ParseACSSListStyleImage (El
     {      {
       cssRule += 7;        cssRule += 7;
       pval.typed_data.unit = VALUE_INHERIT;        pval.typed_data.unit = VALUE_INHERIT;
       if (DoApply)        if (DoDialog)
           DisplayStyleValue ("list-style-image", start_value, cssRule);
         else if (DoApply)
         TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);          TtaSetStylePresentation (PRListStyleImage, element, tsch, ctxt, pval);
     }      }
   else    else
Line 2145  static char *ParseACSSListStylePosition Line 2342  static char *ParseACSSListStylePosition
                                          ThotBool isHTML)                                           ThotBool isHTML)
 {  {
   PresentationValue   pval;    PresentationValue   pval;
     char               *start_value;
   
   pval.typed_data.unit = UNIT_REL;    pval.typed_data.unit = UNIT_REL;
   pval.typed_data.real = FALSE;    pval.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   if (!strncasecmp (cssRule, "inside", 6))    if (!strncasecmp (cssRule, "inside", 6))
     {      {
       pval.typed_data.value = Inside;        pval.typed_data.value = Inside;
Line 2170  static char *ParseACSSListStylePosition Line 2369  static char *ParseACSSListStylePosition
       return (cssRule);        return (cssRule);
     }      }
   
   if (DoApply)    if (DoDialog)
       DisplayStyleValue ("list-style-position", start_value, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRListStylePosition, element, tsch, context, pval);      TtaSetStylePresentation (PRListStylePosition, element, tsch, context, pval);
   return (cssRule);    return (cssRule);
 }  }
Line 2253  static char *ParseCSSTextAlign (Element Line 2454  static char *ParseCSSTextAlign (Element
                                 PresentationContext context, char *cssRule,                                  PresentationContext context, char *cssRule,
                                 CSSInfoPtr css, ThotBool isHTML)                                  CSSInfoPtr css, ThotBool isHTML)
 {  {
   char *ptr = cssRule;    char               *ptr;
   PresentationValue   align;    PresentationValue   align;
   
   align.typed_data.value = 0;    align.typed_data.value = 0;
Line 2261  static char *ParseCSSTextAlign (Element Line 2462  static char *ParseCSSTextAlign (Element
   align.typed_data.real = FALSE;    align.typed_data.real = FALSE;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "left", 4))    if (!strncasecmp (cssRule, "left", 4))
     {      {
       align.typed_data.value = AdjustLeft;        align.typed_data.value = AdjustLeft;
Line 2290  static char *ParseCSSTextAlign (Element Line 2492  static char *ParseCSSTextAlign (Element
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   if (align.typed_data.value && DoApply)    if (align.typed_data.value)
     TtaSetStylePresentation (PRAdjust, element, tsch, context, align);      {
         if (DoDialog)
           DisplayStyleValue ("text-align", ptr, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRAdjust, element, tsch, context, align);
       }
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-align value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-align value");
   return (cssRule);    return (cssRule);
 }  }
Line 2306  static char *ParseCSSTextAnchor (Element Line 2513  static char *ParseCSSTextAnchor (Element
                                  CSSInfoPtr css, ThotBool isHTML)                                   CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   align;    PresentationValue   align;
   char               *ptr = cssRule;    char               *ptr;
   
   align.typed_data.value = 0;    align.typed_data.value = 0;
   align.typed_data.unit = UNIT_REL;    align.typed_data.unit = UNIT_REL;
   align.typed_data.real = FALSE;    align.typed_data.real = FALSE;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "start", 5))    if (!strncasecmp (cssRule, "start", 5))
     {      {
       align.typed_data.value = AdjustLeft;        align.typed_data.value = AdjustLeft;
Line 2342  static char *ParseCSSTextAnchor (Element Line 2550  static char *ParseCSSTextAnchor (Element
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   if (DoApply &&    if (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);        if (DoDialog)
           DisplayStyleValue ("text-anchor", ptr, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRAdjust, element, tsch, context, align);
       }
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-anchor value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-anchor value");
   return (cssRule);    return (cssRule);
 }  }
Line 2357  static char *ParseCSSDirection (Element Line 2569  static char *ParseCSSDirection (Element
                                 CSSInfoPtr css, ThotBool isHTML)                                  CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   direction;    PresentationValue   direction;
   char               *ptr = cssRule;    char               *ptr;
   
   direction.typed_data.value = 0;    direction.typed_data.value = 0;
   direction.typed_data.unit = UNIT_REL;    direction.typed_data.unit = UNIT_REL;
   direction.typed_data.real = FALSE;    direction.typed_data.real = FALSE;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "ltr", 3))    if (!strncasecmp (cssRule, "ltr", 3))
     {      {
       direction.typed_data.value = LeftToRight;        direction.typed_data.value = LeftToRight;
Line 2388  static char *ParseCSSDirection (Element Line 2601  static char *ParseCSSDirection (Element
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   if (DoApply &&    if (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);        if (DoDialog)
           DisplayStyleValue ("direction", ptr, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRDirection, element, tsch, context, direction);
       }
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid direction value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid direction value");
   return (cssRule);    return (cssRule);
 }  }
Line 2403  static char *ParseCSSUnicodeBidi (Elemen Line 2620  static char *ParseCSSUnicodeBidi (Elemen
                                   CSSInfoPtr css, ThotBool isHTML)                                    CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   bidi;    PresentationValue   bidi;
   char               *ptr = cssRule;    char               *ptr;
   
   bidi.typed_data.value = 0;    bidi.typed_data.value = 0;
   bidi.typed_data.unit = UNIT_REL;    bidi.typed_data.unit = UNIT_REL;
   bidi.typed_data.real = FALSE;    bidi.typed_data.real = FALSE;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "normal", 6))    if (!strncasecmp (cssRule, "normal", 6))
     {      {
       bidi.typed_data.value = Normal;        bidi.typed_data.value = Normal;
Line 2439  static char *ParseCSSUnicodeBidi (Elemen Line 2657  static char *ParseCSSUnicodeBidi (Elemen
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   if (DoApply &&    if (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);        if (DoDialog)
           DisplayStyleValue ("unicode-bidi", ptr, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRUnicodeBidi, element, tsch, context, bidi);
       }
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid unicode-bidi value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid unicode-bidi value");
   return (cssRule);    return (cssRule);
 }  }
Line 2469  static char *ParseCSSTextIndent (Element Line 2691  static char *ParseCSSTextIndent (Element
       return (cssRule);        return (cssRule);
     }      }
   /* install the attribute */    /* install the attribute */
   if (DoApply)    if (DoDialog)
       DisplayStyleValue ("text-indent", ptr, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRIndent, element, tsch, context, pval);      TtaSetStylePresentation (PRIndent, element, tsch, context, pval);
   return (cssRule);    return (cssRule);
 }  }
Line 2482  static char *ParseCSSTextTransform (Elem Line 2706  static char *ParseCSSTextTransform (Elem
                                     PresentationContext context, char *cssRule,                                      PresentationContext context, char *cssRule,
                                     CSSInfoPtr css, ThotBool isHTML)                                      CSSInfoPtr css, ThotBool isHTML)
 {  {
     char               *ptr;
   
     cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
     if (DoDialog)
       DisplayStyleValue ("text-transform", ptr, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
Line 2575  static char *ParseCSSVerticalAlign (Elem Line 2805  static char *ParseCSSVerticalAlign (Elem
         }          }
     }      }
   
   if (pval.typed_data.unit != UNIT_INVALID && DoApply)    if (pval.typed_data.unit != UNIT_INVALID)
     TtaSetStylePresentation (PRHorizRef, element, tsch, context, pval);      {
         if (DoDialog)
           DisplayStyleValue ("vertical-align", ptr, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRHorizRef, element, tsch, context, pval);
       }
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid vertical-align value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid vertical-align value");
   return (cssRule);    return (cssRule);
 }  }
Line 2589  static char *ParseCSSWhiteSpace (Element Line 2824  static char *ParseCSSWhiteSpace (Element
                                  PresentationContext context, char *cssRule,                                   PresentationContext context, char *cssRule,
                                  CSSInfoPtr css, ThotBool isHTML)                                   CSSInfoPtr css, ThotBool isHTML)
 {  {
   char *ptr = cssRule;    char *ptr;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "normal", 6))    if (!strncasecmp (cssRule, "normal", 6))
     cssRule += 6;      cssRule += 6;
   else if (!strncasecmp (cssRule, "pre", 3))    else if (!strncasecmp (cssRule, "pre", 3))
Line 2607  static char *ParseCSSWhiteSpace (Element Line 2843  static char *ParseCSSWhiteSpace (Element
   else    else
     cssRule = SkipValue ("Invalid white-space value", cssRule);      cssRule = SkipValue ("Invalid white-space value", cssRule);
   
     if (ptr  != cssRule &&DoDialog)
       DisplayStyleValue ("white-space", ptr, cssRule);
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid white-space value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid white-space value");
   return (cssRule);    return (cssRule);
 }  }
Line 2619  static char *ParseCSSWordSpacing (Elemen Line 2857  static char *ParseCSSWordSpacing (Elemen
                                   PresentationContext context, char *cssRule,                                    PresentationContext context, char *cssRule,
                                   CSSInfoPtr css, ThotBool isHTML)                                    CSSInfoPtr css, ThotBool isHTML)
 {  {
     char *ptr;
   
     cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   cssRule = SkipValue (NULL, cssRule);    cssRule = SkipValue (NULL, cssRule);
     if (DoDialog)
       DisplayStyleValue ("word-spacing", ptr, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
Line 2633  static char *ParseCSSLineHeight (Element Line 2877  static char *ParseCSSLineHeight (Element
   PresentationValue   pval;    PresentationValue   pval;
   char               *ptr;    char               *ptr;
   
     cssRule = SkipBlanksAndComments (cssRule);
   ptr = cssRule;    ptr = cssRule;
   if (!strncasecmp (cssRule, "normal", 6))    if (!strncasecmp (cssRule, "normal", 6))
     {      {
Line 2651  static char *ParseCSSLineHeight (Element Line 2896  static char *ParseCSSLineHeight (Element
   
   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);
     if (DoDialog)
       DisplayStyleValue ("line-height", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     {      {
       /* install the new presentation */        /* install the new presentation */
Line 2671  static char *ParseCSSFontSizeAdjust (Ele Line 2918  static char *ParseCSSFontSizeAdjust (Ele
                                      PresentationContext context, char *cssRule,                                       PresentationContext context, char *cssRule,
                                      CSSInfoPtr css, ThotBool isHTML)                                       CSSInfoPtr css, ThotBool isHTML)
 {  {
   
     cssRule = SkipBlanksAndComments (cssRule);
   cssRule = SkipProperty (cssRule, FALSE);    cssRule = SkipProperty (cssRule, FALSE);
   return (cssRule);    return (cssRule);
 }  }
Line 2689  static char *ParseACSSFontSize (Element Line 2938  static char *ParseACSSFontSize (Element
   ElementType         elType;    ElementType         elType;
   PresentationValue   pval;    PresentationValue   pval;
   char               *ptr = NULL, *ptr1 = NULL;    char               *ptr = NULL, *ptr1 = NULL;
   ThotBool             real, linespace = FALSE;    char               *start_value;
     ThotBool                real, linespace = FALSE;
   
   pval.typed_data.real = FALSE;    pval.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   /* look for a '/' within the current cssRule */    /* look for a '/' within the current cssRule */
   ptr1 = strchr (cssRule, ';');    ptr1 = strchr (cssRule, ';');
   ptr = strchr (cssRule, '/');    ptr = strchr (cssRule, '/');
Line 2830  static char *ParseACSSFontSize (Element Line 3081  static char *ParseACSSFontSize (Element
     }      }
   
   /* install the presentation style */    /* install the presentation style */
   if (!check && DoApply)    if (!check)
     TtaSetStylePresentation (PRSize, element, tsch, context, pval);      {
         if (DoDialog)
           DisplayStyleValue ("font-size", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRSize, element, tsch, context, pval);
       }
   if (!check && ptr)    if (!check && ptr)
     cssRule = ParseCSSLineHeight (element, tsch, context, &ptr[1], css, isHTML);      cssRule = ParseCSSLineHeight (element, tsch, context, &ptr[1], css, isHTML);
   if (linespace)    if (linespace)
Line 2981  static char *ParseACSSFontFamily (Elemen Line 3237  static char *ParseACSSFontFamily (Elemen
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipBlanksAndComments (cssRule);
     }      }
   
   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)      {
     /* install the new presentation */        if (!DoDialog && DoApply)
     TtaSetStylePresentation (PRFont, element, tsch, context, font);          /* install the new presentation */
           TtaSetStylePresentation (PRFont, element, tsch, context, font);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 2997  static char *ParseCSSFontFamily (Element Line 3255  static char *ParseCSSFontFamily (Element
                                  PresentationContext context, char *cssRule,                                   PresentationContext context, char *cssRule,
                                  CSSInfoPtr css, ThotBool isHTML)                                   CSSInfoPtr css, ThotBool isHTML)
 {  {
     char               *start_value;
   
     cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   cssRule = ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);    cssRule = ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);
   /* skip extra values */    /* skip extra values */
   while (cssRule && *cssRule != ';' && *cssRule != '}' && *cssRule != EOS)    while (cssRule && *cssRule != ';' && *cssRule != '}' && *cssRule != EOS)
     cssRule++;      cssRule++;
     if (DoDialog)
       DisplayStyleValue ("font-family", start_value, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
Line 3014  static char *ParseACSSFontWeight (Elemen Line 3278  static char *ParseACSSFontWeight (Elemen
                                   CSSInfoPtr css, ThotBool isHTML)                                    CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   weight;    PresentationValue   weight;
     char               *ptr;
   
   weight.typed_data.value = 0;    weight.typed_data.value = 0;
   weight.typed_data.unit = UNIT_REL;    weight.typed_data.unit = UNIT_REL;
   weight.typed_data.real = FALSE;    weight.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (isdigit (*cssRule) && *cssRule != '0' &&    if (isdigit (*cssRule) && *cssRule != '0' &&
       cssRule[1] == '0' && cssRule[2] == '0' &&        cssRule[1] == '0' && cssRule[2] == '0' &&
       (cssRule[3] == EOS || cssRule[3] == SPACE || cssRule[3] == '/' ||        (cssRule[3] == EOS || cssRule[3] == SPACE || cssRule[3] == '/' ||
Line 3109  static char *ParseACSSFontWeight (Elemen Line 3375  static char *ParseACSSFontWeight (Elemen
     }      }
   
   /* install the new presentation */    /* install the new presentation */
   if (DoApply)    if (cssRule != ptr && DoDialog)
       DisplayStyleValue ("font-weight", ptr, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRWeight, element, tsch, context, weight);      TtaSetStylePresentation (PRWeight, element, tsch, context, weight);
   return (cssRule);    return (cssRule);
 }  }
Line 3125  static char *ParseCSSFontWeight (Element Line 3393  static char *ParseCSSFontWeight (Element
 {  {
   char           *ptr;    char           *ptr;
       
     cssRule = SkipBlanksAndComments (cssRule);
   ptr = cssRule;    ptr = cssRule;
   cssRule = ParseACSSFontWeight (element, tsch, context, cssRule, css, isHTML);    cssRule = ParseACSSFontWeight (element, tsch, context, cssRule, css, isHTML);
   if (ptr == cssRule)    if (ptr == cssRule)
Line 3142  static char *ParseACSSFontVariant (Eleme Line 3411  static char *ParseACSSFontVariant (Eleme
                                    CSSInfoPtr css, ThotBool isHTML)                                     CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   style;    PresentationValue   style;
     char               *ptr;
   
   style.typed_data.value = 0;    style.typed_data.value = 0;
   style.typed_data.unit = UNIT_REL;    style.typed_data.unit = UNIT_REL;
   style.typed_data.real = FALSE;    style.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "small-caps", 10))    if (!strncasecmp (cssRule, "small-caps", 10))
     {      {
       /* Not supported yet */        /* Not supported yet */
Line 3162  static char *ParseACSSFontVariant (Eleme Line 3433  static char *ParseACSSFontVariant (Eleme
       /* Not supported yet */        /* Not supported yet */
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
     }      }
     if (cssRule != ptr && DoDialog)
       DisplayStyleValue ("font-variant", ptr, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
Line 3195  static char *ParseACSSFontStyle (Element Line 3468  static char *ParseACSSFontStyle (Element
 {  {
   PresentationValue   style;    PresentationValue   style;
   PresentationValue   size;    PresentationValue   size;
     PresentationValue   previous_size;
     char               *ptr;
   
   style.typed_data.value = 0;    style.typed_data.value = 0;
   style.typed_data.unit = UNIT_REL;    style.typed_data.unit = UNIT_REL;
Line 3203  static char *ParseACSSFontStyle (Element Line 3478  static char *ParseACSSFontStyle (Element
   size.typed_data.unit = UNIT_REL;    size.typed_data.unit = UNIT_REL;
   size.typed_data.real = FALSE;    size.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   if (!strncasecmp (cssRule, "italic", 6))    if (!strncasecmp (cssRule, "italic", 6))
     {      {
       style.typed_data.value = StyleItalics;        style.typed_data.value = StyleItalics;
Line 3230  static char *ParseACSSFontStyle (Element Line 3506  static char *ParseACSSFontStyle (Element
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   if (DoApply &&    if (style.typed_data.value != 0 || style.typed_data.unit == VALUE_INHERIT)
       (style.typed_data.value != 0 || style.typed_data.unit == VALUE_INHERIT))  
     {      {
       TtaSetStylePresentation (PRStyle, element, tsch, context, style);        if (DoDialog)
           DisplayStyleValue ("font-style", ptr, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRStyle, element, tsch, context, style);
     }      }
   if (size.typed_data.value != 0 && DoApply)    if (size.typed_data.value != 0)
     {      {
       PresentationValue   previous_size;        if (DoDialog)
           DisplayStyleValue ("font-style", ptr, cssRule);
       if (!TtaGetStylePresentation (PRSize, element, tsch, context, &previous_size))        else if (DoApply)
         {  
           /* !!!!!!!!!!!!!!!!!!!!!!!! Unit + relative !!!!!!!!!!!!!!!! */  
           size.typed_data.value += previous_size.typed_data.value;  
           TtaSetStylePresentation (PRSize, element, tsch, context, size);  
         }  
       else  
         {          {
           size.typed_data.value = 10;            if (!TtaGetStylePresentation (PRSize, element, tsch, context, &previous_size))
           TtaSetStylePresentation (PRSize, element, tsch, context, size);              {
                 /* !!!!!!!!!!!!!!!!!!!!!!!! Unit + relative !!!!!!!!!!!!!!!! */
                 size.typed_data.value += previous_size.typed_data.value;
                 TtaSetStylePresentation (PRSize, element, tsch, context, size);
               }
             else
               {
                 size.typed_data.value = 10;
                 TtaSetStylePresentation (PRSize, element, tsch, context, size);
               }
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 3282  static char *ParseCSSFont (Element eleme Line 3563  static char *ParseCSSFont (Element eleme
                            CSSInfoPtr css, ThotBool isHTML)                             CSSInfoPtr css, ThotBool isHTML)
 {  {
   char           *ptr, *p;    char           *ptr, *p;
     char           *start_value;
   int             skippedNL;    int             skippedNL;
   ThotBool        variant = FALSE, style = FALSE, weight = FALSE, found;     ThotBool        variant = FALSE, style = FALSE, weight = FALSE, found; 
   
Line 3304  static char *ParseCSSFont (Element eleme Line 3586  static char *ParseCSSFont (Element eleme
       ParseACSSFontVariant (element, tsch, context, cssRule, css, isHTML);        ParseACSSFontVariant (element, tsch, context, cssRule, css, isHTML);
       ParseACSSFontWeight (element, tsch, context, cssRule, css, isHTML);        ParseACSSFontWeight (element, tsch, context, cssRule, css, isHTML);
       ParseACSSFontSize (element, tsch, context, cssRule, css, isHTML, FALSE);        ParseACSSFontSize (element, tsch, context, cssRule, css, isHTML, FALSE);
         cssRule = SkipBlanksAndComments (cssRule);
         start_value = cssRule;
       ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);        ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);
       cssRule += 7;        cssRule += 7;
         if (DoDialog)
           DisplayStyleValue ("font-family", start_value, cssRule);
     }      }
   else    else
     {      {
Line 3365  static char *ParseCSSFont (Element eleme Line 3651  static char *ParseCSSFont (Element eleme
       if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)        if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)
         cssRule = ParseACSSFontSize (element, tsch, context, cssRule, css, isHTML, FALSE);          cssRule = ParseACSSFontSize (element, tsch, context, cssRule, css, isHTML, FALSE);
       if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)        if (*cssRule != ';' && *cssRule != '}' && *cssRule != EOS)
         cssRule = ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);          {
             cssRule = SkipBlanksAndComments (cssRule);
             start_value = cssRule;
             cssRule = ParseACSSFontFamily (element, tsch, context, cssRule, css, isHTML);
             if (DoDialog)
               DisplayStyleValue ("font-family", start_value, cssRule);
           }
       if (ptr == cssRule)        if (ptr == cssRule)
         cssRule = SkipValue ("Invalid font value", cssRule);          cssRule = SkipValue ("Invalid font value", cssRule);
     }      }
Line 3385  static char *ParseCSSTextDecoration (Ele Line 3677  static char *ParseCSSTextDecoration (Ele
                                      CSSInfoPtr css, ThotBool isHTML)                                       CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   decor;    PresentationValue   decor;
   char               *ptr = cssRule;    char               *ptr;
   ThotBool            ok;    ThotBool            ok;
   
   decor.typed_data.value = 0;    decor.typed_data.value = 0;
   decor.typed_data.unit = UNIT_REL;    decor.typed_data.unit = UNIT_REL;
   decor.typed_data.real = FALSE;    decor.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   ok = TRUE;    ok = TRUE;
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
Line 3445  static char *ParseCSSTextDecoration (Ele Line 3738  static char *ParseCSSTextDecoration (Ele
   /*    /*
    * install the new presentation.     * install the new presentation.
    */     */
   if (DoApply &&    if (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);        if (DoDialog)
           DisplayStyleValue ("text-decoration", ptr, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRUnderline, element, tsch, context, decor);
       }
   cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-decoration value");    cssRule = CSSCheckEndValue (ptr, cssRule, "Invalid text-decoration value");
   return (cssRule);    return (cssRule);
 }  }
Line 3483  static char *ParseCSSHeight (Element ele Line 3780  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;
     }      }
   if (DoApply)  
     if (DoDialog)
       DisplayStyleValue ("height", ptr, cssRule);
     else if (DoApply)
     /* install the new presentation */      /* install the new presentation */
     TtaSetStylePresentation (PRHeight, element, tsch, context, val);      TtaSetStylePresentation (PRHeight, element, tsch, context, val);
   return (cssRule);    return (cssRule);
Line 3521  static char *ParseCSSWidth (Element elem Line 3821  static char *ParseCSSWidth (Element elem
       val.typed_data.unit = UNIT_PX;        val.typed_data.unit = UNIT_PX;
     }      }
   
   if (DoApply)    if (DoDialog)
       DisplayStyleValue ("width", ptr, cssRule);
     else if (DoApply)
     /* 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 3555  static char *ParseACSSMarginTop (Element Line 3857  static char *ParseACSSMarginTop (Element
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-top value", ptr, cssRule);      CSSParseError ("Invalid margin-top value", ptr, cssRule);
     else if (DoDialog)
       {
         if (All_sides)
           DisplayStyleValue ("margin", ptr, cssRule);
         else
           DisplayStyleValue ("margin-top", ptr, cssRule);
       }
   else if (DoApply)    else if (DoApply)
     TtaSetStylePresentation (PRMarginTop, element, tsch, context, margin);      TtaSetStylePresentation (PRMarginTop, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
Line 3603  static char *ParseACSSMarginBottom (Elem Line 3912  static char *ParseACSSMarginBottom (Elem
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-bottom value", ptr, cssRule);      CSSParseError ("Invalid margin-bottom value", ptr, cssRule);
     else if (DoDialog)
       DisplayStyleValue ("margin-bottom", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     TtaSetStylePresentation (PRMarginBottom, element, tsch, context, margin);      TtaSetStylePresentation (PRMarginBottom, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
Line 3651  static char *ParseACSSMarginLeft (Elemen Line 3962  static char *ParseACSSMarginLeft (Elemen
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-left value", ptr, cssRule);      CSSParseError ("Invalid margin-left value", ptr, cssRule);
     else if (DoDialog)
       DisplayStyleValue ("margin-left", ptr, cssRule);
   else if (DoApply && margin.typed_data.unit != UNIT_INVALID && DoApply)    else if (DoApply && margin.typed_data.unit != UNIT_INVALID && DoApply)
     TtaSetStylePresentation (PRMarginLeft, element, tsch, context, margin);      TtaSetStylePresentation (PRMarginLeft, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
Line 3700  static char *ParseACSSMarginRight (Eleme Line 4013  static char *ParseACSSMarginRight (Eleme
       (margin.typed_data.unit == UNIT_INVALID ||        (margin.typed_data.unit == UNIT_INVALID ||
        margin.typed_data.unit == UNIT_BOX))         margin.typed_data.unit == UNIT_BOX))
     CSSParseError ("Invalid margin-right value", ptr, cssRule);      CSSParseError ("Invalid margin-right value", ptr, cssRule);
     else if (DoDialog)
       DisplayStyleValue ("margin-right", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     TtaSetStylePresentation (PRMarginRight, element, tsch, context, margin);      TtaSetStylePresentation (PRMarginRight, element, tsch, context, margin);
   return (cssRule);    return (cssRule);
Line 3729  static char *ParseCSSMargin (Element ele Line 4044  static char *ParseCSSMargin (Element ele
                              ThotBool isHTML)                               ThotBool isHTML)
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    char *ptrT, *ptrR, *ptrB, *ptrL;
   int   skippedNL;    int   skippedNL, n;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipBlanksAndComments (cssRule);
   /* First parse Margin-Top */    if (DoDialog)
   ptrR = ParseACSSMarginTop (element, tsch, context, ptrT, css, isHTML);      n = NumberOfValues (ptrT);
   ptrR = SkipBlanksAndComments (ptrR);    if (DoDialog && n < 2)
   if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')  
     {      {
       skippedNL = NewLineSkipped;        // check if the margin dialog must be updated
       cssRule = ptrR;        All_sides = TRUE;
       /* apply the Margin-Top to all */        ptrR = ParseACSSMarginTop (element, tsch, context, ptrT, css, isHTML);
       ptrR = ParseACSSMarginRight (element, tsch, context, ptrT, css, isHTML);        All_sides = FALSE;
       NewLineSkipped = skippedNL;  
       ptrR = ParseACSSMarginBottom (element, tsch, context, ptrT, css, isHTML);  
       NewLineSkipped = skippedNL;  
       ptrR = ParseACSSMarginLeft (element, tsch, context, ptrT, css, isHTML);  
     }      }
   else    else
     {      {
       /* parse Margin-Right */        /* First parse Margin-Top */
       ptrB = ParseACSSMarginRight (element, tsch, context, ptrR, css, isHTML);        ptrR = ParseACSSMarginTop (element, tsch, context, ptrT, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrR = SkipBlanksAndComments (ptrR);
       if (*ptrB == ';' || *ptrB == '}' || *ptrB == EOS || *ptrB == ',')        if (*ptrR == ';' || *ptrR == '}' || *ptrR == EOS || *ptrR == ',')
         {          {
           skippedNL = NewLineSkipped;            skippedNL = NewLineSkipped;
           cssRule = ptrB;            cssRule = ptrR;
           /* apply the Margin-Top to Margin-Bottom */            /* apply the Margin-Top to all */
           ptrB = ParseACSSMarginBottom (element, tsch, context, ptrT, css, isHTML);            ptrR = ParseACSSMarginRight (element, tsch, context, ptrT, css, isHTML);
             NewLineSkipped = skippedNL;
             ptrR = ParseACSSMarginBottom (element, tsch, context, ptrT, css, isHTML);
           NewLineSkipped = skippedNL;            NewLineSkipped = skippedNL;
           /* apply the Margin-Right to Margin-Left */            ptrR = ParseACSSMarginLeft (element, tsch, context, ptrT, css, isHTML);
           ptrB = ParseACSSMarginLeft (element, tsch, context, ptrR, css, isHTML);  
         }          }
       else        else
         {          {
           /* parse Margin-Bottom */            /* parse Margin-Right */
           ptrL = ParseACSSMarginBottom (element, tsch, context, ptrB, css, isHTML);            ptrB = ParseACSSMarginRight (element, tsch, context, ptrR, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrB = SkipBlanksAndComments (ptrB);
           if (*ptrL == ';' || *ptrL == '}' || *ptrL == EOS || *ptrL == ',')            if (*ptrB == ';' || *ptrB == '}' || *ptrB == EOS || *ptrB == ',')
             {              {
               cssRule = ptrL;                skippedNL = NewLineSkipped;
                 cssRule = ptrB;
                 /* apply the Margin-Top to Margin-Bottom */
                 ptrB = ParseACSSMarginBottom (element, tsch, context, ptrT, css, isHTML);
                 NewLineSkipped = skippedNL;
               /* apply the Margin-Right to Margin-Left */                /* apply the Margin-Right to Margin-Left */
               ptrL = ParseACSSMarginLeft (element, tsch, context, ptrR, css, isHTML);                ptrB = ParseACSSMarginLeft (element, tsch, context, ptrR, css, isHTML);
             }              }
           else            else
             /* parse Margin-Left */              {
             cssRule = ParseACSSMarginLeft (element, tsch, context, ptrL, css, isHTML);                /* parse Margin-Bottom */
           cssRule = SkipBlanksAndComments (cssRule);                ptrL = ParseACSSMarginBottom (element, tsch, context, ptrB, css, isHTML);
                 ptrL = SkipBlanksAndComments (ptrL);
                 if (*ptrL == ';' || *ptrL == '}' || *ptrL == EOS || *ptrL == ',')
                   {
                     cssRule = ptrL;
                     /* apply the Margin-Right to Margin-Left */
                     ptrL = ParseACSSMarginLeft (element, tsch, context, ptrR, css, isHTML);
                   }
                 else
                   /* parse Margin-Left */
                   cssRule = ParseACSSMarginLeft (element, tsch, context, ptrL, css, isHTML);
                 cssRule = SkipBlanksAndComments (cssRule);
               }
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 3804  static char *ParseCSSPaddingTop (Element Line 4131  static char *ParseCSSPaddingTop (Element
       CSSParseError ("Invalid padding-top value", ptr, cssRule);        CSSParseError ("Invalid padding-top value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
     }      }
     else if (DoDialog)
       {
         if (All_sides)
           DisplayStyleValue ("padding", ptr, cssRule);
         else
           DisplayStyleValue ("padding-top", ptr, cssRule);
       }
   else if (DoApply)    else if (DoApply)
     TtaSetStylePresentation (PRPaddingTop, element, tsch, context, padding);      TtaSetStylePresentation (PRPaddingTop, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
Line 3834  static char *ParseCSSPaddingBottom (Elem Line 4168  static char *ParseCSSPaddingBottom (Elem
       CSSParseError ("Invalid padding-bottom value", ptr, cssRule);        CSSParseError ("Invalid padding-bottom value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
     }      }
     else if (DoDialog)
       DisplayStyleValue ("padding-bottom", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     TtaSetStylePresentation (PRPaddingBottom, element, tsch, context, padding);      TtaSetStylePresentation (PRPaddingBottom, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
Line 3864  static char *ParseCSSPaddingLeft (Elemen Line 4200  static char *ParseCSSPaddingLeft (Elemen
       CSSParseError ("Invalid padding-left value", ptr, cssRule);        CSSParseError ("Invalid padding-left value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
     }      }
     else if (DoDialog)
       DisplayStyleValue ("padding-left", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     TtaSetStylePresentation (PRPaddingLeft, element, tsch, context, padding);      TtaSetStylePresentation (PRPaddingLeft, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
Line 3894  static char *ParseCSSPaddingRight (Eleme Line 4232  static char *ParseCSSPaddingRight (Eleme
       CSSParseError ("Invalid padding-right value", ptr, cssRule);        CSSParseError ("Invalid padding-right value", ptr, cssRule);
       padding.typed_data.value = 0;        padding.typed_data.value = 0;
     }      }
     else if (DoDialog)
       DisplayStyleValue ("padding-right", ptr, cssRule);
   else if (DoApply)    else if (DoApply)
     TtaSetStylePresentation (PRPaddingRight, element, tsch, context, padding);      TtaSetStylePresentation (PRPaddingRight, element, tsch, context, padding);
   return (cssRule);    return (cssRule);
Line 3908  static char *ParseCSSPadding (Element el Line 4248  static char *ParseCSSPadding (Element el
                               ThotBool isHTML)                                ThotBool isHTML)
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    char *ptrT, *ptrR, *ptrB, *ptrL;
   int   skippedNL;    int   skippedNL, n;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipBlanksAndComments (cssRule);
   /* First parse Padding-Top */    if (DoDialog)
   ptrR = ParseCSSPaddingTop (element, tsch, context, ptrT, css, isHTML);      n = NumberOfValues (ptrT);
   ptrR = SkipBlanksAndComments (ptrR);    if (DoDialog && n < 2)
   if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')  
     {      {
       skippedNL = NewLineSkipped;        // check if the padding dialog must be updated
       cssRule = ptrR;        All_sides = TRUE;
       /* apply the Padding-Top to all */        ptrR = ParseCSSPaddingTop (element, tsch, context, ptrT, css, isHTML);
       ptrR = ParseCSSPaddingRight (element, tsch, context, ptrT, css, isHTML);        All_sides = FALSE;
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSPaddingBottom (element, tsch, context, ptrT, css, isHTML);  
       NewLineSkipped = skippedNL;  
       ptrR = ParseCSSPaddingLeft (element, tsch, context, ptrT, css, isHTML);  
     }      }
   else    else
     {      {
       /* parse Padding-Right */        /* First parse Padding-Top */
       ptrB = ParseCSSPaddingRight (element, tsch, context, ptrR, css, isHTML);        ptrR = ParseCSSPaddingTop (element, tsch, context, ptrT, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrR = SkipBlanksAndComments (ptrR);
       if (*ptrB == ';' || *ptrB == EOS || *ptrB == ',')        if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')
         {          {
           skippedNL = NewLineSkipped;            skippedNL = NewLineSkipped;
           cssRule = ptrB;            cssRule = ptrR;
           /* apply the Padding-Top to Padding-Bottom */            /* apply the Padding-Top to all */
           ptrB = ParseCSSPaddingBottom (element, tsch, context, ptrT, css, isHTML);            ptrR = ParseCSSPaddingRight (element, tsch, context, ptrT, css, isHTML);
           NewLineSkipped = skippedNL;            NewLineSkipped = skippedNL;
           /* apply the Padding-Right to Padding-Left */            ptrR = ParseCSSPaddingBottom (element, tsch, context, ptrT, css, isHTML);
           ptrB = ParseCSSPaddingLeft (element, tsch, context, ptrR, css, isHTML);            NewLineSkipped = skippedNL;
             ptrR = ParseCSSPaddingLeft (element, tsch, context, ptrT, css, isHTML);
         }          }
       else        else
         {          {
           /* parse Padding-Bottom */            /* parse Padding-Right */
           ptrL = ParseCSSPaddingBottom (element, tsch, context, ptrB, css, isHTML);            ptrB = ParseCSSPaddingRight (element, tsch, context, ptrR, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrB = SkipBlanksAndComments (ptrB);
           if (*ptrL == ';' || *ptrL == EOS || *ptrL == ',')            if (*ptrB == ';' || *ptrB == EOS || *ptrB == ',')
             {              {
               cssRule = ptrL;                skippedNL = NewLineSkipped;
                 cssRule = ptrB;
                 /* apply the Padding-Top to Padding-Bottom */
                 ptrB = ParseCSSPaddingBottom (element, tsch, context, ptrT, css, isHTML);
                 NewLineSkipped = skippedNL;
               /* apply the Padding-Right to Padding-Left */                /* apply the Padding-Right to Padding-Left */
               ptrL = ParseCSSPaddingLeft (element, tsch, context, ptrR, css, isHTML);                ptrB = ParseCSSPaddingLeft (element, tsch, context, ptrR, css, isHTML);
             }              }
           else            else
             /* parse Padding-Left */              {
             cssRule = ParseCSSPaddingLeft (element, tsch, context, ptrL, css, isHTML);                /* parse Padding-Bottom */
           cssRule = SkipBlanksAndComments (cssRule);                ptrL = ParseCSSPaddingBottom (element, tsch, context, ptrB, css, isHTML);
                 ptrL = SkipBlanksAndComments (ptrL);
                 if (*ptrL == ';' || *ptrL == EOS || *ptrL == ',')
                   {
                     cssRule = ptrL;
                     /* apply the Padding-Right to Padding-Left */
                     ptrL = ParseCSSPaddingLeft (element, tsch, context, ptrR, css, isHTML);
                   }
                 else
                   /* parse Padding-Left */
                   cssRule = ParseCSSPaddingLeft (element, tsch, context, ptrL, css, isHTML);
                 cssRule = SkipBlanksAndComments (cssRule);
               }
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 3971  static char *ParseCSSForeground (Element Line 4323  static char *ParseCSSForeground (Element
   PresentationValue   best;    PresentationValue   best;
   char               *p;    char               *p;
   
     cssRule = SkipBlanksAndComments (cssRule);
   p = cssRule;    p = cssRule;
   cssRule = ParseCSSColor (cssRule, &best);    cssRule = ParseCSSColor (cssRule, &best);
   if (best.typed_data.unit != UNIT_INVALID && DoApply)    if (best.typed_data.unit != UNIT_INVALID)
     {      {
       if (*cssRule != EOS && *cssRule !=';')        if (*cssRule != EOS && *cssRule !=';')
         {          {
           cssRule = SkipProperty (cssRule, FALSE);            cssRule = SkipProperty (cssRule, FALSE);
           CSSParseError ("Invalid value", p, cssRule);            CSSParseError ("Invalid color value", p, cssRule);
         }          }
       else        else if (DoDialog)
           DisplayStyleValue ("color", p, cssRule);
         else if (DoApply)
         /* install the new presentation */          /* install the new presentation */
         TtaSetStylePresentation (PRForeground, element, tsch, context, best);          TtaSetStylePresentation (PRForeground, element, tsch, context, best);
     }      }
Line 3996  static char *ParseCSSBackgroundColor (El Line 4351  static char *ParseCSSBackgroundColor (El
                                       CSSInfoPtr css, ThotBool isHTML)                                        CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue     best;    PresentationValue     best;
     char                 *ptr;
   
     cssRule = SkipBlanksAndComments (cssRule);
     ptr = cssRule;
   best.typed_data.unit = UNIT_INVALID;    best.typed_data.unit = UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   if (!strncasecmp (cssRule, "transparent", 11))    if (!strncasecmp (cssRule, "transparent", 11))
Line 4010  static char *ParseCSSBackgroundColor (El Line 4368  static char *ParseCSSBackgroundColor (El
   else    else
     {      {
       cssRule = ParseCSSColor (cssRule, &best);        cssRule = ParseCSSColor (cssRule, &best);
       if (best.typed_data.unit != UNIT_INVALID && DoApply)        if (best.typed_data.unit != UNIT_INVALID)
         {          {
           /* install the new presentation. */            if (DoDialog)
           TtaSetStylePresentation (PRBackground, element, tsch, context, best);              DisplayStyleValue ("background-color", ptr, cssRule);
           /* thot specificity: need to set fill pattern for background color */            else if (DoApply)
           best.typed_data.value = PATTERN_BACKGROUND;              {
           best.typed_data.unit = UNIT_REL;                /* install the new presentation. */
           TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);                TtaSetStylePresentation (PRBackground, element, tsch, context, best);
           best.typed_data.value = 1;                /* thot specificity: need to set fill pattern for background color */
           best.typed_data.unit = UNIT_REL;                best.typed_data.value = PATTERN_BACKGROUND;
           TtaSetStylePresentation (PRShowBox, element, tsch, context, best);                best.typed_data.unit = UNIT_REL;
                 TtaSetStylePresentation (PRFillPattern, element, tsch, context, best);
                 best.typed_data.value = 1;
                 best.typed_data.unit = UNIT_REL;
                 TtaSetStylePresentation (PRShowBox, element, tsch, context, best);
               }
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 4197  static char *ParseCSSContent (Element el Line 4560  static char *ParseCSSContent (Element el
   PresentationValue   value;    PresentationValue   value;
   char                *last, *start, quoteChar, savedChar;    char                *last, *start, quoteChar, savedChar;
   int                 length, val;    int                 length, val;
   unsigned char       *buffer, *p;    char               *buffer, *p;
     char               *start_value;
   ThotBool            repeat;    ThotBool            repeat;
   
   value.typed_data.unit = UNIT_REL;    value.typed_data.unit = UNIT_REL;
   value.typed_data.real = FALSE;    value.typed_data.real = FALSE;
   value.typed_data.value = 0;    value.typed_data.value = 0;
   if (DoApply)    if (!DoDialog && DoApply)
     TtaSetStylePresentation (PRContent, element, tsch, ctxt, value);      TtaSetStylePresentation (PRContent, element, tsch, ctxt, value);
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   repeat = TRUE;    repeat = TRUE;
   while (repeat)    while (repeat)
     {      {
       p = (unsigned char*) cssRule;        p = cssRule;
       if (!strncasecmp (cssRule, "normal", 6))        if (!strncasecmp (cssRule, "normal", 6))
         /* The pseudo-element is not generated */          /* The pseudo-element is not generated */
         {          {
Line 4233  static char *ParseCSSContent (Element el Line 4598  static char *ParseCSSContent (Element el
           last = SkipString (last);            last = SkipString (last);
           length = last - cssRule;            length = last - cssRule;
           /* get a buffer to store the string */            /* get a buffer to store the string */
           buffer = (unsigned char*) TtaGetMemory (length);            buffer = (char *)TtaGetMemory (length);
           p = buffer; /* beginning of the string */            p = buffer; /* beginning of the string */
           cssRule++;            cssRule++;
           while (*cssRule != EOS && *cssRule != quoteChar)            while (*cssRule != EOS && *cssRule != quoteChar)
Line 4254  static char *ParseCSSContent (Element el Line 4619  static char *ParseCSSContent (Element el
                       savedChar = *cssRule;                        savedChar = *cssRule;
                       *cssRule = EOS;                        *cssRule = EOS;
                       sscanf (start, "%x", &val);                        sscanf (start, "%x", &val);
                       TtaWCToMBstring ((wchar_t) val, &p);                        TtaWCToMBstring ((wchar_t) val, (unsigned char **) &p);
                       *cssRule = savedChar;                        *cssRule = savedChar;
                     }                      }
                   else                    else
Line 4270  static char *ParseCSSContent (Element el Line 4635  static char *ParseCSSContent (Element el
                 }                  }
             }              }
           *p = EOS;            *p = EOS;
           if (*cssRule != quoteChar)            if (DoDialog)
               {
                 DisplayStyleValue ("", start_value, p);
                 start_value = p;
               }
             else if (*cssRule != quoteChar)
             cssRule = SkipProperty (cssRule, FALSE);              cssRule = SkipProperty (cssRule, FALSE);
           else            else
             {              {
Line 4291  static char *ParseCSSContent (Element el Line 4661  static char *ParseCSSContent (Element el
           cssRule += 3;            cssRule += 3;
           cssRule = SetCSSImage (element, tsch, ctxt, cssRule, css,            cssRule = SetCSSImage (element, tsch, ctxt, cssRule, css,
                                  PRContentURL);                                   PRContentURL);
             if (DoDialog)
               {
                 DisplayStyleValue ("", start_value, p);
                 start_value = p;
               }
         }          }
       else if (!strncasecmp (cssRule, "counter", 7))        else if (!strncasecmp (cssRule, "counter", 7))
         {          {
           cssRule += 7;            cssRule += 7;
           /* @@@@@@ */            /* @@@@@@ */
           cssRule = SkipProperty (cssRule, FALSE);            if (DoDialog)
               {
                 DisplayStyleValue ("", start_value, p);
                 start_value = p;
               }
             else
               cssRule = SkipProperty (cssRule, FALSE);
         }          }
       else if (!strncasecmp (cssRule, "counters", 8))        else if (!strncasecmp (cssRule, "counters", 8))
         {          {
           cssRule += 8;            cssRule += 8;
           /* @@@@@@ */            /* @@@@@@ */
           cssRule = SkipProperty (cssRule, FALSE);            if (DoDialog)
               {
                 DisplayStyleValue ("", start_value, p);
                 start_value = p;
               }
             else
               cssRule = SkipProperty (cssRule, FALSE);
         }          }
       else if (!strncasecmp (cssRule, "attr", 4))        else if (!strncasecmp (cssRule, "attr", 4))
         {          {
Line 4334  static char *ParseCSSContent (Element el Line 4721  static char *ParseCSSContent (Element el
                   value.typed_data.unit = UNIT_REL;                    value.typed_data.unit = UNIT_REL;
                   value.typed_data.real = FALSE;                    value.typed_data.real = FALSE;
                   value.pointer = start;                    value.pointer = start;
                   if (DoApply)                    if (DoDialog)
                       {
                         DisplayStyleValue ("", start_value, p);
                         start_value = p;
                       }
                     else if (DoApply)
                     TtaSetStylePresentation (PRContentAttr, element, tsch,                      TtaSetStylePresentation (PRContentAttr, element, tsch,
                                              ctxt, value);                                               ctxt, value);
                   *last = savedChar;                    *last = savedChar;
Line 4343  static char *ParseCSSContent (Element el Line 4735  static char *ParseCSSContent (Element el
           if (value.pointer == NULL)            if (value.pointer == NULL)
             {              {
               CSSParseError ("Invalid content value", (char*) p, cssRule);                CSSParseError ("Invalid content value", (char*) p, cssRule);
               cssRule = SkipProperty (cssRule, FALSE);                if (DoDialog)
                   {
                     DisplayStyleValue ("", start_value, p);
                     start_value = p;
                   }
                 else
                   cssRule = SkipProperty (cssRule, FALSE);
             }              }
           cssRule++;            cssRule++;
         }          }
Line 4376  static char *ParseCSSContent (Element el Line 4774  static char *ParseCSSContent (Element el
       else        else
         {          {
           CSSParseError ("Invalid content value", (char*) p, cssRule);            CSSParseError ("Invalid content value", (char*) p, cssRule);
           cssRule = SkipProperty (cssRule, FALSE);            if (DoDialog)
               {
                 DisplayStyleValue ("", start_value, p);
                 start_value = p;
               }
             else
               cssRule = SkipProperty (cssRule, FALSE);
         }          }
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipBlanksAndComments (cssRule);
       if (repeat)        if (repeat)
Line 4403  static char *ParseCSSBackgroundImage (El Line 4807  static char *ParseCSSBackgroundImage (El
   if (!strncasecmp (cssRule, "none", 4))    if (!strncasecmp (cssRule, "none", 4))
     {      {
       cssRule += 4;        cssRule += 4;
       if (DoApply)        if (DoDialog)
           DisplayStyleValue ("background-image", ptr, cssRule);
         else if (DoApply)
         {          {
           /* no background image */            /* no background image */
           image.pointer = NULL;            image.pointer = NULL;
Line 4415  static char *ParseCSSBackgroundImage (El Line 4821  static char *ParseCSSBackgroundImage (El
     {      {
       value.typed_data.unit = VALUE_INHERIT;        value.typed_data.unit = VALUE_INHERIT;
       cssRule += 7;        cssRule += 7;
         if (DoDialog)
           DisplayStyleValue ("background-image", ptr, cssRule);
     }      }
   else if (!strncasecmp (cssRule, "url", 3))    else if (!strncasecmp (cssRule, "url", 3))
     {        {  
Line 4449  static char *ParseACSSBackgroundRepeat ( Line 4857  static char *ParseACSSBackgroundRepeat (
                                         char *cssRule, CSSInfoPtr css, ThotBool isHTML)                                          char *cssRule, CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   repeat;    PresentationValue   repeat;
     char               *start_value;
   
     cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   repeat.typed_data.value = REALSIZE;    repeat.typed_data.value = REALSIZE;
   repeat.typed_data.unit = UNIT_BOX;    repeat.typed_data.unit = UNIT_BOX;
   repeat.typed_data.real = FALSE;    repeat.typed_data.real = FALSE;
Line 4467  static char *ParseACSSBackgroundRepeat ( Line 4878  static char *ParseACSSBackgroundRepeat (
   
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* check if it's an important rule */    /* check if it's an important rule */
   if (DoApply)    if (DoDialog)
       DisplayStyleValue ("background-repeat", start_value, cssRule);
     else if (DoApply)
     /* install the new presentation */      /* install the new presentation */
     TtaSetStylePresentation (PRBackgroundRepeat, element, tsch, ctxt, repeat);      TtaSetStylePresentation (PRBackgroundRepeat, element, tsch, ctxt, repeat);
   return (cssRule);    return (cssRule);
Line 4500  static char *ParseACSSBackgroundAttachme Line 4913  static char *ParseACSSBackgroundAttachme
                                             char *cssRule, CSSInfoPtr css,                                              char *cssRule, CSSInfoPtr css,
                                             ThotBool isHTML)                                              ThotBool isHTML)
 {  {
     char               *start_value;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   if (!strncasecmp (cssRule, "scroll", 6))    if (!strncasecmp (cssRule, "scroll", 6))
     {      {
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
Line 4513  static char *ParseACSSBackgroundAttachme Line 4929  static char *ParseACSSBackgroundAttachme
     {      {
       cssRule = SkipWord (cssRule);        cssRule = SkipWord (cssRule);
     }      }
     if (start_value != cssRule && DoDialog)
       DisplayStyleValue ("background-attachment", start_value, cssRule);
   return (cssRule);    return (cssRule);
 }  }
   
Line 4531  static char *ParseCSSBackgroundAttachmen Line 4949  static char *ParseCSSBackgroundAttachmen
   cssRule = ParseACSSBackgroundAttachment (element, tsch, ctxt,    cssRule = ParseACSSBackgroundAttachment (element, tsch, ctxt,
                                            cssRule, css, isHTML);                                             cssRule, css, isHTML);
   if (ptr == cssRule)    if (ptr == cssRule)
     cssRule = SkipValue ("Invalid background-attachement value", cssRule);      cssRule = SkipValue ("Invalid background-attachment value", cssRule);
   return cssRule;    return cssRule;
 }  }
   
Line 4600  static char *ParseACSSBackgroundPosition Line 5018  static char *ParseACSSBackgroundPosition
         val.typed_data.unit = UNIT_PERCENT;          val.typed_data.unit = UNIT_PERCENT;
     }      }
   
   if (val.typed_data.unit != UNIT_INVALID &&    if (val.typed_data.unit != UNIT_INVALID && val.typed_data.unit != UNIT_BOX)
       val.typed_data.unit != UNIT_BOX)  
     {      {
       if (DoApply)        if (DoDialog)
           {
             if (val.typed_data.unit == VALUE_INHERIT)
               {
                 DisplayStyleValue ("background-positionH", ptr, cssRule);
                 DisplayStyleValue ("background-positionV", ptr, cssRule);
               }
             else if (*across)
                 DisplayStyleValue ("background-positionH", ptr, cssRule);
             else
                 DisplayStyleValue ("background-positionV", ptr, cssRule);
           }
         else if (DoApply)
         /* install the new presentation */          /* install the new presentation */
         {          {
           if (val.typed_data.unit == VALUE_INHERIT)            if (val.typed_data.unit == VALUE_INHERIT)
Line 4762  static char *ParseCSSPageBreakBefore (El Line 5191  static char *ParseCSSPageBreakBefore (El
                                       CSSInfoPtr css, ThotBool isHTML)                                        CSSInfoPtr css, ThotBool isHTML)
 {  {
   PresentationValue   page;    PresentationValue   page;
     char               *start_value;
   
   page.typed_data.unit = UNIT_INVALID;    page.typed_data.unit = UNIT_INVALID;
   page.typed_data.real = FALSE;    page.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     page.typed_data.value = PageAuto;      page.typed_data.value = PageAuto;
   else if (!strncasecmp (cssRule, "always", 6))    else if (!strncasecmp (cssRule, "always", 6))
Line 4795  static char *ParseCSSPageBreakBefore (El Line 5226  static char *ParseCSSPageBreakBefore (El
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* install the new presentation */    /* install the new presentation */
   if (DoApply &&    if ((page.typed_data.unit == UNIT_REL && page.typed_data.value == PageAlways)
       ((page.typed_data.unit == UNIT_REL && page.typed_data.value == PageAlways)        || page.typed_data.unit == VALUE_INHERIT)
        || page.typed_data.unit == VALUE_INHERIT))      {
     TtaSetStylePresentation (PRPageBefore, element, tsch, ctxt, page);        if (DoDialog)
           DisplayStyleValue ("page-break-before", start_value, cssRule);
         else if (DoApply)
           TtaSetStylePresentation (PRPageBefore, element, tsch, ctxt, page);
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 4811  static char *ParseCSSPageBreakAfter (Ele Line 5246  static char *ParseCSSPageBreakAfter (Ele
                                      ThotBool isHTML)                                       ThotBool isHTML)
 {  {
   PresentationValue   page;    PresentationValue   page;
     char               *start_value;
   
   page.typed_data.unit = UNIT_INVALID;    page.typed_data.unit = UNIT_INVALID;
   page.typed_data.real = FALSE;    page.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     page.typed_data.value = PageAuto;      page.typed_data.value = PageAuto;
   else if (!strncasecmp (cssRule, "always", 6))    else if (!strncasecmp (cssRule, "always", 6))
Line 4843  static char *ParseCSSPageBreakAfter (Ele Line 5280  static char *ParseCSSPageBreakAfter (Ele
       page.typed_data.value = PageInherit;        page.typed_data.value = PageInherit;
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
 #if 0  
   /* install the new presentation */    /* install the new presentation */
   if (DoApply &&    if (page.typed_data.unit == UNIT_REL || page.typed_data.unit == VALUE_INHERIT)
       (page.typed_data.unit == UNIT_REL ||      {
        page.typed_data.unit == VALUE_INHERIT))        if (DoDialog)
     /* TtaSetStylePresentation (PRPageAfter, element, tsch, ctxt, page) */;          DisplayStyleValue ("page-break-after", start_value, cssRule);
 #endif /* 0 */        else if (DoApply)
           /* TtaSetStylePresentation (PRPageAfter, element, tsch, ctxt, page) */;
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 4862  static char *ParseCSSPageBreakInside (El Line 5300  static char *ParseCSSPageBreakInside (El
                                       ThotBool isHTML)                                        ThotBool isHTML)
 {  {
   PresentationValue   page;    PresentationValue   page;
     char               *start_value;
   
   page.typed_data.unit = UNIT_INVALID;    page.typed_data.unit = UNIT_INVALID;
   page.typed_data.real = FALSE;    page.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipBlanksAndComments (cssRule);
     start_value = cssRule;
   if (!strncasecmp (cssRule, "auto", 4))    if (!strncasecmp (cssRule, "auto", 4))
     {      {
       /*page.typed_data.unit = UNIT_REL;*/        /*page.typed_data.unit = UNIT_REL;*/
Line 4883  static char *ParseCSSPageBreakInside (El Line 5323  static char *ParseCSSPageBreakInside (El
     }      }
   cssRule = SkipWord (cssRule);    cssRule = SkipWord (cssRule);
   /* 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) &&        page.typed_data.value == PageAvoid)
     page.typed_data.value == PageAvoid && DoApply)      {
     TtaSetStylePresentation (PRPageInside, element, tsch, ctxt, page);*/        if (DoDialog)
           DisplayStyleValue ("page-break-inside", start_value, cssRule);
         else if (DoApply)
           /*TtaSetStylePresentation (PRPageInside, element, tsch, ctxt, page)*/;
       }
   return (cssRule);    return (cssRule);
 }  }
   
Line 4972  static char *ParseCSSPosition (Element e Line 5416  static char *ParseCSSPosition (Element e
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipBlanksAndComments (cssRule);
       if (*cssRule != EOS && *cssRule != ';')        if (*cssRule != EOS && *cssRule != ';')
         SkipValue ("Invalid position value", ptr);          SkipValue ("Invalid position value", ptr);
         else if (DoDialog)
           DisplayStyleValue ("position", ptr, cssRule);
       else if (DoApply)        else if (DoApply)
         TtaSetStylePresentation (PRPosition, element, tsch, ctxt, pval);          TtaSetStylePresentation (PRPosition, element, tsch, ctxt, pval);
     }      }
Line 5012  static char *ParseCSSTop (Element elemen Line 5458  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;
     }      }
   if (DoApply)    if (DoDialog)
           DisplayStyleValue ("top", ptr, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRTop, element, tsch, context, val);      TtaSetStylePresentation (PRTop, element, tsch, context, val);
   return (cssRule);    return (cssRule);
 }  }
Line 5051  static char *ParseCSSRight (Element elem Line 5499  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;
     }      }
   if (DoApply)    if (DoDialog)
           DisplayStyleValue ("right", ptr, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRRight, element, tsch, context, val);      TtaSetStylePresentation (PRRight, element, tsch, context, val);
   return (cssRule);    return (cssRule);
 }  }
Line 5090  static char *ParseCSSBottom (Element ele Line 5540  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;
     }      }
   if (DoApply)    if (DoDialog)
           DisplayStyleValue ("bottom", ptr, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRBottom, element, tsch, context, val);      TtaSetStylePresentation (PRBottom, element, tsch, context, val);
   return (cssRule);    return (cssRule);
 }  }
Line 5129  static char *ParseCSSLeft (Element eleme Line 5581  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;
     }      }
   if (DoApply)    if (DoDialog)
           DisplayStyleValue ("left", ptr, cssRule);
     else if (DoApply)
     TtaSetStylePresentation (PRLeft, element, tsch, context, val);      TtaSetStylePresentation (PRLeft, element, tsch, context, val);
   return (cssRule);    return (cssRule);
 }  }
Line 5164  static char *ParseCSSZIndex (Element ele Line 5618  static char *ParseCSSZIndex (Element ele
           val.typed_data.unit = UNIT_BOX;            val.typed_data.unit = UNIT_BOX;
         }          }
     }      }
     if (DoDialog)
           DisplayStyleValue ("z-index", ptr, cssRule);
   /***    /***
       if (DoApply)        if (DoApply)
       TtaSetStylePresentation (PR, element, tsch, context, val);        TtaSetStylePresentation (PR, element, tsch, context, val);
Line 5276  static CSSProperty CSSProperties[] = Line 5732  static CSSProperty CSSProperties[] =
   property: value [ ; property: value ]*     property: value [ ; property: value ]* 
   but tolerate incorrect or incomplete input                        but tolerate incorrect or incomplete input                    
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static void  ParseCSSRule (Element element, PSchema tsch,  void  ParseCSSRule (Element element, PSchema tsch, PresentationContext ctxt,
                            PresentationContext ctxt, char *cssRule,                      char *cssRule, CSSInfoPtr css, ThotBool isHTML)
                            CSSInfoPtr css, ThotBool isHTML)  
 {  {
   DisplayMode         dispMode;    DisplayMode         dispMode = DisplayImmediately;
   char               *p = NULL, *next, *end;    char               *p = NULL, *next, *end;
   char               *valueStart;    char               *valueStart;
   int                 lg;    int                 lg;
Line 5288  static void  ParseCSSRule (Element eleme Line 5743  static void  ParseCSSRule (Element eleme
   ThotBool            found;    ThotBool            found;
   
   /* avoid too many redisplay */    /* avoid too many redisplay */
   dispMode = TtaGetDisplayMode (ctxt->doc);    if (!DoDialog && ctxt->doc)
   if (dispMode == DisplayImmediately)      {
     TtaSetDisplayMode (ctxt->doc, DeferredDisplay);        dispMode = TtaGetDisplayMode (ctxt->doc);
         if (dispMode == DisplayImmediately)
           TtaSetDisplayMode (ctxt->doc, DeferredDisplay);
       }
   
   while (*cssRule != EOS)    while (*cssRule != EOS)
     {      {
Line 5427  static void  ParseCSSRule (Element eleme Line 5885  static void  ParseCSSRule (Element eleme
     }      }
   
   /* restore the display mode */    /* restore the display mode */
   if (dispMode == DisplayImmediately)    if (!DoDialog && ctxt->doc && dispMode == DisplayImmediately)
     TtaSetDisplayMode (ctxt->doc, dispMode);      TtaSetDisplayMode (ctxt->doc, dispMode);
 }  }
   
Line 5474  void  ParseHTMLSpecificStyle (Element el Line 5932  void  ParseHTMLSpecificStyle (Element el
   /* save the current display mode */    /* save the current display mode */
   dispMode = TtaGetDisplayMode (doc);    dispMode = TtaGetDisplayMode (doc);
   /* Call the parser */    /* Call the parser */
     DoDialog = FALSE; // not parsing for CSS dialog
   ParseCSSRule (el, NULL, (PresentationContext) ctxt, cssRule, NULL, isHTML);    ParseCSSRule (el, NULL, (PresentationContext) ctxt, cssRule, NULL, isHTML);
   /* restore the display mode if necessary */    /* restore the display mode if necessary */
   TtaSetDisplayMode (doc, dispMode);    TtaSetDisplayMode (doc, dispMode);
Line 5484  void  ParseHTMLSpecificStyle (Element el Line 5943  void  ParseHTMLSpecificStyle (Element el
     TtaFreeMemory(ctxt);      TtaFreeMemory(ctxt);
 }  }
   
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   AddClassName adds the class name into the class list of css if it's    AddClassName adds the class name into the class list of css if it's
   not already there.    not already there.
Line 5648  static char *ParseGenericSelector (char Line 6108  static char *ParseGenericSelector (char
   ctxt->var = 0;    ctxt->var = 0;
   ctxt->pseudo = PbNone;    ctxt->pseudo = PbNone;
   ctxt->type = 0;    ctxt->type = 0;
     DoDialog = FALSE; // not arsing for CSS dialog
   /* the specificity of the rule depends on the selector */    /* the specificity of the rule depends on the selector */
   ctxt->cssSpecificity = 0;    ctxt->cssSpecificity = 0;
   /* localisation of the CSS rule */    /* localisation of the CSS rule */

Removed from v.1.365  
changed lines
  Added in v.1.366


Webmaster