aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-10-20 12:00:24 +0000
committerFinn Bock <bckfnn@apache.org>2004-10-20 12:00:24 +0000
commitd8daba391b452ed683c18b86836683d742b62c3c (patch)
tree5a4dc6745ad69fb46019a2733fd85ee546aca399
parent6de5e9dbab81747a8464159c23192671df83ff27 (diff)
downloadxmlgraphics-fop-d8daba391b452ed683c18b86836683d742b62c3c.tar.gz
xmlgraphics-fop-d8daba391b452ed683c18b86836683d742b62c3c.zip
Third phase of performance improvement.
- Use the new CommonXXX fields. - Delegate all access to fo:inline properties to the InlineLM subclass. PR: 31699 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198080 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
index 5b6bf5002..7bf1f1263 100644
--- a/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
@@ -25,8 +25,8 @@ import java.util.ListIterator;
import java.util.HashMap;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
-import org.apache.fop.traits.InlineProps;
+import org.apache.fop.fo.properties.SpaceProperty;
+import org.apache.fop.traits.SpaceVal;
import org.apache.fop.area.Area;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.InlineParent;
@@ -66,9 +66,6 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
*/
protected MinOptMax extraBPD;
-
- private InlineProps inlineProps = null;
-
private Area currentArea; // LineArea or InlineParent
private BreakPoss prevBP;
@@ -97,8 +94,6 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
* @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
*/
protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- inlineProps = pm.getInlineProps();
extraBPD = new MinOptMax(0);
}
@@ -134,6 +129,14 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
return false;
}
+ protected SpaceProperty getSpaceStart() {
+ return null;
+ }
+
+ protected SpaceProperty getSpaceEnd() {
+ return null;
+ }
+
/**
* Reset position for returning next BreakPossibility.
* @param prevPos a Position returned by this layout manager
@@ -175,9 +178,6 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
* propagate to first child LM
*/
public boolean canBreakBefore(LayoutContext context) {
- if (inlineProps.spaceStart.getSpace().min > 0 || hasLeadingFence(false)) {
- return true;
- }
LayoutManager lm = getChildLM();
if (lm != null) {
return lm.canBreakBefore(context);
@@ -215,7 +215,9 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
// First call to this LM in new parent "area", but this may
// not be the first area created by this inline
childLC = new LayoutContext(lc);
- lc.getLeadingSpace().addSpace(inlineProps.spaceStart);
+ if (getSpaceStart() != null) {
+ lc.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart()));
+ }
// Check for "fence"
if (hasLeadingFence(!lc.isFirstArea())) {
@@ -338,7 +340,9 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
// call in this LM
trailingSpace = (SpaceSpecifier) trailingSpace.clone();
}
- trailingSpace.addSpace(inlineProps.spaceEnd);
+ if (getSpaceEnd() != null) {
+ trailingSpace.addSpace(new SpaceVal(getSpaceEnd()));
+ }
myBP.setTrailingSpace(trailingSpace);
// Add start and end borders and padding
@@ -441,7 +445,9 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
false);
}
- context.getLeadingSpace().addSpace(inlineProps.spaceStart);
+ if (getSpaceStart() != null) {
+ context.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart()));
+ }
// "unwrap" the NonLeafPositions stored in parentIter
// and put them in a new list;
@@ -492,10 +498,11 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
context.setTrailingSpace(getContext().getTrailingSpace());
}
// Add own trailing space to parent context (or set on area?)
- if (context.getTrailingSpace() != null) {
- context.getTrailingSpace().addSpace(inlineProps.spaceEnd);
+ if (context.getTrailingSpace() != null && getSpaceEnd() != null) {
+ context.getTrailingSpace().addSpace(new SpaceVal(getSpaceEnd()));
}
-
+ setTraits(bAreaCreated, !bIsLast);
+
parentLM.addChild(getCurrentArea());
context.setFlags(LayoutContext.LAST_AREA, bIsLast);
bAreaCreated = true;
@@ -509,6 +516,10 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
currentArea = area;
}
+ protected void setTraits(boolean bNotFirst, boolean bNotLast) {
+
+ }
+
public void addChild(Area childArea) {
// Make sure childArea is inline area
if (childArea instanceof InlineArea) {
@@ -569,7 +580,9 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
// First call to this LM in new parent "area", but this may
// not be the first area created by this inline
childLC = new LayoutContext(lc);
- lc.getLeadingSpace().addSpace(inlineProps.spaceStart);
+ if (getSpaceStart() != null) {
+ lc.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart()));
+ }
// Check for "fence"
if (hasLeadingFence(!lc.isFirstArea())) {