diff options
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java | 18 | ||||
-rw-r--r-- | status.xml | 4 | ||||
-rw-r--r-- | test/layoutengine/standard-testcases/table-header_bug37875.xml | 76 |
3 files changed, 89 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index 3eea3b6af..4eaf30088 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -100,6 +100,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager */ private static class LineBreakPosition extends LeafPosition { private int iParIndex; // index of the Paragraph this Position refers to + private int iStartIndex; //index of the first element this Position refers to private int availableShrink; private int availableStretch; private int difference; @@ -112,7 +113,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager private int spaceAfter; private int baseline; - LineBreakPosition(LayoutManager lm, int index, int iBreakIndex, + LineBreakPosition(LayoutManager lm, int index, int iStartIndex, int iBreakIndex, int shrink, int stretch, int diff, double ipdA, double adjust, int ind, int lh, int lw, int sb, int sa, int bl) { @@ -121,6 +122,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager availableStretch = stretch; difference = diff; iParIndex = index; + this.iStartIndex = iStartIndex; ipdAdjust = ipdA; dAdjust = adjust; startIndent = ind; @@ -139,7 +141,6 @@ public class LineLayoutManager extends InlineStackingLayoutManager private int effectiveAlignment; private Length textIndent; private Length lastLineEndIndent; - private int iIndents = 0; private CommonHyphenation hyphenationProperties; private Numeric hyphenationLadderCount; private int wrapOption = EN_WRAP; @@ -152,8 +153,6 @@ public class LineLayoutManager extends InlineStackingLayoutManager private List knuthParagraphs = null; private int iReturnedLBP = 0; - private int iStartElement = 0; - private int iEndElement = 0; // parameters of Knuth's algorithm: // penalty value for flagged penalties @@ -531,13 +530,13 @@ public class LineLayoutManager extends InlineStackingLayoutManager if (bZeroHeightLine) { return new LineBreakPosition(thisLLM, knuthParagraphs.indexOf(par), - lastElementIndex, + firstElementIndex, lastElementIndex, availableShrink, availableStretch, difference, ratio, 0, indent, 0, iLineWidth, 0, 0, 0); } else { return new LineBreakPosition(thisLLM, knuthParagraphs.indexOf(par), - lastElementIndex, + firstElementIndex, lastElementIndex, availableShrink, availableStretch, difference, ratio, 0, indent, lineLead + lineFollow, iLineWidth, spaceBefore, spaceAfter, @@ -1038,7 +1037,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager } } LineBreakPosition lbp = new LineBreakPosition(this, - knuthParagraphs.indexOf(seq), seq.size() - 1, + knuthParagraphs.indexOf(seq), 0, seq.size() - 1, lineShrink, lineStretch, 0, 0, 0, 0, lineHeight, iLineWidth, 0, 0, 0); lineLayouts.addBreakPosition(lbp, 0); @@ -1694,8 +1693,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager LineBreakPosition lbp = (LineBreakPosition) pos; iCurrParIndex = lbp.iParIndex; - KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(iCurrParIndex); - iEndElement = lbp.getLeafPos(); + KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(iCurrParIndex); + int iStartElement = lbp.iStartIndex; + int iEndElement = lbp.getLeafPos(); LineArea lineArea = new LineArea((lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast), lbp.difference, lbp.availableStretch, lbp.availableShrink); diff --git a/status.xml b/status.xml index 07cb722d3..c1022ab8a 100644 --- a/status.xml +++ b/status.xml @@ -27,6 +27,10 @@ <changes> <release version="FOP Trunk"> + <action context="Code" dev="JM" type="fix" fixes-bug="37875"> + Bugfix: Some content inside a table-header may not have been renderered on + pages n > 1 in certain conditions. + </action> <action context="Code" dev="MM" type="fix"> Fixed a bug where an empty line, i.e. a block containing only a &nbsp;, was not rendered at all. diff --git a/test/layoutengine/standard-testcases/table-header_bug37875.xml b/test/layoutengine/standard-testcases/table-header_bug37875.xml new file mode 100644 index 000000000..d25dd6ae3 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-header_bug37875.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2005 The Apache Software Foundation + + Licensed 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 Bugzilla #37875: Content in a table-header is not completely painted on subsequent pages, but only + if a line in the header overflows in inline-progression-direction. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="3in" page-height="3in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal" white-space-collapse="true"> + <fo:flow flow-name="xsl-region-body"> + <fo:table table-layout="fixed" width="100%" border-collapse="separate" space-before="1.5in" space-before.conditionality="retain"> + <fo:table-column column-width="1.5cm" text-align="right"/> + <fo:table-header> + <fo:table-row> + <fo:table-cell padding-left="3pt" padding-top="1pt" border-style="solid" border-width="thin" padding-right="0.25cm" id="header-cell"> + <fo:block text-align="center">Blah-<fo:block/>blahblah</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row> + <fo:table-cell padding-left="3pt" padding-top="1pt" border-style="solid" border-width="thin" padding-right="0.25cm"> + <fo:block text-align="right">1</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-left="3pt" padding-top="1pt" border-style="solid" border-width="thin" padding-right="0.25cm"> + <fo:block text-align="right">2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-left="3pt" padding-top="1pt" border-style="solid" border-width="thin" padding-right="0.25cm"> + <fo:block text-align="right">3</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-left="3pt" padding-top="1pt" border-style="solid" border-width="thin" padding-right="0.25cm"> + <fo:block text-align="right">4</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="2" xpath="count(//pageViewport[1]//block[@prod-id='header-cell']/block/lineArea)"/> + <eval expected="2" xpath="count(//pageViewport[1]//block[@prod-id='header-cell']/block//text)"/> + <eval expected="2" xpath="count(//pageViewport[2]//block[@prod-id='header-cell']/block/lineArea)"/> + <eval expected="2" xpath="count(//pageViewport[2]//block[@prod-id='header-cell']/block//text)"/> + </checks> +</testcase> |