aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2006-08-24 20:08:26 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2006-08-24 20:08:26 +0000
commit61173ad5a278a128d7917276ad0f17ebcca60667 (patch)
treed483d0bfbfb2d43dfa9885df0228f9fbd65aaa74 /src/java
parentaa26e120ea76254da8fb7a0585f51fdd1c9bbf39 (diff)
downloadxmlgraphics-fop-61173ad5a278a128d7917276ad0f17ebcca60667.tar.gz
xmlgraphics-fop-61173ad5a278a128d7917276ad0f17ebcca60667.zip
Fix: suppressed call to PercentLength.getBaseLength() without context (introduced in r433385)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@434497 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/properties/LengthRangeProperty.java14
-rw-r--r--src/java/org/apache/fop/fo/properties/PercentLength.java13
2 files changed, 16 insertions, 11 deletions
diff --git a/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java b/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
index 886cd01ea..09e64a714 100644
--- a/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
+++ b/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
@@ -73,10 +73,14 @@ public class LengthRangeProperty extends Property implements CompoundDatatype {
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 @@ public class LengthRangeProperty extends Property implements CompoundDatatype {
/**
* @return this.lengthRange cast as an Object
*/
- public Object getObject() {
+ protected Object getObject() {
return this;
}
diff --git a/src/java/org/apache/fop/fo/properties/PercentLength.java b/src/java/org/apache/fop/fo/properties/PercentLength.java
index e43ac529c..a1865d7cd 100644
--- a/src/java/org/apache/fop/fo/properties/PercentLength.java
+++ b/src/java/org/apache/fop/fo/properties/PercentLength.java
@@ -63,12 +63,13 @@ public class PercentLength extends LengthProperty {
}
/**
- *
- * @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 class PercentLength extends LengthProperty {
public int getValue(PercentBaseContext context) {
return (int) getNumericValue(context);
}
-
+
/**
* @return the String equivalent of this
*/