Browse Source

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
tags/fop-0_95beta
Vincent Hennebert 16 years ago
parent
commit
5ea761b17a

+ 10
- 35
src/java/org/apache/fop/layoutmgr/ElementListUtils.java View File

@@ -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;
}
}

+ 0
- 2
src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java View File

@@ -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()) {

Loading…
Cancel
Save