Extracted functionality to find a previous break into a helper method in ElementListUtils. Fixed misguided german->english translation on parameter names (last != previous). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@349909 13f79535-47bb-0310-9956-ffa450edef68tags/fop-0_91-beta
@@ -146,4 +146,23 @@ public class ElementListUtils { | |||
return last.isForcedBreak(); | |||
} | |||
/** | |||
* Determines the position of the previous break before the start index on an | |||
* element list. | |||
* @param elems the element list | |||
* @param startIndex the start index | |||
* @return the position of the previous break, or -1 if there was no previous break | |||
*/ | |||
public static int determinePreviousBreak(List elems, int startIndex) { | |||
int prevBreak = startIndex - 1; | |||
while (prevBreak >= 0) { | |||
KnuthElement el = (KnuthElement)elems.get(prevBreak); | |||
if (el.isPenalty() && el.getP() < KnuthElement.INFINITE) { | |||
break; | |||
} | |||
prevBreak--; | |||
} | |||
return prevBreak; | |||
} | |||
} |
@@ -692,14 +692,14 @@ public class SpaceResolver { | |||
* @param effectiveList the effective element list | |||
* @param startElementIndex index of the first element in the part to be processed | |||
* @param endElementIndex index of the last element in the part to be processed | |||
* @param lastBreak index of the the break possibility just before this part (used to | |||
* @param prevBreak index of the the break possibility just before this part (used to | |||
* identify a break condition, lastBreak <= 0 represents a no-break condition) | |||
*/ | |||
public static void performConditionalsNotification(List effectiveList, | |||
int startElementIndex, int endElementIndex, int lastBreak) { | |||
int startElementIndex, int endElementIndex, int prevBreak) { | |||
KnuthElement el = null; | |||
if (lastBreak > 0) { | |||
el = (KnuthElement)effectiveList.get(lastBreak); | |||
if (prevBreak > 0) { | |||
el = (KnuthElement)effectiveList.get(prevBreak); | |||
} | |||
SpaceResolver.SpaceHandlingBreakPosition beforeBreak = null; | |||
SpaceResolver.SpaceHandlingBreakPosition afterBreak = null; |
@@ -461,30 +461,15 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager | |||
int bodyFirstIndex = ((ListItemPosition) positionList.getFirst()).getBodyFirstIndex(); | |||
int bodyLastIndex = ((ListItemPosition) positionList.getLast()).getBodyLastIndex(); | |||
int lastBreak; | |||
//Determine last break if any | |||
lastBreak = labelFirstIndex - 1; | |||
while (lastBreak >= 0) { | |||
KnuthElement el = (KnuthElement)labelList.get(lastBreak); | |||
if (el.isPenalty() && el.getP() < KnuthElement.INFINITE) { | |||
break; | |||
} | |||
lastBreak--; | |||
} | |||
//Determine previous break if any | |||
int previousBreak = ElementListUtils.determinePreviousBreak(labelList, labelFirstIndex); | |||
SpaceResolver.performConditionalsNotification(labelList, | |||
labelFirstIndex, labelLastIndex, lastBreak); | |||
//Determine last break if any | |||
lastBreak = bodyFirstIndex - 1; | |||
while (lastBreak >= 0) { | |||
KnuthElement el = (KnuthElement)bodyList.get(lastBreak); | |||
if (el.isPenalty() && el.getP() < KnuthElement.INFINITE) { | |||
break; | |||
} | |||
lastBreak--; | |||
} | |||
labelFirstIndex, labelLastIndex, previousBreak); | |||
//Determine previous break if any | |||
previousBreak = ElementListUtils.determinePreviousBreak(labelList, labelFirstIndex); | |||
SpaceResolver.performConditionalsNotification(bodyList, | |||
bodyFirstIndex, bodyLastIndex, lastBreak); | |||
bodyFirstIndex, bodyLastIndex, previousBreak); | |||
// add label areas | |||
if (labelFirstIndex <= labelLastIndex) { |
@@ -49,6 +49,7 @@ import org.apache.fop.layoutmgr.ListElement; | |||
import org.apache.fop.layoutmgr.MinOptMaxUtil; | |||
import org.apache.fop.layoutmgr.Position; | |||
import org.apache.fop.layoutmgr.PositionIterator; | |||
import org.apache.fop.layoutmgr.SpaceResolver; | |||
import org.apache.fop.layoutmgr.TraitSetter; | |||
import org.apache.fop.layoutmgr.SpaceResolver.SpaceHandlingBreakPosition; | |||
import org.apache.fop.traits.MinOptMax; | |||
@@ -948,6 +949,9 @@ public class TableContentLayoutManager implements PercentBaseContext { | |||
cellLM.setContentHeight(contentHeight); | |||
cellLM.setRowHeight(effCellHeight); | |||
//cellLM.setRowHeight(row.getHeight().opt); | |||
int prevBreak = ElementListUtils.determinePreviousBreak(pgu.getElements(), startPos); | |||
SpaceResolver.performConditionalsNotification(pgu.getElements(), | |||
startPos, endPos, prevBreak); | |||
cellLM.addAreas(new KnuthPossPosIter(pgu.getElements(), | |||
startPos, endPos + 1), layoutContext); | |||
} |
@@ -27,6 +27,19 @@ | |||
<changes> | |||
<release version="FOP Trunk"> | |||
<action context="Code" dev="JM" type="fix"> | |||
Bugfix: Space resolution was incomplete for content in table-cells. Conditional elements | |||
didn't get removed. | |||
</action> | |||
<action contexn="Code" dev="JM" type="fix"> | |||
The validation check for non-zero borders and padding on a region-* is now turned off | |||
when relaxed validation is active to improve compatibility with FO documents written | |||
for other FO implementations. | |||
</action> | |||
<action context="Code" dev="JM" type="fix"> | |||
Bugfix for "/ by zero" ArithmeticExceptions when an URL to a non-existing image is used | |||
and content-width and/or content-height is used. | |||
</action> | |||
<action context="Code" dev="JM" type="fix"> | |||
Bugfix for a multi-threading problem: | |||
propertyListTable initialization moved from the constructor to a static block in FONode. |