From: Simon Steiner Date: Thu, 12 Dec 2019 09:42:19 +0000 (+0000) Subject: FOP-2894: Fit table contents onto current page X-Git-Tag: fop-2_5~30 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c668267826963ff998b71ca6090b8b371081407a;p=xmlgraphics-fop.git FOP-2894: Fit table contents onto current page git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1871261 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java index 136f9c4e3..3bcec5e9a 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java @@ -274,17 +274,19 @@ public class TableStepper { laststep = step; step = getNextStep(); - if (penaltyOrGlueLen < 0) { + int shrink = 0; + int stretch = 0; + int width = -penaltyOrGlueLen; if (keep.getPenalty() == KnuthElement.INFINITE) { - if (boxLen > -penaltyOrGlueLen && boxLen < maxRemainingHeight) { - returnList.add(new KnuthGlue(boxLen, 0, 0, new Position(null), true)); - } else { - returnList.add(new KnuthGlue(0, -penaltyOrGlueLen, 0, new Position(null), true)); + width = (boxLen + -penaltyOrGlueLen) / 2; + if (-penaltyOrGlueLen > maxRemainingHeight) { + width = 0; } - } else { - returnList.add(new KnuthGlue(-penaltyOrGlueLen, 0, 0, new Position(null), true)); + stretch = Math.max(boxLen, -penaltyOrGlueLen); + shrink = Math.min(boxLen, -penaltyOrGlueLen); } + returnList.add(new KnuthGlue(width, stretch, shrink, new Position(null), true)); } } while (step >= 0); assert !returnList.isEmpty(); diff --git a/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml b/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml new file mode 100755 index 000000000..fdc70360c --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml @@ -0,0 +1,203 @@ + + + + + +

+ This test checks border and padding conditionality on table. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Your retirement options + + + + + + + + You’ll need to choose an option for your pension savings, such as: + + + + + ● + + + + + Buy + + + + + + + ● + + + + + Re + + + + + + + ● + + + + + Take + + + + + + + + + ● + + + + + Mix + + + + + + + ● + + + + + Leave + + + + + + + + + + + + + + + + + test test test test test test test test + test test test test test test test test test test test test test test test + + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + + + + + + + + test test test test test test test test test test test + + + + + + + + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + + + + + + + + + + + + + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test + + + + + + + + + + + + + + + + + + + + + + +