diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2013-10-28 18:54:11 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2013-10-28 18:54:11 +0000 |
commit | 19f04b9ac8fdaaea7436753ef272d19b658d0471 (patch) | |
tree | 842df9ac3ceedec86bbca533bea3c468aea4dabf /src/java/org/apache/fop/layoutmgr | |
parent | 0169e567a969752cf36139831318187a1e63c8e9 (diff) | |
download | xmlgraphics-fop-19f04b9ac8fdaaea7436753ef272d19b658d0471.tar.gz xmlgraphics-fop-19f04b9ac8fdaaea7436753ef272d19b658d0471.zip |
Properly handle "error-if-overflow" value of "overflow" property when overflow happens in inline-progression-direction
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1536486 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java | 3 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java | 30 |
2 files changed, 29 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index d11f062cb..250e07727 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -36,6 +36,7 @@ import org.apache.fop.fo.properties.BreakPropertySet; 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 BlockStackingLayoutManager extends AbstractLayoutManager 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; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index 7e2b186be..85d21833b 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java @@ -63,6 +63,7 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen private int contentAreaBPD; private List<ListElement> childElements; + private int ipdOverflow; private InlineViewport currentViewport; private Container referenceArea; @@ -119,17 +120,23 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen } 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 InlineContainerLayoutManager extends AbstractLayoutManager implemen 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 InlineContainerLayoutManager extends AbstractLayoutManager implemen context.getWritingMode()); } + public boolean handleOverflow(int milliPoints) { + ipdOverflow = Math.max(ipdOverflow, milliPoints); + return true; + } + public List addALetterSpaceTo(List oldList) { throw new UnsupportedOperationException("Not implemented"); } |