On 17.03.2008 20:29:07 Vincent Hennebert wrote:
> > Author: jeremias
> > Date: Fri Mar 14 07:41:03 2008
> > New Revision: 637119
> >
> > URL: http://svn.apache.org/viewvc?rev=637119&view=rev
> > Log:
> > Bugzilla #44412:
> > Bugfix: The before border of a block is no longer swallowed if its first
> > child issues a break-before.
> >
> > Added:
> >
> > xmlgraphics/fop/branches/fop-0_95/test/layoutengine/standard-testcases/block_break-before_bug44412.xml
> > (with props)
> > Modified:
> >
> > xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
> > xmlgraphics/fop/branches/fop-0_95/status.xml
> >
> > 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=637119&r1=637118&r2=637119&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
> > Fri Mar 14 07:41:03 2008
> > @@ -294,15 +294,24 @@
> > if (returnedList != null
> > && returnedList.size() == 1
> > && ((ListElement)
> > returnedList.getFirst()).isForcedBreak()) {
> > - // a descendant of this block has break-before
> > - contentList.addAll(returnedList);
> >
> > if (curLM.isFinished() && !hasNextChildLM()) {
> > + // a descendant of this block has break-before
> > + contentList.addAll(returnedList);
> > +
> > forcedBreakAfterLast =
> > (BreakElement)contentList.removeLast();
> > context.clearPendingMarks();
> > break;
> > }
>
> What’s the point in adding a one-element list to another one if this
> element is removed just after that? What have I missed?
No particular point. It was refactoring to conserve existing
functionality without looking at the bigger context. The if statement
could probably be rewritten like this to "optimize" it.
if (curLM.isFinished() && !hasNextChildLM()) {
// a descendant of this block has break-before
forcedBreakAfterLast =
(BreakElement)contentList.removeLast();
assert contentList.size() == 0;
context.clearPendingMarks();
break;
}
Jeremias Maerki