From 7ce41696f38d92fb75cf6737674966e32351e00c Mon Sep 17 00:00:00 2001 From: Manuel Mall Date: Fri, 14 Oct 2005 13:20:53 +0000 Subject: [PATCH] Inline block parents were not correctly positioned when border/padding got involved - matched their positioning logic with the usual inlines git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@321108 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/layoutmgr/inline/InlineLayoutManager.java | 7 +++++++ src/java/org/apache/fop/render/AbstractRenderer.java | 1 + src/java/org/apache/fop/render/xml/XMLRenderer.java | 1 + .../testcases/inline_border_padding_block_nested_1.xml | 3 +++ .../testcases/inline_border_padding_block_nested_2.xml | 3 +++ 5 files changed, 15 insertions(+) diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java index fdfcca373..ea1eb11a0 100755 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java @@ -447,6 +447,13 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { parent.setBPD(alignmentContext.getHeight()); if (parent instanceof InlineParent) { parent.setOffset(alignmentContext.getOffset()); + } else if (parent instanceof InlineBlockParent) { + // All inline elements are positioned by the renderers relative to + // the before edge of their content rectangle + if (borderProps != null) { + parent.setOffset(borderProps.getPaddingBefore(false, this) + + borderProps.getBorderBeforeWidth(false)); + } } setCurrentArea(parent); diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 16c8f75ae..aceac1a87 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -662,6 +662,7 @@ public abstract class AbstractRenderer currentIPPosition += ibp.getBorderAndPaddingWidthStart(); // For inline content the BP position is updated by the enclosing line area int saveBP = currentBPPosition; + currentBPPosition += ibp.getOffset(); renderBlock(ibp.getChildArea()); currentBPPosition = saveBP; } diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index cedbb404f..71d47df40 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -638,6 +638,7 @@ public class XMLRenderer extends PrintRenderer { atts.clear(); addAreaAttributes(ibp); addTraitAttributes(ibp); + addAttribute("offset", ibp.getOffset()); startElement("inlineblockparent", atts); super.renderInlineBlockParent(ibp); endElement("inlineblockparent"); diff --git a/test/layoutengine/testcases/inline_border_padding_block_nested_1.xml b/test/layoutengine/testcases/inline_border_padding_block_nested_1.xml index 393745999..a3d9e9e4e 100755 --- a/test/layoutengine/testcases/inline_border_padding_block_nested_1.xml +++ b/test/layoutengine/testcases/inline_border_padding_block_nested_1.xml @@ -64,6 +64,7 @@ + @@ -89,6 +90,7 @@ + @@ -106,6 +108,7 @@ + diff --git a/test/layoutengine/testcases/inline_border_padding_block_nested_2.xml b/test/layoutengine/testcases/inline_border_padding_block_nested_2.xml index 4f48a4dd2..c7e9210f0 100755 --- a/test/layoutengine/testcases/inline_border_padding_block_nested_2.xml +++ b/test/layoutengine/testcases/inline_border_padding_block_nested_2.xml @@ -90,6 +90,7 @@ + @@ -121,6 +122,7 @@ + @@ -142,6 +144,7 @@ + -- 2.39.5