Diff for /Amaya/amaya/XHTMLbuilder.c between versions 1.133 and 1.134

version 1.133, 2006/01/27 15:51:27 version 1.134, 2006/06/30 13:03:14
Line 318  void XhtmlElementComplete (ParserData *c Line 318  void XhtmlElementComplete (ParserData *c
   char           *name1, *data;    char           *name1, *data;
   int            length;    int            length;
   SSchema        htmlSchema;    SSchema        htmlSchema;
   ThotBool       isImage, isInline;    ThotBool       isImage, isInline, clean;
   char           msgBuffer[MaxMsgLength];    char           msgBuffer[MaxMsgLength];
   int            lineNum;    int            lineNum;
   
Line 370  void XhtmlElementComplete (ParserData *c Line 370  void XhtmlElementComplete (ParserData *c
   
   switch (elType.ElTypeNum)    switch (elType.ElTypeNum)
     {      {
       case HTML_EL_PICTURE_UNIT:
         /* Check the mandatory SRC attribute */
         CheckMandatoryAttribute (el, doc, HTML_ATTR_SRC);
         break;
   
     case HTML_EL_Object:        /* it's an object */      case HTML_EL_Object:        /* it's an object */
       data = NULL;        data = NULL;
       isImage = FALSE;        isImage = FALSE;
Line 445  void XhtmlElementComplete (ParserData *c Line 450  void XhtmlElementComplete (ParserData *c
           if (data)            if (data)
             /* the object has a data attribute */              /* the object has a data attribute */
             {              {
                 // remove extra spaces
                 clean = FALSE;
                 while (length > 0 && data[length-1] == SPACE)
                   {
                     data[length-1] = EOS;
                     length--;
                     clean = TRUE;
                   }
                 if (clean)
                   TtaSetAttributeText (attr, data, el, doc);
                 // copy the attribute in the picture element
               attrType.AttrTypeNum = HTML_ATTR_SRC;                attrType.AttrTypeNum = HTML_ATTR_SRC;
               attr = TtaGetAttribute (picture, attrType);                attr = TtaGetAttribute (picture, attrType);
               if (attr == NULL)                if (attr == NULL)
                 {                  {
                   attr = TtaNewAttribute (attrType);                    attr = TtaNewAttribute (attrType);
                   TtaAttachAttribute (picture, attr, doc);                    TtaAttachAttribute (picture, attr, doc);
   
                 }                  }
               TtaSetAttributeText (attr, data, picture, doc);                TtaSetAttributeText (attr, data, picture, doc);
             }                }
           attrType.AttrTypeNum = HTML_ATTR_Height_;            attrType.AttrTypeNum = HTML_ATTR_Height_;
           attr = TtaGetAttribute (el, attrType);            attr = TtaGetAttribute (el, attrType);
           if (attr)            if (attr)
Line 489  void XhtmlElementComplete (ParserData *c Line 506  void XhtmlElementComplete (ParserData *c
                 }                  }
             }              }
         }          }
       //else  
         /* cannot display object image */  
       // SetAttrOnElement (doc, el, HTML_ATTR_NoObjects, 1);  
   
       /* is the Object_Content element already created ? */        /* is the Object_Content element already created ? */
       if (child)        if (child)
Line 528  void XhtmlElementComplete (ParserData *c Line 542  void XhtmlElementComplete (ParserData *c
                 }                  }
             }              }
         }          }
       if (data)        TtaFreeMemory (data);
         TtaFreeMemory (data);        break;
   
       case HTML_EL_IMG:
         /* Check the mandatory ALT attribute */
         CheckMandatoryAttribute (el, doc, HTML_ATTR_ALT);
         /* Check the mandatory SRC attribute */
         CheckMandatoryAttribute (el, doc, HTML_ATTR_SRC);
         /* We need a PICTURE element as child to hold the image */
         picture = NULL;
         child = TtaGetFirstChild (el);
         if (child)
           {
             elType = TtaGetElementType (child);
             if (elType.ElTypeNum == HTML_EL_PICTURE_UNIT)
               // the picture is already created
               picture = child;
           }
         if (picture == NULL)
           {
             elType.ElTypeNum = HTML_EL_PICTURE_UNIT;
             picture = TtaNewTree (doc, elType, "");
             if (child)
               TtaInsertSibling (picture, child, TRUE, doc);
             else
               TtaInsertFirstChild (&picture, el, doc);
           }
         attrType.AttrSSchema = elType.ElSSchema;
         attrType.AttrTypeNum = HTML_ATTR_SRC;
         attr = TtaGetAttribute (el, attrType);
         if (attr)
           /* the img has a src attribute */
           {
             length = TtaGetTextAttributeLength (attr);
             data = (char *)TtaGetMemory (length + 1);
             TtaGiveTextAttributeValue (attr, data, &length);
             if (data)
               {
                 // remove extra spaces
                 clean = FALSE;
                 while (length > 0 && data[length-1] == SPACE)
                   {
                     data[length-1] = EOS;
                     length--;
                     clean = TRUE;
                   }
                 if (clean)
                   TtaSetAttributeText (attr, data, el, doc);
                 // copy the attribute in the picture element
                 attr = TtaGetAttribute (picture, attrType);
                 if (attr == NULL)
                   {
                     attr = TtaNewAttribute (attrType);
                     TtaAttachAttribute (picture, attr, doc);
                   }
                 TtaSetAttributeText (attr, data, picture, doc);
                 TtaFreeMemory (data);
               }
           }
         attrType.AttrTypeNum = HTML_ATTR_Height_;
         attr = TtaGetAttribute (el, attrType);
         if (attr)
           /* the img has a height attribute. Applies it to the
              picture element */
           {
             length = TtaGetTextAttributeLength (attr);
             if (length > 0)
               {
                 text = (char *)TtaGetMemory (length + 1);
                 TtaGiveTextAttributeValue (attr, text, &length);
                 /* create the corresponding attribute IntHeightPercent or */
                 /* IntHeightPxl */
                 CreateAttrHeightPercentPxl (text, el, doc, -1);
                 TtaFreeMemory (text);
               }
           }
         attrType.AttrTypeNum = HTML_ATTR_Width__;
         attr = TtaGetAttribute (el, attrType);
         if (attr)
           /* the img has a width attribute. Applies it to the
              picture element */
           {
             length = TtaGetTextAttributeLength (attr);
             if (length > 0)
               {
                 text = (char *)TtaGetMemory (length + 1);
                 TtaGiveTextAttributeValue (attr, text, &length);
                 /* create the corresponding attribute IntWidthPercent or */
                 /* IntWidthPxl */
                 CreateAttrWidthPercentPxl (text, el, doc, -1);
                 TtaFreeMemory (text);
               }
           }
       break;        break;
   
     case HTML_EL_Parameter:      case HTML_EL_Parameter:
Line 903  void XhtmlElementComplete (ParserData *c Line 1008  void XhtmlElementComplete (ParserData *c
       /* Check the mandatory alt attribute */        /* Check the mandatory alt attribute */
       CheckMandatoryAttribute (el, doc, HTML_ATTR_ALT);        CheckMandatoryAttribute (el, doc, HTML_ATTR_ALT);
       break;        break;
   
     case HTML_EL_PICTURE_UNIT:  
       /* Check the mandatory ALT attribute */  
       attrType.AttrSSchema = htmlSchema;  
       attrType.AttrTypeNum = HTML_ATTR_IsInput;  
       if (TtaGetAttribute (el, attrType) == NULL)  
         CheckMandatoryAttribute (el, doc, HTML_ATTR_ALT);  
       /* Check the mandatory SRC attribute */  
       CheckMandatoryAttribute (el, doc, HTML_ATTR_SRC);  
       break;  
                 
     case HTML_EL_LINK:      case HTML_EL_LINK:
       CheckCSSLink (el, doc, htmlSchema);        CheckCSSLink (el, doc, htmlSchema);
Line 1280  void CreateAttrWidthPercentPxl (char *bu Line 1375  void CreateAttrWidthPercentPxl (char *bu
   isImage = (elType.ElTypeNum == HTML_EL_PICTURE_UNIT ||    isImage = (elType.ElTypeNum == HTML_EL_PICTURE_UNIT ||
              elType.ElTypeNum == HTML_EL_Data_cell ||               elType.ElTypeNum == HTML_EL_Data_cell ||
              elType.ElTypeNum == HTML_EL_Heading_cell ||               elType.ElTypeNum == HTML_EL_Heading_cell ||
              elType.ElTypeNum == HTML_EL_Object);               elType.ElTypeNum == HTML_EL_Object ||
                elType.ElTypeNum == HTML_EL_IMG);
   
   if (elType.ElTypeNum == HTML_EL_Object)    if (elType.ElTypeNum == HTML_EL_Object)
     /* the width attribute is attached to an Object element */      /* the width attribute is attached to an Object element */
Line 1409  void CreateAttrHeightPercentPxl (char *b Line 1505  void CreateAttrHeightPercentPxl (char *b
   isImage = (elType.ElTypeNum == HTML_EL_PICTURE_UNIT ||    isImage = (elType.ElTypeNum == HTML_EL_PICTURE_UNIT ||
              elType.ElTypeNum == HTML_EL_Data_cell ||               elType.ElTypeNum == HTML_EL_Data_cell ||
              elType.ElTypeNum == HTML_EL_Heading_cell ||               elType.ElTypeNum == HTML_EL_Heading_cell ||
              elType.ElTypeNum == HTML_EL_Object);               elType.ElTypeNum == HTML_EL_Object ||
                elType.ElTypeNum == HTML_EL_IMG);
   
   if (elType.ElTypeNum == HTML_EL_Object)    if (elType.ElTypeNum == HTML_EL_Object)
     /* the height attribute is attached to an Object element */      /* the height attribute is attached to an Object element */

Removed from v.1.133  
changed lines
  Added in v.1.134


Webmaster