From 5530937d762b0a15b48940c544a157769b1137a0 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Thu, 24 Oct 2013 16:26:26 +0000 Subject: [PATCH] Issue a warning if the content of an inline-container overflows it in the block-progression-direction git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1535430 13f79535-47bb-0310-9956-ffa450edef68 --- .../inline/InlineContainerLayoutManager.java | 12 +++++++++++- .../standard-testcases/inline-container_auto-ipd.xml | 2 +- .../standard-testcases/inline-container_bpd.xml | 12 +++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index 107461c0a..152d16a3d 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.BlockLevelEventProducer; import org.apache.fop.layoutmgr.ElementListUtils; import org.apache.fop.layoutmgr.InlineKnuthSequence; import org.apache.fop.layoutmgr.KnuthPossPosIter; @@ -106,10 +107,19 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen private void determineBPD() { LengthRangeProperty bpd = ((InlineContainer) fobj).getBlockProgressionDimension(); Property optimum = bpd.getOptimum(this); // TODO percent base context + int actualBPD = ElementListUtils.calcContentLength(childElements); if (optimum.isAuto()) { - contentAreaBPD = ElementListUtils.calcContentLength(childElements); + 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()); + } } } diff --git a/test/layoutengine/standard-testcases/inline-container_auto-ipd.xml b/test/layoutengine/standard-testcases/inline-container_auto-ipd.xml index 48f5cd1cf..0833d7f0d 100644 --- a/test/layoutengine/standard-testcases/inline-container_auto-ipd.xml +++ b/test/layoutengine/standard-testcases/inline-container_auto-ipd.xml @@ -42,7 +42,7 @@ - Before: + Before: Inside the inline-container. After. diff --git a/test/layoutengine/standard-testcases/inline-container_bpd.xml b/test/layoutengine/standard-testcases/inline-container_bpd.xml index 0a9d87442..bd2dfdf9e 100644 --- a/test/layoutengine/standard-testcases/inline-container_bpd.xml +++ b/test/layoutengine/standard-testcases/inline-container_bpd.xml @@ -37,10 +37,20 @@ After. + + + Before: + This text overflows the inline-container in the + block-progression-direction. + After. + + - + + + -- 2.39.5