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 je...@apache.org on 2008/06/19 15:03:57 UTC
svn commit: r669478 - in
/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr:
BlockContainerLayoutManager.java BlockStackingLayoutManager.java
Author: jeremias
Date: Thu Jun 19 06:03:57 2008
New Revision: 669478
URL: http://svn.apache.org/viewvc?rev=669478&view=rev
Log:
Bugzilla #44412:
Improvements after Vincent's feedback:
Removal of the somewhat ugly Reference.
getBreakBefore() reduced to private visibility.
Modified:
xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
Modified: xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=669478&r1=669477&r2=669478&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Thu Jun 19 06:03:57 2008
@@ -21,7 +21,6 @@
import java.awt.Point;
import java.awt.geom.Rectangle2D;
-import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
@@ -257,7 +256,6 @@
breakBeforeServed = true;
if (!context.suppressBreakBefore()) {
if (addKnuthElementsForBreakBefore(returnList, context)) {
- this.childLMForBreakSkip = new WeakReference(getChildLM());
return returnList;
}
}
@@ -283,7 +281,7 @@
childLC.setStackLimitBP(MinOptMax.subtract(context.getStackLimitBP(), stackLimit));
childLC.setRefIPD(relDims.ipd);
childLC.setWritingMode(getBlockContainerFO().getWritingMode());
- if (this.childLMForBreakSkip != null && curLM == this.childLMForBreakSkip.get()) {
+ if (curLM == this.childLMs.get(0)) {
childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE);
//Handled already by the parent (break collapsing, see above)
}
Modified: xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=669478&r1=669477&r2=669478&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Thu Jun 19 06:03:57 2008
@@ -19,8 +19,6 @@
package org.apache.fop.layoutmgr;
-import java.lang.ref.Reference;
-import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -70,11 +68,6 @@
protected LinkedList storedList = null;
/** Indicates whether break before has been served or not */
protected boolean breakBeforeServed = false;
- /**
- * Holds a weak reference on the first layout manager for optionally skipping
- * a break-before that has already been handled by the parent.
- */
- protected Reference childLMForBreakSkip;
/** Indicates whether the first visible mark has been returned by this LM, yet */
protected boolean firstVisibleMarkServed = false;
/** Reference IPD available */
@@ -258,7 +251,6 @@
breakBeforeServed = true;
if (!context.suppressBreakBefore()) {
if (addKnuthElementsForBreakBefore(returnList, context)) {
- this.childLMForBreakSkip = new WeakReference(getChildLM());
return returnList;
}
}
@@ -293,7 +285,7 @@
childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(referenceIPD);
}
- if (this.childLMForBreakSkip != null && curLM == this.childLMForBreakSkip.get()) {
+ if (curLM == this.childLMs.get(0)) {
childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE);
//Handled already by the parent (break collapsing, see above)
}
@@ -959,7 +951,7 @@
*/
protected boolean addKnuthElementsForBreakBefore(LinkedList returnList,
LayoutContext context) {
- int breakBefore = getBreakBefore(true);
+ int breakBefore = getBreakBefore();
if (breakBefore == EN_PAGE
|| breakBefore == EN_COLUMN
|| breakBefore == EN_EVEN_PAGE
@@ -975,36 +967,26 @@
/**
* Returns the break-before value of the current formatting object.
- * @param mergedWithChildren true if any break-before on first children should be checked, too
* @return the break-before value (Constants.EN_*)
*/
- protected int getBreakBefore(boolean mergedWithChildren) {
- int breakBefore = getBreakBefore();
- if (mergedWithChildren /* uncomment to only partially merge: && breakBefore != EN_AUTO*/) {
+ private int getBreakBefore() {
+ int breakBefore = EN_AUTO;
+ if (fobj instanceof BreakPropertySet) {
+ breakBefore = ((BreakPropertySet)fobj).getBreakBefore();
+ }
+ if (true /* uncomment to only partially merge: && breakBefore != EN_AUTO*/) {
LayoutManager lm = getChildLM();
//It is assumed this is only called when the first LM is active.
if (lm instanceof BlockStackingLayoutManager) {
BlockStackingLayoutManager bslm = (BlockStackingLayoutManager)lm;
breakBefore = BreakUtil.compareBreakClasses(
- breakBefore, bslm.getBreakBefore(true));
+ breakBefore, bslm.getBreakBefore());
}
}
return breakBefore;
}
/**
- * Returns the break-before value of the current formatting object.
- * @return the break-before value (Constants.EN_*)
- */
- protected int getBreakBefore() {
- int breakBefore = EN_AUTO;
- if (fobj instanceof BreakPropertySet) {
- breakBefore = ((BreakPropertySet)fobj).getBreakBefore();
- }
- return breakBefore;
- }
-
- /**
* Creates Knuth elements for break-after and adds them to the return list.
* @param returnList return list to add the additional elements to
* @param context the layout context
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org