From c925990c7c290876d6857a4cc02e362b0ed6ca72 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Thu, 24 Oct 2013 15:36:12 +0000 Subject: [PATCH] Added support for block-progression-dimension="auto" git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1535417 13f79535-47bb-0310-9956-ffa450edef68 --- .../inline/InlineContainerLayoutManager.java | 14 +++--- .../inline-container_bpd.xml | 46 +++++++++++++++++++ 2 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 test/layoutengine/standard-testcases/inline-container_bpd.xml diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index fb342bd8e..107461c0a 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java @@ -35,6 +35,7 @@ import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; import org.apache.fop.layoutmgr.AbstractLayoutManager; +import org.apache.fop.layoutmgr.ElementListUtils; import org.apache.fop.layoutmgr.InlineKnuthSequence; import org.apache.fop.layoutmgr.KnuthPossPosIter; import org.apache.fop.layoutmgr.KnuthSequence; @@ -74,12 +75,11 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen @Override public List getNextKnuthElements(LayoutContext context, int alignment) { - InlineContainer ic = (InlineContainer) fobj; determineIPD(context); - contentAreaBPD = getLength(ic.getBlockProgressionDimension()); LayoutContext childLC = LayoutContext.offspringOf(context); // TODO copyOf? childLC.setRefIPD(contentAreaIPD); childElements = getChildKnuthElements(childLC, alignment); // TODO which alignment? + determineBPD(); AlignmentContext alignmentContext = makeAlignmentContext(context); // TODO correct? Position position = new Position(this, 0); KnuthSequence knuthSequence = new InlineKnuthSequence(); @@ -103,12 +103,14 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen } } - private int getLength(LengthRangeProperty property) { - Property optimum = property.getOptimum(this); // TODO percent base context + private void determineBPD() { + LengthRangeProperty bpd = ((InlineContainer) fobj).getBlockProgressionDimension(); + Property optimum = bpd.getOptimum(this); // TODO percent base context if (optimum.isAuto()) { - throw new UnsupportedOperationException("auto dimension not supported"); + contentAreaBPD = ElementListUtils.calcContentLength(childElements); + } else { + contentAreaBPD = optimum.getLength().getValue(this); // TODO percent base context } - return optimum.getLength().getValue(this); // TODO percent base context } private List getChildKnuthElements(LayoutContext layoutContext, int alignment) { diff --git a/test/layoutengine/standard-testcases/inline-container_bpd.xml b/test/layoutengine/standard-testcases/inline-container_bpd.xml new file mode 100644 index 000000000..0a9d87442 --- /dev/null +++ b/test/layoutengine/standard-testcases/inline-container_bpd.xml @@ -0,0 +1,46 @@ + + + + + +

+ Checks that inline-progression-dimension on fo:inline-container is properly handled. +

+
+ + + + + + + + + + Before: + This text inside inline-container should fit on four lines. + After. + + + + + + + + +
-- 2.39.5