diff options
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/table/ActiveCell.java | 26 | ||||
-rw-r--r-- | status.xml | 4 | ||||
-rw-r--r-- | test/layoutengine/standard-testcases/footnote_in_table_fixed-height.xml | 67 |
3 files changed, 87 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java b/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java index a9da7a3ca..ffbb1ff03 100644 --- a/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java +++ b/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java @@ -19,12 +19,13 @@ package org.apache.fop.layoutmgr.table; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.fo.Constants; import org.apache.fop.fo.flow.table.ConditionalBorder; import org.apache.fop.fo.flow.table.EffRow; @@ -77,6 +78,14 @@ class ActiveCell { private int spanIndex = 0; + /** + * The list of active footnotes. Those are the footnotes from the next step + * that is due to be merged by TableStepper. + * + * @see {@link #addFootnotes(List)} + */ + private List footnotes; + private Step previousStep; private Step nextStep; /** @@ -102,8 +111,6 @@ class ActiveCell { private int penaltyLength; /** Value of the penalty ending this step, 0 if the step does not end on a penalty. */ private int penaltyValue; - /** List of footnotes for this step. */ - private List footnoteList; /** * One of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, * {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, @@ -133,7 +140,6 @@ class ActiveCell { this.totalLength = other.totalLength; this.penaltyLength = other.penaltyLength; this.penaltyValue = other.penaltyValue; - this.footnoteList = other.footnoteList; this.condBeforeContentLength = other.condBeforeContentLength; this.breakClass = other.breakClass; } @@ -297,7 +303,6 @@ class ActiveCell { afterNextStep.penaltyValue = 0; afterNextStep.condBeforeContentLength = 0; afterNextStep.breakClass = Constants.EN_AUTO; - afterNextStep.footnoteList = null; boolean breakFound = false; boolean prevIsBox = false; boolean boxFound = false; @@ -328,10 +333,10 @@ class ActiveCell { prevIsBox = false; } else { if (el instanceof KnuthBlockBox && ((KnuthBlockBox) el).hasAnchors()) { - if (afterNextStep.footnoteList == null) { - afterNextStep.footnoteList = new LinkedList(); + if (footnotes == null) { + footnotes = new ArrayList(); } - afterNextStep.footnoteList.addAll(((KnuthBlockBox) el).getFootnoteBodyLMs()); + footnotes.addAll(((KnuthBlockBox) el).getFootnoteBodyLMs()); } prevIsBox = true; boxFound = true; @@ -561,8 +566,9 @@ class ActiveCell { * @param footnoteList the list to which this cell must add its footnotes */ void addFootnotes(List footnoteList) { - if (includedInLastStep() && nextStep.footnoteList != null) { - footnoteList.addAll(nextStep.footnoteList); + if (includedInLastStep() && footnotes != null) { + footnoteList.addAll(footnotes); + footnotes.clear(); } } diff --git a/status.xml b/status.xml index 7d73899bd..0450fbbe8 100644 --- a/status.xml +++ b/status.xml @@ -58,6 +58,10 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Layout" dev="VH" type="fix"> + Bugfix: footnotes occurring within the forced height of a table row did not appear on the + output + </action> <action context="Renderers" dev="JM" type="update" fixes-bug="47031" due-to="Francois Fernandes"> PDFGraphics2D.writeClip doesn't generate a clip command anymore when the clip path is empty. diff --git a/test/layoutengine/standard-testcases/footnote_in_table_fixed-height.xml b/test/layoutengine/standard-testcases/footnote_in_table_fixed-height.xml new file mode 100644 index 000000000..0b1e02d94 --- /dev/null +++ b/test/layoutengine/standard-testcases/footnote_in_table_fixed-height.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<testcase> + <info> + <p> + This test checks that a footnote within the fixed height of a table row is properly handled. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="simple" page-height="220pt" page-width="3in" + margin="10pt"> + <fo:region-body background-color="#F0F0F0"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="simple" font-size="8pt" line-height="10pt"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Before the table</fo:block> + <fo:table table-layout="fixed" width="100%"> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-body border="1pt solid black"> + <fo:table-row border="inherit" height="40pt"> + <fo:table-cell border="inherit"> + <fo:block>Cell 1.1</fo:block> + <fo:block>Cell 1.1</fo:block> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="inherit"> + <fo:block>Cell 1.2<fo:footnote> + <fo:inline>(1)</fo:inline> + <fo:footnote-body> + <fo:block>(1) Footnote within the fixed height.</fo:block> + </fo:footnote-body> + </fo:footnote></fo:block> + <fo:block>Cell 1.2</fo:block> + <fo:block>Cell 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="count(//pageSequence[1]//footnote/block)"/> + <eval expected="(1) Footnote within the fixed height." xpath="//pageSequence[1]//footnote/block[1]"/> + </checks> +</testcase> |