]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Third phase of performance improvement.
authorFinn Bock <bckfnn@apache.org>
Wed, 20 Oct 2004 12:00:24 +0000 (12:00 +0000)
committerFinn Bock <bckfnn@apache.org>
Wed, 20 Oct 2004 12:00:24 +0000 (12:00 +0000)
- 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

src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java

index 5b6bf5002e12bc269054d955d4ff5602fa0f93ac..7bf1f126351e35fe4ec4c3ad67f58af1d5dd5376 100644 (file)
@@ -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())) {