Author: adelmelle
Date: Sun Mar 22 19:18:14 2009
New Revision: 757239
URL: http://svn.apache.org/viewvc?rev=757239&view=rev
Log:
Bugzilla 46489:
Issue when combining page-position="last" with a block with break-before as a
descendant of a table.
Added:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml
(with props)
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java
xmlgraphics/fop/trunk/status.xml
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=757239&r1=757238&r2=757239&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java
Sun Mar 22 19:18:14 2009
@@ -273,7 +273,8 @@
//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 @@
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 @@
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 @@
/** {...@inheritdoc} */
protected void observeElementList(List elementList) {
ElementListObserver.observe(elementList, "breaker",
- ((PageSequence)pslm.getFObj()).getId());
+ pslm.getFObj().getId());
}
/**
Modified: xmlgraphics/fop/trunk/status.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=757239&r1=757238&r2=757239&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Sun Mar 22 19:18:14 2009
@@ -58,6 +58,12 @@
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="AD" type="fix" fixes-bug="46489">
+ 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.
+ </action>
<action context="Fonts" dev="JM" type="add">
Added a command-line tool to list all configured fonts
(org.apache.fop.tools.fontlist.FontListMain).
Added:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml?rev=757239&view=auto
==============================================================================
---
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml
(added)
+++
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml
Sun Mar 22 19:18:14 2009
@@ -0,0 +1,117 @@
+<?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 page-masters (reference orientation).
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="OTCTermsheetPageMasterFrontPage"
page-width="210mm" page-height="297mm" margin-bottom="12.7mm"
margin-right="12.7mm" margin-top="12.7mm" margin-left="12.7mm">
+ <fo:region-body margin-bottom="30mm" margin-top="42.3mm"
region-name="PageBody"/>
+ <fo:region-before region-name="PageHeaderFrontPage" extent="42.3mm"/>
+ <fo:region-after precedence="true" region-name="PageFooter"
extent="30mm"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="OTCTermsheetPageMasterFollowing"
page-width="210mm" page-height="297mm" margin-bottom="12.7mm"
margin-right="12.7mm" margin-top="12.7mm" margin-left="12.7mm">
+ <fo:region-body margin-bottom="30mm" margin-top="20mm"
region-name="PageBody"/>
+ <fo:region-before region-name="PageHeaderFollowing" extent="20mm"/>
+ <fo:region-after precedence="true" region-name="PageFooter"
extent="30mm"/>
+ </fo:simple-page-master>
+ <fo:page-sequence-master master-name="OTCTermsheetPageSeq">
+ <fo:repeatable-page-master-alternatives>
+ <fo:conditional-page-master-reference page-position="first"
master-reference="OTCTermsheetPageMasterFrontPage"/>
+ <fo:conditional-page-master-reference page-position="rest"
master-reference="OTCTermsheetPageMasterFollowing"/>
+ <fo:conditional-page-master-reference page-position="last"
master-reference="OTCTermsheetPageMasterFollowing"/>
+ </fo:repeatable-page-master-alternatives>
+ </fo:page-sequence-master>
+ </fo:layout-master-set>
+ <fo:page-sequence initial-page-number="1" force-page-count="no-force"
master-reference="OTCTermsheetPageSeq">
+ <fo:flow flow-name="PageBody" font-family="Times New Roman"
font-size="10pt" line-height="12pt">
+ <fo:block>
+ <fo:table table-layout="fixed" width="100%">
+ <fo:table-column column-width="proportional-column-width(32.36)"
column-number="1"/>
+ <fo:table-column column-width="proportional-column-width(67.64)"
column-number="2"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell padding="4pt">
+ <fo:block>
+ <fo:block>
+ <fo:inline color="#6D6E71">Some text</fo:inline>
+ </fo:block>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell padding="4pt">
+ <fo:block>
+ <fo:block text-align="justify">More text before break.
More text before break. More text before break.</fo:block>
+ <fo:block>
+ <fo:leader/>
+ </fo:block>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:table table-layout="fixed" width="100%">
+ <fo:table-column column-width="proportional-column-width(100)"
column-number="1"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell padding="4pt">
+ <fo:block>
+ <fo:block id="the-block" line-height="14pt"
color="#6D6E71" font-size="11pt" font-family="Arial" text-align="left"
page-break-before="always">TEXT AFTER BREAK</fo:block>
+ <fo:block>
+ <fo:leader/>
+ </fo:block>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:table table-layout="fixed" width="100%">
+ <fo:table-column column-width="proportional-column-width(100)"
column-number="1"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell padding="4pt">
+ <fo:block>
+ <fo:block>
+ <fo:leader/>
+ </fo:block>
+ <fo:block>
+ <fo:leader/>
+ </fo:block>
+ <fo:block text-align="justify">blah blah blah</fo:block>
+ <fo:block>
+ <fo:leader/>
+ </fo:block>
+ <fo:block text-align="justify">blah blah blah</fo:block>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <true xpath="count(//page) = 2" />
+ </checks>
+</testcase>
Propchange:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-position-last_break-before_bugzilla46489.xml
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]