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 18:09:22 UTC
svn commit: r1536418 - in /xmlgraphics/fop/branches/Temp_InlineContainer:
src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/
test/layoutengine/standard-testcases/
Author: vhennebert
Date: Mon Oct 28 17:09:21 2013
New Revision: 1536418
URL: http://svn.apache.org/r1536418
Log:
Do space resolution on the children of the inline-container
Modified:
xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
xmlgraphics/fop/branches/Temp_InlineContainer/test/layoutengine/standard-testcases/inline-container_bpd.xml
Modified: xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=1536418&r1=1536417&r2=1536418&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Mon Oct 28 17:09:21 2013
@@ -33,11 +33,11 @@ public final class AreaAdditionUtil {
/**
* Creates the child areas for the given layout manager.
- * @param bslm the BlockStackingLayoutManager instance for which "addAreas" is performed.
+ * @param parentLM the parent layout manager
* @param parentIter the position iterator
* @param layoutContext the layout context
*/
- public static void addAreas(BlockStackingLayoutManager bslm,
+ public static void addAreas(AbstractLayoutManager parentLM,
PositionIterator parentIter, LayoutContext layoutContext) {
LayoutManager childLM;
LayoutContext lc = LayoutContext.offspringOf(layoutContext);
@@ -46,8 +46,8 @@ public final class AreaAdditionUtil {
Position firstPos = null;
Position lastPos = null;
- if (bslm != null) {
- bslm.addId();
+ if (parentLM != null) {
+ parentLM.addId();
}
// "unwrap" the NonLeafPositions stored in parentIter
@@ -86,11 +86,11 @@ public final class AreaAdditionUtil {
//doesn't give us that info.
}
- if (bslm != null) {
- bslm.registerMarkers(
+ if (parentLM != null) {
+ parentLM.registerMarkers(
true,
- bslm.isFirst(firstPos),
- bslm.isLast(lastPos));
+ parentLM.isFirst(firstPos),
+ parentLM.isLast(lastPos));
}
PositionIterator childPosIter = new PositionIterator(positionList.listIterator());
@@ -113,11 +113,11 @@ public final class AreaAdditionUtil {
childLM.addAreas(childPosIter, lc);
}
- if (bslm != null) {
- bslm.registerMarkers(
+ if (parentLM != null) {
+ parentLM.registerMarkers(
false,
- bslm.isFirst(firstPos),
- bslm.isLast(lastPos));
+ parentLM.isFirst(firstPos),
+ parentLM.isLast(lastPos));
}
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=1536418&r1=1536417&r2=1536418&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 17:09:21 2013
@@ -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.AreaAdditionUtil;
import org.apache.fop.layoutmgr.BlockLevelEventProducer;
import org.apache.fop.layoutmgr.ElementListUtils;
import org.apache.fop.layoutmgr.InlineKnuthSequence;
@@ -43,6 +44,7 @@ import org.apache.fop.layoutmgr.KnuthSeq
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.ListElement;
+import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.SpaceResolver;
@@ -134,11 +136,20 @@ public class InlineContainerLayoutManage
allChildElements.addAll(childElements);
// TODO breaks, keeps, empty content
}
+ wrapPositions(allChildElements);
SpaceResolver.resolveElementList(allChildElements);
// TODO break-before, break-after
return allChildElements;
}
+ private void wrapPositions(List<ListElement> elements) {
+ for (ListElement element : elements) {
+ Position position = new NonLeafPosition(this, element.getPosition());
+ notifyPos(position);
+ element.setPosition(position);
+ }
+ }
+
@Override
public void addAreas(PositionIterator posIter, LayoutContext context) {
Position inlineContainerPosition = null;
@@ -148,26 +159,12 @@ public class InlineContainerLayoutManage
inlineContainerPosition = pos;
}
}
- addId();
-// addMarkersToPage(
-// true,
-// true,
-// lastPos == null || isLast(lastPos));
-
if (inlineContainerPosition != null) {
- LayoutManager childLM;
+ SpaceResolver.performConditionalsNotification(childElements, 0, childElements.size() - 1, -1);
KnuthPossPosIter childPosIter = new KnuthPossPosIter(childElements);
- while ((childLM = childPosIter.getNextChildLM()) != null) {
- LayoutContext childLC = LayoutContext.copyOf(context); // TODO correct?
- childLM.addAreas(childPosIter, childLC);
- }
+ AreaAdditionUtil.addAreas(this, childPosIter, context);
}
-// addMarkersToPage(
-// false,
-// true,
-// lastPos == null || isLast(lastPos));
-
// boolean isLast = (context.isLastArea() && prevLM == lastChildLM);
// context.setFlags(LayoutContext.LAST_AREA, isLast);
}
Modified: xmlgraphics/fop/branches/Temp_InlineContainer/test/layoutengine/standard-testcases/inline-container_bpd.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_InlineContainer/test/layoutengine/standard-testcases/inline-container_bpd.xml?rev=1536418&r1=1536417&r2=1536418&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_InlineContainer/test/layoutengine/standard-testcases/inline-container_bpd.xml (original)
+++ xmlgraphics/fop/branches/Temp_InlineContainer/test/layoutengine/standard-testcases/inline-container_bpd.xml Mon Oct 28 17:09:21 2013
@@ -45,12 +45,24 @@
</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="80pt">
+ <fo:block space-after="10pt">Block 1</fo:block>
+ <fo:block space-before="20pt" space-after="10pt"
+ space-after.conditionality="retain">Block 2</fo:block>
+ </fo:inline-container> After.</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
</fo:root>
</fo>
<checks>
<eval expected="40000" xpath="//pageSequence[1]//viewport/@bpd"/>
+
<eval expected="35000" xpath="//pageSequence[2]//viewport/@bpd"/>
<true xpath="//pageSequence[2]//viewport/@clip"/>
+
+ <eval expected="50000" xpath="//pageSequence[3]//viewport/@bpd"/>
</checks>
</testcase>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org