aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2013-10-28 17:15:35 +0000
committerVincent Hennebert <vhennebert@apache.org>2013-10-28 17:15:35 +0000
commit0169e567a969752cf36139831318187a1e63c8e9 (patch)
tree765593d8bffad00623e93d79dae0101fa5c615e0 /src/java
parent8c5aef924ae27549bac3d34057e5e36aaf0bca81 (diff)
downloadxmlgraphics-fop-0169e567a969752cf36139831318187a1e63c8e9.tar.gz
xmlgraphics-fop-0169e567a969752cf36139831318187a1e63c8e9.zip
Added support for percentage dimensions
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1536425 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
index a51d64c2c..7e2b186be 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
@@ -95,32 +95,37 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen
private void determineIPD(LayoutContext layoutContext) {
LengthRangeProperty ipd = ((InlineContainer) fobj).getInlineProgressionDimension();
- Property optimum = ipd.getOptimum(this); // TODO percent base context
+ Property optimum = ipd.getOptimum(this);
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
+ contentAreaIPD = optimum.getLength().getValue(this);
}
}
private void determineBPD() {
LengthRangeProperty bpd = ((InlineContainer) fobj).getBlockProgressionDimension();
- Property optimum = bpd.getOptimum(this); // TODO percent base context
+ Property optimum = bpd.getOptimum(this);
int actualBPD = ElementListUtils.calcContentLength(childElements);
if (optimum.isAuto()) {
contentAreaBPD = actualBPD;
} else {
- contentAreaBPD = optimum.getLength().getValue(this); // TODO percent base context
- if (contentAreaBPD < actualBPD) {
- BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
- fobj.getUserAgent().getEventBroadcaster());
- boolean canRecover = (((InlineContainer) fobj).getOverflow() != EN_ERROR_IF_OVERFLOW);
- eventProducer.viewportBPDOverflow(this, fobj.getName(),
- actualBPD - contentAreaBPD, needClip(), canRecover,
- fobj.getLocator());
+ double bpdValue = optimum.getLength().getNumericValue(this);
+ if (bpdValue < 0) {
+ contentAreaBPD = actualBPD;
+ } else {
+ contentAreaBPD = (int) Math.round(bpdValue);
+ if (contentAreaBPD < actualBPD) {
+ BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
+ fobj.getUserAgent().getEventBroadcaster());
+ boolean canRecover = (((InlineContainer) fobj).getOverflow() != EN_ERROR_IF_OVERFLOW);
+ eventProducer.viewportBPDOverflow(this, fobj.getName(),
+ actualBPD - contentAreaBPD, needClip(), canRecover,
+ fobj.getLocator());
+ }
}
}
}