From: Vincent Hennebert Date: Thu, 13 Dec 2007 15:55:29 +0000 (+0000) Subject: Removed calls to removeLegalBreaks since they aren't necessary (the whole content... X-Git-Tag: fop-0_95beta~216 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5ea761b17a5cbdcc2ac36f6c841d7a22d8bdd974;p=xmlgraphics-fop.git Removed calls to removeLegalBreaks since they aren't necessary (the whole content is put in a single box anyway) and the method is buggy. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@603943 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/ElementListUtils.java b/src/java/org/apache/fop/layoutmgr/ElementListUtils.java index 08450db98..a2baba2fc 100644 --- a/src/java/org/apache/fop/layoutmgr/ElementListUtils.java +++ b/src/java/org/apache/fop/layoutmgr/ElementListUtils.java @@ -30,31 +30,6 @@ import org.apache.fop.traits.MinOptMax; */ public class ElementListUtils { - /** - * Removes all legal breaks in an element list. - * @param elements the element list - */ - public static void removeLegalBreaks(LinkedList elements) { - ListIterator i = elements.listIterator(); - while (i.hasNext()) { - ListElement el = (ListElement)i.next(); - if (el.isPenalty()) { - BreakElement breakPoss = (BreakElement)el; - //Convert all penalties no break inhibitors - if (breakPoss.getPenaltyValue() < KnuthPenalty.INFINITE) { - breakPoss.setPenaltyValue(KnuthPenalty.INFINITE); - } - } else if (el.isGlue()) { - i.previous(); - if (el.isBox()) { - i.next(); - i.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, - null, false)); - } - } - } - } - /** * Removes legal breaks in an element list. A constraint can be specified to limit the * range in which the breaks are removed. Legal breaks occuring before at least @@ -66,7 +41,7 @@ public class ElementListUtils { public static boolean removeLegalBreaks(LinkedList elements, MinOptMax constraint) { return removeLegalBreaks(elements, constraint.opt); } - + /** * Removes legal breaks in an element list. A constraint can be specified to limit the * range in which the breaks are removed. Legal breaks occuring before at least @@ -84,7 +59,7 @@ public class ElementListUtils { KnuthPenalty penalty = (KnuthPenalty)el; //Convert all penalties to break inhibitors if (penalty.getP() < KnuthPenalty.INFINITE) { - iter.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE, + iter.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE, penalty.isFlagged(), penalty.getPosition(), penalty.isAuxiliary())); } } else if (el.isGlue()) { @@ -94,7 +69,7 @@ public class ElementListUtils { el = (ListElement)iter.previous(); iter.next(); if (el.isBox()) { - iter.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, + iter.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, null, false)); } iter.next(); @@ -131,7 +106,7 @@ public class ElementListUtils { KnuthPenalty penalty = (KnuthPenalty)el; //Convert all penalties to break inhibitors if (penalty.getP() < KnuthPenalty.INFINITE) { - i.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE, + i.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE, penalty.isFlagged(), penalty.getPosition(), penalty.isAuxiliary())); } } else if (el.isGlue()) { @@ -140,7 +115,7 @@ public class ElementListUtils { el = (ListElement)i.previous(); i.next(); if (el.isBox()) { - i.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, + i.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, null, false)); } } else if (el.isUnresolvedElement()) { @@ -163,7 +138,7 @@ public class ElementListUtils { } return true; } - + /** * Calculates the content length of the given element list. Warning: It doesn't take any * stretch and shrink possibilities into account. @@ -193,7 +168,7 @@ public class ElementListUtils { } return len; } - + /** * Calculates the content length of the given element list. Warning: It doesn't take any * stretch and shrink possibilities into account. @@ -203,7 +178,7 @@ public class ElementListUtils { public static int calcContentLength(List elems) { return calcContentLength(elems, 0, elems.size() - 1); } - + /** * Indicates whether the given element list ends with a forced break. * @param elems the element list @@ -213,7 +188,7 @@ public class ElementListUtils { ListElement last = (ListElement)elems.getLast(); return last.isForcedBreak(); } - + /** * Determines the position of the previous break before the start index on an * element list. @@ -232,5 +207,5 @@ public class ElementListUtils { } return prevBreak; } - + } diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index c08216480..bcd7f0244 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -136,7 +136,6 @@ public class TableContentLayoutManager implements PercentBaseContext { if (headerIter != null && headerList == null) { this.headerList = getKnuthElementsForRowIterator( headerIter, context, alignment, TableRowIterator.HEADER); - ElementListUtils.removeLegalBreaks(this.headerList); this.headerNetHeight = ElementListUtils.calcContentLength(this.headerList); if (log.isDebugEnabled()) { @@ -157,7 +156,6 @@ public class TableContentLayoutManager implements PercentBaseContext { if (footerIter != null && footerList == null) { this.footerList = getKnuthElementsForRowIterator( footerIter, context, alignment, TableRowIterator.FOOTER); - ElementListUtils.removeLegalBreaks(this.footerList); this.footerNetHeight = ElementListUtils.calcContentLength(this.footerList); if (log.isDebugEnabled()) {