]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added support for <percentage> values on alignment-adjust
authorVincent Hennebert <vhennebert@apache.org>
Thu, 7 Nov 2013 12:33:11 +0000 (12:33 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Thu, 7 Nov 2013 12:33:11 +0000 (12:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1539615 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
test/layoutengine/standard-testcases/inline-container_alignment-adjust.xml

index 539ebc897802606e1fa60c55d2d68fd7408ebabc..5127794c036dfbcd6e39bbb411630d6d1b8725a6 100644 (file)
@@ -201,8 +201,9 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen
             return getInlineContainerBaselineOffset(baseline);
         } else {
             int baselineOffset = getInlineContainerBaselineOffset(dominantBaseline);
+            int lineHeight = getInlineContainer().getLineHeight().getOptimum(this).getLength().getValue(this);
             int adjust = alignmentAdjust.getValue(
-                    new SimplePercentBaseContext(null, LengthBase.ALIGNMENT_ADJUST, 0));
+                    new SimplePercentBaseContext(null, LengthBase.ALIGNMENT_ADJUST, lineHeight));
             return baselineOffset + adjust;
         }
     }
index b63e36b69f42e6900d34c962cc9533c671fa1b99..3e696a69689c6d0f6d2d36e2c781e5f3dab5122f 100644 (file)
         </fo:flow>
       </fo:page-sequence>
 
+      <fo:page-sequence master-reference="page">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block space-after="10pt">alignment-adjust="10%":</fo:block>
+          <fo:block>The line before. The line before. Before: <fo:inline-container width="100pt" 
+              alignment-adjust="-10%" dominant-baseline="text-before-edge">
+              <fo:block>Inside the inline-container.</fo:block>
+            </fo:inline-container> After the inline-container.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+
     </fo:root>
   </fo>
 
     <eval expected="38664" xpath="//pageSequence[11]//flow/block[2]/lineArea[2]/text[1]/@offset"/>
     <eval expected="8616"  xpath="//pageSequence[11]//flow/block[2]/lineArea[2]/text[1]/@baseline"/>
     <eval expected="28800" xpath="//pageSequence[11]//flow/block[2]/lineArea[2]/viewport/@bpd"/>
-    <eval expected="0"  xpath="//pageSequence[11]//flow/block[2]/lineArea[2]/viewport/@offset"/>
+    <eval expected="0"     xpath="//pageSequence[11]//flow/block[2]/lineArea[2]/viewport/@offset"/>
+
+    <!-- 10% -->
+    <eval expected="38856" xpath="//pageSequence[12]//flow/block[2]/lineArea[2]/@bpd"/>
+    <eval expected="0"     xpath="//pageSequence[12]//flow/block[2]/lineArea[2]/text[1]/@offset"/>
+    <eval expected="8616"  xpath="//pageSequence[12]//flow/block[2]/lineArea[2]/text[1]/@baseline"/>
+    <eval expected="28800" xpath="//pageSequence[12]//flow/block[2]/lineArea[2]/viewport/@bpd"/>
+    <eval expected="10056" xpath="//pageSequence[12]//flow/block[2]/lineArea[2]/viewport/@offset"/>
 
   </checks>
 </testcase>