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 bc...@apache.org on 2004/10/20 14:00:24 UTC

cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr InlineStackingLayoutManager.java

bckfnn      2004/10/20 05:00:24

  Modified:    src/java/org/apache/fop/layoutmgr
                        InlineStackingLayoutManager.java
  Log:
  Third phase of performance improvement.
  - Use the new CommonXXX fields.
  - Delegate all access to fo:inline properties to the InlineLM subclass.
  PR: 31699
  
  Revision  Changes    Path
  1.14      +30 -17    xml-fop/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
  
  Index: InlineStackingLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- InlineStackingLayoutManager.java	19 Oct 2004 21:51:54 -0000	1.13
  +++ InlineStackingLayoutManager.java	20 Oct 2004 12:00:24 -0000	1.14
  @@ -25,8 +25,8 @@
   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 @@
        */
       protected MinOptMax extraBPD;
   
  -
  -    private InlineProps inlineProps = null;
  -
       private Area currentArea; // LineArea or InlineParent
   
       private BreakPoss prevBP;
  @@ -97,8 +94,6 @@
        * @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 @@
           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 @@
        * 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 @@
               // 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 @@
               // 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 @@
                                     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 @@
               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 @@
           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 @@
               // 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())) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org