You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2006/08/21 23:59:31 UTC

svn commit: r433385 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/fo/properties/LengthRangeProperty.java status.xml test/fotree/disabled-testcases.xml

Author: adelmelle
Date: Mon Aug 21 14:59:30 2006
New Revision: 433385

URL: http://svn.apache.org/viewvc?rev=433385&view=rev
Log:
Minor fix: set negative values to zero for b-p-d/i-p-d

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
    xmlgraphics/fop/trunk/status.xml
    xmlgraphics/fop/trunk/test/fotree/disabled-testcases.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java?rev=433385&r1=433384&r2=433385&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java Mon Aug 21 14:59:30 2006
@@ -20,6 +20,7 @@
 package org.apache.fop.fo.properties;
 
 import org.apache.fop.datatypes.CompoundDatatype;
+import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
@@ -61,14 +62,49 @@
         /**
          * @see CompoundPropertyMaker#convertProperty
          */        
-        public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
-            throws PropertyException
-        {
+        public Property convertProperty(Property p, 
+                                PropertyList propertyList, FObj fo)
+                        throws PropertyException {
+            
             if (p instanceof LengthRangeProperty) {
                 return p;
             }
+            
+            if (this.propId == PR_BLOCK_PROGRESSION_DIMENSION
+                    || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
+                Length len = p.getLength();
+                if (len != null && len.getValue() < 0) {
+                    log.warn("Replaced negative value for " + getName()
+                            + " with 0mpt");
+                    p = new FixedLength(0);
+                }
+            }
+            
             return super.convertProperty(p, propertyList, fo);
         }
+        
+        
+        /**
+         * @see org.apache.fop.fo.properties.PropertyMaker#getSubprop()
+         */
+        protected Property setSubprop(Property baseProperty, int subpropertyId,
+                                        Property subproperty) {
+            CompoundDatatype val = (CompoundDatatype) baseProperty.getObject();
+            if (this.propId == PR_BLOCK_PROGRESSION_DIMENSION
+                    || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
+                Length len = subproperty.getLength();
+                if (len != null && len.getValue() < 0) {
+                    log.warn("Replaced negative value for " + getName()
+                            + " with 0mpt");
+                    val.setComponent(subpropertyId,
+                            new FixedLength(0), false);
+                    return baseProperty;
+                }
+            }
+            val.setComponent(subpropertyId, subproperty, false);
+            return baseProperty;
+        }
+
     }
 
 
@@ -186,8 +222,9 @@
                 // opt is default and max is explicit or default
                 optimum = maximum;
             }
-        } else if (!optimum.isAuto() && !minimum.isAuto() && 
-                optimum.getLength().getValue(context) < minimum.getLength().getValue(context)) {
+        } else if (!optimum.isAuto() && !minimum.isAuto() 
+                    && optimum.getLength().getValue(context) 
+                        < minimum.getLength().getValue(context)) {
             if ((bfSet & MINSET) != 0) {
                 // if minimum is explicit, force opt to min
                 if ((bfSet & OPTSET) != 0) {
@@ -246,7 +283,7 @@
     /**
      * @return this.lengthRange cast as an Object
      */
-    public Object getObject() {
+    protected Object getObject() {
         return this;
     }
 

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=433385&r1=433384&r2=433385&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Mon Aug 21 14:59:30 2006
@@ -28,6 +28,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="AD" type="update">
+        Minor fix: correctly set negative values to zero.
+      </action>
       <action context="Code" dev="AD" type="update" fixes-bug="35656">
         Rework of default column-creation / column-width setting from
         cells in the first row.

Modified: xmlgraphics/fop/trunk/test/fotree/disabled-testcases.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/fotree/disabled-testcases.xml?rev=433385&r1=433384&r2=433385&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/fotree/disabled-testcases.xml (original)
+++ xmlgraphics/fop/trunk/test/fotree/disabled-testcases.xml Mon Aug 21 14:59:30 2006
@@ -23,19 +23,9 @@
     <description></description>
   </testcase>
   <testcase>
-    <name>Negative values on block-progression-dimension</name>
-    <file>block-progression-dimension_negative.fo</file>
-    <description>The code currently doesn't set negative values to 0mpt as mandated by the spec.</description>
-  </testcase>
-  <testcase>
-    <name>Negative values on inline-progression-dimension</name>
-    <file>inline-progression-dimension_negative.fo</file>
-    <description>The code currently doesn't set negative values to 0mpt as mandated by the spec.</description>
-  </testcase>
-  <testcase>
     <name>Markers and core function evaluation</name>
     <file>from-table-column_marker.fo</file>
     <description>The code currently evaluates this function according to the column in which the 
-    marker appearsin the source document, rather than the column it is retrieved in.</description>
+    marker appears in the source document, rather than the column it is retrieved in.</description>
   </testcase>
 </disabled-testcases>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org