private MinOptMax effSpaceBefore;
private MinOptMax effSpaceAfter;
+ private int horizontalOverflow;
private double contentRectOffsetX = 0;
private double contentRectOffsetY = 0;
BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
getBlockContainerFO().getUserAgent().getEventBroadcaster());
boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
- eventProducer.viewportOverflow(this, getBlockContainerFO().getName(),
+ eventProducer.viewportBPDOverflow(this, getBlockContainerFO().getName(),
breaker.getOverflowAmount(), needClip(), canRecover,
getBlockContainerFO().getLocator());
}
BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
getBlockContainerFO().getUserAgent().getEventBroadcaster());
boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
- eventProducer.viewportOverflow(this, getBlockContainerFO().getName(),
+ eventProducer.viewportBPDOverflow(this, getBlockContainerFO().getName(),
breaker.getOverflowAmount(), needClip(), canRecover,
getBlockContainerFO().getLocator());
}
+ // this handles the IPD (horizontal) overflow
+ if (this.horizontalOverflow > 0) {
+ BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider
+ .get(getBlockContainerFO().getUserAgent().getEventBroadcaster());
+ boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
+ eventProducer.viewportIPDOverflow(this, getBlockContainerFO().getName(),
+ this.horizontalOverflow, needClip(), canRecover, getBlockContainerFO().getLocator());
+ }
}
setFinished(true);
}
}
+ /** {@inheritDoc} */
+ public boolean handleOverflow(int milliPoints) {
+ if (milliPoints > this.horizontalOverflow) {
+ this.horizontalOverflow = milliPoints;
+ }
+ return true;
+ }
}
void overconstrainedAdjustEndIndent(Object source, String elementName, int amount, Locator loc);
/**
- * Contents overflow a viewport.
+ * Contents IPD overflow a viewport.
* @param source the event source
* @param elementName the formatting object
* @param amount the amount by which the contents overflow (in mpt)
* @param clip true if the content will be clipped
* @param canRecover indicates whether FOP can recover from this problem and continue working
* @param loc the location of the error or null
- * @throws LayoutException the layout error provoked by the method call
- * @event.severity FATAL
+ * @event.severity ERROR
*/
- void viewportOverflow(Object source, String elementName,
- int amount, boolean clip, boolean canRecover,
- Locator loc) throws LayoutException;
+ void viewportIPDOverflow(Object source, String elementName, int amount, boolean clip,
+ boolean canRecover, Locator loc);
+
+ /**
+ * Contents BPD overflow a viewport.
+ * @param source the event source
+ * @param elementName the formatting object
+ * @param amount the amount by which the contents overflow (in mpt)
+ * @param clip true if the content will be clipped
+ * @param canRecover indicates whether FOP can recover from this problem and continue working
+ * @param loc the location of the error or null
+ * @event.severity ERROR
+ */
+ void viewportBPDOverflow(Object source, String elementName, int amount, boolean clip,
+ boolean canRecover, Locator loc);
/**
* Contents overflow a region viewport.
<message key="tableFixedAutoWidthNotSupported">table-layout="fixed" and width="auto", but auto-layout not supported => assuming width="100%".{{locator}}</message>
<message key="objectTooWide">The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt > {maxIPD}mpt).{{locator}}</message>
<message key="overconstrainedAdjustEndIndent">An {elementName} {{locator}} is wider than the available room in inline-progression-dimension. Adjusting end-indent based on overconstrained geometry rules (XSL 1.1, ch. 5.3.4)</message>
- <message key="viewportOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
+ <message key="viewportIPDOverflow">Content overflows the viewport of an {elementName} in inline-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
+ <message key="viewportBPDOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
<message key="regionOverflow">Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
<message key="flowNotMappingToRegionBody">Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}}</message>
<message key="pageSequenceMasterExhausted">Subsequences exhausted in page-sequence-master "{pageSequenceMasterName}", {canRecover,if,using previous subsequence,cannot recover}.{{locator}}</message>
// TODO startIndent, endIndent
}
+ /**
+ * Whether this LM can handle horizontal overflow error messages (only a BlockContainerLayoutManager can).
+ * @param milliPoints horizontal overflow
+ * @return true if handled by a BlockContainerLayoutManager
+ */
+ public boolean handleOverflow(int milliPoints) {
+ if (getParent() instanceof BlockStackingLayoutManager) {
+ return ((BlockStackingLayoutManager) getParent()).handleOverflow(milliPoints);
+ }
+ return false;
+ }
}
import org.apache.fop.hyphenation.Hyphenation;
import org.apache.fop.hyphenation.Hyphenator;
import org.apache.fop.layoutmgr.Adjustment;
+import org.apache.fop.layoutmgr.BlockLayoutManager;
import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BreakElement;
import org.apache.fop.layoutmgr.BreakingAlgorithm;
if (log.isWarnEnabled()) {
int lack = difference + bestActiveNode.availableShrink;
- if (lack < 0) {
+ // if this LLM is nested inside a BlockContainerLayoutManager that is constraining
+ // the available width and thus responsible for the overflow then we do not issue
+ // warning event here and instead let the BCLM handle that at a later stage
+ if (lack < 0 && !handleOverflow(-lack)) {
InlineLevelEventProducer eventProducer
= InlineLevelEventProducer.Provider.get(
getFObj().getUserAgent().getEventBroadcaster());
return true;
}
+ /**
+ * Whether this LM can handle horizontal overflow error messages (only a BlockContainerLayoutManager can).
+ * @param milliPoints horizontal overflow
+ * @return true if handled by a BlockContainerLayoutManager
+ */
+ public boolean handleOverflow(int milliPoints) {
+ if (getParent() instanceof BlockLayoutManager) {
+ return ((BlockLayoutManager) getParent()).handleOverflow(milliPoints);
+ }
+ return false;
+ }
}
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Code" dev="GA" type="update" fixes-bug="53094" due-to="Luis Bernardo">
+ Convert block container overflow exception to event model, improving overflow property behavior.
+ </action>
<action context="Code" dev="GA" type="update" fixes-bug="51617">
Add run target for embedded examples. Add increased JVM memory heap flag for example8 in case font cache is rebuilt.
</action>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="page"
- page-height="420pt" page-width="320pt" margin="10pt">
+ page-height="420pt" page-width="100pt" margin="10pt">
<fo:region-body background-color="#F0F0F0"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page">
<fo:flow flow-name="xsl-region-body">
<fo:block>The following line overflows its container:</fo:block>
- <fo:block-container width="100pt" height="100pt" border="1pt solid black">
- <fo:block>ThisLineOverflowsItsContainer</fo:block>
- </fo:block-container>
+ <fo:block border="1pt solid black">ThisLineOverflowsItsContainer</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master page-width="10.0cm" page-height="10.0cm" master-name="testpage">
+ <fo:region-body />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="testpage">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block-container overflow="error-if-overflow" position="absolute" height="20pt" width="40pt" left="30pt" top="20pt">
+ <fo:block>abcdefghijklmnopqrstuvwxyz</fo:block>
+ </fo:block-container>
+ <fo:block-container overflow="error-if-overflow" position="absolute" height="65pt" width="40pt" left="90pt" top="20pt">
+ <fo:block>abc def ghi jkl mno pqr stu vwx yz</fo:block>
+ </fo:block-container>
+ </fo:flow>
+ </fo:page-sequence>
+</fo:root>
doTest("inline-level.fo",
InlineLevelEventProducer.class.getName() + ".lineOverflows");
}
+
+ @Test
+ public void testViewportIPDOverflow() throws FOPException, TransformerException, IOException,
+ SAXException {
+ doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportIPDOverflow");
+ }
+
+ @Test
+ public void testViewportBPDOverflow() throws FOPException, TransformerException, IOException,
+ SAXException {
+ doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportBPDOverflow");
+ }
}