aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Mall <manuel@apache.org>2005-10-14 13:20:53 +0000
committerManuel Mall <manuel@apache.org>2005-10-14 13:20:53 +0000
commit7ce41696f38d92fb75cf6737674966e32351e00c (patch)
tree1294be67aa301a66cd7e92ca766c668f26a5c914
parent64336ac4d35019d99a6634dbe5a36a65ac791175 (diff)
downloadxmlgraphics-fop-7ce41696f38d92fb75cf6737674966e32351e00c.tar.gz
xmlgraphics-fop-7ce41696f38d92fb75cf6737674966e32351e00c.zip
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
-rwxr-xr-xsrc/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java7
-rw-r--r--src/java/org/apache/fop/render/AbstractRenderer.java1
-rw-r--r--src/java/org/apache/fop/render/xml/XMLRenderer.java1
-rwxr-xr-xtest/layoutengine/testcases/inline_border_padding_block_nested_1.xml3
-rwxr-xr-xtest/layoutengine/testcases/inline_border_padding_block_nested_2.xml3
5 files changed, 15 insertions, 0 deletions
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 @@
<checks>
<eval expected="347000" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@ipd"/>
<eval expected="350000" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@ipda"/>
+ <eval expected="3000" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@offset"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@border-after"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@border-before"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@border-start"/>
@@ -89,6 +90,7 @@
<eval expected="2000" xpath="//flow/block[5]/lineArea[1]/inlineparent/@padding-start"/>
<eval expected="347000" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@ipd"/>
<eval expected="350000" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@ipda"/>
+ <eval expected="3000" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@offset"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@border-after"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@border-before"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@border-end"/>
@@ -106,6 +108,7 @@
<eval expected="2000" xpath="//flow/block[8]/lineArea[1]/inlineparent/@padding-start"/>
<eval expected="350000" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@ipd"/>
<eval expected="350000" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@ipda"/>
+ <eval expected="2000" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@offset"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@border-after"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@border-before"/>
<eval expected="1000" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@padding-after"/>
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 @@
<checks>
<eval expected="344000" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@ipd"/>
<eval expected="350000" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@ipda"/>
+ <eval expected="3000" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@offset"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@border-after"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@border-before"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[2]/lineArea[2]/inlineblockparent/@border-start"/>
@@ -121,6 +122,7 @@
<eval expected="2000" xpath="//flow/block[5]/lineArea[1]/inlineparent/@padding-end"/>
<eval expected="344000" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@ipd"/>
<eval expected="350000" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@ipda"/>
+ <eval expected="3000" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@offset"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@border-after"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@border-before"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[5]/lineArea[2]/inlineblockparent/@border-start"/>
@@ -142,6 +144,7 @@
<eval expected="2000" xpath="//flow/block[8]/lineArea[1]/inlineparent/@padding-end"/>
<eval expected="344000" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@ipd"/>
<eval expected="350000" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@ipda"/>
+ <eval expected="3000" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@offset"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@border-after"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@border-before"/>
<eval expected="(solid,#ff0000,1000)" xpath="//flow/block[8]/lineArea[2]/inlineblockparent/@border-start"/>