You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2013/10/28 19:54:11 UTC

svn commit: r1536486 - in /xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr: BlockStackingLayoutManager.java inline/InlineContainerLayoutManager.java

Author: vhennebert
Date: Mon Oct 28 18:54:11 2013
New Revision: 1536486

URL: http://svn.apache.org/r1536486
Log:
Properly handle "error-if-overflow" value of "overflow" property when overflow happens in inline-progression-direction

Modified:
    xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
    xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java

Modified: xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=1536486&r1=1536485&r2=1536486&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Mon Oct 28 18:54:11 2013
@@ -36,6 +36,7 @@ import org.apache.fop.fo.properties.Brea
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.fo.properties.KeepProperty;
 import org.apache.fop.fo.properties.SpaceProperty;
+import org.apache.fop.layoutmgr.inline.InlineContainerLayoutManager;
 import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.util.ListUtil;
@@ -1246,6 +1247,8 @@ public abstract class BlockStackingLayou
     public boolean handleOverflow(int milliPoints) {
         if (getParent() instanceof BlockStackingLayoutManager) {
             return ((BlockStackingLayoutManager) getParent()).handleOverflow(milliPoints);
+        } else if (getParent() instanceof InlineContainerLayoutManager) {
+            return ((InlineContainerLayoutManager) getParent()).handleOverflow(milliPoints);
         }
         return false;
     }

Modified: xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java?rev=1536486&r1=1536485&r2=1536486&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java Mon Oct 28 18:54:11 2013
@@ -63,6 +63,7 @@ public class InlineContainerLayoutManage
     private int contentAreaBPD;
 
     private List<ListElement> childElements;
+    private int ipdOverflow;
     private InlineViewport currentViewport;
     private Container referenceArea;
 
@@ -119,17 +120,23 @@ public class InlineContainerLayoutManage
             } 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);
+                    BlockLevelEventProducer eventProducer = getBlockLevelEventProducer();
                     eventProducer.viewportBPDOverflow(this, fobj.getName(),
-                            actualBPD - contentAreaBPD, needClip(), canRecover,
+                            actualBPD - contentAreaBPD, needClip(), canRecoverFromOverflow(),
                             fobj.getLocator());
                 }
             }
         }
     }
 
+    private BlockLevelEventProducer getBlockLevelEventProducer() {
+        return BlockLevelEventProducer.Provider.get(fobj.getUserAgent().getEventBroadcaster());
+    }
+
+    private boolean canRecoverFromOverflow() {
+        return ((InlineContainer) fobj).getOverflow() != EN_ERROR_IF_OVERFLOW;
+    }
+
     private List<ListElement> getChildKnuthElements(LayoutContext layoutContext, int alignment) {
         List<ListElement> allChildElements = new LinkedList<ListElement>();
         LayoutManager childLM;
@@ -141,12 +148,22 @@ public class InlineContainerLayoutManage
             allChildElements.addAll(childElements);
             // TODO breaks, keeps, empty content
         }
+        handleIPDOverflow();
         wrapPositions(allChildElements);
         SpaceResolver.resolveElementList(allChildElements);
         // TODO break-before, break-after
         return allChildElements;
     }
 
+    private void handleIPDOverflow() {
+        if (ipdOverflow > 0) {
+            BlockLevelEventProducer eventProducer = getBlockLevelEventProducer();
+            eventProducer.viewportIPDOverflow(this, fobj.getName(),
+                    ipdOverflow, needClip(), canRecoverFromOverflow(),
+                    fobj.getLocator());
+        }
+    }
+
     private void wrapPositions(List<ListElement> elements) {
         for (ListElement element : elements) {
             Position position = new NonLeafPosition(this, element.getPosition());
@@ -234,6 +251,11 @@ public class InlineContainerLayoutManage
                 context.getWritingMode());
     }
 
+    public boolean handleOverflow(int milliPoints) {
+        ipdOverflow = Math.max(ipdOverflow, milliPoints);
+        return true;
+    }
+
     public List addALetterSpaceTo(List oldList) {
         throw new UnsupportedOperationException("Not implemented");
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org