From 69d42ce2637062798b0829d36511f4fceb74b97a Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 3 Feb 2005 08:18:27 +0000 Subject: [PATCH] Bugfix for whitespace handling that surfaced after my last fix for linefeed handling when markers are involved. Nodes preceeding a marker that don't create an area were removed from the childNodes list but the firstInlineChild was not cleared creating additional unwanted empty lines in the output. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198368 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FObj.java | 12 +++++++++++- src/java/org/apache/fop/fo/flow/Block.java | 15 ++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 3281a4c27..87dc3bb1e 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -262,7 +262,16 @@ public abstract class FObj extends FONode implements Constants { return null; } - /** + /** + * Notifies a FObj that one of it's children is removed. + * This method is subclassed by Block to clear the firstInlineChild variable. + * @param node the node that was removed + */ + protected void notifyChildRemoval(FONode node) { + //nop + } + + /** * Add the marker to this formatting object. * If this object can contain markers it checks that the marker * has a unique class-name for this object and that it is @@ -282,6 +291,7 @@ public abstract class FObj extends FONode implements Constants { return; } else { iter.remove(); + notifyChildRemoval(node); } } else { getLogger().error("fo:marker must be an initial child: " + mcname); diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index b99d49c40..234abb6ce 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 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. @@ -18,9 +18,6 @@ package org.apache.fop.fo.flow; -// Java -import java.util.List; - import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; @@ -45,7 +42,6 @@ import org.apache.fop.fo.properties.CommonMarginBlock; import org.apache.fop.fo.properties.CommonRelativePosition; import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.SpaceProperty; -import org.apache.fop.layoutmgr.BlockLayoutManager; import org.apache.fop.util.CharUtilities; /* @@ -323,6 +319,15 @@ public class Block extends FObjMixed { } super.addChildNode(child); } + + /** + * @see org.apache.fop.fo.FObj#notifyChildRemoval(org.apache.fop.fo.FONode) + */ + protected void notifyChildRemoval(FONode node) { + if (node != null && node == firstInlineChild) { + firstInlineChild = null; + } + } private void handleWhiteSpace() { //getLogger().debug("fo:block: handleWhiteSpace"); -- 2.39.5