]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Issue a warning if the content of an inline-container overflows it in the block-progr...
authorVincent Hennebert <vhennebert@apache.org>
Thu, 24 Oct 2013 16:26:26 +0000 (16:26 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Thu, 24 Oct 2013 16:26:26 +0000 (16:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1535430 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
test/layoutengine/standard-testcases/inline-container_auto-ipd.xml
test/layoutengine/standard-testcases/inline-container_bpd.xml

index 107461c0a8910bd371245d570517c9e6f131aa7a..152d16a3d5ea96c73833e9fe04c99244a1ed99b1 100644 (file)
@@ -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());
+            }
         }
     }
 
index 48f5cd1cf72d224d800d56fa8985ae5b1714e2c2..0833d7f0daf89c22c68d346dd70e85ede7f00ca3 100644 (file)
@@ -42,7 +42,7 @@
         <fo:flow flow-name="xsl-region-body">
           <fo:block-container space-before="10pt" start-indent="100pt" width="100pt">
             <fo:block start-indent="0">
-              Before: <fo:inline-container height="20pt">
+              Before: <fo:inline-container>
                 <fo:block>Inside the inline-container.</fo:block>
               </fo:inline-container> After.
             </fo:block>
index 0a9d87442a48b5b39c7362df233d7252d48902a9..bd2dfdf9e0b7a0241f46f711ba24551137841b3d 100644 (file)
             </fo:inline-container> After.</fo:block>
         </fo:flow>
       </fo:page-sequence>
+      <fo:page-sequence master-reference="page">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Before: <fo:inline-container width="70pt" height="35pt" overflow="hidden">
+              <fo:block>This text overflows the inline-container in the 
+                block-progression-direction.</fo:block>
+            </fo:inline-container> After.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
     </fo:root>
   </fo>
 
   <checks>
-    <eval expected="40000" xpath="//viewport/@bpd"/>
+    <eval expected="40000" xpath="//pageSequence[1]//viewport/@bpd"/>
+    <eval expected="35000" xpath="//pageSequence[2]//viewport/@bpd"/>
+    <true xpath="//pageSequence[2]//viewport/@clip"/>
   </checks>
 </testcase>