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/19 23:51:54 UTC
cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr InlineLayoutManager.java InlineStackingLayoutManager.java
bckfnn 2004/10/19 14:51:54
Modified: src/java/org/apache/fop/layoutmgr
InlineStackingLayoutManager.java
Added: src/java/org/apache/fop/layoutmgr InlineLayoutManager.java
Log:
Third phase of performance improvement.
- Split the border/padding features of InlineStackingLM out into a
InlineLM which is the LM for fo:inline.
PR: 31699
Revision Changes Path
1.13 +5 -41 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- InlineStackingLayoutManager.java 22 Sep 2004 08:24:32 -0000 1.12
+++ InlineStackingLayoutManager.java 19 Oct 2004 21:51:54 -0000 1.13
@@ -26,8 +26,6 @@
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyManager;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.traits.InlineProps;
import org.apache.fop.area.Area;
import org.apache.fop.area.inline.InlineArea;
@@ -66,12 +64,10 @@
/**
* Size of border and padding in BPD (ie, before and after).
*/
- private MinOptMax extraBPD;
+ protected MinOptMax extraBPD;
private InlineProps inlineProps = null;
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
private Area currentArea; // LineArea or InlineParent
@@ -103,16 +99,7 @@
protected void initProperties() {
PropertyManager pm = fobj.getPropertyManager();
inlineProps = pm.getInlineProps();
- borderProps = pm.getBorderAndPadding();
- // Calculdate border and padding size in BPD
- int iPad = borderProps.getPadding(CommonBorderAndPadding.BEFORE, false);
- iPad += borderProps.getBorderWidth(CommonBorderAndPadding.BEFORE,
- false);
- iPad += borderProps.getPadding(CommonBorderAndPadding.AFTER, false);
- iPad += borderProps.getBorderWidth(CommonBorderAndPadding.AFTER, false);
- extraBPD = new MinOptMax(iPad);
-
- backgroundProps = pm.getBackgroundProps();
+ extraBPD = new MinOptMax(0);
}
/**
@@ -135,28 +122,16 @@
}
private MinOptMax getExtraIPD(boolean bNotFirst, boolean bNotLast) {
- int iBP = borderProps.getPadding(CommonBorderAndPadding.START,
- bNotFirst);
- iBP += borderProps.getBorderWidth(CommonBorderAndPadding.START,
- bNotFirst);
- iBP += borderProps.getPadding(CommonBorderAndPadding.END, bNotLast);
- iBP += borderProps.getBorderWidth(CommonBorderAndPadding.END, bNotLast);
- return new MinOptMax(iBP);
+ return new MinOptMax(0);
}
protected boolean hasLeadingFence(boolean bNotFirst) {
- int iBP = borderProps.getPadding(CommonBorderAndPadding.START,
- bNotFirst);
- iBP += borderProps.getBorderWidth(CommonBorderAndPadding.START,
- bNotFirst);
- return (iBP > 0);
+ return false;
}
protected boolean hasTrailingFence(boolean bNotLast) {
- int iBP = borderProps.getPadding(CommonBorderAndPadding.END, bNotLast);
- iBP += borderProps.getBorderWidth(CommonBorderAndPadding.END, bNotLast);
- return (iBP > 0);
+ return false;
}
/**
@@ -519,17 +494,6 @@
// Add own trailing space to parent context (or set on area?)
if (context.getTrailingSpace() != null) {
context.getTrailingSpace().addSpace(inlineProps.spaceEnd);
- }
-
- // Add border and padding to current area and set flags (FIRST, LAST ...)
- TraitSetter.setBorderPaddingTraits(getCurrentArea(),
- borderProps, bAreaCreated, !bIsLast);
-
- if (borderProps != null) {
- TraitSetter.addBorders(getCurrentArea(), borderProps);
- }
- if (backgroundProps != null) {
- TraitSetter.addBackground(getCurrentArea(), backgroundProps);
}
parentLM.addChild(getCurrentArea());
1.1 xml-fop/src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java
Index: InlineLayoutManager.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id: InlineLayoutManager.java,v 1.1 2004/10/19 21:51:54 bckfnn Exp $ */
package org.apache.fop.layoutmgr;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
/**
* LayoutManager for objects which stack children in the inline direction,
* such as Inline or Line
*/
public class InlineLayoutManager extends InlineStackingLayoutManager {
private Inline fobj;
private CommonMarginInline inlineProps = null;
private CommonBorderPaddingBackground borderProps = null;
/**
* Create an inline layout manager.
* This is used for fo's that create areas that
* contain inline areas.
*
* @param node the formatting object that creates the area
*/
public InlineLayoutManager(Inline node) {
super(node);
fobj = node;
}
/**
* @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
*/
protected void initProperties() {
super.initProperties();
inlineProps = fobj.getCommonMarginInline();
borderProps = fobj.getCommonBorderPaddingBackground();
int iPad = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
iPad += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE,
false);
iPad += borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
iPad += borderProps.getBorderWidth(CommonBorderPaddingBackground.AFTER, false);
extraBPD = new MinOptMax(iPad);
}
protected MinOptMax getExtraIPD(boolean bNotFirst, boolean bNotLast) {
int iBP = borderProps.getPadding(CommonBorderPaddingBackground.START,
bNotFirst);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
bNotFirst);
iBP += borderProps.getPadding(CommonBorderPaddingBackground.END, bNotLast);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, bNotLast);
return new MinOptMax(iBP);
}
protected boolean hasLeadingFence(boolean bNotFirst) {
int iBP = borderProps.getPadding(CommonBorderPaddingBackground.START,
bNotFirst);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
bNotFirst);
return (iBP > 0);
}
protected boolean hasTrailingFence(boolean bNotLast) {
int iBP = borderProps.getPadding(CommonBorderPaddingBackground.END, bNotLast);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, bNotLast);
return (iBP > 0);
}
protected SpaceProperty getSpaceStart() {
return inlineProps.spaceStart;
}
protected SpaceProperty getSpaceEnd() {
return inlineProps.spaceEnd;
}
/**
* Return value indicating whether the next area to be generated could
* start a new line. This should only be called in the "START" condition
* if a previous inline BP couldn't end the line.
* Return true if any space-start, border-start or padding-start, else
* propagate to first child LM
*/
public boolean canBreakBefore(LayoutContext context) {
if (new SpaceVal(inlineProps.spaceStart).getSpace().min > 0 || hasLeadingFence(false)) {
return true;
}
return super.canBreakBefore(context);
}
protected void setTraits(boolean bNotFirst, boolean bNotLast) {
// Add border and padding to current area and set flags (FIRST, LAST ...)
TraitSetter.setBorderPaddingTraits(getCurrentArea(),
borderProps, bNotFirst, bNotLast);
if (borderProps != null) {
TraitSetter.addBorders(getCurrentArea(), borderProps);
TraitSetter.addBackground(getCurrentArea(), borderProps);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org