]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Inline block parents were not correctly positioned when border/padding got involved...
authorManuel Mall <manuel@apache.org>
Fri, 14 Oct 2005 13:20:53 +0000 (13:20 +0000)
committerManuel Mall <manuel@apache.org>
Fri, 14 Oct 2005 13:20:53 +0000 (13:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@321108 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
src/java/org/apache/fop/render/AbstractRenderer.java
src/java/org/apache/fop/render/xml/XMLRenderer.java
test/layoutengine/testcases/inline_border_padding_block_nested_1.xml
test/layoutengine/testcases/inline_border_padding_block_nested_2.xml

index fdfcca3730abd7eaa85037247f59f5a3f594d6f5..ea1eb11a02d359323a33d0b6c3c1f7d7f3ccec0a 100755 (executable)
@@ -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);
         
index 16c8f75aed559ce1a72a11989845e10e6f5f1a3f..aceac1a87f86467e2a5f006029a17ed1342ed07a 100644 (file)
@@ -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;
     }
index cedbb404f41320bd8032ca3f761415e9f8561fd2..71d47df40fae887b3e01d7302dbe39f156b163f7 100644 (file)
@@ -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");
index 39374599947fae62f5f7e278bab1bb7585c77bbd..a3d9e9e4ebac3023f439a4fadb5a044f338044a7 100755 (executable)
@@ -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"/>
     <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"/>
index 4f48a4dd2b63d39887ec9abea2132f15c0ffee22..c7e9210f02a77592a3f8483e0061c5814b33243d 100755 (executable)
@@ -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"/>
     <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"/>
     <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"/>