xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adelme...@apache.org
Subject svn commit: r360083 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/flow/ test/layoutengine/standard-testcases/
Date Fri, 30 Dec 2005 13:33:31 GMT
Author: adelmelle
Date: Fri Dec 30 05:33:18 2005
New Revision: 360083

URL: http://svn.apache.org/viewcvs?rev=360083&view=rev
Log:
Revision of refinement white-space handling (cfr. Bugzilla 37639)

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOEventHandler.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObjMixed.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
    xmlgraphics/fop/trunk/status.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_text-align.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOEventHandler.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOEventHandler.java?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOEventHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOEventHandler.java Fri Dec 30 05:33:18
2005
@@ -83,6 +83,11 @@
     protected PropertyListMaker propertyListMaker;
 
     /**
+     * The XMLWhitespaceHandler for this tree
+     */
+    protected XMLWhiteSpaceHandler whiteSpaceHandler = new XMLWhiteSpaceHandler();
+    
+    /**
      * Main constructor
      * @param foUserAgent the apps.FOUserAgent instance for this process
      */
@@ -127,6 +132,14 @@
      */
     public void setPropertyListMaker(PropertyListMaker propertyListMaker) {
         this.propertyListMaker = propertyListMaker;
+    }
+    
+    /**
+     * Return the XMLWhiteSpaceHandler
+     * @return the whiteSpaceHandler
+     */
+    public XMLWhiteSpaceHandler getXMLWhiteSpaceHandler() {
+        return whiteSpaceHandler;
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObjMixed.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObjMixed.java?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObjMixed.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObjMixed.java Fri Dec 30 05:33:18 2005
@@ -32,6 +32,9 @@
     /** Represents accumulated, pending FO text. See flushText(). */
     protected FOText ft = null;
     
+    /** Used for white-space handling; start CharIterator at node ... */
+    protected FONode currentTextNode;
+    
     /**
      * @param parent FONode that is the parent of this object
      */
@@ -54,6 +57,10 @@
     /** @see org.apache.fop.fo.FONode#endOfNode() */
     protected void endOfNode() throws FOPException {
         flushText();
+        if (getNameId() != FO_LEADER) {
+            getFOEventHandler().whiteSpaceHandler
+                .handleWhiteSpace(this, currentTextNode);
+        }
         super.endOfNode();
     }
 
@@ -72,11 +79,24 @@
         }
     }
 
+    /**
+     * @see org.apache.fop.fo.FONode#addChildNode(FONode)
+     */
     protected void addChildNode(FONode child) throws FOPException {
         flushText();
+        if (child instanceof FOText || child.getNameId() == FO_CHARACTER) {
+            if (currentTextNode == null) {
+                currentTextNode = child;
+            }
+        } else if (getNameId() != FO_LEADER) {
+            // handle white-space for all text up to here
+            getFOEventHandler().whiteSpaceHandler
+                .handleWhiteSpace(this, currentTextNode, child);
+            currentTextNode = null;
+        }
         super.addChildNode(child);
     }
-
+    
     /**
      * @return iterator for this object
      */
@@ -84,5 +104,4 @@
         return new RecursiveCharIterator(this);
     }
     
-}
-
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java?rev=360083&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java Fri Dec 30
05:33:18 2005
@@ -0,0 +1,246 @@
+/*
+ * Copyright 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.
+ * 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$ */
+
+package org.apache.fop.fo;
+
+import java.util.List;
+import org.apache.fop.fo.flow.Block;
+import org.apache.fop.fo.flow.Character;
+import org.apache.fop.util.CharUtilities;
+
+/**
+ * Class encapsulating the functionality for white-space-handling
+ * during refinement stage.
+ *
+ */
+public class XMLWhiteSpaceHandler {
+    
+    // True if we are in a run of white space
+    private boolean inWhiteSpace = false;
+    // True if the last char was a linefeed
+    private boolean afterLinefeed = true;
+    
+    private Block currentBlock;
+    private FObj currentFO;
+    private int linefeedTreatment;
+    private int whiteSpaceTreatment;
+    private int whiteSpaceCollapse;
+    private FONode nextChild;
+    private boolean endOfBlock;
+    private boolean nextChildIsBlock;
+    private RecursiveCharIterator charIter;
+    
+    private List discardableFOCharacters;
+    
+    /**
+     * Marks a Character object as discardable, so that it is effectively
+     * removed from the FOTree at the end of handleWhitespace()
+     * @param foChar the Character object to be removed from the list of
+     *               childNodes
+     */
+    public void addDiscardableFOChar(Character foChar) {
+        if (discardableFOCharacters == null) {
+            discardableFOCharacters = new java.util.ArrayList();
+        }
+        discardableFOCharacters.add(foChar);
+    }
+    
+    /**
+     * Handle white-space for the fo that is passed in, starting at
+     * firstTextNode
+     * @param fo    the FO for which to handle white-space
+     * @param firstTextNode the node at which to start
+     */
+    public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode) {
+        if (fo.getNameId() == Constants.FO_BLOCK) {
+            this.currentBlock = (Block) fo;
+            this.linefeedTreatment = currentBlock.getLinefeedTreatment();
+            this.whiteSpaceCollapse = currentBlock.getWhitespaceCollapse();
+            this.whiteSpaceTreatment = currentBlock.getWhitespaceTreatment();
+        }
+        currentFO = fo;
+        if (firstTextNode == null) {
+            //nothing to do but initialize related properties
+            return;
+        }
+        charIter = new RecursiveCharIterator(fo, firstTextNode);
+        inWhiteSpace = false;
+        if (fo.getNameId() == Constants.FO_BLOCK) {
+            int textNodeIndex = -1;
+            if (fo.childNodes != null) {
+                textNodeIndex = fo.childNodes.indexOf(firstTextNode);
+            }
+            afterLinefeed = (textNodeIndex == 0
+                    || ((FONode) fo.childNodes.get(textNodeIndex - 1))
+                            .getNameId() == Constants.FO_BLOCK);
+        }
+        endOfBlock = (nextChild == null && currentFO == currentBlock);
+        nextChildIsBlock = (nextChild != null 
+                && nextChild.getNameId() == Constants.FO_BLOCK);
+        handleWhiteSpace();
+    }
+    
+    /**
+     * Handle white-space for the fo that is passed in, starting at
+     * firstTextNode (when a nested FO is encountered)
+     * @param fo    the FO for which to handle white-space
+     * @param firstTextNode the node at which to start
+     * @param nextChild the child-node that will be added to the list after
+     *                  the last text-node
+     */
+    public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode, FONode nextChild) {
+        this.nextChild = nextChild;
+        handleWhiteSpace(fo, firstTextNode);
+        this.nextChild = null;
+    }
+    
+    private void handleWhiteSpace() {
+        
+        EOLchecker lfCheck = new EOLchecker(charIter);
+
+        while (charIter.hasNext()) {
+            char currentChar = charIter.nextChar();
+            int currentCharClass = CharUtilities.classOf(currentChar);
+            if (currentCharClass == CharUtilities.LINEFEED
+                && linefeedTreatment == Constants.EN_TREAT_AS_SPACE) {
+                // if we have a linefeed and it is supposed to be treated
+                // like a space, that's what we do and continue
+                currentChar = '\u0020';
+                charIter.replaceChar('\u0020');
+                currentCharClass = CharUtilities.classOf(currentChar);
+            }
+            switch (CharUtilities.classOf(currentChar)) {
+                case CharUtilities.XMLWHITESPACE:
+                    // Some kind of whitespace character, except linefeed.
+                    if (inWhiteSpace && whiteSpaceCollapse == Constants.EN_TRUE)
{
+                        // We are in a run of whitespace and should collapse
+                        // Just delete the char
+                        charIter.remove();
+                    } else {
+                        // Do the white space treatment here
+                        boolean bIgnore = false;
+
+                        switch (whiteSpaceTreatment) {
+                            case Constants.EN_IGNORE:
+                                bIgnore = true;
+                                break;
+                            case Constants.EN_IGNORE_IF_BEFORE_LINEFEED:
+                                bIgnore = lfCheck.beforeLinefeed();
+                                break;
+                            case Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED:
+                                bIgnore = afterLinefeed
+                                           || lfCheck.beforeLinefeed();
+                                break;
+                            case Constants.EN_IGNORE_IF_AFTER_LINEFEED:
+                                bIgnore = afterLinefeed;
+                                break;
+                            case Constants.EN_PRESERVE:
+                                // nothing to do now, replacement takes place later
+                                break;
+                            default:
+                                //nop
+                        }
+                        // Handle ignore and replacement
+                        if (bIgnore) {
+                            charIter.remove();
+                        } else {
+                            // this is to retain a single space between words
+                            inWhiteSpace = true;
+                            if (currentChar != '\u0020') {
+                                charIter.replaceChar('\u0020');
+                            }
+                        }
+                    }
+                    break;
+
+                case CharUtilities.LINEFEED:
+                    // A linefeed
+                    switch (linefeedTreatment) {
+                        case Constants.EN_IGNORE:
+                            charIter.remove();
+                            break;
+                        case Constants.EN_TREAT_AS_ZERO_WIDTH_SPACE:
+                            charIter.replaceChar(CharUtilities.ZERO_WIDTH_SPACE);
+                            inWhiteSpace = false;
+                            break;
+                        case Constants.EN_PRESERVE:
+                            lfCheck.reset();
+                            inWhiteSpace = false;
+                            afterLinefeed = true; // for following whitespace
+                            break;
+                        default:
+                            //nop
+                    }
+                    break;
+
+                case CharUtilities.EOT:
+                    // A "boundary" objects such as non-character inline
+                    // or nested block object was encountered.
+                    // If any whitespace run in progress, finish it.
+                    // FALL THROUGH
+
+                default:
+                    // Any other character
+                    inWhiteSpace = false;
+                    afterLinefeed = false;
+                    lfCheck.reset();
+                    break;
+            }
+        }
+        if (discardableFOCharacters != null
+                && !discardableFOCharacters.isEmpty()) {
+            currentFO.childNodes.removeAll(discardableFOCharacters);
+            discardableFOCharacters.clear();
+        }
+    }
+    
+    private class EOLchecker {
+        private boolean nextIsEOL = false;
+        private RecursiveCharIterator charIter;
+
+        EOLchecker(RecursiveCharIterator charIter) {
+            this.charIter = charIter;
+        }
+
+        boolean beforeLinefeed() {
+            if (!nextIsEOL) {
+                CharIterator lfIter = charIter.mark();
+                while (lfIter.hasNext()) {
+                    int charClass = CharUtilities.classOf(lfIter.nextChar());
+                    if (charClass == CharUtilities.LINEFEED) {
+                        if (linefeedTreatment == Constants.EN_PRESERVE) {
+                            nextIsEOL = true;
+                            return nextIsEOL;
+                        }
+                    } else if (charClass != CharUtilities.XMLWHITESPACE) {
+                        return nextIsEOL;
+                    }
+                }
+                // No more characters == end of text run
+                // means EOL if there either is a nested block to be added,
+                // or if this is the last text node in the current block   
+                nextIsEOL = nextChildIsBlock || endOfBlock;
+            }
+            return nextIsEOL;
+        }
+
+        void reset() {
+            nextIsEOL = false;
+        }
+    }
+}

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java Fri Dec 30 05:33:18 2005
@@ -25,14 +25,10 @@
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.fo.CharIterator;
-import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FOText;
 import org.apache.fop.fo.FObjMixed;
 import org.apache.fop.fo.NullCharIterator;
 import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.PropertySets;
-import org.apache.fop.fo.RecursiveCharIterator;
 import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.properties.CommonAccessibility;
 import org.apache.fop.fo.properties.CommonAural;
@@ -43,7 +39,6 @@
 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.util.CharUtilities;
 
 /*
   Modified by Mark Lillywhite mark-fop@inomial.com. The changes
@@ -109,12 +104,6 @@
     private boolean anythingLaidOut = false;
 
     /**
-     * Index of first inline-type FO seen in a sequence.
-     * Used during FO tree building to do white-space handling.
-     */
-    private FONode firstInlineChild = null;
-
-    /**
      * @param parent FONode that is the parent of this object
      *
      */
@@ -176,7 +165,6 @@
      */
     protected void endOfNode() throws FOPException {
         super.endOfNode();
-        handleWhiteSpace();
         getFOEventHandler().endBlock(this);
     }
 
@@ -348,173 +336,32 @@
     }
 
     /**
-     * @see org.apache.fop.fo.FONode#addChildNode(FONode)
+     * Accessor for the linefeed-treatment property
+     * 
+     * @return the enum value of linefeed-treatment
      */
-    public void addChildNode(FONode child) throws FOPException {
-        flushText();
-        // Handle whitespace based on values of properties
-        // Handle a sequence of inline-producing child nodes in
-        // one pass
-        if (child instanceof FOText
-            || PropertySets.generatesInlineAreas(child.getNameId())) {
-                if (firstInlineChild == null) {
-                    firstInlineChild = child;
-                }
-                // lastInlineChild = childNodes.size();
-        } else {
-            // Handle whitespace in preceeding inline areas if any
-            handleWhiteSpace();
-        }
-        super.addChildNode(child);
+    public int getLinefeedTreatment() {
+        return linefeedTreatment;
     }
     
     /**
-     * @see org.apache.fop.fo.FObj#notifyChildRemoval(org.apache.fop.fo.FONode)
+     * Accessor for the white-space-treatment property
+     * 
+     * @return the enum value of white-space-treatment
      */
-    protected void notifyChildRemoval(FONode node) {
-        if (node != null && node == firstInlineChild) {
-            firstInlineChild = null;
-        }
-    }
-
-    private void handleWhiteSpace() {
-        //getLogger().debug("fo:block: handleWhiteSpace");
-        if (firstInlineChild == null) {
-            return; // Nothing to do
-        }
-        
-        boolean inWS = false; // True if we are in a run of white space
-        /*
-         * True if the last non white space char seen was a linefeed.
-         * We start from the beginning of a line so it defaults to True.
-         */
-        boolean prevWasLF = true; 
-
-        RecursiveCharIterator charIter =
-          new RecursiveCharIterator(this, firstInlineChild);
-        EOLchecker lfCheck = new EOLchecker(charIter);
-
-        while (charIter.hasNext()) {
-            char currentChar = charIter.nextChar();
-            int currentCharClass = CharUtilities.classOf(currentChar);
-            if (currentCharClass == CharUtilities.LINEFEED
-                && linefeedTreatment == EN_TREAT_AS_SPACE) {
-                // if we have a linefeed and it is suppose to be treated
-                // like a space, that's what we do and continue
-                currentChar = ' ';
-                charIter.replaceChar(' ');
-                currentCharClass = CharUtilities.classOf(currentChar);
-            }
-            switch (CharUtilities.classOf(currentChar)) {
-                case CharUtilities.XMLWHITESPACE:
-                    /* Some kind of whitespace character, except linefeed. */
-                    if (inWS && whiteSpaceCollapse == EN_TRUE) {
-                        // We are in a run of whitespace and should collapse
-                        // Just delete the char
-                        charIter.remove();
-                    } else {
-                        // Do the white space treatment here
-                        boolean bIgnore = false;
-
-                        switch (whiteSpaceTreatment) {
-                            case Constants.EN_IGNORE:
-                                bIgnore = true;
-                                break;
-                            case Constants.EN_IGNORE_IF_BEFORE_LINEFEED:
-                                bIgnore = linefeedTreatment == Constants.EN_PRESERVE
-                                            && lfCheck.nextIsLF();
-                                break;
-                            case Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED:
-                                bIgnore = (prevWasLF
-                                           || (linefeedTreatment == Constants.EN_PRESERVE
-                                               && lfCheck.nextIsLF()));
-                                break;
-                            case Constants.EN_IGNORE_IF_AFTER_LINEFEED:
-                                bIgnore = prevWasLF;
-                                break;
-                            case Constants.EN_PRESERVE:
-                                // nothing to do now, replacement takes place later
-                                break;
-                        }
-                        // Handle ignore and replacement
-                        if (bIgnore) {
-                            charIter.remove();
-                        } else {
-                            // this is to retain a single space between words
-                            inWS = true;
-                            if (currentChar != '\u0020') {
-                                charIter.replaceChar('\u0020');
-                            }
-                        }
-                    }
-                    break;
-
-                case CharUtilities.LINEFEED:
-                    /* A linefeed */
-                    switch (linefeedTreatment) {
-                        case Constants.EN_IGNORE:
-                            charIter.remove();
-                            break;
-                        case Constants.EN_TREAT_AS_ZERO_WIDTH_SPACE:
-                            charIter.replaceChar(CharUtilities.ZERO_WIDTH_SPACE);
-                            inWS = false;
-                            break;
-                        case Constants.EN_PRESERVE:
-                            lfCheck.reset();
-                            inWS = false;
-                            prevWasLF = true; // for following whitespace
-                            break;
-                    }
-                    break;
-
-                case CharUtilities.EOT:
-                    // A "boundary" objects such as non-character inline
-                    // or nested block object was encountered.
-                    // If any whitespace run in progress, finish it.
-                    // FALL THROUGH
-
-                default:
-                    /* Any other character */
-                    inWS = prevWasLF = false;
-                    lfCheck.reset();
-                    break;
-            }
-        }
-        firstInlineChild = null;
+    public int getWhitespaceTreatment() {
+        return whiteSpaceTreatment;
     }
-
-    private static class EOLchecker {
-        private boolean nextIsEOL = false;
-        private RecursiveCharIterator charIter;
-
-        EOLchecker(RecursiveCharIterator charIter) {
-            this.charIter = charIter;
-        }
-
-        boolean nextIsLF() {
-            if (nextIsEOL == false) {
-                CharIterator lfIter = charIter.mark();
-                while (lfIter.hasNext()) {
-                    int charClass = CharUtilities.classOf(lfIter.nextChar());
-                    if (charClass == CharUtilities.LINEFEED) {
-                        nextIsEOL = true;
-                        return nextIsEOL;
-                    } else if (charClass != CharUtilities.XMLWHITESPACE) {
-                        return nextIsEOL;
-                    }
-                }
-                // No more characters == end of block == end of line
-                nextIsEOL = true;
-                return nextIsEOL;
-            }
-            return nextIsEOL;
-        }
-
-        void reset() {
-            nextIsEOL = false;
-        }
+    
+    /**
+     * Accessor for the white-space-collapse property
+     * 
+     * @return the enum value of white-space-collapse
+     */
+    public int getWhitespaceCollapse() {
+        return whiteSpaceCollapse;
     }
-     
+    
     /** @see org.apache.fop.fo.FONode#charIterator() */
     public CharIterator charIterator() {
         return NullCharIterator.getInstance();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java Fri Dec 30 05:33:18
2005
@@ -158,7 +158,7 @@
      * @see org.apache.fop.fo.FObj#charIterator
      */
     public CharIterator charIterator() {
-        return new TextCharIterator();
+        return new FOCharIterator(this);
     }
 
     /**
@@ -269,9 +269,14 @@
         return FO_CHARACTER;
     }
     
-    private class TextCharIterator extends CharIterator {
+    private class FOCharIterator extends CharIterator {
 
-        private boolean bFirst = character != CharUtilities.CODE_EOT;
+        private boolean bFirst = true;
+        private Character foChar;
+        
+        FOCharIterator(Character foChar) {
+            this.foChar = foChar;
+        }
         
         public boolean hasNext() {
             return bFirst;
@@ -280,18 +285,20 @@
         public char nextChar() {
             if (bFirst) {
                 bFirst = false;
-                return character;
+                return foChar.character;
             } else {
                 throw new NoSuchElementException();
             }
         }
 
         public void remove() {
-            character = CharUtilities.CODE_EOT;
+            foChar.character = CharUtilities.CODE_EOT;
+            getFOEventHandler().getXMLWhiteSpaceHandler()
+                .addDiscardableFOChar(foChar);
         }
 
         public void replaceChar(char c) {
-            character = c;
+            foChar.character = c;
         }
 
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java Fri Dec 30 05:33:18
2005
@@ -24,7 +24,7 @@
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.CharIterator;
 import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.InlineCharIterator;
+import org.apache.fop.fo.OneCharIterator;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.properties.CommonRelativePosition;
@@ -108,6 +108,7 @@
        }
 
         checkId(id);
+        
         getFOEventHandler().startInline(this);
     }
 
@@ -182,13 +183,6 @@
         return dominantBaseline;
     }
     
-    /**
-     * @see org.apache.fop.fo.FObjMixed#charIterator
-     */
-    public CharIterator charIterator() {
-        return new InlineCharIterator(this, commonBorderPaddingBackground);
-    }
-
     /** @see org.apache.fop.fo.FONode#getLocalName() */
     public String getLocalName() {
         return "inline";

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java Fri Dec 30 05:33:18
2005
@@ -43,7 +43,7 @@
  * This will create a layout manager that will retrieve
  * a marker based on the information.
  */
-public class RetrieveMarker extends FObjMixed {
+public class RetrieveMarker extends FObj {
     // The value of properties relevant for fo:retrieve-marker.
     private String retrieveClassName;
     private int retrievePosition;

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/status.xml?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Fri Dec 30 05:33:18 2005
@@ -27,10 +27,13 @@
 
   <changes>
     <release version="FOP Trunk">
-      <action context="Code" dev="AD" type="enhancement">
+      <action context="Code" dev="AD" type="update">
+        Revision of refinement white-space handling.
+      </action>
+      <action context="Code" dev="AD" type="add">
         Added feature: support for white-space shorthand
       </action>
-      <action context="Code" dev="AD" type="enhancement">
+      <action context="Code" dev="AD" type="add">
         Added feature: support for page-break-* shorthands
       </action>
       <action context="Code" dev="MM" type="fix" fixes-bug="38053">

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml
(original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_white-space-collapse_2.xml
Fri Dec 30 05:33:18 2005
@@ -41,7 +41,7 @@
             word  <fo:character character="&#xa;" />
 <fo:character character=" " /><fo:character character=" " />          and  
             linefeeds<fo:character character=" " /><fo:character character=" " />
-            everywhere<fo:character character=" " /> 
+            everywhere<fo:character character=" " />          
           </fo:block>
           <fo:block background-color="silver" margin="1pt 0pt 1pt 0pt">  
             <fo:block background-color="orange">
@@ -102,10 +102,6 @@
   </fo>
   <checks>
     <!-- The tests are currently incomplete but enough to fail -->
-    <eval expected="8" xpath="count(//flow/block[1]/lineArea[1]/text/word)"/>
-    <eval expected="35" xpath="count(//flow/block[1]/lineArea[1]/text/space)"/>
-    <eval expected="1" xpath="count(//flow/block[1]/lineArea[2]/text/word)"/>
-    <eval expected="0" xpath="count(//flow/block[1]/lineArea[2]/text/space)"/>
-    
+    <eval expected="60" xpath="count(//flow/block[1]/lineArea[1]/text/space)"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_text-align.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_text-align.xml?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_text-align.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_text-align.xml Fri Dec
30 05:33:18 2005
@@ -112,27 +112,27 @@
     <eval expected="12000" xpath="//flow/block[4]/lineArea/inlineparent/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[5]/lineArea/@ipd"/>
-    <eval expected="215456" xpath="//flow/block[5]/lineArea/inlineparent/@ipd"/>
+    <eval expected="211186" xpath="//flow/block[5]/lineArea/inlineparent/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[6]/lineArea/@ipd"/>
-    <eval expected="178155" xpath="//flow/block[6]/lineArea/leader/@ipd"/>
+    <eval expected="174081" xpath="//flow/block[6]/lineArea/leader/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[7]/lineArea/@ipd"/>
-    <eval expected="206165" xpath="//flow/block[7]/lineArea/space/@ipd"/>
+    <eval expected="201939" xpath="//flow/block[7]/lineArea/space/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[8]/lineArea/@ipd"/>
     <eval expected="161589" xpath="//flow/block[8]/lineArea/inlineparent/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[9]/lineArea/@ipd"/>
-    <eval expected="215088" xpath="//flow/block[9]/lineArea/@start-indent"/>
+    <eval expected="211752" xpath="//flow/block[9]/lineArea/@start-indent"/>
     <eval expected="12000" xpath="//flow/block[9]/lineArea/inlineparent/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[10]/lineArea/@ipd"/>
-    <eval expected="178404" xpath="//flow/block[10]/lineArea/@start-indent"/>
+    <eval expected="175068" xpath="//flow/block[10]/lineArea/@start-indent"/>
     <eval expected="12000" xpath="//flow/block[10]/lineArea/leader/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[11]/lineArea/@ipd"/>
-    <eval expected="205752" xpath="//flow/block[11]/lineArea/@start-indent"/>
+    <eval expected="202416" xpath="//flow/block[11]/lineArea/@start-indent"/>
     <eval expected="12000" xpath="//flow/block[11]/lineArea/space/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[12]/lineArea/@ipd"/>
@@ -140,15 +140,15 @@
     <eval expected="12000" xpath="//flow/block[12]/lineArea/inlineparent/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[13]/lineArea/@ipd"/>
-    <eval expected="100878" xpath="//flow/block[13]/lineArea/@start-indent"/>
+    <eval expected="99210" xpath="//flow/block[13]/lineArea/@start-indent"/>
     <eval expected="12000" xpath="//flow/block[13]/lineArea/inlineparent/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[14]/lineArea/@ipd"/>
-    <eval expected="82536" xpath="//flow/block[14]/lineArea/@start-indent"/>
+    <eval expected="80868" xpath="//flow/block[14]/lineArea/@start-indent"/>
     <eval expected="12000" xpath="//flow/block[14]/lineArea/leader/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[15]/lineArea/@ipd"/>
-    <eval expected="96210" xpath="//flow/block[15]/lineArea/@start-indent"/>
+    <eval expected="94542" xpath="//flow/block[15]/lineArea/@start-indent"/>
     <eval expected="12000" xpath="//flow/block[15]/lineArea/space/@ipd"/>
 
     <eval expected="360000" xpath="//flow/block[16]/lineArea/@ipd"/>

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml?rev=360083&r1=360082&r2=360083&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml Fri Dec 30 05:33:18
2005
@@ -122,32 +122,32 @@
   <checks>
     <eval expected="11100" xpath="//flow/block[1]/lineArea/@bpd"/>
     <eval expected="360000" xpath="//flow/block[1]/lineArea/@ipd"/>
-    <eval expected="268268" xpath="//flow/block[1]/lineArea/inlineparent[2]/@ipd"/>
+    <eval expected="263812" xpath="//flow/block[1]/lineArea/inlineparent[2]/@ipd"/>
     <eval expected="5280" xpath="//flow/block[1]/lineArea/inlineparent[2]/@offset"/>
 
     <eval expected="11100" xpath="//flow/block[2]/lineArea/@bpd"/>
     <eval expected="331654" xpath="//flow/block[2]/lineArea/@ipd"/>
-    <eval expected="236051" xpath="//flow/block[2]/lineArea/inlineparent[2]/@ipd"/>
+    <eval expected="231669" xpath="//flow/block[2]/lineArea/inlineparent[2]/@ipd"/>
     <eval expected="5280" xpath="//flow/block[2]/lineArea/inlineparent[2]/@offset"/>
 
     <eval expected="11100" xpath="//flow/block[3]/lineArea/@bpd"/>
     <eval expected="331654" xpath="//flow/block[3]/lineArea/@ipd"/>
-    <eval expected="236051" xpath="//flow/block[3]/lineArea/inlineparent[2]/@ipd"/>
+    <eval expected="231669" xpath="//flow/block[3]/lineArea/inlineparent[2]/@ipd"/>
     <eval expected="5280" xpath="//flow/block[3]/lineArea/inlineparent[2]/@offset"/>
 
     <eval expected="11100" xpath="//flow/block[4]/lineArea/@bpd"/>
     <eval expected="360000" xpath="//flow/block[4]/lineArea/@ipd"/>
-    <eval expected="268268" xpath="//flow/block[4]/lineArea/inlineparent[2]/@ipd"/>
+    <eval expected="263812" xpath="//flow/block[4]/lineArea/inlineparent[2]/@ipd"/>
     <eval expected="5280" xpath="//flow/block[4]/lineArea/inlineparent[2]/@offset"/>
 
     <eval expected="11100" xpath="//flow/block[5]/lineArea/@bpd"/>
     <eval expected="331654" xpath="//flow/block[5]/lineArea/@ipd"/>
-    <eval expected="236051" xpath="//flow/block[5]/lineArea/inlineparent[2]/@ipd"/>
+    <eval expected="231669" xpath="//flow/block[5]/lineArea/inlineparent[2]/@ipd"/>
     <eval expected="5280" xpath="//flow/block[5]/lineArea/inlineparent[2]/@offset"/>
 
     <eval expected="11100" xpath="//flow/block[6]/lineArea/@bpd"/>
     <eval expected="331654" xpath="//flow/block[6]/lineArea/@ipd"/>
-    <eval expected="236051" xpath="//flow/block[6]/lineArea/inlineparent[2]/@ipd"/>
+    <eval expected="231669" xpath="//flow/block[6]/lineArea/inlineparent[2]/@ipd"/>
     <eval expected="5280" xpath="//flow/block[6]/lineArea/inlineparent[2]/@offset"/>
   </checks>
 </testcase>



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


Mime
View raw message