Просмотр исходного кода

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
tags/fop-2_0
Vincent Hennebert 10 лет назад
Родитель
Сommit
5530937d76

+ 11
- 1
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());
}
}
}


+ 1
- 1
test/layoutengine/standard-testcases/inline-container_auto-ipd.xml Просмотреть файл

@@ -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>

+ 11
- 1
test/layoutengine/standard-testcases/inline-container_bpd.xml Просмотреть файл

@@ -37,10 +37,20 @@
</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>

Загрузка…
Отмена
Сохранить