Browse Source

Set currentLine to null after adding it in BlockArea.

Some cosmetical rearrangements.
PR: 17472 and several postings


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@196008 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_20_5rc3
Joerg Pietschmann 21 years ago
parent
commit
c88917b675
2 changed files with 16 additions and 40 deletions
  1. 15
    40
      src/org/apache/fop/fo/flow/Block.java
  2. 1
    0
      src/org/apache/fop/layout/BlockArea.java

+ 15
- 40
src/org/apache/fop/fo/flow/Block.java View File

@@ -185,8 +185,9 @@ public class Block extends FObjMixed {
area.end();
}

if (area.getIDReferences() != null)
if (area.getIDReferences() != null) {
area.getIDReferences().createID(id);
}

this.marker = 0;

@@ -221,9 +222,6 @@ public class Block extends FObjMixed {
this.areasGenerated++;
if (this.areasGenerated == 1)
blockArea.isFirst(true);
// for normal areas this should be the only pair
// blockArea.addLineagePair(this, this.areasGenerated);

// markers
// if (this.hasMarkers())
// blockArea.addMarkers(this.getMarkers());
@@ -243,37 +241,25 @@ public class Block extends FObjMixed {
int numChildren = this.children.size();
for (int i = this.marker; i < numChildren; i++) {
FONode fo = (FONode)children.get(i);
int status;
if (Status.isIncomplete(status = fo.layout(blockArea))) {
int status = fo.layout(blockArea);
if (Status.isIncomplete(status)) {
this.marker = i;
// this block was modified by
// Hani Elabed 11/27/2000
// if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE))
// {
// status = new Status(Status.AREA_FULL_SOME);
// }

// new block to replace the one above
// Hani Elabed 11/27/2000
if (status == Status.AREA_FULL_NONE) {
// something has already been laid out
if ((i != 0)) {
status = Status.AREA_FULL_SOME;
if (i == 0) {
// Nothing was laid out.
anythingLaidOut = false;
return status;
} else {
// A previous child has already been laid out.
area.addChild(blockArea);
area.setMaxHeight(area.getMaxHeight() - spaceLeft
+ blockArea.getMaxHeight());
area.increaseHeight(blockArea.getHeight());
anythingLaidOut = true;

return status;
} else // i == 0 nothing was laid out..
{
anythingLaidOut = false;
return status;
return Status.AREA_FULL_SOME;
}
}

// blockArea.end();
// Something has been laid out.
area.addChild(blockArea);
area.setMaxHeight(area.getMaxHeight() - spaceLeft
+ blockArea.getMaxHeight());
@@ -285,13 +271,10 @@ public class Block extends FObjMixed {
}

blockArea.end();

blockArea.isLast(true);
area.addChild(blockArea);
area.setMaxHeight(area.getMaxHeight() - spaceLeft
+ blockArea.getMaxHeight());

area.addChild(blockArea);

/* should this be combined into above? */
area.increaseHeight(blockArea.getHeight());

if (spaceAfter != 0) {
@@ -301,8 +284,6 @@ public class Block extends FObjMixed {
if (area instanceof BlockArea) {
area.start();
}
// This is not needed any more and it consumes a LOT
// of memory. So we release it for the GC.
areaHeight= blockArea.getHeight();
contentWidth= blockArea.getContentWidth();

@@ -311,18 +292,12 @@ public class Block extends FObjMixed {
int breakAfterStatus = propMgr.checkBreakAfter(area);
if (breakAfterStatus != Status.OK) {
this.marker = BREAK_AFTER;
blockArea = null; //Faster GC - BlockArea is big
blockArea = null;
return breakAfterStatus;
}

if (keepWithNext != 0) {
blockArea = null; // Faster GC - BlockArea is big
return Status.KEEP_WITH_NEXT;
}

// log.error(" b:OK" + marker + " ");
blockArea.isLast(true);
blockArea = null; // Faster GC - BlockArea is big
return Status.OK;
}


+ 1
- 0
src/org/apache/fop/layout/BlockArea.java View File

@@ -213,6 +213,7 @@ public class BlockArea extends Area {
this.currentLineArea.addPending();
this.currentLineArea.align(this.alignLastLine);
this.addLineArea(this.currentLineArea);
this.currentLineArea = null;
}
}


Loading…
Cancel
Save