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/24 22:08:27 UTC

svn commit: r434497 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties: LengthRangeProperty.java PercentLength.java

Author: adelmelle
Date: Thu Aug 24 13:08:26 2006
New Revision: 434497

URL: http://svn.apache.org/viewvc?rev=434497&view=rev
Log:
Fix: suppressed call to PercentLength.getBaseLength() without context (introduced in r433385)

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PercentLength.java

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=434497&r1=434496&r2=434497&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 Thu Aug 24 13:08:26 2006
@@ -73,10 +73,14 @@
             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);
+                if (len != null) {
+                    if ((len instanceof FixedLength && len.getValue() < 0)
+                            || (len instanceof PercentLength
+                                && ((PercentLength) len).getPercentage() < 0)) {
+                        log.warn("Replaced negative value for " + getName()
+                                + " with 0mpt");
+                        p = new FixedLength(0);
+                    }
                 }
             }
             
@@ -283,7 +287,7 @@
     /**
      * @return this.lengthRange cast as an Object
      */
-    public Object getObject() {
+    protected Object getObject() {
         return this;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PercentLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PercentLength.java?rev=434497&r1=434496&r2=434497&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PercentLength.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PercentLength.java Thu Aug 24 13:08:26 2006
@@ -63,12 +63,13 @@
     }
 
     /**
-     *
-     * @return the factor
-     * TODO: Should this really exists? 
+     * Used during property resolution to check for 
+     * negative percentages
+     * 
+     * @return the percentage value
      */
-    public double value() {
-        return factor;
+    protected double getPercentage() {
+        return factor * 100;
     }
 
     /**
@@ -113,7 +114,7 @@
     public int getValue(PercentBaseContext context) {
         return (int) getNumericValue(context);
     }
-
+    
     /**
      * @return the String equivalent of this
      */



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