aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/AbstractRenderer.java
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-09-23 13:56:27 +0000
committerFinn Bock <bckfnn@apache.org>2004-09-23 13:56:27 +0000
commit70aefe60b0de2e8fc769139c628172f9d5589b8a (patch)
treeba98cc44c220643b6e342df0ea956a1bbd2ffe0d /src/java/org/apache/fop/render/AbstractRenderer.java
parentab8ea40b5b1149ccf541c57da3c513bfd5e233da (diff)
downloadxmlgraphics-fop-70aefe60b0de2e8fc769139c628172f9d5589b8a.tar.gz
xmlgraphics-fop-70aefe60b0de2e8fc769139c628172f9d5589b8a.zip
Calculate the margin offsets (border & padding), by increasing
current[IB]PPosition, in AbstractRenderer instead of in PDFRenderer. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197969 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/AbstractRenderer.java')
-rw-r--r--src/java/org/apache/fop/render/AbstractRenderer.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java
index cc340fc70..e4bb2c823 100644
--- a/src/java/org/apache/fop/render/AbstractRenderer.java
+++ b/src/java/org/apache/fop/render/AbstractRenderer.java
@@ -47,6 +47,7 @@ import org.apache.fop.area.PageViewport;
import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.RegionReference;
import org.apache.fop.area.Title;
+import org.apache.fop.area.Trait;
import org.apache.fop.area.TreeExt;
import org.apache.fop.area.inline.Container;
import org.apache.fop.area.inline.ForeignObject;
@@ -464,18 +465,29 @@ public abstract class AbstractRenderer
*/
protected void renderBlocks(Block parent, List blocks) {
int saveIP = currentIPPosition;
+ int saveBP = currentBPPosition;
+
+ // Calculate the position of the content rectangle.
+ if (parent != null) {
+ currentBPPosition += parent.getBorderAndPaddingWidthBefore();
+ currentIPPosition += parent.getBorderAndPaddingWidthStart();
+ Integer spaceStart = (Integer) parent.getTrait(Trait.SPACE_START);
+ if (spaceStart != null) {
+ currentIPPosition += spaceStart.intValue();
+ }
+ }
// the position of the containing block is used for
// absolutely positioned areas
int contBP = currentBPPosition;
int contIP = currentIPPosition;
- containingBPPosition = contBP;
- containingIPPosition = contIP;
+ containingBPPosition = currentBPPosition;
+ containingIPPosition = currentIPPosition;
for (int count = 0; count < blocks.size(); count++) {
Object obj = blocks.get(count);
if (obj instanceof Block) {
- currentIPPosition = saveIP;
+ currentIPPosition = contIP;
containingBPPosition = contBP;
containingIPPosition = contIP;
renderBlock((Block) obj);
@@ -485,7 +497,7 @@ public abstract class AbstractRenderer
// a line area is rendered from the top left position
// of the line, each inline object is offset from there
LineArea line = (LineArea) obj;
- currentIPPosition = saveIP + line.getStartIndent();
+ currentIPPosition = contIP + line.getStartIndent();
renderLineArea(line);
currentBPPosition += line.getAllocBPD();
}