From 4ff004719b5ded58bbed329eeb276dcff7e9a6fb Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Thu, 2 Jan 2020 16:28:29 +0000 Subject: [PATCH] FOP-2898: Only use zero glue for change ipd git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1872250 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutmgr/BlockStackingLayoutManager.java | 6 + .../fop/layoutmgr/table/TableStepper.java | 14 +- .../table_border_padding_8.xml | 148 ++++++++++++++++++ .../table_border_padding_9.xml | 124 +++++++++++++++ 4 files changed, 284 insertions(+), 8 deletions(-) create mode 100755 fop/test/layoutengine/standard-testcases/table_border_padding_8.xml create mode 100755 fop/test/layoutengine/standard-testcases/table_border_padding_9.xml diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 6069dbcc3..3e8bd992b 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -88,6 +88,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager private Position auxiliaryPosition; private int contentAreaIPD; + private boolean isRestartAtLM; /** * @param node the fo this LM deals with @@ -244,6 +245,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager @Override public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, Position restartPosition, LayoutManager restartAtLM) { + isRestartAtLM = restartAtLM != null; referenceIPD = context.getRefIPD(); updateContentAreaIPDwithOverconstrainedAdjust(); @@ -1257,5 +1259,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager } return false; } + + public boolean isRestartAtLM() { + return isRestartAtLM; + } } 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 3bcec5e9a..3261a0afb 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 @@ -30,14 +30,15 @@ import org.apache.fop.fo.Constants; import org.apache.fop.fo.flow.table.EffRow; import org.apache.fop.fo.flow.table.GridUnit; import org.apache.fop.fo.flow.table.PrimaryGridUnit; +import org.apache.fop.layoutmgr.BlockStackingLayoutManager; import org.apache.fop.layoutmgr.BreakElement; import org.apache.fop.layoutmgr.Keep; import org.apache.fop.layoutmgr.KnuthBlockBox; import org.apache.fop.layoutmgr.KnuthBox; -import org.apache.fop.layoutmgr.KnuthElement; import org.apache.fop.layoutmgr.KnuthGlue; import org.apache.fop.layoutmgr.KnuthPenalty; import org.apache.fop.layoutmgr.LayoutContext; +import org.apache.fop.layoutmgr.LayoutManager; import org.apache.fop.layoutmgr.Position; import org.apache.fop.util.BreakUtil; @@ -278,13 +279,10 @@ public class TableStepper { int shrink = 0; int stretch = 0; int width = -penaltyOrGlueLen; - if (keep.getPenalty() == KnuthElement.INFINITE) { - width = (boxLen + -penaltyOrGlueLen) / 2; - if (-penaltyOrGlueLen > maxRemainingHeight) { - width = 0; - } - stretch = Math.max(boxLen, -penaltyOrGlueLen); - shrink = Math.min(boxLen, -penaltyOrGlueLen); + LayoutManager bslm = getTableLM().getParent(); + if (bslm instanceof BlockStackingLayoutManager && ((BlockStackingLayoutManager)bslm).isRestartAtLM() + && keep.getPenalty() == KnuthPenalty.INFINITE) { + width = 0; } returnList.add(new KnuthGlue(width, stretch, shrink, new Position(null), true)); } diff --git a/fop/test/layoutengine/standard-testcases/table_border_padding_8.xml b/fop/test/layoutengine/standard-testcases/table_border_padding_8.xml new file mode 100755 index 000000000..d0ab0e721 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/table_border_padding_8.xml @@ -0,0 +1,148 @@ + + + + + +

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + What you've got left to pay + + + + + + + + + + + + + + You're paying by monthly Direct Debit + + + + + > + + + We'll take a first Direct Debit of £146.50 on or just after 1 September 2016. + + + + + + > More on page [[P;1057000239;1;1]] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/fop/test/layoutengine/standard-testcases/table_border_padding_9.xml b/fop/test/layoutengine/standard-testcases/table_border_padding_9.xml new file mode 100755 index 000000000..517ef8b75 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/table_border_padding_9.xml @@ -0,0 +1,124 @@ + + + + + +

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

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mr.Test Fop3 + Thank you for your recent application for X recognition. + I am pleased to confirm that we will recognise you as a complementary medicine practitioner in the field of String from <<<Date>>> on GP referral. We will allow benefit towards any eligible treatment provided to X members on or after this date. As a recognised practitioner you will receive claims payment directly from us. + Your X Provider Number is 999999 and should be quoted on accounts and in all correspondence. Please note that for claims to be eligible the patient must have been referred to you by their GP or a recognised X Consultant. May I remind you that it is a condition of your recognition that you maintain your professional indemnity insurance. + Finally, our Provider Services team are available to answer any queries you may have about working with X. Their telephone number is 08457 55 33 33*. Calls will be automatically directed to the first available assistant. It is important that we maintain accurate and up to date records in order to ensure the speedy settlement of claims made by your patients who are X members. It would help us therefore, if you would inform us of any changes in your address or your professional circumstances by contacting our Provider Services team directly. + If you have any further queries regarding recognition, please do not hesitate to contact me. + + + + + + + + Yours sincerely + Mrs.FOP HOP + Healthcare Consultant + + + + + + + Provider Recognition Team + 01400654800**  + + + + + + + + * + + + + + Lines are open 8.00am - 6.00pm Monday to Friday and 8.00am - 1.00pm each Saturday. Calls may be recorded and may be monitored. + + + + + + + + + + ** + + + + + Lines are open 9.00am - 5.00pm Monday to Friday. Calls may be recorded and may be monitored. + + + + + + + + + Break Before + + + + + + + + + +
-- 2.39.5