From: Vincent Hennebert Date: Thu, 24 Oct 2013 15:17:36 +0000 (+0000) Subject: When inline-progression-dimension has been left to auto on fo:inline-container, fall... X-Git-Tag: fop-2_0~137^2~23 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=69ff3a9270810958bbbcb414b60c7e2d460d3221;p=xmlgraphics-fop.git When inline-progression-dimension has been left to auto on fo:inline-container, fall back to the IPD of the nearest ancestor reference-area. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1535410 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index 3e044ad38..fb342bd8e 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java @@ -75,7 +75,7 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen @Override public List getNextKnuthElements(LayoutContext context, int alignment) { InlineContainer ic = (InlineContainer) fobj; - contentAreaIPD = getLength(ic.getInlineProgressionDimension()); + determineIPD(context); contentAreaBPD = getLength(ic.getBlockProgressionDimension()); LayoutContext childLC = LayoutContext.offspringOf(context); // TODO copyOf? childLC.setRefIPD(contentAreaIPD); @@ -90,6 +90,19 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen return knuthElements; } + private void determineIPD(LayoutContext layoutContext) { + LengthRangeProperty ipd = ((InlineContainer) fobj).getInlineProgressionDimension(); + Property optimum = ipd.getOptimum(this); // TODO percent base context + if (optimum.isAuto()) { + contentAreaIPD = layoutContext.getRefIPD(); + InlineLevelEventProducer eventProducer = InlineLevelEventProducer.Provider.get( + fobj.getUserAgent().getEventBroadcaster()); + eventProducer.inlineContainerAutoIPDNotSupported(this, contentAreaIPD / 1000f); + } else { + contentAreaIPD = optimum.getLength().getValue(this); // TODO percent base context + } + } + private int getLength(LengthRangeProperty property) { Property optimum = property.getOptimum(this); // TODO percent base context if (optimum.isAuto()) { diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java index 15284ae0a..332e14935 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java @@ -67,4 +67,13 @@ public interface InlineLevelEventProducer extends EventProducer { */ void lineOverflows(Object source, String elementName, int line, int overflowLength, Locator loc); + /** + * Auto IPD on inline-container is not supported. + * + * @param source the event source + * @param fallback the value in points that will be used as a fallback + * @event.severity WARN + */ + void inlineContainerAutoIPDNotSupported(Object source, float fallback); + } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml index 66d352eb7..8d699f6bc 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml @@ -20,4 +20,5 @@ [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] fo:leader is set to "use-content" but has no content.{{locator}} The contents of {elementName} line {line} exceed the available area in the inline-progression direction by {overflowLength,choice,50000#{overflowLength} millipoints|50000<more than 50 points}.{{locator}} + A value of "auto" for the inline-progression-dimension property on fo:inline-container is not supported. Falling back to {fallback}pt.{{locator}} diff --git a/test/layoutengine/standard-testcases/inline-container_auto-ipd.xml b/test/layoutengine/standard-testcases/inline-container_auto-ipd.xml new file mode 100644 index 000000000..48f5cd1cf --- /dev/null +++ b/test/layoutengine/standard-testcases/inline-container_auto-ipd.xml @@ -0,0 +1,61 @@ + + + + + +

+ When inline-progression-dimension has been left to auto on fo:inline-container, fall back to + the IPD of the nearest ancestor reference-area. +

+
+ + + + + + + + + + Before: + Text inside inline-container. + After. + + + + + + + Before: + Inside the inline-container. + After. + + + + + + + + + + + + + +