diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2009-01-30 18:56:34 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2009-01-30 18:56:34 +0000 |
commit | 34856199208b84891a449d0d97fd11e0803f8e8f (patch) | |
tree | 16f88d48ccade2468ff0c695fad88e4f9cd4b750 /src | |
parent | 03f4dfa913ea78384ca46fc99fada352add6579b (diff) | |
download | xmlgraphics-fop-34856199208b84891a449d0d97fd11e0803f8e8f.tar.gz xmlgraphics-fop-34856199208b84891a449d0d97fd11e0803f8e8f.zip |
Bugzilla #46638: MinOptMaxUtil.toMinOptMax was converting LengthRangeProperty objects into illegal MinOptMax objects (in some cases opt could be inferior to min).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@739376 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java b/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java index 155abcd39..f029d9082 100644 --- a/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java +++ b/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java @@ -103,15 +103,13 @@ public class MinOptMaxUtil { * @return the requested MinOptMax instance */ public static MinOptMax toMinOptMax(LengthRangeProperty prop, PercentBaseContext context) { - MinOptMax mom = new MinOptMax( - (prop.getMinimum(context).isAuto() - ? 0 : prop.getMinimum(context).getLength().getValue(context)), - (prop.getOptimum(context).isAuto() - ? 0 : prop.getOptimum(context).getLength().getValue(context)), - (prop.getMaximum(context).isAuto() - ? Integer.MAX_VALUE - : prop.getMaximum(context).getLength().getValue(context))); - return mom; + int min = prop.getMinimum(context).isAuto() ? 0 + : prop.getMinimum(context).getLength().getValue(context); + int opt = prop.getOptimum(context).isAuto() ? min + : prop.getOptimum(context).getLength().getValue(context); + int max = prop.getMaximum(context).isAuto() ? Integer.MAX_VALUE + : prop.getMaximum(context).getLength().getValue(context); + return new MinOptMax(min, opt, max); } } |