pbwest      2002/09/20 21:39:32

  Modified:    src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design
                        Properties.java
  Log:
  Changed FOTree arg to refineParsing() to FONode.
   Added resolve() calls to IndirectValues.
  Added refineExpansionList() and applied to shorthand expansions.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.25  +245 -155  xml-fop/src/org/apache/fop/fo/Attic/Properties.java
  
  Index: Properties.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v
  retrieving revision 1.1.2.24
  retrieving revision 1.1.2.25
  diff -u -r1.1.2.24 -r1.1.2.25
  --- Properties.java   18 Sep 2002 15:42:12 -0000      1.1.2.24
  +++ Properties.java   21 Sep 2002 04:39:30 -0000      1.1.2.25
  @@ -60,6 +60,7 @@
   import org.apache.fop.datatypes.ShadowEffect;
   import org.apache.fop.datatypes.Slash;
   import org.apache.fop.datatypes.indirect.Inherit;
  +import org.apache.fop.datatypes.indirect.InheritedValue;
   import org.apache.fop.datatypes.indirect.FromParent;
   import org.apache.fop.datatypes.indirect.FromNearestSpecified;
   
  @@ -313,19 +314,19 @@
        *
        * <p>This method is overriden by individual property classes which
        * require specific processing.
  -     * @param foTree - the <tt>FOTree</tt> being built
  +     * @param foNode - the <tt>FONode</tt> being built
        * @param value - <tt>PropertyValue</tt> returned by the parser
        */
       public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
               throws PropertyException
       {
  -        return refineParsing(foTree, value, NOT_NESTED);
  +        return refineParsing(foNode, value, NOT_NESTED);
       }
   
       /**
        * Do the work for the two argument refineParsing method.
  -     * @param foTree - the <tt>FOTree</tt> being built
  +     * @param foNode - the <tt>FONode</tt> being built
        * @param value - <tt>PropertyValue</tt> returned by the parser
        * @param nested - <tt>boolean</tt> indicating whether this method is
        * called normally (false), or as part of another <i>refineParsing</i>
  @@ -333,13 +334,14 @@
        * @see #refineParsing(FOTree,PropertyValue)
        */
       protected static PropertyValue refineParsing
  -                        (FOTree foTree, PropertyValue value, boolean nested)
  +                        (FONode foNode, PropertyValue value, boolean nested)
               throws PropertyException
       {
           int property = value.getProperty();
           String propName = PropNames.getPropertyName(property);
           int datatype = PropertyConsts.dataTypes.get(property);
           int proptype = value.getType();
  +        PropertyValue pv;
           switch (proptype) {
           case PropertyValue.NUMERIC:
               // Can be any of
  @@ -363,7 +365,7 @@
               if ((datatype & ENUM) != 0)
                   return new EnumType(property, ncname);
               if ((datatype & MAPPED_LENGTH) != 0)
  -                return (new MappedNumeric(property, ncname, foTree))
  +                return (new MappedNumeric(property, ncname, foNode.foTree))
                                   .getMappedNumValue();
           case PropertyValue.LITERAL:
               // Can be LITERAL or CHARACTER_T
  @@ -396,10 +398,28 @@
               if ((datatype & MIMETYPE) != 0) return value;
               throw new PropertyException
                           ("mimetype invalid for " + propName);
  +        // The following types cannot have their values validated in advance.
  +        // The result must be validated from within the property type.
  +        case PropertyValue.FROM_PARENT:
  +            pv = ((FromParent)value).resolve(foNode);
  +            if (pv == value) return value;  // unable to resolve
  +            // TODO: validate here
  +            return pv;
  +        case PropertyValue.FROM_NEAREST_SPECIFIED:
  +            pv = ((FromNearestSpecified)value).resolve(foNode);
  +            if (pv == value) return value;  // unable to resolve
  +            // TODO: validate here
  +            return pv;
  +        case PropertyValue.INHERITED_VALUE:
  +            pv = ((InheritedValue)value).resolve(foNode);
  +            if (pv == value) return value;  // unable to resolve
  +            // TODO: validate here
  +            return pv;
           default:
               if ( ! nested) {
                   if (proptype == PropertyValue.INHERIT) {
  -                    if ((datatype & INHERIT) != 0) return value;
  +                    if ((datatype & INHERIT) != 0)
  +                        return ((Inherit)value).resolve(foNode);
                       throw new PropertyException
                                       ("'inherit' invalid for " + propName);
                   }
  @@ -411,6 +431,41 @@
       }
   
       /**
  +     * Refine a list of property values against their properties.
  +     * Expansion lists are generated by shorthand and compound expansion.
  +     * The set of properties will, in general, be different from the
  +     * generating property, which will be the one associated with the list
  +     * itself.
  +     * @param foNode - the <tt>FONode</tt> for which the properties are
  +     * being processed.
  +     * @param list - the list of <tt>PropertyValues</tt> to be refined.
  +     * @return a <tt>PropertyValueList>/tt> containing the refined property
  +     * values.
  +     */
  +    private static PropertyValueList refineExpansionList
  +                                    (FONode foNode, PropertyValueList list)
  +            throws PropertyException
  +    {
  +        PropertyValueList newlist = new PropertyValueList(list.getProperty());
  +        Iterator properties = list.iterator();
  +        while (properties.hasNext()) {
  +            // refine the next element
  +            PropertyValue pv =
  +                    PropertyConsts.refineParsing
  +                                (foNode, (PropertyValue)(properties.next()));
  +            // if it's a list, recursively refine.  This will return a list
  +            if (pv.getType() == PropertyValue.LIST) {
  +                PropertyValueList pvl =
  +                        refineExpansionList(foNode, (PropertyValueList)pv);
  +                newlist.addAll(pvl);
  +            } else { // single element
  +                newlist.add(pv);
  +            }
  +        }
  +        return newlist;
  +    }
  +
  +    /**
        * Determine whether argument <i>list</i> contains a space-separated list
        * from the parser.
        * A space-separated list will be represented by a
  @@ -534,31 +589,31 @@
        *  N.B. this is the order of elements defined in
        *       PropertySets.borderRightExpansion
        */
  -    protected static PropertyValue borderEdge(FOTree foTree,
  +    protected static PropertyValue borderEdge(FONode foNode,
               PropertyValue value, int styleProp, int colorProp, int widthProp)
                   throws PropertyException
       {
           return borderEdge
  -                (foTree, value, styleProp, colorProp, widthProp, NOT_NESTED);
  +                (foNode, value, styleProp, colorProp, widthProp, NOT_NESTED);
       }
   
       protected static PropertyValue borderEdge
  -            (FOTree foTree, PropertyValue value, int styleProp,
  +            (FONode foNode, PropertyValue value, int styleProp,
                   int colorProp, int widthProp, boolean nested)
                   throws PropertyException
       {
           if (value.getType() != PropertyValue.LIST) {
               return processEdgeValue
  -                    (foTree, value, styleProp, colorProp, widthProp, nested);
  +                    (foNode, value, styleProp, colorProp, widthProp, nested);
           } else {
               return processEdgeList
  -                (foTree, spaceSeparatedList((PropertyValueList)value),
  +                (foNode, spaceSeparatedList((PropertyValueList)value),
                                               styleProp, colorProp, widthProp);
           }
       }
   
       private static PropertyValueList processEdgeValue
  -            (FOTree foTree, PropertyValue value, int styleProp,
  +            (FONode foNode, PropertyValue value, int styleProp,
                   int colorProp, int widthProp, boolean nested)
               throws PropertyException
       {
  @@ -567,18 +622,22 @@
               if (type == PropertyValue.INHERIT ||
                       type == PropertyValue.FROM_PARENT ||
                           type == PropertyValue.FROM_NEAREST_SPECIFIED)
  +            {
                   // Construct a list of Inherit values
  -                return PropertySets.expandAndCopySHand(value);
  +                PropertyValueList list =
  +                                    PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList(foNode, list);
  +            }
           }
           // Make a list and pass to processList
           PropertyValueList tmpList
                   = new PropertyValueList(value.getProperty());
           tmpList.add(value);
           return processEdgeList
  -                    (foTree, tmpList, styleProp, colorProp, widthProp);
  +                    (foNode, tmpList, styleProp, colorProp, widthProp);
       }
   
  -    private static PropertyValueList processEdgeList(FOTree foTree,
  +    private static PropertyValueList processEdgeList(FONode foNode,
           PropertyValueList value, int styleProp, int colorProp, int widthProp)
                       throws PropertyException
       {
  @@ -623,7 +682,7 @@
   
                   try {
                       widthFound =
  -                        (new MappedNumeric(widthProp, ncname, foTree))
  +                        (new MappedNumeric(widthProp, ncname, foNode.foTree))
                               .getMappedNumValue();
                   } catch (PropertyException e) {}
                   if (widthFound != null) {
  @@ -1047,19 +1106,19 @@
            *   a BackgroundPositionVertical Numeric or Inherit value
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               if ( ! (value instanceof PropertyValueList)) {
  -                return processValue(foTree, value);
  +                return processValue(foNode, value);
               } else {
                   return processList
  -                    (foTree, spaceSeparatedList((PropertyValueList)value));
  +                    (foNode, spaceSeparatedList((PropertyValueList)value));
               }
           }
   
           private static PropertyValueList processValue
  -            (FOTree foTree, PropertyValue value) throws PropertyException
  +            (FONode foNode, PropertyValue value) throws PropertyException
           {
               // Can be Inherit, ColorType, UriType, None, Numeric, or an
               // NCName (i.e. enum token)
  @@ -1069,18 +1128,19 @@
                           type == PropertyValue.FROM_NEAREST_SPECIFIED)
               {
                   // Construct a list of Inherit values
  -                return PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand(value));
               } else  {
                   // Make a list and pass to processList
                   PropertyValueList tmpList
                           = new PropertyValueList(value.getProperty());
                   tmpList.add(value);
  -                return processList(foTree, tmpList);
  +                return processList(foNode, tmpList);
               }
           }
   
           private static PropertyValueList processList
  -                (FOTree foTree, PropertyValueList value)
  +                                    (FONode foNode, PropertyValueList value)
                           throws PropertyException
           {
               int property = value.getProperty();
  @@ -1146,14 +1206,14 @@
                               "position overrides previous position");
                       if (tmpval == null)
                           position = BackgroundPosition.refineParsing
  -                                                (foTree, pval, IS_NESTED);
  +                                                (foNode, pval, IS_NESTED);
                       else { // 2 elements
                           // make a space-separated list
                           PropertyValueList ssList = new PropertyValueList
                                               (PropNames.BACKGROUND_POSITION);
                           ssList.add(posnList);
                           position = BackgroundPosition.refineParsing
  -                                                (foTree, ssList, IS_NESTED);
  +                                                (foNode, ssList, IS_NESTED);
                       }
                       continue scanning_elements;
                   }  // end of case NUMERIC
  @@ -1236,11 +1296,11 @@
                                               (PropNames.BACKGROUND_POSITION);
                               ssList.add(posnList);
                               position = BackgroundPosition.refineParsing
  -                                                (foTree, ssList, IS_NESTED);
  +                                                (foNode, ssList, IS_NESTED);
                           } else { // one only
                           // Now send one NCName to BackgroundPosition
                               position = BackgroundPosition.refineParsing
  -                                                (foTree, pval, IS_NESTED);
  +                                                (foNode, pval, IS_NESTED);
                           }
                           continue scanning_elements;
                       }
  @@ -1386,20 +1446,20 @@
            * containing the expansion of the shorthand.  I.e. the first
            * element is a value for BackgroundPositionHorizontal, and the
            * second is for BackgroundPositionVertical.
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
  -            return refineParsing(foTree, value, NOT_NESTED);
  +            return refineParsing(foNode, value, NOT_NESTED);
           }
   
           /**
            * Do the work for the two argument refineParsing method.
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @param nested <tt>boolean</tt> indicating whether this method is
            * called normally (false), or as part of another <i>refineParsing</i>
  @@ -1408,11 +1468,11 @@
            * @see #refineParsing(FOTree,PropertyValue)
            */
           public static PropertyValue refineParsing
  -                        (FOTree foTree, PropertyValue value, boolean nested)
  +                        (FONode foNode, PropertyValue value, boolean nested)
                           throws PropertyException
           {
               if ( ! (value instanceof PropertyValueList)) {
  -                return processValue(value, nested);
  +                return processValue(foNode, value, nested);
               } else {
                   return processList
                               (spaceSeparatedList((PropertyValueList)value));
  @@ -1420,8 +1480,8 @@
           }
   
           private static PropertyValueList processValue
  -                                        (PropertyValue value, boolean nested)
  -                        throws PropertyException
  +                        (FONode foNode, PropertyValue value, boolean nested)
  +                    throws PropertyException
           {
               PropertyValueList newlist
                               = new PropertyValueList(value.getProperty());
  @@ -1433,8 +1493,8 @@
                           type == PropertyValue.FROM_PARENT ||
                               type == PropertyValue.FROM_NEAREST_SPECIFIED) {
                       // Construct a list of Inherit values
  -                    newlist = PropertySets.expandAndCopySHand(value);
  -                    return newlist;
  +                    newlist = refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(value));
                   }
               }
   
  @@ -1872,7 +1932,7 @@
           public static final int inherited = NO;
   
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
               throws PropertyException
           {
               int type = value.getType();
  @@ -1880,7 +1940,8 @@
                       type == PropertyValue.FROM_PARENT ||
                           type == PropertyValue.FROM_NEAREST_SPECIFIED)
                   // Construct a list of Inherit values
  -                return PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand(value));
   
               PropertyValueList ssList = null;
               // Must be a space-separated list or a single value from the
  @@ -1907,7 +1968,7 @@
                   PropertyValue val = (PropertyValue)(values.next());
                   PropertyValue pv = null;
                   try {
  -                    pv = BorderWidth.refineParsing(foTree, val, IS_NESTED);
  +                    pv = BorderWidth.refineParsing(foNode, val, IS_NESTED);
                       if (width != null)
                           MessageHandler.log("border: duplicate" +
                           "width overrides previous width");
  @@ -1915,7 +1976,7 @@
                       continue;
                   } catch (PropertyException e) {}
                   try {
  -                    pv = BorderStyle.refineParsing(foTree, val, IS_NESTED);
  +                    pv = BorderStyle.refineParsing(foNode, val, IS_NESTED);
                       if (style != null)
                           MessageHandler.log("border: duplicate" +
                           "style overrides previous style");
  @@ -1923,7 +1984,7 @@
                       continue;
                   } catch (PropertyException e) {}
                   try {
  -                    pv = BorderColor.refineParsing(foTree, val, IS_NESTED);
  +                    pv = BorderColor.refineParsing(foNode, val, IS_NESTED);
                       if (color != null)
                           MessageHandler.log("border: duplicate" +
                           "color overrides previous color");
  @@ -1938,7 +1999,8 @@
               }
               // Construct the shorthand expansion list
               PropertyValueList borderexp =
  -                PropertySets.initialValueExpansion(foTree, PropNames.BORDER);
  +                PropertySets.initialValueExpansion
  +                                            (foNode.foTree, PropNames.BORDER);
               if (style != null)
                   borderexp = PropertySets.overrideSHandElements(borderexp,
                                                       (PropertyValueList)style);
  @@ -2176,15 +2238,15 @@
            *  N.B. this is the order of elements defined in
            *       PropertySets.borderRightExpansion
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
  -            return Properties.borderEdge(foTree, value,
  +            return Properties.borderEdge(foNode, value,
                                       PropNames.BORDER_BOTTOM_STYLE,
                                       PropNames.BORDER_BOTTOM_COLOR,
                                       PropNames.BORDER_BOTTOM_WIDTH
  @@ -2295,29 +2357,29 @@
            * the third element is a value for border-bottom-color,
            * the fourth element is a value for border-left-color.
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
  -            return refineParsing(foTree, value, NOT_NESTED);
  +            return refineParsing(foNode, value, NOT_NESTED);
           }
   
           /**
            * Do the work for the two argument refineParsing method.
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @param nested <tt>boolean</tt> indicating whether this method is
            * called normally (false), or as part of another <i>refineParsing</i>
            * method.
            * @return <tt>PropertyValue</tt> the verified value
  -         * @see #refineParsing(FOTree,PropertyValue)
  +         * @see #refineParsing(FONode,PropertyValue)
            */
           public static PropertyValue refineParsing
  -                        (FOTree foTree, PropertyValue value, boolean nested)
  +                        (FONode foNode, PropertyValue value, boolean nested)
                       throws PropertyException
           {
               int type = value.getType();
  @@ -2326,10 +2388,12 @@
                       if (type == PropertyValue.INHERIT ||
                               type == PropertyValue.FROM_PARENT ||
                                   type == PropertyValue.FROM_NEAREST_SPECIFIED)
  -                        return PropertySets.expandAndCopySHand(value);
  +                        return refineExpansionList
  +                            (foNode, PropertySets.expandAndCopySHand(value));
                   }
                   if (type == PropertyValue.COLOR_TYPE)
  -                    return PropertySets.expandAndCopySHand(value);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(value));
                   if (type == PropertyValue.NCNAME) {
                       // Must be a standard color
                       ColorType color;
  @@ -2341,7 +2405,8 @@
                               (((NCName)value).getNCName() +
                                   " not a standard color for border-color");
                       }
  -                    return PropertySets.expandAndCopySHand(color);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(color));
                   }
                   else throw new PropertyException
                       ("Invalid " + value.getClass().getName() +
  @@ -2542,15 +2607,15 @@
            *  N.B. this is the order of elements defined in
            *       PropertySets.borderRightExpansion
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
  -            return Properties.borderEdge(foTree, value,
  +            return Properties.borderEdge(foNode, value,
                                       PropNames.BORDER_LEFT_STYLE,
                                       PropNames.BORDER_LEFT_COLOR,
                                       PropNames.BORDER_LEFT_WIDTH
  @@ -2628,15 +2693,15 @@
            *  N.B. this is the order of elements defined in
            *       PropertySets.borderRightExpansion
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
  -            return Properties.borderEdge(foTree, value,
  +            return Properties.borderEdge(foNode, value,
                                       PropNames.BORDER_RIGHT_STYLE,
                                       PropNames.BORDER_RIGHT_COLOR,
                                       PropNames.BORDER_RIGHT_WIDTH
  @@ -2750,12 +2815,12 @@
            *   Note: the Lengths cannot be percentages (what about relative
            *         lengths?)
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
               int type = value.getType();
  @@ -2763,11 +2828,13 @@
                   if (type == PropertyValue.INHERIT ||
                           type == PropertyValue.FROM_PARENT ||
                               type == PropertyValue.FROM_NEAREST_SPECIFIED)
  -                    return PropertySets.expandAndCopySHand(value);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(value));
   
                   if (type == PropertyValue.NUMERIC &&
                                                   ((Numeric)value).isLength())
  -                    return PropertySets.expandAndCopySHand(value);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(value));
   
                   throw new PropertyException
                       ("Invalid " + value.getClass().getName() +
  @@ -2929,29 +2996,29 @@
            * the third element is a value for border-bottom-style,
            * the fourth element is a value for border-left-style.
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
  -            return refineParsing(foTree, value, NOT_NESTED);
  +            return refineParsing(foNode, value, NOT_NESTED);
           }
   
           /**
            * Do the work for the two argument refineParsing method.
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @param nested <tt>boolean</tt> indicating whether this method is
            * called normally (false), or as part of another <i>refineParsing</i>
            * method.
            * @return <tt>PropertyValue</tt> the verified value
  -         * @see #refineParsing(FOTree,PropertyValue)
  +         * @see #refineParsing(FONode,PropertyValue)
            */
           public static PropertyValue refineParsing
  -                        (FOTree foTree, PropertyValue value, boolean nested)
  +                        (FONode foNode, PropertyValue value, boolean nested)
                       throws PropertyException
           {
               int type = value.getType();
  @@ -2960,7 +3027,8 @@
                       if (type == PropertyValue.INHERIT ||
                               type == PropertyValue.FROM_PARENT ||
                                   type == PropertyValue.FROM_NEAREST_SPECIFIED)
  -                        return PropertySets.expandAndCopySHand(value);
  +                        return refineExpansionList
  +                            (foNode, PropertySets.expandAndCopySHand(value));
                   }
                   if (type == PropertyValue.NCNAME) {
                       // Must be a border-style
  @@ -2973,7 +3041,8 @@
                               (((NCName)value).getNCName() +
                                                       " not a border-style");
                       }
  -                    return PropertySets.expandAndCopySHand(enum);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(enum));
                   }
                   else throw new PropertyException
                       ("Invalid " + value.getClass().getName() +
  @@ -3049,15 +3118,15 @@
            *  N.B. this is the order of elements defined in
            *       PropertySets.borderRightExpansion
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
  -            return Properties.borderEdge(foTree, value,
  +            return Properties.borderEdge(foNode, value,
                                       PropNames.BORDER_TOP_STYLE,
                                       PropNames.BORDER_TOP_COLOR,
                                       PropNames.BORDER_TOP_WIDTH
  @@ -3146,29 +3215,29 @@
            * the third element is a value for border-bottom-width,
            * the fourth element is a value for border-left-width.
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
  -            return refineParsing(foTree, value, NOT_NESTED);
  +            return refineParsing(foNode, value, NOT_NESTED);
           }
   
           /**
            * Do the work for the two argument refineParsing method.
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @param nested <tt>boolean</tt> indicating whether this method is
            * called normally (false), or as part of another <i>refineParsing</i>
            * method.
            * @return <tt>PropertyValue</tt> the verified value
  -         * @see #refineParsing(FOTree,PropertyValue)
  +         * @see #refineParsing(FONode,PropertyValue)
            */
           public static PropertyValue refineParsing
  -                        (FOTree foTree, PropertyValue value, boolean nested)
  +                        (FONode foNode, PropertyValue value, boolean nested)
                       throws PropertyException
           {
               int type = value.getType();
  @@ -3177,7 +3246,8 @@
                       if (type == PropertyValue.INHERIT ||
                               type == PropertyValue.FROM_PARENT ||
                                   type == PropertyValue.FROM_NEAREST_SPECIFIED)
  -                        return PropertySets.expandAndCopySHand(value);
  +                        return refineExpansionList
  +                            (foNode, PropertySets.expandAndCopySHand(value));
                   }
                   if (type == PropertyValue.NCNAME) {
                       // Must be a border-width
  @@ -3188,7 +3258,7 @@
                       try {
                           mapped =
                               (new MappedNumeric(PropNames.BORDER_TOP_WIDTH,
  -                                ((NCName)value).getNCName(), foTree))
  +                                ((NCName)value).getNCName(), foNode.foTree))
                                       .getMappedNumValue();
                       } catch (PropertyException e) {
                           throw new PropertyException
  @@ -3197,7 +3267,8 @@
                       }
                       // Correct the property in the mapped Numeric
                       mapped.setProperty(PropNames.BORDER_WIDTH);
  -                    return PropertySets.expandAndCopySHand(mapped);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(mapped));
                   }
                   else throw new PropertyException
                       ("Invalid " + value.getClass().getName() +
  @@ -3221,11 +3292,13 @@
                   // There must be at least two
                   top = (new MappedNumeric
                               (PropNames.BORDER_TOP_WIDTH,
  -                            ((NCName)(widths.next())).getNCName(), foTree)
  +                            ((NCName)(widths.next())).getNCName(),
  +                            foNode.foTree)
                           ).getMappedNumValue();
                   right = (new MappedNumeric
                               (PropNames.BORDER_RIGHT_WIDTH,
  -                            ((NCName)(widths.next())).getNCName(), foTree)
  +                            ((NCName)(widths.next())).getNCName(),
  +                            foNode.foTree)
                           ).getMappedNumValue();
                   try {
                       bottom = (Numeric)(top.clone());
  @@ -3240,12 +3313,14 @@
                   if (widths.hasNext())
                       bottom = (new MappedNumeric
                                   (PropNames.BORDER_BOTTOM_WIDTH,
  -                                ((NCName)(widths.next())).getNCName(), foTree)
  +                                ((NCName)(widths.next())).getNCName(),
  +                                foNode.foTree)
                               ).getMappedNumValue();
                   if (widths.hasNext())
                       left = (new MappedNumeric
                                   (PropNames.BORDER_LEFT_WIDTH,
  -                                ((NCName)(widths.next())).getNCName(), foTree)
  +                                ((NCName)(widths.next())).getNCName(),
  +                                foNode.foTree)
                               ).getMappedNumValue();
   
                   list = new PropertyValueList(PropNames.BORDER_WIDTH);
  @@ -3429,12 +3504,12 @@
           public static final int inherited = NO;
   
           /*
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               int type = value.getType();
  @@ -3598,12 +3673,12 @@
            * The first element is a value for cue-before,
            * the second element is a value for cue-after.
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
               int type = value.getType();
  @@ -3612,7 +3687,8 @@
                           type == PropertyValue.FROM_PARENT ||
                               type == PropertyValue.FROM_NEAREST_SPECIFIED ||
                                   type == PropertyValue.URI_TYPE)
  -                    return PropertySets.expandAndCopySHand(value);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(value));
                   throw new PropertyException
                       ("Invalid " + value.getClass().getName() +
                           " object for cue");
  @@ -4022,18 +4098,18 @@
            * <p>The setup of the shorthand expansion list is determined by the
            * above considerations.
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               PropertyValueList startList = null;
               PropertyValueList fontList = null;
               if (value.getType() != PropertyValue.LIST) {
  -                return processValue(foTree, value);
  +                return processValue(foNode, value);
               } else {
                   fontList = (PropertyValueList)value;
                   try {
  @@ -4066,12 +4142,12 @@
                               + "'font' expression");
                       startList = (PropertyValueList)tmpo;
                   }
  -                return processSpaceSepList(foTree, startList, fontList);
  +                return processSpaceSepList(foNode, startList, fontList);
               }
           }
   
           private static PropertyValueList processValue
  -            (FOTree foTree, PropertyValue value)
  +            (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               // Can be Inherit, FromParent, FromNearestSpecified, a
  @@ -4081,7 +4157,8 @@
                       type == PropertyValue.FROM_PARENT ||
                           type == PropertyValue.FROM_NEAREST_SPECIFIED)
               {
  -                return PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand(value));
               }
               // else not Inherit/From../From..
               FontFamilySet family = null;
  @@ -4096,6 +4173,8 @@
                           ("Unrecognized NCName in font expression: " + ncname);
                   }
                   // A system font enum
  +                // System font characteristics should require no further
  +                // refinement
                   return SystemFontFunction.expandFontSHand
                                                   (PropNames.FONT, ncname);
               }
  @@ -4124,6 +4203,8 @@
            * must be from the specification
            * [font-style||font-variant||font-weight]?
            *
  +         * @param foNode the <tt>FONode</tt> with which this property is
  +         * associated.
            * @param list a <tt>PropertyValueList</tt> containing the actual
            * space-separated list; i.e. the single inner list from the
            * outer list returned by the parser. or removed from the front of
  @@ -4138,7 +4219,7 @@
            * @exception PropertyValueException
            */
           private static PropertyValueList
  -                processSpaceSepList(FOTree foTree,
  +                processSpaceSepList(FONode foNode,
                                       PropertyValueList list,
                                       PropertyValueList fontList)
                           throws PropertyException
  @@ -4178,11 +4259,11 @@
                   familyStart = slash + 2;
                   fontsize = slash - 1;
                   size = FontSize.refineParsing
  -                                    (foTree, propvals[fontsize], IS_NESTED);
  +                                    (foNode, propvals[fontsize], IS_NESTED);
                   // derive the line-height
                   // line-height is at slash + 1
                   height = LineHeight.refineParsing
  -                                    (foTree, propvals[slash + 1], IS_NESTED);
  +                                    (foNode, propvals[slash + 1], IS_NESTED);
               } else {
                   // Don''t know where slash is.  If anything precedes the
                   // font-family, it must be a font-size.  Look for that.
  @@ -4193,7 +4274,7 @@
                           String name = ((NCName)propvals[fontsize]).getNCName();
                           try {
                               size = new MappedNumeric
  -                                        (PropNames.FONT_SIZE, name, foTree);
  +                                (PropNames.FONT_SIZE, name, foNode.foTree);
                           } catch (PropertyException e) {
                               // Attempt to derive mapped numeric failed
                               continue;
  @@ -4238,7 +4319,7 @@
               if (fontList.size() == 0
                                   && familyStart == (propvals.length - 1)) {
                   fontset = FontFamily.refineParsing
  -                                (foTree, propvals[familyStart], IS_NESTED);
  +                                (foNode, propvals[familyStart], IS_NESTED);
               } else {
                   // Must develop a list to prepend to fontList
                   PropertyValueList tmpList =
  @@ -4248,7 +4329,7 @@
                   fontList.addFirst(tmpList);
                   // Get a FontFamilySet
                   fontset = FontFamily.refineParsing
  -                                            (foTree, fontList, IS_NESTED);
  +                                            (foNode, fontList, IS_NESTED);
               }
               // Only font-style font-variant and font-weight, in any order
               // remain as possibilities at the front of the expression
  @@ -4256,7 +4337,7 @@
                   PropertyValue pv = null;
                   try {
                       pv = FontStyle.refineParsing
  -                                            (foTree, propvals[i], IS_NESTED);
  +                                            (foNode, propvals[i], IS_NESTED);
                       if (style != null)
                           MessageHandler.log("font: duplicate" +
                           "style overrides previous style");
  @@ -4266,7 +4347,7 @@
   
                   try {
                       pv = FontVariant.refineParsing
  -                                            (foTree, propvals[i], IS_NESTED);
  +                                            (foNode, propvals[i], IS_NESTED);
                       if (variant != null)
                           MessageHandler.log("font: duplicate" +
                           "variant overrides previous variant");
  @@ -4276,7 +4357,7 @@
   
                   try {
                       pv = FontWeight.refineParsing
  -                                            (foTree, propvals[i], IS_NESTED);
  +                                            (foNode, propvals[i], IS_NESTED);
                       if (weight != null)
                           MessageHandler.log("font: duplicate" +
                           "weight overrides previous weight");
  @@ -4292,7 +4373,8 @@
               // values of individual components
   
               newlist =
  -                PropertySets.initialValueExpansion(foTree, PropNames.FONT);
  +                PropertySets.initialValueExpansion
  +                                            (foNode.foTree, PropNames.FONT);
               // For each discovered property, override the value in the
               // initial value expansion.
               ListIterator expansions = newlist.listIterator();
  @@ -4357,7 +4439,7 @@
           }
   
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               // There is no point in attempting to validate the enumeration
  @@ -4373,11 +4455,11 @@
               // be at the top level, and any font family names
               // that contained spaces will be in PropertyValueLists.
   
  -            return refineParsing(foTree, value, NOT_NESTED);
  +            return refineParsing(foNode, value, NOT_NESTED);
           }
   
           public static PropertyValue refineParsing
  -                        (FOTree foTree, PropertyValue value, boolean nested)
  +                        (FONode foNode, PropertyValue value, boolean nested)
                           throws PropertyException
           {
               int property = value.getProperty();
  @@ -4385,8 +4467,7 @@
               // First, check that we have a list
               if (type != PropertyValue.LIST) {
                   if ( ! nested && type == PropertyValue.INHERIT) {
  -                    return value; // DUMMY
  -                    //return ((Inherit)value).resolve(foTree);
  +                    return ((Inherit)value).resolve(foNode);
                   }
                   if ( ! (value instanceof StringType))
                       throw new PropertyException
  @@ -4657,34 +4738,34 @@
           public static final ROStringArray enumValues = enums;
   
           /*
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
  -            return refineParsing(foTree, value, NOT_NESTED);
  +            return refineParsing(foNode, value, NOT_NESTED);
           }
   
           /**
            * Do the work for the two argument refineParsing method.
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @param nested <tt>boolean</tt> indicating whether this method is
            * called normally (false), or as part of another <i>refineParsing</i>
            * method.
            * @return <tt>PropertyValue</tt> the verified value
  -         * @see #refineParsing(FOTree,PropertyValue)
  +         * @see #refineParsing(FONode,PropertyValue)
            */
           public static PropertyValue refineParsing
  -                        (FOTree foTree, PropertyValue value, boolean nested)
  +                        (FONode foNode, PropertyValue value, boolean nested)
                           throws PropertyException
           {
               // Override the shadowed method to ensure that Integer values
               // are limited to the valid numbers
  -            PropertyValue fw = Properties.refineParsing(foTree, value, nested);
  +            PropertyValue fw = Properties.refineParsing(foNode, value, nested);
               // If the result is an IntegerType, restrict the values
               if (fw instanceof IntegerType) {
                   int weight = ((IntegerType)fw).getInt();
  @@ -5549,12 +5630,12 @@
            * the third element is a value for margin-bottom,
            * the fourth element is a value for margin-left.
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
               if ( ! (value instanceof PropertyValueList)) {
  @@ -5562,9 +5643,13 @@
                       || value instanceof FromParent
                       || value instanceof FromNearestSpecified
                       )
  -                    return PropertySets.expandAndCopySHand(value);
  -                return PropertySets.expandAndCopySHand
  -                                                    (autoOrDistance(value));
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(value));
  +                // N.B.  Does this require further refinement?
  +                // Where is Auto expanded?
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand
  +                                                    (autoOrDistance(value)));
               } else {
                   PropertyValueList list =
                                   spaceSeparatedList((PropertyValueList)value);
  @@ -5936,12 +6021,12 @@
            * the third element is a value for padding-bottom,
            * the fourth element is a value for padding-left.
            *
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                       throws PropertyException
           {
               if ( ! (value instanceof PropertyValueList)) {
  @@ -5951,7 +6036,8 @@
                       || (value instanceof Numeric
                               && ((Numeric)value).isDistance())
                       )
  -                    return PropertySets.expandAndCopySHand(value);
  +                    return refineExpansionList
  +                        (foNode, PropertySets.expandAndCopySHand(value));
                   throw new PropertyException
                       ("Invalid property value for 'padding': "
                           + value.getClass().getName());
  @@ -6253,12 +6339,12 @@
           }
   
           /*
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               if (value instanceof Inherit |
  @@ -6266,7 +6352,8 @@
                           value instanceof FromNearestSpecified |
                               value instanceof Auto)
               {
  -                return PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand(value));
               }
               if (value instanceof NCName) {
                   EnumType enum = null;
  @@ -6315,12 +6402,12 @@
                                               = PageBreakAfter.rwEnumValues;
   
           /*
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               if (value instanceof Inherit |
  @@ -6328,7 +6415,8 @@
                           value instanceof FromNearestSpecified |
                               value instanceof Auto)
               {
  -                return PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand(value));
               }
               if (value instanceof NCName) {
                   EnumType enum = null;
  @@ -6385,12 +6473,12 @@
           public static final ROStringArray enumValues = enums;
   
           /*
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               if (value instanceof Inherit |
  @@ -6398,7 +6486,8 @@
                           value instanceof FromNearestSpecified |
                               value instanceof Auto)
               {
  -                return PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand(value));
               }
               if (value instanceof NCName) {
                   EnumType enum = null;
  @@ -6543,19 +6632,20 @@
           public static final ROStringArray enumValues = enums;
   
           /*
  -         * @param foTree the <tt>FOTree</tt> being built
  +         * @param foNode - the <tt>FONode</tt> being built
            * @param value <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue value)
  +                                        (FONode foNode, PropertyValue value)
                           throws PropertyException
           {
               if (value instanceof Inherit |
                       value instanceof FromParent |
                           value instanceof FromNearestSpecified)
               {
  -                return PropertySets.expandAndCopySHand(value);
  +                return refineExpansionList
  +                    (foNode, PropertySets.expandAndCopySHand(value));
               }
               if (value instanceof NCName) {
                   EnumType enum = null;
  @@ -7021,16 +7111,16 @@
           public static final int inherited = NO;
   
           /*
  -         * @param foTree the <tt>FOTree</tt> being built
  -         * @param value <tt>PropertyValue</tt> returned by the parser
  +         * @param foNode - the <tt>FONode</tt> being built
  +         * @param list <tt>PropertyValue</tt> returned by the parser
            * @return <tt>PropertyValue</tt> the verified value
            */
           public static PropertyValue refineParsing
  -                                        (FOTree foTree, PropertyValue list)
  +                                        (FONode foNode, PropertyValue list)
                           throws PropertyException
           {
               if ( ! (list instanceof PropertyValueList))
  -                                return Properties.refineParsing(foTree, list);
  +                                return Properties.refineParsing(foNode, list);
               // Confirm that the list contains only UriType elements
               Iterator iter = ((PropertyValueList)list).iterator();
               while (iter.hasNext()) {
  @@ -7536,14 +7626,14 @@
           public static final ROStringArray enumValues = enums;
   
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue list)
  +                                        (FONode foNode, PropertyValue list)
                           throws PropertyException
           {
               // Check for the enumeration.  Look for a list of NCNames.
               // N.B. it may be possible to perform further checks on the
               // validity of the NCNames - do they match multi-case case names.
               if ( ! (list instanceof PropertyValueList))
  -                return Properties.refineParsing(foTree, list);
  +                return Properties.refineParsing(foNode, list);
   
               PropertyValueList ssList =
                                   spaceSeparatedList((PropertyValueList)list);
  @@ -7814,7 +7904,7 @@
                               });
   
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue list)
  +                                        (FONode foNode, PropertyValue list)
                           throws PropertyException
           {
               byte onMask = NO_DECORATION;
  @@ -7919,12 +8009,12 @@
            * specifier.
            */
           public static PropertyValue refineParsing
  -                (FOTree foTree, PropertyValue list)
  +                                        (FONode foNode, PropertyValue list)
                           throws PropertyException
           {
               int property = list.getProperty();
               if ( ! (list instanceof PropertyValueList)) {
  -                return Properties.refineParsing(foTree, list);
  +                return Properties.refineParsing(foNode, list);
               }
               if (((PropertyValueList)list).size() == 0)
                   throw new PropertyException
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to