Author: vhennebert
Date: Fri Jan 25 07:52:53 2008
New Revision: 615251
URL: http://svn.apache.org/viewvc?rev=615251&view=rev
Log:
Fixed a bug in computeContentLength when there are empty cells
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java?rev=615251&r1=615250&r2=615251&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
Fri Jan 25 07:52:53 2008
@@ -234,20 +234,26 @@
// be used as padding.
// This should be handled automatically by a proper use of Knuth elements
private int computeContentLength(PrimaryGridUnit pgu, int startIndex, int
endIndex) {
- int actualStart = startIndex;
- // Skip from the content length calculation glues and penalties
occurring at the
- // beginning of the page
- while (actualStart <= endIndex
- && !((KnuthElement)
pgu.getElements().get(actualStart)).isBox()) {
- actualStart++;
+ if (startIndex >= endIndex) {
+ // May happen if the cell contributes no content on the current
page (empty
+ // cell, in most cases)
+ return 0;
+ } else {
+ int actualStart = startIndex;
+ // Skip from the content length calculation glues and penalties
occurring at the
+ // beginning of the page
+ while (actualStart <= endIndex
+ && !((KnuthElement)
pgu.getElements().get(actualStart)).isBox()) {
+ actualStart++;
+ }
+ int len = ElementListUtils.calcContentLength(
+ pgu.getElements(), actualStart, endIndex);
+ KnuthElement el = (KnuthElement)pgu.getElements().get(endIndex);
+ if (el.isPenalty()) {
+ len += el.getW();
+ }
+ return len;
}
- int len = ElementListUtils.calcContentLength(
- pgu.getElements(), actualStart, endIndex);
- KnuthElement el = (KnuthElement)pgu.getElements().get(endIndex);
- if (el.isPenalty()) {
- len += el.getW();
- }
- return len;
}
private void addAreasForCell(PrimaryGridUnit pgu, int startPos, int endPos,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]