From: Andreas L. Delmelle Date: Sun, 22 Mar 2009 19:18:14 +0000 (+0000) Subject: Bugzilla 46489: X-Git-Tag: fop-1_0~282 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=39846b082abe7df751bd45cd70abe61e842fbb20;p=xmlgraphics-fop.git Bugzilla 46489: Issue when combining page-position="last" with a block with break-before as a descendant of a table. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@757239 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/PageBreaker.java b/src/java/org/apache/fop/layoutmgr/PageBreaker.java index 5dc1576c7..1137065ab 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreaker.java @@ -273,7 +273,8 @@ public class PageBreaker extends AbstractBreaker { //Get page break from which we restart PageBreakPosition pbp = (PageBreakPosition) alg.getPageBreaks().get(restartPoint - 1); - newStartPos = pbp.getLeafPos(); + //Set starting position to the first element *after* the page-break + newStartPos = pbp.getLeafPos() + 1; //Handle page break right here to avoid any side-effects if (newStartPos > 0) { handleBreakTrait(Constants.EN_PAGE); @@ -306,16 +307,15 @@ public class PageBreaker extends AbstractBreaker { 1, true, BreakingAlgorithm.ALL_BREAKS); AbstractBreaker.log.debug("restart: iOptPageCount= " + iOptPageCount + " pageBreaks.size()= " + algRestart.getPageBreaks().size()); + //Make sure we only add the areas we haven't added already + effectiveList.ignoreAtStart = newStartPos; boolean replaceLastPage = iOptPageCount <= pslm.getCurrentPV().getBodyRegion().getColumnCount(); if (replaceLastPage) { //Replace last page pslm.setCurrentPage(pageProvider.getPage(false, currentPageNum)); - //Make sure we only add the areas we haven't added already - effectiveList.ignoreAtStart = newStartPos; addAreas(algRestart, iOptPageCount, originalList, effectiveList); } else { - effectiveList.ignoreAtStart = newStartPos; addAreas(alg, restartPoint, partCount - restartPoint, originalList, effectiveList); //Add blank last page pageProvider.setLastPageIndex(currentPageNum + 1); @@ -430,8 +430,8 @@ public class PageBreaker extends AbstractBreaker { childLC); } // set the offset from the top margin - Footnote parentArea = (Footnote) pslm.getCurrentPV().getBodyRegion().getFootnote(); - int topOffset = (int) pslm.getCurrentPV().getBodyRegion().getBPD() - parentArea.getBPD(); + Footnote parentArea = pslm.getCurrentPV().getBodyRegion().getFootnote(); + int topOffset = pslm.getCurrentPV().getBodyRegion().getBPD() - parentArea.getBPD(); if (separatorArea != null) { topOffset -= separatorArea.getBPD(); } @@ -451,7 +451,7 @@ public class PageBreaker extends AbstractBreaker { /** {@inheritDoc} */ protected void observeElementList(List elementList) { ElementListObserver.observe(elementList, "breaker", - ((PageSequence)pslm.getFObj()).getId()); + pslm.getFObj().getId()); } /** diff --git a/status.xml b/status.xml index 5c28c8005..ec311f6a6 100644 --- a/status.xml +++ b/status.xml @@ -58,6 +58,12 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Fixed a bug when combining a forced break with a "last" page-master. The restart + of the algorithm would start at the index of the penalty corresponding to the last + page-break. This has been changed to the index of the first element after the last + page-break. + Added a command-line tool to list all configured fonts (org.apache.fop.tools.fontlist.FontListMain). diff --git a/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml b/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml new file mode 100644 index 000000000..d3c106852 --- /dev/null +++ b/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml @@ -0,0 +1,117 @@ + + + + + +

+ This test checks page-masters (reference orientation). +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Some text + + + + + + More text before break. More text before break. More text before break. + + + + + + + + + + + + + + + TEXT AFTER BREAK + + + + + + + + + + + + + + + + + + + + + blah blah blah + + + + blah blah blah + + + + + + + + + + + + + +